client

package
v0.0.35 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const OwnerInTopicDefault = true

Variables

View Source
var Id = "connector"

values are matching to test server produced by /senergy-platform-connector/test/server/server.go

View Source
var Secret = "d61daec4-40d6-4d3e-98c9-f3b515696fc6"

Functions

This section is empty.

Types

type Client

type Client struct {
	HubId string
	// contains filtered or unexported fields
}

func New

func New(mqttUrl string, deviceManagerUrl string, deviceRepoUrl string, authUrl string, userName string, password string, hubId string, hubName string, devices []DeviceRepresentation, authenticationMethod string, mqttVersion MqttVersion, ownerInTopic bool) (client *Client, err error)

func NewWithoutProvisioning

func NewWithoutProvisioning(mqttUrl string, deviceManagerUrl string, deviceRepoUrl string, authUrl string, userName string, password string, hubId string, hubName string, devices []DeviceRepresentation, mqttVersion MqttVersion, ownerInTopic bool) (client *Client, err error)

func (*Client) ListenCommand

func (this *Client) ListenCommand(deviceUri string, serviceUri string, handler func(msg platform_connector_lib.CommandRequestMsg) (platform_connector_lib.CommandResponseMsg, error)) error

func (*Client) ListenCommandWithQos

func (this *Client) ListenCommandWithQos(deviceUri string, serviceUri string, qos byte, handler func(msg platform_connector_lib.CommandRequestMsg) (platform_connector_lib.CommandResponseMsg, error)) error

func (*Client) Mqtt

func (this *Client) Mqtt() paho.Client

func (*Client) Publish

func (this *Client) Publish(topic string, msg interface{}, qos byte) (err error)

func (*Client) PublishMqtt4

func (this *Client) PublishMqtt4(topic string, msg interface{}, qos byte) (err error)

func (*Client) PublishMqtt5

func (this *Client) PublishMqtt5(topic string, msg interface{}, qos byte) (err error)

func (*Client) SendClientError

func (this *Client) SendClientError(message string) error

func (*Client) SendDeviceError

func (this *Client) SendDeviceError(deviceUri string, message string) error

func (*Client) SendEvent

func (this *Client) SendEvent(deviceUri string, serviceUri string, msg platform_connector_lib.EventMsg) (err error)

func (*Client) SendEventWithQos

func (this *Client) SendEventWithQos(deviceUri string, serviceUri string, msg platform_connector_lib.EventMsg, qos byte) (err error)

func (*Client) Stop

func (this *Client) Stop()

func (*Client) Subscribe

func (this *Client) Subscribe(topic string, qos byte, callback func(topic string, pl []byte)) error

func (*Client) SubscribeMqtt4

func (this *Client) SubscribeMqtt4(topic string, qos byte, callback func(topic string, pl []byte)) error

func (*Client) SubscribeMqtt5

func (this *Client) SubscribeMqtt5(topic string, qos byte, callback func(topic string, pl []byte)) error

func (*Client) Unsubscribe

func (this *Client) Unsubscribe(deviceUri string, serviceUri string) (err error)

func (*Client) UnsubscribeMqtt4

func (this *Client) UnsubscribeMqtt4(deviceUri string, serviceUri string) (err error)

func (*Client) UnsubscribeMqtt5

func (this *Client) UnsubscribeMqtt5(deviceUri string, serviceUri string) (err error)

type DeviceRepresentation

type DeviceRepresentation struct {
	IotType string `json:"iot_type"`
	Uri     string `json:"uri"`
	Name    string `json:"name"`
}

type MqttVersion

type MqttVersion int
const (
	MQTT4 MqttVersion = iota
	MQTT5
)

type Subscription

type Subscription struct {
	Topic   string
	Handler paho.MessageHandler
	Qos     byte
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL