Documentation
¶
Overview ¶
Sparkplug 3.0.0 Note: Complies to v3.0.0 of the Sparkplug specification
to the extent needed for Winsonic DataIO and other industrial 4.0 products.
Copyright (c) 2023 Winsonic Electronics, Taiwan @author David Lee
* This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0.
Sparkplug 3.0.0 Note: Complies to v3.0.0 of the Sparkplug specification
to the extent needed for Winsonic DataIO and other industrial 4.0 products.
Copyright (c) 2023 Winsonic Electronics, Taiwan @author David Lee
* This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0.
Sparkplug 3.0.0 Note: Complies to v3.0.0 of the Sparkplug specification
to the extent needed for Winsonic DataIO and other industrial 4.0 products.
Copyright (c) 2023 Winsonic Electronics, Taiwan @author David Lee
* This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0.
Sparkplug 3.0.0 Note: Complies to v3.0.0 of the Sparkplug specification
to the extent needed for Winsonic DataIO and other industrial 4.0 products.
Copyright (c) 2023 Winsonic Electronics, Taiwan @author David Lee
* This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0.
Index ¶
- Constants
- func GetWillPayload(bdSeq int) ([]byte, error)
- func RequestNodeRebirth(client mqtt.Client, groupID string, nodeID string) error
- func SendNodeControlCMD(client mqtt.Client, groupID string, nodeID string, metrics []Metric) error
- type Auth
- type ClientApp
- type ClientNode
- func (c *ClientNode) Connect(bdSeq int) error
- func (c *ClientNode) Disconnect()
- func (c *ClientNode) PublishDeviceBirth(deviceID string, metrics []Metric) error
- func (c *ClientNode) PublishDeviceData(deviceID string, metrics []Metric) error
- func (c *ClientNode) PublishDeviceDeath(deviceID string) error
- func (c *ClientNode) PublishNodeBirth(metrics []Metric) error
- func (c *ClientNode) PublishNodeData(metrics []Metric) error
- func (c *ClientNode) SubscribeDeviceCMD(deviceID string)
- type Config
- type DataType
- type MessageType
- type Metric
- type Payload
Constants ¶
const ( // Node message types MESSAGETYPE_NBIRTH = "NBIRTH" MESSAGETYPE_NDEATH = "NDEATH" MESSAGETYPE_NDATA = "NDATA" MESSAGETYPE_NCMD = "NCMD" // Device message types MESSAGETYPE_DBIRTH = "DBIRTH" MESSAGETYPE_DDEATH = "DDEATH" MESSAGETYPE_DDATA = "DDATA" MESSAGETYPE_DCMD = "DCMD" )
Variables ¶
This section is empty.
Functions ¶
func GetWillPayload ¶
GetWillPayload will return the formatted payload with a single metric "bdSeq"
func RequestNodeRebirth ¶
Types ¶
type ClientApp ¶
type ClientApp struct { Auth Auth MessagePubHandler *mqtt.MessageHandler ConnectHandler *mqtt.OnConnectHandler ConnectLostHandler *mqtt.ConnectionLostHandler ReconnectingHandler *mqtt.ReconnectHandler // contains filtered or unexported fields }
func (*ClientApp) Disconnect ¶
func (c *ClientApp) Disconnect()
Disconnect disconnects the client from the MQTT server
type ClientNode ¶
type ClientNode struct { Config Config MessagePubHandler *mqtt.MessageHandler ConnectHandler *mqtt.OnConnectHandler ConnectLostHandler *mqtt.ConnectionLostHandler ReconnectingHandler *mqtt.ReconnectHandler // contains filtered or unexported fields }
func (*ClientNode) Connect ¶
func (c *ClientNode) Connect(bdSeq int) error
Connect will connect to the MQTT broker Need to provide a bdSeq number which should increment with every connect The bdSeq number is from 0 to 255
func (*ClientNode) Disconnect ¶
func (c *ClientNode) Disconnect()
Disconnect disconnects the client from the MQTT server
func (*ClientNode) PublishDeviceBirth ¶
func (c *ClientNode) PublishDeviceBirth(deviceID string, metrics []Metric) error
func (*ClientNode) PublishDeviceData ¶
func (c *ClientNode) PublishDeviceData(deviceID string, metrics []Metric) error
func (*ClientNode) PublishDeviceDeath ¶
func (c *ClientNode) PublishDeviceDeath(deviceID string) error
func (*ClientNode) PublishNodeBirth ¶
func (c *ClientNode) PublishNodeBirth(metrics []Metric) error
func (*ClientNode) PublishNodeData ¶
func (c *ClientNode) PublishNodeData(metrics []Metric) error
func (*ClientNode) SubscribeDeviceCMD ¶
func (c *ClientNode) SubscribeDeviceCMD(deviceID string)
type MessageType ¶
type MessageType string