n9m/pkg/models/configmodel.go
Alexander Lazarenko eaaa634558
Refactor and simplify package structure and interfaces.
Reorganize code by removing unused files, restructuring package organization, and updating import references to new paths. This simplifies handling of smart and protocol-related operations, improves maintainability, and eliminates redundancy.
2025-04-27 17:05:45 +03:00

84 lines
1.8 KiB
Go

package models
import (
"gitea.unprism.ru/KRBL/n9m/v2/pkg/parameters"
)
/*
// 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
*/
type ConfigModelSetRequest struct {
MDVR parameters.Setting `json:"MDVR"`
}
type ConfigModelGetRequest struct {
MDVR interface{} `json:"MDVR"`
}
type ConfigModelSetResponse struct {
MDVR parameters.Setting `json:"MDVR"`
}
func InitialConfig() ConfigModelSetRequest {
return ConfigModelSetRequest{
MDVR: parameters.Setting{
KEYS: parameters.KEYS{
GV: 1, // GPS version
},
PGDSM: parameters.PGDSM{
PGPS: parameters.PGPS{
EN: 1, // Real-time position monitoring
MODE: 0b10, // Enable timer
TM: 10, // Time interval
},
},
SUBSTRNET: parameters.SUBSTRNET{
SM: 1,
},
},
}
}
/*
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,
}
}
*/