lorawan: github.com/brocaar/lorawan/applayer/clocksync Index | Files

package clocksync

import "github.com/brocaar/lorawan/applayer/clocksync"

Package clocksync implements the Application Layer Clock Synchronization v1.0.0 over LoRaWAN.

Index

Package Files

cid_string.go clocksync.go

Constants

const DefaultFPort uint8 = 202

DefaultFPort defines the default fPort value for Clock Synnchronization.

Variables

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

Errors

type AppTimeAnsPayload Uses

type AppTimeAnsPayload struct {
    TimeCorrection int32
    Param          AppTimeAnsPayloadParam
}

AppTimeAnsPayload implements the AppTimeAns payload.

func (AppTimeAnsPayload) MarshalBinary Uses

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

MarshalBinary encodes the payload to a slice of bytes.

func (*AppTimeAnsPayload) Size Uses

func (p *AppTimeAnsPayload) Size() int

Size returns the payload size in bytes.

func (*AppTimeAnsPayload) UnmarshalBinary Uses

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

UnmarshalBinary decoces the payload from a slice of bytes.

type AppTimeAnsPayloadParam Uses

type AppTimeAnsPayloadParam struct {
    TokenAns uint8
}

AppTimeAnsPayloadParam implements the AppTimeAns payload Param field.

type AppTimeReqPayload Uses

type AppTimeReqPayload struct {
    DeviceTime uint32
    Param      AppTimeReqPayloadParam
}

AppTimeReqPayload implements the AppTimeReq payload.

func (AppTimeReqPayload) MarshalBinary Uses

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

MarshalBinary encodes the payload to a slice of bytes.

func (AppTimeReqPayload) Size Uses

func (p AppTimeReqPayload) Size() int

Size returns the payload size in bytes.

func (*AppTimeReqPayload) UnmarshalBinary Uses

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

UnmarshalBinary decodes the payload from a slice of bytes.

type AppTimeReqPayloadParam Uses

type AppTimeReqPayloadParam struct {
    AnsRequired bool
    TokenReq    uint8
}

AppTimeReqPayloadParam implements the AppTimeReq Param field.

type CID Uses

type CID byte

CID defines the command identifier.

const (
    PackageVersionReq           CID = 0x00
    PackageVersionAns           CID = 0x00
    AppTimeReq                  CID = 0x01
    AppTimeAns                  CID = 0x01
    DeviceAppTimePeriodicityReq CID = 0x02
    DeviceAppTimePeriodicityAns CID = 0x02
    ForceDeviceResyncReq        CID = 0x03
)

Available command identifiers.

func (CID) String Uses

func (i CID) String() string

type Command Uses

type Command struct {
    CID     CID
    Payload CommandPayload
}

Command defines the Command structure.

func (Command) MarshalBinary Uses

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

MarshalBinary encodes the command to a slice of bytes.

func (Command) Size Uses

func (c Command) Size() int

Size returns the size of the command in bytes.

func (*Command) UnmarshalBinary Uses

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

UnmarshalBinary decodes a slice of bytes into a command.

type CommandPayload Uses

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 Uses

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

GetCommandPayload returns a new CommandPayload for the given CID.

type Commands Uses

type Commands []Command

Commands defines a slice of commands.

func (Commands) MarshalBinary Uses

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

MarshalBinary encodes the commands to a slice of bytes.

func (*Commands) UnmarshalBinary Uses

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

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

type DeviceAppTimePeriodicityAnsPayload Uses

type DeviceAppTimePeriodicityAnsPayload struct {
    Status DeviceAppTimePeriodicityAnsPayloadStatus
    Time   uint32
}

DeviceAppTimePeriodicityAnsPayload implements the DeviceAppTimePeriodicityAns payload.

func (DeviceAppTimePeriodicityAnsPayload) MarshalBinary Uses

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

MarshalBinary encodes the payload to a slice of bytes.

func (DeviceAppTimePeriodicityAnsPayload) Size Uses

func (p DeviceAppTimePeriodicityAnsPayload) Size() int

Size returns the payload size in bytes.

func (*DeviceAppTimePeriodicityAnsPayload) UnmarshalBinary Uses

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

UnmarshalBinary decodes the payload from a slice of bytes.

type DeviceAppTimePeriodicityAnsPayloadStatus Uses

type DeviceAppTimePeriodicityAnsPayloadStatus struct {
    NotSupported bool
}

DeviceAppTimePeriodicityAnsPayloadStatus implements the DeviceAppTimePeriodicityAns status field.

type DeviceAppTimePeriodicityReqPayload Uses

type DeviceAppTimePeriodicityReqPayload struct {
    Periodicity DeviceAppTimePeriodicityReqPayloadPeriodicity
}

DeviceAppTimePeriodicityReqPayload implements the DeviceAppTimePeriodicityReq payload.

func (DeviceAppTimePeriodicityReqPayload) MarshalBinary Uses

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

MarshalBinary encodes the payload to a slice of bytes.

func (DeviceAppTimePeriodicityReqPayload) Size Uses

func (p DeviceAppTimePeriodicityReqPayload) Size() int

Size returns the payload size in bytes.

func (*DeviceAppTimePeriodicityReqPayload) UnmarshalBinary Uses

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

UnmarshalBinary decodes the payload from a slice of bytes.

type DeviceAppTimePeriodicityReqPayloadPeriodicity Uses

type DeviceAppTimePeriodicityReqPayloadPeriodicity struct {
    Period uint8
}

DeviceAppTimePeriodicityReqPayloadPeriodicity implements the DeviceAppTimePeriodicityReq payload Periodicity field.

type ForceDeviceResyncReqPayload Uses

type ForceDeviceResyncReqPayload struct {
    ForceConf ForceDeviceResyncReqPayloadForceConf
}

ForceDeviceResyncReqPayload implements the ForceDeviceResyncReq payload.

func (ForceDeviceResyncReqPayload) MarshalBinary Uses

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

MarshalBinary encodes the payload to a slice of bytes.

func (ForceDeviceResyncReqPayload) Size Uses

func (p ForceDeviceResyncReqPayload) Size() int

Size returns the payload size in bytes.

func (*ForceDeviceResyncReqPayload) UnmarshalBinary Uses

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

UnmarshalBinary decodes the payload from a slice of bytes.

type ForceDeviceResyncReqPayloadForceConf Uses

type ForceDeviceResyncReqPayloadForceConf struct {
    NbTransmissions uint8
}

ForceDeviceResyncReqPayloadForceConf implements the ForceDeviceResyncReq payload ForceConf field.

type PackageVersionAnsPayload Uses

type PackageVersionAnsPayload struct {
    PackageIdentifier uint8
    PackageVersion    uint8
}

PackageVersionAnsPayload implements the PackageVersionAns payload.

func (PackageVersionAnsPayload) MarshalBinary Uses

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

MarshalBinary encodes the payload to a slice of bytes.

func (*PackageVersionAnsPayload) Size Uses

func (p *PackageVersionAnsPayload) Size() int

Size returns the payload size in bytes.

func (*PackageVersionAnsPayload) UnmarshalBinary Uses

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

UnmarshalBinary decodes the payload from a slice of bytes.

Package clocksync imports 4 packages (graph) and is imported by 1 packages. Updated 2019-02-27. Refresh now. Tools for package owners.