Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gqgmc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kevin Lyda
gqgmc
Commits
616f1be2
Commit
616f1be2
authored
Jan 31, 2017
by
Kevin Lyda
Browse files
Options
Downloads
Patches
Plain Diff
Add new commands.
parent
66b148da
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
devices/geiger/geiger.go
+4
-1
4 additions, 1 deletion
devices/geiger/geiger.go
devices/geiger/gqgmc.go
+40
-11
40 additions, 11 deletions
devices/geiger/gqgmc.go
with
44 additions
and
12 deletions
devices/geiger/geiger.go
+
4
−
1
View file @
616f1be2
...
...
@@ -34,7 +34,10 @@ type Counter interface {
GetConfiguration
()
SetConfiguration
()
ResetConfiguration
()
SetTime
(
t
time
.
Time
)
SetTime
(
time
.
Time
)
GetTime
()
(
time
.
Time
,
error
)
FactoryReset
()
Reboot
()
}
// Config contain the configuration for a Geiger Counter
...
...
This diff is collapsed.
Click to expand it.
devices/geiger/gqgmc.go
+
40
−
11
View file @
616f1be2
...
...
@@ -114,6 +114,9 @@ const (
cmdTurnOnCPS
=
"<HEARTBEAT1>>"
cmdTurnOffCPS
=
"<HEARTBEAT0>>"
cmdTurnOffPwr
=
"<POWEROFF>>"
cmdFactoryReset
=
"<FACTORYRESET>>"
cmdReboot
=
"<REBOOT>>"
cmdGetTime
=
"<GETDATETIME>>"
)
// GQGMCCounter is a GQ GMC Counter
...
...
@@ -275,6 +278,9 @@ func (gc *GQGMCCounter) ResetConfiguration() {
// SetTime sets the time
func
(
gc
*
GQGMCCounter
)
SetTime
(
t
time
.
Time
)
{
//command: <SETDATETIME[YYMMDDHHMMSS]>>
//Firmware supported: GMC-280, GMC-300 Re.3.00 or later
cmd
:=
make
([]
byte
,
13
)
var
timeCmds
=
[]
struct
{
cmd
string
...
...
@@ -297,6 +303,29 @@ func (gc *GQGMCCounter) SetTime(t time.Time) {
}
}
// GetTime gets the time
func
(
gc
*
GQGMCCounter
)
GetTime
()
(
time
.
Time
,
error
)
{
b
,
err
:=
gc
.
communicate
(
cmdGetTime
,
7
)
if
err
!=
nil
{
return
time
.
Unix
(
0
,
0
),
err
}
t
:=
time
.
Date
(
int
(
b
[
0
])
+
2000
,
time
.
Month
(
b
[
1
]),
int
(
b
[
2
]),
int
(
b
[
3
]),
int
(
b
[
4
]),
int
(
b
[
5
]),
0
,
nil
)
return
t
,
nil
}
// FactoryReset does a factory reset
func
(
gc
*
GQGMCCounter
)
FactoryReset
()
{
gc
.
sendCmd
(
cmdFactoryReset
)
return
}
// Reboot reboots the device
func
(
gc
*
GQGMCCounter
)
Reboot
()
{
gc
.
sendCmd
(
cmdReboot
)
return
}
func
(
gc
*
GQGMCCounter
)
communicate
(
cmd
string
,
length
uint32
)
([]
byte
,
error
)
{
gc
.
Clear
()
if
len
(
cmd
)
>
0
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment