Documentation
¶
Index ¶
Constants ¶
View Source
const ( // TopicNetworkTpl 创建网络连接 // //Deprecated TopicNetworkTpl = "oss.network.%s" // schedule/network/{network_type} // TopicHeartbeatTpl 网络心跳 // // Deprecated TopicHeartbeatTpl = "oss.network.heartbeat" // oss.network.heartbeat )
View Source
const ( BridgeQueueMqtt = "oss.bridge.mqtt" BridgeQueueLoraWAN = "oss.bridge.lorawan" BridgeQueueTree = "oss.bridge.tree" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AzureIotHubConfig ¶ added in v0.6.1
type AzureIotHubConfig struct {
Host string `json:"host,omitempty"`
DeviceId string `json:"deviceId,omitempty"`
}
AzureIotHubConfig azure iot_hub rest api
func (AzureIotHubConfig) Build ¶ added in v0.6.1
func (a AzureIotHubConfig) Build() string
type ConnectorPool ¶
type ConnectorPool interface {
Add(id string, c Connector)
Remove(id string)
Subscribe(event NetworkEvent)
NetworkType() NetworkType
}
ConnectorPool
连接池 规则:一个网络ID维持一个连接实例. 同一网络ID如需同时维持多个实例,需要通过启动多个应用实例实现 负责管理连接,但不负责创建连接
type LorawanMqttConfig ¶ added in v0.6.1
type LorawanMqttConfig struct {
Host string `json:"host,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
ClientId string `json:"clientId,omitempty"`
LorawanOssConfig
}
LorawanMqttConfig 使用mqtt协议连接lorawan服务器
type LorawanOssConfig ¶ added in v0.6.3
type LorawanRestConfig ¶ added in v0.6.1
type LorawanRestConfig struct {
Host string `json:"host,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
}
LorawanRestConfig 使用rest协议连接lorawan服务器
type MqttConfig ¶ added in v0.6.1
type MqttConfig struct {
Host string `json:"host,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
ClientId string `json:"clientId,omitempty"` // 如果不设置client id,需要支持随机client id
}
MqttConfig 连接MQTT服务器的配置
type NetworkConfig ¶ added in v0.3.0
type NetworkConfig struct {
NetworkId string `json:"network_id,omitempty"` // 编号
NetworkInstanceId string `json:"network_instance_id,omitempty"` // 连接实例编号
ConnectInfo string `json:"connect_info,omitempty"` // 连接配置(json->base64格式)
ExpireTime int64 `json:"expire_time,omitempty"` // 自定义网络超时时间,特定的网络超时时间
NetworkType NetworkType `json:"network_type,omitempty"`
}
NetworkConfig 网络配置
type NetworkEvent ¶
type NetworkEvent struct {
EventType EventType `json:"event_type,omitempty"`
NetworkConfig
}
type NetworkType ¶ added in v0.1.5
type NetworkType string
NetworkType 网络类型
const ( Mqtt NetworkType = "MQTT" Lorawan NetworkType = "LORAWAN" Tree NetworkType = "TREE" )
type Schedule ¶
type Schedule interface {
// Connect 创建连接
Connect(networkStruct NetworkConfig)
// DisConnect 销毁连接
DisConnect(networkStruct NetworkConfig)
// OnPing 收到Ping(更新timeout)
OnPing(func(networkStruct NetworkConfig))
}
Click to show internal directories.
Click to hide internal directories.