iothub

package
v0.2024.5 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package iothub provides a client for Azure IoT Hub.

Connect to an IoT Hub using Dial passing in a ConnectionParameters struct. ConnectionParameters can be created manually, parsed from a connection string using ParseConnectionString, or created dynamically using the Device Provisioning Service using the github.com/vanti-dev/sc-bos/pkg/internal/iothub/dps package.

Index

Constants

View Source
const APIVersion = "2021-04-12"

Variables

View Source
var ErrInvalidConnectionString = errors.New("invalid connection string")

Functions

func MQTTClientOptions

func MQTTClientOptions(hostName, deviceID, moduleID string, signer auth.Signer) (*mqtt.ClientOptions, error)

Types

type Conn

type Conn interface {
	// SendOutputMessage sends telemetry as json encode payload to the device event topic.
	SendOutputMessage(ctx context.Context, telemetry any) error
	io.Closer
}

Conn represents a connection to IoT Hub.

func Dial

func Dial(ctx context.Context, params ConnectionParameters) (Conn, error)

Dial returns a Conn connected to the host described by params.

type ConnectionParameters

type ConnectionParameters struct {
	HostName              string
	SharedAccessKeyName   string
	SharedAccessKey       auth.SASKey
	SharedAccessSignature string
	DeviceID              string
	ModuleID              string
	GatewayHostName       string
	X509                  string
}

func ParseConnectionString

func ParseConnectionString(cs string) (ConnectionParameters, error)

Directories

Path Synopsis
Package dps implements provisioning a device using the Azure IoT Device Provisioning Service.
Package dps implements provisioning a device using the Azure IoT Device Provisioning Service.

Jump to

Keyboard shortcuts

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