enddevices

package
v3.30.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data interface {
	qrcode.Data
	Encode(*ttnpb.EndDevice) error
	// FormatID returns the ID of the format used to parse the QR Code data.
	FormatID() string
	// EndDeviceTemplate returns the End Device Template corresponding to the QR code data.
	EndDeviceTemplate() *ttnpb.EndDeviceTemplate
}

Data represents end device QR code data.

type Format

type Format interface {
	Format() *ttnpb.QRCodeFormat
	New() Data
}

Format is a end device QR code format.

type LoRaAllianceTR005

type LoRaAllianceTR005 struct {
	JoinEUI,
	DevEUI types.EUI64
	VendorID,
	ModelID [2]byte
	Checksum,
	OwnerToken,
	SerialNumber,
	Proprietary string
}

LoRaAllianceTR005 is the LoRa Alliance defined format in Technical Recommendation TR005. See https://lora-alliance.org/wp-content/uploads/2020/11/TR005_LoRaWAN_Device_Identification_QR_Codes.pdf

func (*LoRaAllianceTR005) Encode

func (m *LoRaAllianceTR005) Encode(dev *ttnpb.EndDevice) error

Encode implements the Data interface.

func (*LoRaAllianceTR005) EndDeviceTemplate

func (m *LoRaAllianceTR005) EndDeviceTemplate() *ttnpb.EndDeviceTemplate

EndDeviceTemplate implements the Data interface.

func (*LoRaAllianceTR005) FormatID

func (m *LoRaAllianceTR005) FormatID() string

FormatID implements the Data interface.

func (LoRaAllianceTR005) MarshalText

func (m LoRaAllianceTR005) MarshalText() ([]byte, error)

MarshalText implements the TextMarshaler interface.

func (*LoRaAllianceTR005) UnmarshalText

func (m *LoRaAllianceTR005) UnmarshalText(text []byte) error

UnmarshalText implements the TextUnmarshaler interface.

func (LoRaAllianceTR005) Validate

func (m LoRaAllianceTR005) Validate() error

Validate implements the Data interface.

type LoRaAllianceTR005Draft2

type LoRaAllianceTR005Draft2 struct {
	JoinEUI,
	DevEUI types.EUI64
	VendorID,
	ModelID [2]byte
	DeviceValidationCode,
	SerialNumber,
	Proprietary string
}

LoRaAllianceTR005Draft2 is the LoRa Alliance defined format in Technical Recommendation TR005 Draft 2.

func (*LoRaAllianceTR005Draft2) Encode

func (m *LoRaAllianceTR005Draft2) Encode(dev *ttnpb.EndDevice) error

Encode implements the Data interface.

func (*LoRaAllianceTR005Draft2) EndDeviceTemplate

func (m *LoRaAllianceTR005Draft2) EndDeviceTemplate() *ttnpb.EndDeviceTemplate

EndDeviceTemplate implements the Data interface.

func (*LoRaAllianceTR005Draft2) FormatID

func (m *LoRaAllianceTR005Draft2) FormatID() string

FormatID implements the Data interface.

func (LoRaAllianceTR005Draft2) MarshalText

func (m LoRaAllianceTR005Draft2) MarshalText() ([]byte, error)

MarshalText implements the TextMarshaler interface.

func (*LoRaAllianceTR005Draft2) UnmarshalText

func (m *LoRaAllianceTR005Draft2) UnmarshalText(text []byte) error

UnmarshalText implements the TextUnmarshaler interface.

func (LoRaAllianceTR005Draft2) Validate

func (m LoRaAllianceTR005Draft2) Validate() error

Validate implements the Data interface.

type LoRaAllianceTR005Draft2Format

type LoRaAllianceTR005Draft2Format struct{}

LoRaAllianceTR005Draft2Format implements the LoRa Alliance TR005 Draft2 Format.

func (LoRaAllianceTR005Draft2Format) Format

Format implements the Format interface.

func (LoRaAllianceTR005Draft2Format) ID

ID is the identifier of the format as a string.

func (LoRaAllianceTR005Draft2Format) New

New implements the Format interface.

type LoRaAllianceTR005Draft3

type LoRaAllianceTR005Draft3 struct {
	JoinEUI,
	DevEUI types.EUI64
	VendorID,
	ModelID [2]byte
	DeviceValidationCode,
	SerialNumber,
	Proprietary string
}

LoRaAllianceTR005Draft3 is the LoRa Alliance defined format in Technical Recommendation TR005 Draft 3.

func (*LoRaAllianceTR005Draft3) Encode

func (m *LoRaAllianceTR005Draft3) Encode(dev *ttnpb.EndDevice) error

Encode implements the Data interface.

func (*LoRaAllianceTR005Draft3) EndDeviceTemplate

func (m *LoRaAllianceTR005Draft3) EndDeviceTemplate() *ttnpb.EndDeviceTemplate

EndDeviceTemplate implements the Data interface.

func (*LoRaAllianceTR005Draft3) FormatID

func (m *LoRaAllianceTR005Draft3) FormatID() string

FormatID implements the Data interface.

func (LoRaAllianceTR005Draft3) MarshalText

func (m LoRaAllianceTR005Draft3) MarshalText() ([]byte, error)

MarshalText implements the TextMarshaler interface.

func (*LoRaAllianceTR005Draft3) UnmarshalText

func (m *LoRaAllianceTR005Draft3) UnmarshalText(text []byte) error

UnmarshalText implements the TextUnmarshaler interface.

func (LoRaAllianceTR005Draft3) Validate

func (m LoRaAllianceTR005Draft3) Validate() error

Validate implements the Data interface.

type LoRaAllianceTR005Draft3Format

type LoRaAllianceTR005Draft3Format struct{}

LoRaAllianceTR005Draft3Format implements the LoRa Alliance TR005 Draft3 Format.

func (LoRaAllianceTR005Draft3Format) Format

Format implements the Format interface.

func (LoRaAllianceTR005Draft3Format) ID

ID is the identifier of the format as a string.

func (LoRaAllianceTR005Draft3Format) New

New implements EndDeviceFormat.

type LoRaAllianceTR005Format

type LoRaAllianceTR005Format struct{}

LoRaAllianceTR005Format implements the LoRa Alliance TR005 Format.

func (LoRaAllianceTR005Format) Format

Format implements the Format interface.

func (LoRaAllianceTR005Format) ID

ID is the identifier of the format as a string.

func (LoRaAllianceTR005Format) New

New implements the Format interface.

type Server

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

Server provides methods for end device QR codes.

func New

func New(ctx context.Context) *Server

New returns a new Server.

func (*Server) GetEndDeviceFormat

func (s *Server) GetEndDeviceFormat(id string) Format

GetEndDeviceFormat returns the converter by ID.

func (*Server) GetEndDeviceFormats

func (s *Server) GetEndDeviceFormats() map[string]Format

GetEndDeviceFormats returns the registered end device QR code formats.

func (*Server) Parse

func (s *Server) Parse(formatID string, data []byte) (ret Data, err error)

Parse attempts to parse the given QR code data. It returns the parser and the format ID that successfully parsed the QR code.

func (*Server) RegisterEndDeviceFormat

func (s *Server) RegisterEndDeviceFormat(id string, f Format)

RegisterEndDeviceFormat registers the given end device QR code format. Existing registrations with the same ID will not be overwritten. While matching, the slice will be traversed in a FIFO manner.

Jump to

Keyboard shortcuts

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