Documentation ¶
Overview ¶
Package firmwaremanagement implements the Firmware Management Protocol v1.0.0 over LoRaWAN.
Index ¶
- Constants
- Variables
- type CID
- type Command
- type CommandPayload
- type Commands
- type DevDeleteImageAnsPayload
- type DevDeleteImageAnsPayloadStatus
- type DevDeleteImageReqPayload
- type DevRebootCountdownAnsPayload
- type DevRebootCountdownReqPayload
- type DevRebootTimeAnsPayload
- type DevRebootTimeReqPayload
- type DevUpgradeImageAnsPayload
- type DevUpgradeImageAnsPayloadStatus
- type DevUpgradeImageReqPayload
- type DevVersionAnsPayload
- type DevVersionReqPayload
- type PackageVersionAnsPayload
- type UpImageStatus
Constants ¶
const DefaultFPort uint8 = 203
DefaultFPort defines the default fPort value for Firmware Management.
Variables ¶
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.
type Command ¶
type Command struct { CID CID Payload CommandPayload }
Command defines the Command structure.
func (Command) MarshalBinary ¶
MarshalBinary encodes the command to a slice of bytes.
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 ¶
MarshalBinary encodes the commands to a slice of bytes.
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 ¶
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 ¶
func (p DevRebootCountdownAnsPayload) Size() int
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 ¶
func (p DevRebootCountdownReqPayload) Size() int
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 ¶
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 ¶
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