Documentation ¶
Index ¶
- Constants
- Variables
- func Encode(e Event, opt CodecOption) ([]byte, error)
- func FullNameOfEvent(e Event) string
- func NameOfEvent(t uint32) string
- type AuthChangeEvent
- func (p *AuthChangeEvent) GetBrokerId() string
- func (p *AuthChangeEvent) GetClientId() string
- func (p *AuthChangeEvent) GetDeviceName() string
- func (p *AuthChangeEvent) GetProductId() string
- func (p *AuthChangeEvent) GetType() uint32
- func (p *AuthChangeEvent) Serialize() ([]byte, error)
- func (p *AuthChangeEvent) SetBrokerId(brokerId string)
- func (p *AuthChangeEvent) SetClientId(clientID string)
- func (p *AuthChangeEvent) SetDeviceName(deviceName string)
- func (p *AuthChangeEvent) SetProductId(productId string)
- func (p *AuthChangeEvent) SetType(eventType uint32)
- type CodecOption
- type Event
- type QutoChangeEvent
- func (p *QutoChangeEvent) GetBrokerId() string
- func (p *QutoChangeEvent) GetClientId() string
- func (p *QutoChangeEvent) GetDeviceName() string
- func (p *QutoChangeEvent) GetProductId() string
- func (p *QutoChangeEvent) GetType() uint32
- func (p *QutoChangeEvent) Serialize() ([]byte, error)
- func (p *QutoChangeEvent) SetBrokerId(brokerId string)
- func (p *QutoChangeEvent) SetClientId(clientID string)
- func (p *QutoChangeEvent) SetDeviceName(deviceName string)
- func (p *QutoChangeEvent) SetProductId(productId string)
- func (p *QutoChangeEvent) SetType(eventType uint32)
- type SessionCreateEvent
- func (p *SessionCreateEvent) GetBrokerId() string
- func (p *SessionCreateEvent) GetClientId() string
- func (p *SessionCreateEvent) GetDeviceName() string
- func (p *SessionCreateEvent) GetProductId() string
- func (p *SessionCreateEvent) GetType() uint32
- func (p *SessionCreateEvent) Serialize() ([]byte, error)
- func (p *SessionCreateEvent) SetBrokerId(brokerId string)
- func (p *SessionCreateEvent) SetClientId(clientID string)
- func (p *SessionCreateEvent) SetDeviceName(deviceName string)
- func (p *SessionCreateEvent) SetProductId(productId string)
- func (p *SessionCreateEvent) SetType(eventType uint32)
- type SessionDestroyEvent
- func (p *SessionDestroyEvent) GetBrokerId() string
- func (p *SessionDestroyEvent) GetClientId() string
- func (p *SessionDestroyEvent) GetDeviceName() string
- func (p *SessionDestroyEvent) GetProductId() string
- func (p *SessionDestroyEvent) GetType() uint32
- func (p *SessionDestroyEvent) Serialize() ([]byte, error)
- func (p *SessionDestroyEvent) SetBrokerId(brokerId string)
- func (p *SessionDestroyEvent) SetClientId(clientID string)
- func (p *SessionDestroyEvent) SetDeviceName(deviceName string)
- func (p *SessionDestroyEvent) SetProductId(productId string)
- func (p *SessionDestroyEvent) SetType(eventType uint32)
- type SessionResumeEvent
- func (p *SessionResumeEvent) GetBrokerId() string
- func (p *SessionResumeEvent) GetClientId() string
- func (p *SessionResumeEvent) GetDeviceName() string
- func (p *SessionResumeEvent) GetProductId() string
- func (p *SessionResumeEvent) GetType() uint32
- func (p *SessionResumeEvent) Serialize() ([]byte, error)
- func (p *SessionResumeEvent) SetBrokerId(brokerId string)
- func (p *SessionResumeEvent) SetClientId(clientID string)
- func (p *SessionResumeEvent) SetDeviceName(deviceName string)
- func (p *SessionResumeEvent) SetProductId(productId string)
- func (p *SessionResumeEvent) SetType(eventType uint32)
- type TopicPublishEvent
- func (p *TopicPublishEvent) GetBrokerId() string
- func (p *TopicPublishEvent) GetClientId() string
- func (p *TopicPublishEvent) GetDeviceName() string
- func (p *TopicPublishEvent) GetProductId() string
- func (p *TopicPublishEvent) GetType() uint32
- func (p *TopicPublishEvent) Serialize() ([]byte, error)
- func (p *TopicPublishEvent) SetBrokerId(brokerId string)
- func (p *TopicPublishEvent) SetClientId(clientID string)
- func (p *TopicPublishEvent) SetDeviceName(deviceName string)
- func (p *TopicPublishEvent) SetProductId(productId string)
- func (p *TopicPublishEvent) SetType(eventType uint32)
- type TopicSubscribeEvent
- func (p *TopicSubscribeEvent) GetBrokerId() string
- func (p *TopicSubscribeEvent) GetClientId() string
- func (p *TopicSubscribeEvent) GetDeviceName() string
- func (p *TopicSubscribeEvent) GetProductId() string
- func (p *TopicSubscribeEvent) GetType() uint32
- func (p *TopicSubscribeEvent) Serialize() ([]byte, error)
- func (p *TopicSubscribeEvent) SetBrokerId(brokerID string)
- func (p *TopicSubscribeEvent) SetClientId(clientID string)
- func (p *TopicSubscribeEvent) SetDeviceName(deviceName string)
- func (p *TopicSubscribeEvent) SetProductId(productId string)
- func (p *TopicSubscribeEvent) SetType(eventType uint32)
- type TopicUnsubscribeEvent
- func (p *TopicUnsubscribeEvent) GetBrokerId() string
- func (p *TopicUnsubscribeEvent) GetClientId() string
- func (p *TopicUnsubscribeEvent) GetDeviceName() string
- func (p *TopicUnsubscribeEvent) GetProductId() string
- func (p *TopicUnsubscribeEvent) GetType() uint32
- func (p *TopicUnsubscribeEvent) Serialize() ([]byte, error)
- func (p *TopicUnsubscribeEvent) SetBrokerId(brokerId string)
- func (p *TopicUnsubscribeEvent) SetClientId(clientID string)
- func (p *TopicUnsubscribeEvent) SetDeviceName(deviceName string)
- func (p *TopicUnsubscribeEvent) SetProductId(productId string)
- func (p *TopicUnsubscribeEvent) SetType(eventType uint32)
Constants ¶
View Source
const ( FmtOfMqttEventBus = "iot-%s-event-mqtt" FmtOfBrokerEventBus = "iot-%s-event-broker" )
View Source
const ( SessionCreate = 1 SessionDestroy = 2 TopicPublish = 3 TopicSubscribe = 4 TopicUnsubscribe = 5 QutoChange = 6 SessionResume = 7 AuthChange = 8 )
View Source
const ( Direction_UP uint8 = iota Direction_DOWN )
Variables ¶
View Source
var (
JSONCodec = CodecOption{Format: "json"}
)
Functions ¶
func Encode ¶
func Encode(e Event, opt CodecOption) ([]byte, error)
Encode serialize event using rawEvent
func FullNameOfEvent ¶
FullNameOfEvent return event information
Types ¶
type AuthChangeEvent ¶
type AuthChangeEvent struct { BrokerID string `json:"brokerId"` // Broker identifier where event come from Type uint32 `json:"type"` // Event type ClientID string `json:"clientID"` // Client identifier where event come from DeviceName string `json:"deviceName"` // DeviceName identifier where event come from Persistent bool `json:"persistent"` // Whether the session is persistent ProductID string `json:"productId"` // Product ID SubType uint32 `json:"subType"` // 0 Authenticate 1 Authorize }
func (*AuthChangeEvent) GetBrokerId ¶
func (p *AuthChangeEvent) GetBrokerId() string
func (*AuthChangeEvent) GetClientId ¶
func (p *AuthChangeEvent) GetClientId() string
func (*AuthChangeEvent) GetDeviceName ¶
func (p *AuthChangeEvent) GetDeviceName() string
func (*AuthChangeEvent) GetProductId ¶
func (p *AuthChangeEvent) GetProductId() string
func (*AuthChangeEvent) GetType ¶
func (p *AuthChangeEvent) GetType() uint32
func (*AuthChangeEvent) Serialize ¶
func (p *AuthChangeEvent) Serialize() ([]byte, error)
func (*AuthChangeEvent) SetBrokerId ¶
func (p *AuthChangeEvent) SetBrokerId(brokerId string)
func (*AuthChangeEvent) SetClientId ¶
func (p *AuthChangeEvent) SetClientId(clientID string)
func (*AuthChangeEvent) SetDeviceName ¶
func (p *AuthChangeEvent) SetDeviceName(deviceName string)
func (*AuthChangeEvent) SetProductId ¶
func (p *AuthChangeEvent) SetProductId(productId string)
func (*AuthChangeEvent) SetType ¶
func (p *AuthChangeEvent) SetType(eventType uint32)
type CodecOption ¶
type CodecOption struct {
Format string
}
type Event ¶
type QutoChangeEvent ¶
type QutoChangeEvent struct { BrokerId string `json:"brokerId"` // Broker identifier where event come from Type uint32 `json:"type"` // Event type ClientId string `json:"clientID"` // Client identifier where event come from ProductID string `json:"productId"` // Product identifier where event come from DeviceName string `json:"deviceName"` // DeviceName identifier where event come from Persistent bool `json:"persistent"` // Whether the session is persistent QutoId string `json:"qutoId"` }
func (*QutoChangeEvent) GetBrokerId ¶
func (p *QutoChangeEvent) GetBrokerId() string
func (*QutoChangeEvent) GetClientId ¶
func (p *QutoChangeEvent) GetClientId() string
func (*QutoChangeEvent) GetDeviceName ¶
func (p *QutoChangeEvent) GetDeviceName() string
func (*QutoChangeEvent) GetProductId ¶
func (p *QutoChangeEvent) GetProductId() string
func (*QutoChangeEvent) GetType ¶
func (p *QutoChangeEvent) GetType() uint32
func (*QutoChangeEvent) Serialize ¶
func (p *QutoChangeEvent) Serialize() ([]byte, error)
func (*QutoChangeEvent) SetBrokerId ¶
func (p *QutoChangeEvent) SetBrokerId(brokerId string)
func (*QutoChangeEvent) SetClientId ¶
func (p *QutoChangeEvent) SetClientId(clientID string)
func (*QutoChangeEvent) SetDeviceName ¶
func (p *QutoChangeEvent) SetDeviceName(deviceName string)
func (*QutoChangeEvent) SetProductId ¶
func (p *QutoChangeEvent) SetProductId(productId string)
func (*QutoChangeEvent) SetType ¶
func (p *QutoChangeEvent) SetType(eventType uint32)
type SessionCreateEvent ¶
type SessionCreateEvent struct { BrokerId string `json:"brokerId"` // Broker identifier where event come from Type uint32 `json:"type"` // Event type ProductID string `json:"productId"` // Product identifier where event come from DeviceName string `json:"deviceName"` // DeviceName identifier where event come from ClientId string `json:"clientID"` // Client identifier where event come from Persistent bool `json:"persistent"` // Whether the session is persistent Retain bool `json:"retain"` }
SessionCreateEvent
func (*SessionCreateEvent) GetBrokerId ¶
func (p *SessionCreateEvent) GetBrokerId() string
func (*SessionCreateEvent) GetClientId ¶
func (p *SessionCreateEvent) GetClientId() string
func (*SessionCreateEvent) GetDeviceName ¶
func (p *SessionCreateEvent) GetDeviceName() string
func (*SessionCreateEvent) GetProductId ¶
func (p *SessionCreateEvent) GetProductId() string
func (*SessionCreateEvent) GetType ¶
func (p *SessionCreateEvent) GetType() uint32
func (*SessionCreateEvent) Serialize ¶
func (p *SessionCreateEvent) Serialize() ([]byte, error)
func (*SessionCreateEvent) SetBrokerId ¶
func (p *SessionCreateEvent) SetBrokerId(brokerId string)
func (*SessionCreateEvent) SetClientId ¶
func (p *SessionCreateEvent) SetClientId(clientID string)
func (*SessionCreateEvent) SetDeviceName ¶
func (p *SessionCreateEvent) SetDeviceName(deviceName string)
func (*SessionCreateEvent) SetProductId ¶
func (p *SessionCreateEvent) SetProductId(productId string)
func (*SessionCreateEvent) SetType ¶
func (p *SessionCreateEvent) SetType(eventType uint32)
type SessionDestroyEvent ¶
type SessionDestroyEvent struct { BrokerId string `json:"brokerId"` // Broker identifier where event come from Type uint32 `json:"type"` // Event type ProductID string `json:"productId"` // Product identifier where event come from DeviceName string `json:"deviceName"` // DeviceName identifier where event come from ClientId string `json:"clientID"` // Client identifier where event come from Persistent bool `json:"persistent"` // Whether the session is persistent Retain bool `json:"retain"` }
SessionDestroyEvent
func (*SessionDestroyEvent) GetBrokerId ¶
func (p *SessionDestroyEvent) GetBrokerId() string
func (*SessionDestroyEvent) GetClientId ¶
func (p *SessionDestroyEvent) GetClientId() string
func (*SessionDestroyEvent) GetDeviceName ¶
func (p *SessionDestroyEvent) GetDeviceName() string
func (*SessionDestroyEvent) GetProductId ¶
func (p *SessionDestroyEvent) GetProductId() string
func (*SessionDestroyEvent) GetType ¶
func (p *SessionDestroyEvent) GetType() uint32
func (*SessionDestroyEvent) Serialize ¶
func (p *SessionDestroyEvent) Serialize() ([]byte, error)
func (*SessionDestroyEvent) SetBrokerId ¶
func (p *SessionDestroyEvent) SetBrokerId(brokerId string)
func (*SessionDestroyEvent) SetClientId ¶
func (p *SessionDestroyEvent) SetClientId(clientID string)
func (*SessionDestroyEvent) SetDeviceName ¶
func (p *SessionDestroyEvent) SetDeviceName(deviceName string)
func (*SessionDestroyEvent) SetProductId ¶
func (p *SessionDestroyEvent) SetProductId(productId string)
func (*SessionDestroyEvent) SetType ¶
func (p *SessionDestroyEvent) SetType(eventType uint32)
type SessionResumeEvent ¶
type SessionResumeEvent struct { BrokerId string `json:"brokerId"` // Broker identifier where event come from Type uint32 `json:"type"` // Event type DeviceName string `json:"deviceName"` // DeviceName identifier where event come from ClientId string `json:"clientID"` // Client identifier where event come from ProductID string `json:"productId"` // Product identifier where event come from }
SessionResumeEvent
func (*SessionResumeEvent) GetBrokerId ¶
func (p *SessionResumeEvent) GetBrokerId() string
func (*SessionResumeEvent) GetClientId ¶
func (p *SessionResumeEvent) GetClientId() string
func (*SessionResumeEvent) GetDeviceName ¶
func (p *SessionResumeEvent) GetDeviceName() string
func (*SessionResumeEvent) GetProductId ¶
func (p *SessionResumeEvent) GetProductId() string
func (*SessionResumeEvent) GetType ¶
func (p *SessionResumeEvent) GetType() uint32
func (*SessionResumeEvent) Serialize ¶
func (p *SessionResumeEvent) Serialize() ([]byte, error)
func (*SessionResumeEvent) SetBrokerId ¶
func (p *SessionResumeEvent) SetBrokerId(brokerId string)
func (*SessionResumeEvent) SetClientId ¶
func (p *SessionResumeEvent) SetClientId(clientID string)
func (*SessionResumeEvent) SetDeviceName ¶
func (p *SessionResumeEvent) SetDeviceName(deviceName string)
func (*SessionResumeEvent) SetProductId ¶
func (p *SessionResumeEvent) SetProductId(productId string)
func (*SessionResumeEvent) SetType ¶
func (p *SessionResumeEvent) SetType(eventType uint32)
type TopicPublishEvent ¶
type TopicPublishEvent struct { BrokerID string `json:"brokerId"` // Broker identifier where event come from Type uint32 `json:"type"` // Event type ClientID string `json:"clientID"` // Client identifier where event come from DeviceName string `json:"deviceName"` // DeviceName identifier where event come from ProductID string `json:"productId"` // Product identifier where event come from Persistent bool `json:"persistent"` // Whether the session is persistent ID uint16 `json:"id"` // Message Id Topic string `json:"topic"` // Topic Payload []byte `json:"data"` // Topic data Qos uint8 `json:"qos"` Direction uint8 `json:"direction"` // Direction_UP: from device to cloud; Direction_DOWN: from cloud to device Retain bool `json:"retain"` Dup bool `json:"dup"` }
TopicPublishEvent
func (*TopicPublishEvent) GetBrokerId ¶
func (p *TopicPublishEvent) GetBrokerId() string
func (*TopicPublishEvent) GetClientId ¶
func (p *TopicPublishEvent) GetClientId() string
func (*TopicPublishEvent) GetDeviceName ¶
func (p *TopicPublishEvent) GetDeviceName() string
func (*TopicPublishEvent) GetProductId ¶
func (p *TopicPublishEvent) GetProductId() string
func (*TopicPublishEvent) GetType ¶
func (p *TopicPublishEvent) GetType() uint32
func (*TopicPublishEvent) Serialize ¶
func (p *TopicPublishEvent) Serialize() ([]byte, error)
func (*TopicPublishEvent) SetBrokerId ¶
func (p *TopicPublishEvent) SetBrokerId(brokerId string)
func (*TopicPublishEvent) SetClientId ¶
func (p *TopicPublishEvent) SetClientId(clientID string)
func (*TopicPublishEvent) SetDeviceName ¶
func (p *TopicPublishEvent) SetDeviceName(deviceName string)
func (*TopicPublishEvent) SetProductId ¶
func (p *TopicPublishEvent) SetProductId(productId string)
func (*TopicPublishEvent) SetType ¶
func (p *TopicPublishEvent) SetType(eventType uint32)
type TopicSubscribeEvent ¶
type TopicSubscribeEvent struct { BrokerID string `json:"brokerId"` // Broker identifier where event come from Type uint32 `json:"type"` // Event type ProductID string `json:"productId"` // Product identifier where event come from ClientID string `json:"clientID"` // Client identifier where event come from DeviceName string `json:"deviceName"` // DeviceName identifier where event come from Persistent bool `json:"persistent"` // Whether the session is persistent Topic string `json:"topic"` // Topic Qos uint8 `json:"qos"` Data []byte `json:"data"` // Topic data Retain bool `json:"retain"` }
TopicSubscribeEvent
func (*TopicSubscribeEvent) GetBrokerId ¶
func (p *TopicSubscribeEvent) GetBrokerId() string
func (*TopicSubscribeEvent) GetClientId ¶
func (p *TopicSubscribeEvent) GetClientId() string
func (*TopicSubscribeEvent) GetDeviceName ¶
func (p *TopicSubscribeEvent) GetDeviceName() string
func (*TopicSubscribeEvent) GetProductId ¶
func (p *TopicSubscribeEvent) GetProductId() string
func (*TopicSubscribeEvent) GetType ¶
func (p *TopicSubscribeEvent) GetType() uint32
func (*TopicSubscribeEvent) Serialize ¶
func (p *TopicSubscribeEvent) Serialize() ([]byte, error)
func (*TopicSubscribeEvent) SetBrokerId ¶
func (p *TopicSubscribeEvent) SetBrokerId(brokerID string)
func (*TopicSubscribeEvent) SetClientId ¶
func (p *TopicSubscribeEvent) SetClientId(clientID string)
func (*TopicSubscribeEvent) SetDeviceName ¶
func (p *TopicSubscribeEvent) SetDeviceName(deviceName string)
func (*TopicSubscribeEvent) SetProductId ¶
func (p *TopicSubscribeEvent) SetProductId(productId string)
func (*TopicSubscribeEvent) SetType ¶
func (p *TopicSubscribeEvent) SetType(eventType uint32)
type TopicUnsubscribeEvent ¶
type TopicUnsubscribeEvent struct { BrokerID string `json:"brokerId"` // Broker identifier where event come from Type uint32 `json:"type"` // Event type ClientID string `json:"clientID"` // Client identifier where event come from ProductID string `json:"productId"` // Product identifier where event come from DeviceName string `json:"deviceName"` // DeviceName identifier where event come from Persistent bool `json:"persistent"` // Whether the session is persistent Topic string `json:"topic"` // Topic Data []byte `json:"data"` // Topic data }
TopicUnsubscribeEvent
func (*TopicUnsubscribeEvent) GetBrokerId ¶
func (p *TopicUnsubscribeEvent) GetBrokerId() string
func (*TopicUnsubscribeEvent) GetClientId ¶
func (p *TopicUnsubscribeEvent) GetClientId() string
func (*TopicUnsubscribeEvent) GetDeviceName ¶
func (p *TopicUnsubscribeEvent) GetDeviceName() string
func (*TopicUnsubscribeEvent) GetProductId ¶
func (p *TopicUnsubscribeEvent) GetProductId() string
func (*TopicUnsubscribeEvent) GetType ¶
func (p *TopicUnsubscribeEvent) GetType() uint32
func (*TopicUnsubscribeEvent) Serialize ¶
func (p *TopicUnsubscribeEvent) Serialize() ([]byte, error)
func (*TopicUnsubscribeEvent) SetBrokerId ¶
func (p *TopicUnsubscribeEvent) SetBrokerId(brokerId string)
func (*TopicUnsubscribeEvent) SetClientId ¶
func (p *TopicUnsubscribeEvent) SetClientId(clientID string)
func (*TopicUnsubscribeEvent) SetDeviceName ¶
func (p *TopicUnsubscribeEvent) SetDeviceName(deviceName string)
func (*TopicUnsubscribeEvent) SetProductId ¶
func (p *TopicUnsubscribeEvent) SetProductId(productId string)
func (*TopicUnsubscribeEvent) SetType ¶
func (p *TopicUnsubscribeEvent) SetType(eventType uint32)
Click to show internal directories.
Click to hide internal directories.