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

package fragmentation

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

Package fragmentation implements the Fragmented Data Block Transport v1.0.0 over LoRaWAN.

Index

Package Files

cid_string.go encode.go fragmentation.go

Constants

const DefaultFPort uint8 = 201

DefaultFPort defines the default fPort value for Fragmented Data Block Transport.

Variables

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

Errors

func Encode Uses

func Encode(data []byte, fragmentSize, redundancy int) ([][]byte, error)

Encode encodes the given slice of bytes to fragments including forward error correction. This is based on the proposed FEC code from the Fragmented Data Block Transport over LoRaWAN recommendation.

type CID Uses

type CID byte

CID defines the command identifier.

const (
    PackageVersionReq    CID = 0x00
    PackageVersionAns    CID = 0x00
    FragSessionStatusReq CID = 0x01
    FragSessionStatusAns CID = 0x01
    FragSessionSetupReq  CID = 0x02
    FragSessionSetupAns  CID = 0x02
    FragSessionDeleteReq CID = 0x03
    FragSessionDeleteAns CID = 0x03
    DataFragment         CID = 0x08
)

Available command identifier.

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 DataFragmentPayload Uses

type DataFragmentPayload struct {
    IndexAndN DataFragmentPayloadIndexAndN
    Payload   []byte
}

DataFragmentPayload implements the DataFragment payload.

func (DataFragmentPayload) MarshalBinary Uses

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

MarshalBinary encodes the given payload to a slice of bytes.

func (DataFragmentPayload) Size Uses

func (p DataFragmentPayload) Size() int

Size returns the payload size in bytes.

func (*DataFragmentPayload) UnmarshalBinary Uses

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

UnmarshalBinary decodes the payload from a slice of bytes.

type DataFragmentPayloadIndexAndN Uses

type DataFragmentPayloadIndexAndN struct {
    FragIndex uint8
    N         uint16
}

DataFragmentPayloadIndexAndN implements the DataFragment payload IndexAndN field.

type FragSessionDeleteAnsPayload Uses

type FragSessionDeleteAnsPayload struct {
    Status FragSessionDeleteAnsPayloadStatus
}

FragSessionDeleteAnsPayload implements the FragSessionDeleteAns payload.

func (FragSessionDeleteAnsPayload) MarshalBinary Uses

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

MarshalBinary encodes the payload to a slice of bytes.

func (FragSessionDeleteAnsPayload) Size Uses

func (p FragSessionDeleteAnsPayload) Size() int

Size returns the size of the payload in bytes.

func (*FragSessionDeleteAnsPayload) UnmarshalBinary Uses

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

UnmarshalBinary decodes the payload from a slice of bytes.

type FragSessionDeleteAnsPayloadStatus Uses

type FragSessionDeleteAnsPayloadStatus struct {
    FragIndex           uint8
    SessionDoesNotExist bool
}

FragSessionDeleteAnsPayloadStatus implements the FragSessionDeleteAns payload Status field.

type FragSessionDeleteReqPayload Uses

type FragSessionDeleteReqPayload struct {
    Param FragSessionDeleteReqPayloadParam
}

FragSessionDeleteReqPayload implements the FragSessionDeleteReq paylaod.

func (FragSessionDeleteReqPayload) MarshalBinary Uses

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

MarshalBinary encodes the payload to a slice of bytes.

func (FragSessionDeleteReqPayload) Size Uses

func (p FragSessionDeleteReqPayload) Size() int

Size returns the payload size in bytes.

func (*FragSessionDeleteReqPayload) UnmarshalBinary Uses

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

UnmarshalBinary decodes the payload from a slice of bytes.

type FragSessionDeleteReqPayloadParam Uses

type FragSessionDeleteReqPayloadParam struct {
    FragIndex uint8
}

FragSessionDeleteReqPayloadParam implements the FragSessionDeleteReq payload Param field.

type FragSessionSetupAnsPayload Uses

type FragSessionSetupAnsPayload struct {
    StatusBitMask FragSessionSetupAnsPayloadStatusBitMask
}

FragSessionSetupAnsPayload implements the FragSessionSetupAns payload.

func (FragSessionSetupAnsPayload) MarshalBinary Uses

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

MarshalBinary encodes the payload to a slice of bytes.

func (FragSessionSetupAnsPayload) Size Uses

func (p FragSessionSetupAnsPayload) Size() int

Size returns the paylaod size in bytes.

func (*FragSessionSetupAnsPayload) UnmarshalBinary Uses

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

UnmarshalBinary decodes the payload from a slice of bytes.

type FragSessionSetupAnsPayloadStatusBitMask Uses

type FragSessionSetupAnsPayloadStatusBitMask struct {
    FragIndex                    uint8
    WrongDescriptor              bool
    FragSessionIndexNotSupported bool
    NotEnoughMemory              bool
    EncodingUnsupported          bool
}

FragSessionSetupAnsPayloadStatusBitMask implements the FragSessionSetupAns payload StatusBitMask field.

type FragSessionSetupReqPayload Uses

type FragSessionSetupReqPayload struct {
    FragSession FragSessionSetupReqPayloadFragSession
    NbFrag      uint16
    FragSize    uint8
    Control     FragSessionSetupReqPayloadControl
    Padding     uint8
    Descriptor  [4]byte
}

FragSessionSetupReqPayload implements the FragSessionSetupReq payload.

func (FragSessionSetupReqPayload) MarshalBinary Uses

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

MarshalBinary encodes the payload to a slice of bytes.

func (FragSessionSetupReqPayload) Size Uses

func (p FragSessionSetupReqPayload) Size() int

Size returns the payload size in number of bytes.

func (*FragSessionSetupReqPayload) UnmarshalBinary Uses

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

UnmarshalBinary decodes the payload from a slice of bytes.

type FragSessionSetupReqPayloadControl Uses

type FragSessionSetupReqPayloadControl struct {
    FragmentationMatrix uint8
    BlockAckDelay       uint8
}

FragSessionSetupReqPayloadControl implements the FragSessionSetupReq payload Control field.

type FragSessionSetupReqPayloadFragSession Uses

type FragSessionSetupReqPayloadFragSession struct {
    FragIndex      uint8
    McGroupBitMask [4]bool
}

FragSessionSetupReqPayloadFragSession implements the FragSessionSetupReq payload FragSession field.

type FragSessionStatusAnsPayload Uses

type FragSessionStatusAnsPayload struct {
    ReceivedAndIndex FragSessionStatusAnsPayloadReceivedAndIndex
    MissingFrag      uint8
    Status           FragSessionStatusAnsPayloadStatus
}

FragSessionStatusAnsPayload implements the FragSessionStatusAns payload.

func (FragSessionStatusAnsPayload) MarshalBinary Uses

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

MarshalBinary encodes the payload to a slice of bytes.

func (FragSessionStatusAnsPayload) Size Uses

func (p FragSessionStatusAnsPayload) Size() int

Size returns the payload size in number of bytes.

func (*FragSessionStatusAnsPayload) UnmarshalBinary Uses

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

UnmarshalBinary decodes the payload from a slice of bytes.

type FragSessionStatusAnsPayloadReceivedAndIndex Uses

type FragSessionStatusAnsPayloadReceivedAndIndex struct {
    FragIndex      uint8
    NbFragReceived uint16
}

FragSessionStatusAnsPayloadReceivedAndIndex implements the FragSessionStatusAns payload ReceivedAndIndex field.

type FragSessionStatusAnsPayloadStatus Uses

type FragSessionStatusAnsPayloadStatus struct {
    NotEnoughMatrixMemory bool
}

FragSessionStatusAnsPayloadStatus implements the FragSessionStatusAns payload Status field.

type FragSessionStatusReqPayload Uses

type FragSessionStatusReqPayload struct {
    FragStatusReqParam FragSessionStatusReqPayloadFragStatusReqParam
}

FragSessionStatusReqPayload implements the FragSessionStatusReq payload.

func (FragSessionStatusReqPayload) MarshalBinary Uses

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

MarshalBinary encodes the payload to a slice of bytes.

func (FragSessionStatusReqPayload) Size Uses

func (p FragSessionStatusReqPayload) Size() int

Size returns the payload size in number of bytes.

func (*FragSessionStatusReqPayload) UnmarshalBinary Uses

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

UnmarshalBinary decodes the payload from a slice of bytes.

type FragSessionStatusReqPayloadFragStatusReqParam Uses

type FragSessionStatusReqPayloadFragStatusReqParam struct {
    FragIndex    uint8
    Participants bool
}

FragSessionStatusReqPayloadFragStatusReqParam implements the FragSessionStatusReq payload FragStatusReqParam 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 number of bytes.

func (*PackageVersionAnsPayload) UnmarshalBinary Uses

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

UnmarshalBinary decodes the payload from a slice of bytes.

Package fragmentation imports 4 packages (graph) and is imported by 6 packages. Updated 2019-03-04. Refresh now. Tools for package owners.