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.
This commit is contained in:
84
pkg/models/storm.go
Normal file
84
pkg/models/storm.go
Normal file
@ -0,0 +1,84 @@
|
||||
package models
|
||||
|
||||
/*
|
||||
|
||||
func (e *Package) ResponseCalendar(errorCode int, errorCause string, serial int, dates []string) {
|
||||
e.Payload = map[string]any{
|
||||
"MODULE": "STORM",
|
||||
"OPERATION": "GETCALENDAR",
|
||||
"RESPONSE": map[string]any{
|
||||
"ERRORCODE": errorCode,
|
||||
"ERRORCAUSE": errorCause,
|
||||
"SERIAL": serial,
|
||||
"COUNT": len(dates),
|
||||
"CALENDER": dates,
|
||||
// no CHCALENDER[COUNT]
|
||||
// no T[COUNT]
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Package) RequestCalendar(queryTime string, serial int, session string, camNo int64) {
|
||||
channel := 1 << (camNo - 1)
|
||||
e.Payload = map[string]any{
|
||||
"MODULE": "STORM",
|
||||
"OPERATION": "GETCALENDAR",
|
||||
"PARAMETER": map[string]any{
|
||||
"CALENDARTYPE": 1, // Month data
|
||||
"STREAMTYPE": 1, // Main Stream
|
||||
"FILETYPE": 0b111111, // get file type
|
||||
"PICMTYPE": 0b10, // fixed timing pictures (fixed framerate)
|
||||
"APT0": 0xFFFFFF, // get every alarm
|
||||
"APT1": 0xFFFF, // get every alarm
|
||||
"AUDIOTYPE": 0b111, // normal recording, passenger complaints, alarm recording
|
||||
"CHANNEL": channel, // request all channels
|
||||
"QUERYTIME": queryTime, // year + month = xxxxxx
|
||||
"SERIAL": serial,
|
||||
"NEWSTREAMTYPE": 0b111, // master stream (bit1)
|
||||
"RFSTORAGE": 0, // 0 - hdd, 1 - sd
|
||||
},
|
||||
"SESSION": session,
|
||||
}
|
||||
}
|
||||
|
||||
// filenames without fileextension
|
||||
func (e *Package) ResponseFileList(errorCode int, errorCause string, serial int, filenames []string, fileextensions []int, ids []string) {
|
||||
e.Payload = map[string]any{
|
||||
"MODULE": "STORM",
|
||||
"OPERATION": "QUERYFILELIST",
|
||||
"RESPONSE": map[string]any{
|
||||
"ERRORCODE": errorCode,
|
||||
"ERRORCAUSE": errorCause,
|
||||
"SERIAL": serial,
|
||||
"SENDFILECOUNT": len(filenames),
|
||||
"RECORD": filenames,
|
||||
"FILETYPE": fileextensions,
|
||||
"RECORDID": ids,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Package) RequestFileList(queryTime string, serial int, session string, camNo int64) {
|
||||
channel := 1 << (camNo - 1)
|
||||
e.Payload = map[string]any{
|
||||
"MODULE": "STORM",
|
||||
"OPERATION": "QUERYFILELIST",
|
||||
"PARAMETER": map[string]any{
|
||||
"STREAMTYPE": 1, // Main Stream
|
||||
"FILETYPE": 0b111111, // get all filetypes
|
||||
"PICMTYPE": 0b10, // fixed timing pictures (fixed framerate)
|
||||
"APT0": 0xFFFFFF, // get every alarm
|
||||
"APT1": 0xFFFF, // get every alarm
|
||||
"AUDIOTYPE": 0b111, // normal recording, passenger complaints, alarm recording
|
||||
"CHANNEL": channel, // request all channels
|
||||
"STARTTIME": queryTime + "000000",
|
||||
"ENDTIME": queryTime + "235959",
|
||||
"SERIAL": serial,
|
||||
"NEWSTREAMTYPE": 0b10, // master stream (bit1)
|
||||
"RFSTORAGE": 0, // 0 - hdd, 1 - sd
|
||||
},
|
||||
"SESSION": session,
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
Reference in New Issue
Block a user