firmwaremanagement

package
v0.0.0-...-a18a103 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package firmwaremanagement implements the Firmware Management Protocol v1.0.0 over LoRaWAN.

Index

Constants

View Source
const DefaultFPort uint8 = 203

DefaultFPort defines the default fPort value for Firmware Management.

Variables

View Source
var (
	ErrNoPayloadForCID = errors.New("lorawan/applayer/firmwaremanagement: no payload for given CID")
)

Errors

Functions

This section is empty.

Types

type CID

type CID byte

CID defines the command identifier.

const (
	PackageVersionReq     CID = 0x00
	PackageVersionAns     CID = 0x00
	DevVersionReq         CID = 0x01
	DevVersionAns         CID = 0x01
	DevRebootTimeReq      CID = 0x02
	DevRebootTimeAns      CID = 0x02
	DevRebootCountdownReq CID = 0x03
	DevRebootCountdownAns CID = 0x03
	DevUpgradeImageReq    CID = 0x04
	DevUpgradeImageAns    CID = 0x04
	DevDeleteImageReq     CID = 0x05
	DevDeleteImageAns     CID = 0x05
)

Available command identifiers.

func (CID) String

func (i CID) String() string

type Command

type Command struct {
	CID     CID
	Payload CommandPayload
}

Command defines the Command structure.

func (Command) MarshalBinary

func (c Command) MarshalBinary() ([]byte, error)

MarshalBinary encodes the command to a slice of bytes.

func (Command) Size

func (c Command) Size() int

Size returns the size of the command in bytes.

func (*Command) UnmarshalBinary

func (c *Command) UnmarshalBinary(uplink bool, data []byte) error

UnmarshalBinary decodes a slice of bytes into a command.

type CommandPayload

type CommandPayload interface {
	MarshalBinary() (data []byte, err error)
	UnmarshalBinary(data []byte) error
	Size() int
}

CommandPayload defines the interface that a command payload must implement.

func GetCommandPayload

func GetCommandPayload(uplink bool, c CID) (CommandPayload, error)

GetCommandPayload returns a new CommandPayload for the given CID.

type Commands

type Commands []Command

Commands defines a slice of commands.

func (Commands) MarshalBinary

func (c Commands) MarshalBinary() ([]byte, error)

MarshalBinary encodes the commands to a slice of bytes.

func (*Commands) UnmarshalBinary

func (c *Commands) UnmarshalBinary(uplink bool, data []byte) error

UnmarshalBinary decodes a slice of bytes into a slice of commands.

type DevDeleteImageAnsPayload

type DevDeleteImageAnsPayload struct {
	Status DevDeleteImageAnsPayloadStatus
}

DevDeleteImageAnsPayload implements the DevDeleteImageAns payload.

func (DevDeleteImageAnsPayload) MarshalBinary

func (p DevDeleteImageAnsPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the payload to a slice of bytes.

func (DevDeleteImageAnsPayload) Size

func (p DevDeleteImageAnsPayload) Size() int

Size returns the payload size in number of bytes.

func (*DevDeleteImageAnsPayload) UnmarshalBinary

func (p *DevDeleteImageAnsPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the payload from a slice of bytes.

type DevDeleteImageAnsPayloadStatus

type DevDeleteImageAnsPayloadStatus struct {
	ErrorInvalidVersion uint8
	ErrorNoValidImage   uint8
}

DevDeleteImageAnsPayloadStatus implements the DevDeleteImageAns payload Status field.

type DevDeleteImageReqPayload

type DevDeleteImageReqPayload struct {
	FirmwareToDeleteVersion uint32
}

DevDeleteImageReqPayload implements the DevDeleteImageReq payload.

func (DevDeleteImageReqPayload) MarshalBinary

func (p DevDeleteImageReqPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the payload to a slice of bytes.

func (DevDeleteImageReqPayload) Size

func (p DevDeleteImageReqPayload) Size() int

Size returns the payload size in number of bytes.

func (*DevDeleteImageReqPayload) UnmarshalBinary

func (p *DevDeleteImageReqPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the payload from a slice of bytes.

type DevRebootCountdownAnsPayload

type DevRebootCountdownAnsPayload struct {
	Countdown uint32
}

DevRebootCountdownAnsPayload implements the DevRebootCountdownAns payload.

func (DevRebootCountdownAnsPayload) MarshalBinary

func (p DevRebootCountdownAnsPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the payload to a slice of bytes.

func (DevRebootCountdownAnsPayload) Size

Size returns the payload size in number of bytes.

func (*DevRebootCountdownAnsPayload) UnmarshalBinary

func (p *DevRebootCountdownAnsPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the payload from a slice of bytes.

type DevRebootCountdownReqPayload

type DevRebootCountdownReqPayload struct {
	Countdown uint32
}

DevRebootCountdownReqPayload implements the DevRebootCountdownReq payload.

func (DevRebootCountdownReqPayload) MarshalBinary

func (p DevRebootCountdownReqPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the payload to a slice of bytes.

func (DevRebootCountdownReqPayload) Size

Size returns the payload size in number of bytes.

func (*DevRebootCountdownReqPayload) UnmarshalBinary

func (p *DevRebootCountdownReqPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the payload from a slice of bytes.

type DevRebootTimeAnsPayload

type DevRebootTimeAnsPayload struct {
	RebootTime uint32
}

DevRebootTimeAnsPayload implements the DevRebootTimeAns payload.

func (DevRebootTimeAnsPayload) MarshalBinary

func (p DevRebootTimeAnsPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the payload to a slice of bytes.

func (DevRebootTimeAnsPayload) Size

func (p DevRebootTimeAnsPayload) Size() int

Size returns the payload size in number of bytes.

func (*DevRebootTimeAnsPayload) UnmarshalBinary

func (p *DevRebootTimeAnsPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the payload from a slice of bytes.

type DevRebootTimeReqPayload

type DevRebootTimeReqPayload struct {
	RebootTime uint32
}

DevRebootTimeReqPayload implements the DevRebootTimeReq payload.

func (DevRebootTimeReqPayload) MarshalBinary

func (p DevRebootTimeReqPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the payload to a slice of bytes.

func (DevRebootTimeReqPayload) Size

func (p DevRebootTimeReqPayload) Size() int

Size returns the payload size in number of bytes.

func (*DevRebootTimeReqPayload) UnmarshalBinary

func (p *DevRebootTimeReqPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the payload from a slice of bytes.

type DevUpgradeImageAnsPayload

type DevUpgradeImageAnsPayload struct {
	Status DevUpgradeImageAnsPayloadStatus
	// contains filtered or unexported fields
}

DevUpgradeImageAnsPayload implements the DevUpgradeImageAns payload.

func (DevUpgradeImageAnsPayload) MarshalBinary

func (p DevUpgradeImageAnsPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the payload to a slice of bytes.

func (DevUpgradeImageAnsPayload) Size

func (p DevUpgradeImageAnsPayload) Size() int

Size returns the payload size in number of bytes.

func (*DevUpgradeImageAnsPayload) UnmarshalBinary

func (p *DevUpgradeImageAnsPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the payload from a slice of bytes.

type DevUpgradeImageAnsPayloadStatus

type DevUpgradeImageAnsPayloadStatus struct {
	UpImageStatus UpImageStatus
}

DevUpgradeImageAnsPayloadStatus implements the DevUpgradeImageAnsPayload payload Status field.

func (DevUpgradeImageAnsPayloadStatus) IsFirmwareImageValid

func (p DevUpgradeImageAnsPayloadStatus) IsFirmwareImageValid() bool

IsFirmwareImageValid returns whether UpImageStatus==FirmwareValid stating update is present and valid

type DevUpgradeImageReqPayload

type DevUpgradeImageReqPayload struct{}

DevUpgradeImageReqPayload implements the DevUpgradeImageReq payload.

func (DevUpgradeImageReqPayload) MarshalBinary

func (p DevUpgradeImageReqPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the payload to a slice of bytes.

func (DevUpgradeImageReqPayload) Size

func (p DevUpgradeImageReqPayload) Size() int

Size returns the payload size in number of bytes.

func (*DevUpgradeImageReqPayload) UnmarshalBinary

func (p *DevUpgradeImageReqPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the payload from a slice of bytes.

type DevVersionAnsPayload

type DevVersionAnsPayload struct {
	FWversion uint32
	HWversion uint32
}

DevVersionAnsPayload implements the DevVersionAns payload.

func (DevVersionAnsPayload) MarshalBinary

func (p DevVersionAnsPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the payload to a slice of bytes.

func (DevVersionAnsPayload) Size

func (p DevVersionAnsPayload) Size() int

Size returns the payload size in number of bytes.

func (*DevVersionAnsPayload) UnmarshalBinary

func (p *DevVersionAnsPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the payload from a slice of bytes.

type DevVersionReqPayload

type DevVersionReqPayload struct{}

DevVersionReqPayload implements the DevVersionReq payload.

func (DevVersionReqPayload) MarshalBinary

func (p DevVersionReqPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the payload to a slice of bytes.

func (DevVersionReqPayload) Size

func (p DevVersionReqPayload) Size() int

Size returns the payload size in number of bytes.

func (*DevVersionReqPayload) UnmarshalBinary

func (p *DevVersionReqPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the payload from a slice of bytes.

type PackageVersionAnsPayload

type PackageVersionAnsPayload struct {
	PackageIdentifier uint8
	PackageVersion    uint8
}

PackageVersionAnsPayload implements the PackageVersionAns payload.

func (PackageVersionAnsPayload) MarshalBinary

func (p PackageVersionAnsPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the payload to a slice of bytes.

func (PackageVersionAnsPayload) Size

func (p PackageVersionAnsPayload) Size() int

Size returns the payload size in number of bytes.

func (*PackageVersionAnsPayload) UnmarshalBinary

func (p *PackageVersionAnsPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the payload from a slice of bytes.

type UpImageStatus

type UpImageStatus uint8

UpImageStatus enumerate status of firmware upgrade on device

const (
	NoFirmwarePresent                 UpImageStatus = 0
	FirmwareCorruptOrInvalidSignature UpImageStatus = 1
	FirmwareIncorrectHardware         UpImageStatus = 2
	FirmwareValid                     UpImageStatus = 3
)

Possible UpImageStatus values

Jump to

Keyboard shortcuts

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