Documentation ¶
Index ¶
- func Actions2Commands(dm config.DeviceModel) (deviceCommands []models.DeviceCommand)
- func Points2Resources(m config.Model) (deviceResources []models.DeviceResource, err error)
- type DeviceEventEnum
- type DeviceEventModel
- type EdgexExport
- func (s *EdgexExport) AddDevice(deviceName string, protocols map[string]models.ProtocolProperties, ...) error
- func (export *EdgexExport) ExportTo(deviceData plugin.DeviceData)
- func (s *EdgexExport) HandleReadCommands(deviceName string, protocols map[string]models.ProtocolProperties, ...) (res []*sdkModels.CommandValue, err error)
- func (s *EdgexExport) HandleWriteCommands(deviceName string, protocols map[string]models.ProtocolProperties, ...) error
- func (export *EdgexExport) Init() error
- func (s *EdgexExport) Initialize(lc logger.LoggingClient, asyncCh chan<- *sdkModels.AsyncValues, ...) error
- func (export *EdgexExport) IsReady() bool
- func (s *EdgexExport) RemoveDevice(deviceName string, protocols map[string]models.ProtocolProperties) error
- func (s *EdgexExport) SendStatusChangeNotification(deviceName string, online bool) error
- func (s *EdgexExport) Stop(force bool) error
- func (s *EdgexExport) UpdateDevice(deviceName string, protocols map[string]models.ProtocolProperties, ...) error
- type EventModel
- type EventType
- type ServiceConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Actions2Commands ¶
func Actions2Commands(dm config.DeviceModel) (deviceCommands []models.DeviceCommand)
Actions2Commands action 转 command
func Points2Resources ¶
func Points2Resources(m config.Model) (deviceResources []models.DeviceResource, err error)
Points2Resources points 转 resources 配置文件点位值类型限定三种:int、float、string,对应 go 类型:int64、float64、string
Types ¶
type DeviceEventEnum ¶
type DeviceEventEnum string
const ( DeviceEventOnline DeviceEventEnum = "Online" // 设备在线事件 DeviceEventOffline DeviceEventEnum = "Offline" // 设备离线事件 )
type DeviceEventModel ¶
type DeviceEventModel struct { DeviceSN string `json:"deviceSN"` // 设备SN Type DeviceEventEnum `json:"type"` // 事件名称 Data map[string]interface{} `json:"data"` // 事件数据 }
DeviceEventModel 设备事件模型
type EdgexExport ¶
type EdgexExport struct {
// contains filtered or unexported fields
}
func (*EdgexExport) AddDevice ¶
func (s *EdgexExport) AddDevice(deviceName string, protocols map[string]models.ProtocolProperties, adminState models.AdminState) error
AddDevice is a callback function that is invoked when a new Device associated with this Device Service is added
func (*EdgexExport) ExportTo ¶
func (export *EdgexExport) ExportTo(deviceData plugin.DeviceData)
导出消息:写入Edgex总线、MQTT上云
func (*EdgexExport) HandleReadCommands ¶
func (s *EdgexExport) HandleReadCommands(deviceName string, protocols map[string]models.ProtocolProperties, reqs []sdkModels.CommandRequest) (res []*sdkModels.CommandValue, err error)
HandleReadCommands triggers a protocol Read operation for the specified device.
func (*EdgexExport) HandleWriteCommands ¶
func (s *EdgexExport) HandleWriteCommands(deviceName string, protocols map[string]models.ProtocolProperties, reqs []sdkModels.CommandRequest, params []*sdkModels.CommandValue) error
HandleWriteCommands passes a slice of CommandRequest struct each representing a ResourceOperation for a specific device resource. Since the commands are actuation commands, params provide parameters for the individual command.
func (*EdgexExport) Init ¶
func (export *EdgexExport) Init() error
func (*EdgexExport) Initialize ¶
func (s *EdgexExport) Initialize(lc logger.LoggingClient, asyncCh chan<- *sdkModels.AsyncValues, deviceCh chan<- []sdkModels.DiscoveredDevice) error
Initialize 初始化
func (*EdgexExport) IsReady ¶
func (export *EdgexExport) IsReady() bool
func (*EdgexExport) RemoveDevice ¶
func (s *EdgexExport) RemoveDevice(deviceName string, protocols map[string]models.ProtocolProperties) error
RemoveDevice is a callback function that is invoked when a Device associated with this Device Service is removed
func (*EdgexExport) SendStatusChangeNotification ¶
func (s *EdgexExport) SendStatusChangeNotification(deviceName string, online bool) error
SendStatusChangeNotification 发送设备状态变更通知
func (*EdgexExport) Stop ¶
func (s *EdgexExport) Stop(force bool) error
func (*EdgexExport) UpdateDevice ¶
func (s *EdgexExport) UpdateDevice(deviceName string, protocols map[string]models.ProtocolProperties, adminState models.AdminState) error
UpdateDevice is a callback function that is invoked when a Device associated with this Device Service is updated
type EventModel ¶
type EventModel struct { EventType EventType `json:"eventType"` // 事件类型(指令相应、时间表触发、设备事件) ReportTimestamp int64 `json:"reportTimestamp"` // 上报时间戳(毫秒级) EventData interface{} `json:"eventData"` // 事件数据 Description string `json:"description"` // 事件描述 }
EventModel 自定义事件模型
type ServiceConfig ¶
type ServiceConfig struct {
DriverConfig config.DriverConfig
}
func (*ServiceConfig) UpdateFromRaw ¶
func (sw *ServiceConfig) UpdateFromRaw(rawConfig interface{}) bool
UpdateFromRaw updates the service's full configuration from raw data received from the Service Provider.