n9m/configmodel.go

80 lines
1.6 KiB
Go
Raw Normal View History

2023-11-30 17:05:11 +00:00
package n9m
/*
2023-11-30 17:05:11 +00:00
// request reqistration parameters (directly to register)
func (e *Package) RequestParameters(params map[string]any, serial int, session string) {
e.Payload = map[string]any{
"MODULE": "CONFIGMODEL",
"OPERATION": "GET",
"PARAMETER": map[string]any{
"MDVR": params["MDVR"],
"SERIAL": serial,
},
"SESSION": session,
}
} // end of 'RequestParameters' function
// set reigeter parameters (directly to register)
func (e *Package) SetParameters(params map[string]any, serial int, session string) {
e.Payload = map[string]any{
"MODULE": "CONFIGMODEL",
"OPERATION": "SET",
"PARAMETER": map[string]any{
"MDVR": params["MDVR"],
"SERIAL": serial,
},
"SESSION": session,
}
2023-11-30 18:35:52 +00:00
// log.Println(e.Payload)
2023-11-30 17:05:11 +00:00
} // end of 'SetParameters' function
*/
2023-11-30 17:05:11 +00:00
type ConfigModelSetRequest struct {
MDVR Setting `json:"MDVR"`
}
type ConfigModelGetRequest struct {
MDVR interface{} `json:"MDVR"`
}
type ConfigModelSetResponse struct {
MDVR Setting `json:"MDVR"`
}
func (e *Package) InitialConfigModelSetRequest() {
e.SetParameters(ConfigModelSetRequest{
MDVR: Setting{
KEYS: KEYS{
GV: 1, // GPS version
},
PGDSM: PGDSM{
PGPS: PGPS{
EN: 1, // Real-time position monitoring
MODE: 0b10, // Enable timer
TM: 10, // Time interval
2023-11-30 17:05:11 +00:00
},
},
SUBSTRNET: SUBSTRNET{
SM: 1,
},
2023-11-30 17:05:11 +00:00
},
})
2023-11-30 17:05:11 +00:00
}
/*
2023-11-30 17:05:11 +00:00
func (e *Package) ResponseConfigModelSet(Sid string) {
e.Payload = map[string]any{
"MODULE": "CONFIGMODUL", // it's not error
"OPERATION": "SET",
"RESPONSE": map[string]any{
"ERRORCODE": 0,
"ERRORCAUSE": "None",
"ERRORDESCRIPTION": "None",
},
"SESSION": Sid,
}
}
*/