n9m/configmodel.go

72 lines
1.8 KiB
Go

package n9m
// 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,
}
// log.Println(e.Payload)
} // end of 'SetParameters' function
// todo al1
func (e *Package) ConfigeModel(Sid string) {
e.Payload = map[string]any{
"MODULE": "CONFIGMODEL",
"OPERATION": "SET",
"PARAMETER": map[string]any{
"MDVR": map[string]any{
"KEYS": map[string]any{ // KEY parameters
"GV": 1, // GPS version
},
"PGDSM": map[string]any{ // Network monitoring status parameters
"PGPS": map[string]any{ // GPS position
"EN": 1, // Real-time position monitoring
"TM": 10, // Time interval
},
},
"PSI": map[string]any{ // Platform basic information
"CG": map[string]any{ // Call information
"AS": 0, // Automatic answer
},
},
"SUBSTRNET": map[string]any{
"SM": 1, // 0-Smooth .. 4-Clear
},
},
},
}
}
// main server util
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,
}
}