driver_mqtt_aws

package
v0.3.36 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSIoTConnection

type AWSIoTConnection struct {
	// contains filtered or unexported fields
}

AWSIoTConnection holds connection for AWS IoT

func NewAWSIoTConnection

func NewAWSIoTConnection(config *Config) (instance *AWSIoTConnection, err error)

NewAWSIoTConnection Creates new MQTT connection with AWS IoT It requires config parameter for initialisation

func (*AWSIoTConnection) Close

func (instance *AWSIoTConnection) Close() bool

Close function disconnects the MQTT connection only if its already connected else returns error

func (*AWSIoTConnection) IsConnected

func (instance *AWSIoTConnection) IsConnected() (response bool)

func (*AWSIoTConnection) Open

func (instance *AWSIoTConnection) Open() (err error)

func (*AWSIoTConnection) Publish

func (instance *AWSIoTConnection) Publish(topic string, data interface{}, qos byte) (err error)

Publish function publishes data in interface on topic with level of qos (Quality of service) currently supported 0 & 1 (2 coming in future)

func (*AWSIoTConnection) Subscribe

func (instance *AWSIoTConnection) Subscribe(topic string, qos byte) error

Subscribe function subscribes on topic with level of qos (Quality of service) currently supported 0 & 1 (2 coming in future).

func (*AWSIoTConnection) SubscribeWithHandler

func (instance *AWSIoTConnection) SubscribeWithHandler(topic string, qos byte, handler MQTT.MessageHandler) (err error)

SubscribeWithHandler function subscribes on topic with level of qos (Quality of service) currently supported 0 & 1 (2 coming in future) & handler function to listen to incoming messages for the topic & qos level. It is called every time when message is received

func (*AWSIoTConnection) Unsubscribe

func (instance *AWSIoTConnection) Unsubscribe(topic string) (err error)

Unsubscribe function removes subscription for specified topic

type Config

type Config struct {
	ClientId string `json:"client-id" binding:"required"`
	Endpoint string `json:"endpoint" binding:"required"`

	KeyPath  string `json:"key-path" binding:"required"`  // private key
	CertPath string `json:"cert-path" binding:"required"` // .crt file
	CAPath   string `json:"ca-path" binding:"required"`   // CA
}

Config struct holds connection parameters for AWSIoTConnection initialisation All parameters are compulsory KeyPath is path to x.509 Private Key CertPath is path to x.509 Public Key CAPath is path to CA certificate ClientId is the clientId of thing Endpoint is Unique AWS IoT endpoint provided by AWS IoT

func NewAWSIoTConnectionConfig

func NewAWSIoTConnectionConfig(args ...interface{}) (instance *Config, err error)

func (*Config) Parse

func (instance *Config) Parse(args ...interface{}) (err error)

Directories

Path Synopsis
topics
lifecycle
Package lifecycle provides topics to intercept thing lifecycle & subscription events
Package lifecycle provides topics to intercept thing lifecycle & subscription events
registry
Package registry provides topics for Device registry operations
Package registry provides topics for Device registry operations

Jump to

Keyboard shortcuts

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