Documentation
¶
Index ¶
Constants ¶
View Source
const ( TypeNone = "" TypeSet = "set" TypeRequest = "request" TypePresentation = "presentation" TypeAction = "action" )
Commands
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeliveryStatus ¶
type DeliveryStatus struct {
ID string `json:"id" yaml:"id"`
Success bool `json:"success" yaml:"success"`
Message string `json:"message" yaml:"message"`
}
DeliveryStatus definition
type Message ¶
type Message struct {
ID string `json:"id" yaml:"id"`
GatewayID string `json:"gatewayId" yaml:"gatewayId"`
NodeID string `json:"nodeId" yaml:"nodeId"`
SourceID string `json:"sourceId" yaml:"sourceId"`
Type string `json:"type" yaml:"type"` // Message type: set, request, ...
Payloads []Payload `json:"payloads" yaml:"payloads"` // payloads
Labels cmap.CustomStringMap `json:"labels" yaml:"labels"` // these labels can be used in transport or other purpose
IsAck bool `json:"isAck" yaml:"isAck"` // Is this acknowledgement message
IsReceived bool `json:"isReceived" yaml:"isReceived"` // Is this received message
IsAckEnabled bool `json:"isAckEnabled" yaml:"isAckEnabled"` // Is Acknowledge enabled?
IsSleepNode bool `json:"isSleepNode" yaml:"isSleepNode"` // Is this message for active node or sleep node?
Timestamp time.Time `json:"timestamp" yaml:"timestamp"`
}
Message definition
type Payload ¶
type Payload struct {
Key string `json:"key" yaml:"key"` // it is id for the the fields. for node, source key says what it is
Value customTY.StringData `json:"value" yaml:"value"` // 1, true, 99.45, started, 72.345,45.333, any...
MetricType string `json:"metricType" yaml:"metricType"` // none, binary, gauge, counter, geo ...
Unit string `json:"unit" yaml:"unit"` // Volt, MilliVolt, °C, °F, ⚡, etc...
Labels cmap.CustomStringMap `json:"labels" yaml:"labels"` // labels for this data
Others cmap.CustomMap `json:"others" yaml:"others"` // can hold other than key, value data.
}
Payload definition
type RawMessage ¶
type RawMessage struct {
ID string `json:"id" yaml:"id"`
IsReceived bool `json:"isReceived" yaml:"isReceived"`
IsAckEnabled bool `json:"isAckEnabled" yaml:"isAckEnabled"`
Data interface{} `json:"data" yaml:"data"`
Timestamp time.Time `json:"timestamp" yaml:"timestamp"`
Others cmap.CustomMap `json:"others" yaml:"others"`
}
RawMessage from/to gateway media
func NewRawMessage ¶
func NewRawMessage(isReceived bool, data []byte) *RawMessage
NewRawMessage returns empty message
func (*RawMessage) MarshalJSON ¶
func (rm *RawMessage) MarshalJSON() ([]byte, error)
MarshalJSON for RawMessage, Data should be printed as string on the log
Click to show internal directories.
Click to hide internal directories.