Documentation ¶
Index ¶
- Constants
- type Client
- func (c *Client) CheckRemoteConfig() (ConfigMetaDataResp, bool, error)
- func (c *Client) Close()
- func (c *Client) Connect() Token
- func (c *Client) EnergyGateWay(data EnergyStruct, node uuid.UUID) Token
- func (c *Client) GetClientID() string
- func (c *Client) GetRemoteConfig() (ConfigResp, bool, error)
- func (c *Client) IsConnected() bool
- func (c *Client) NPFloatGateWay(data NodeParamFloat, node uuid.UUID) Token
- func (c *Client) PushEnergyData(data EnergyStruct) Token
- func (c *Client) PushFloatNP(datapoint NodeParamFloat) Token
- type ClientOptions
- type ConfigMetaDataResp
- type ConfigResp
- type EnergyStruct
- type NodeParamFloat
- type OnConnLostCallback
- type OnConnectCallback
- type ResponseCallback
- type Subscripiton
- type Token
Constants ¶
const ( Memory int = 0 File int = 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { TlsConfig tls.Config MQTT mqtt.Client ClientID uuid.UUID // contains filtered or unexported fields }
func NewInstance ¶
func NewInstance(options ClientOptions) (Client, error)
Create a new instance of unitlinq client. You can create as many instance you want. The only restriction is that you can not use same client certificate more than once.
func (*Client) CheckRemoteConfig ¶
func (c *Client) CheckRemoteConfig() (ConfigMetaDataResp, bool, error)
func (*Client) EnergyGateWay ¶ added in v0.0.6
func (c *Client) EnergyGateWay(data EnergyStruct, node uuid.UUID) Token
Act as a gateway, Send energy data on behalf of other node. Please note that to act as a gateway for other device, both devices must be registered with the unitlinq platform
func (*Client) GetClientID ¶
Get client ID string parsed from client certificate
func (*Client) GetRemoteConfig ¶
func (c *Client) GetRemoteConfig() (ConfigResp, bool, error)
func (*Client) IsConnected ¶
Check whether connection is active or not. Returns true if connection is active
func (*Client) NPFloatGateWay ¶ added in v0.0.6
func (c *Client) NPFloatGateWay(data NodeParamFloat, node uuid.UUID) Token
Act as a gateway, send parameter data on behalf of other node. Please note that to act as a gateway for other device, both devices must be registered with the unitlinq platform
func (*Client) PushEnergyData ¶
func (c *Client) PushEnergyData(data EnergyStruct) Token
Push Energy readings to the unitlinq platfrom.
func (*Client) PushFloatNP ¶
func (c *Client) PushFloatNP(datapoint NodeParamFloat) Token
type ClientOptions ¶
type ClientOptions struct { Cert string CertKey string StorageType int Store string RequestTimeout time.Duration OnConnect OnConnectCallback OnConnLost OnConnLostCallback }
ClientOptions - A struct describing the client options
type ConfigMetaDataResp ¶
type ConfigMetaDataResp struct {
UpdatedOn int32 `cbor:"updatedon"`
}
type ConfigResp ¶
type ConfigResp struct {
Data []byte `cbor:"data"`
}
type EnergyStruct ¶
type EnergyStruct struct { V1 float32 V2 float32 V3 float32 V12 float32 V23 float32 V31 float32 I1 float32 I2 float32 I3 float32 Pf1 float32 Pf2 float32 Pf3 float32 W1 float32 W2 float32 W3 float32 ImportkWh float32 Exportkwh float32 ImportkVArh float32 ExportkVArh float32 Freq float32 Timestamp int64 }
func NewDefaultEnergyStruct ¶ added in v0.0.6
func NewDefaultEnergyStruct() EnergyStruct
type NodeParamFloat ¶
func NewDefaultNpFloat ¶ added in v0.0.6
func NewDefaultNpFloat() NodeParamFloat
type OnConnLostCallback ¶ added in v0.0.5
type OnConnectCallback ¶ added in v0.0.5
type OnConnectCallback func(Client)
type ResponseCallback ¶
type Subscripiton ¶
type Subscripiton struct { Topic string Qos byte Callback mqtt.MessageHandler }