edgex

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

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 NewEdgexExport

func NewEdgexExport() *EdgexExport

NewEdgexExport return driver instance

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 EventType

type EventType string
const (
	CommandAck      EventType = "CommandAck"      // 指令相应
	ScheduleTrigger EventType = "ScheduleTrigger" // 时间表触发
	DeviceEvent     EventType = "DeviceEvent"     // 设别事件
)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL