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:
33
pkg/smart/scheme.go
Normal file
33
pkg/smart/scheme.go
Normal file
@ -0,0 +1,33 @@
|
||||
package smart
|
||||
|
||||
import (
|
||||
"gitea.unprism.ru/KRBL/n9m/v2/pkg/models"
|
||||
"gitea.unprism.ru/KRBL/n9m/v2/pkg/protocol"
|
||||
"net"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type ProcessFunc func(*SmartPackage, protocol.Package) error
|
||||
type AlarmProcessFunc func(*SmartPackage, protocol.Package, models.SendAlarmInfoResponse) error
|
||||
|
||||
type SmartPackage struct {
|
||||
pack protocol.Package
|
||||
|
||||
conn net.Conn
|
||||
buff []byte
|
||||
|
||||
payloadProcess map[protocol.PayloadType]ProcessFunc
|
||||
jsonProcess map[string]ProcessFunc
|
||||
alarmProcess map[protocol.AlarmType]AlarmProcessFunc
|
||||
Storage map[string]interface{}
|
||||
}
|
||||
|
||||
type SmartChannelPackage struct {
|
||||
pack *SmartPackage
|
||||
mainPack *SmartPackage
|
||||
|
||||
channelName string
|
||||
|
||||
mutex sync.RWMutex
|
||||
ssrc map[uint16][]func([]byte) error
|
||||
}
|
Reference in New Issue
Block a user