types

package module
v0.0.0-...-6a0c198 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: MIT Imports: 9 Imported by: 252

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseHEX

func ParseHEX(input string, length int) ([]byte, error)

ParseHEX parses a string "input" to a byteslice with length "length".

Types

type AES128Key

type AES128Key [16]byte

AES128Key is an 128 bit AES key.

func ParseAES128Key

func ParseAES128Key(input string) (key AES128Key, err error)

ParseAES128Key parses a 128-bit hex-encoded string to an AES128Key

func (AES128Key) Bytes

func (key AES128Key) Bytes() []byte

Bytes returns the AES128Key as a byte slice

func (AES128Key) Equal

func (key AES128Key) Equal(other AES128Key) bool

Equal returns whether key is equal to other

func (AES128Key) GoString

func (key AES128Key) GoString() string

GoString implements the GoStringer interface.

func (AES128Key) IsEmpty

func (key AES128Key) IsEmpty() bool

func (AES128Key) Marshal

func (key AES128Key) Marshal() ([]byte, error)

Marshal implements the Marshaler interface.

func (AES128Key) MarshalBinary

func (key AES128Key) MarshalBinary() ([]byte, error)

MarshalBinary implements the BinaryMarshaler interface.

func (AES128Key) MarshalText

func (key AES128Key) MarshalText() ([]byte, error)

MarshalText implements the TextMarshaler interface.

func (*AES128Key) MarshalTo

func (key *AES128Key) MarshalTo(b []byte) (int, error)

MarshalTo is used by Protobuf

func (*AES128Key) Size

func (key *AES128Key) Size() int

Size is used by Protobuf

func (AES128Key) String

func (key AES128Key) String() string

String implements the Stringer interface.

func (*AES128Key) Unmarshal

func (key *AES128Key) Unmarshal(data []byte) error

Unmarshal implements the Unmarshaler interface.

func (*AES128Key) UnmarshalBinary

func (key *AES128Key) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*AES128Key) UnmarshalText

func (key *AES128Key) UnmarshalText(data []byte) error

UnmarshalText implements the TextUnmarshaler interface.

type AccessKey

type AccessKey struct {
	// The friendly name of the access key
	Name string `json:"name"`

	// The hard-to-guess access key
	Key string `json:"key"`

	// The rights associated with the key
	Rights []Right `json:"rights"`
}

AccessKey is an access key that gives someone the right to do something with an application

func (*AccessKey) HasRight

func (k *AccessKey) HasRight(right Right) bool

HasRight checks if an AccessKey has a certain right

type Activation

type Activation struct {
	AppID    string   `json:"app_id,omitempty"`
	DevID    string   `json:"dev_id,omitempty"`
	AppEUI   AppEUI   `json:"app_eui,omitempty"`
	DevEUI   DevEUI   `json:"dev_eui,omitempty"`
	DevAddr  DevAddr  `json:"dev_addr,omitempty"`
	Metadata Metadata `json:"metadata,omitempty"`
}

Activation messages are used to notify application of a device activation

type ActivationEventData

type ActivationEventData struct {
	ErrorEventData
	AppEUI   AppEUI   `json:"app_eui"`
	DevEUI   DevEUI   `json:"dev_eui"`
	DevAddr  DevAddr  `json:"dev_addr"`
	Metadata Metadata `json:"metadata"`
}

ActivationEventData is added to activation events

type AppEUI

type AppEUI EUI64

AppEUI is a unique identifier for applications.

func NewPopulatedAppEUI

func NewPopulatedAppEUI(r Rand) (appEUI *AppEUI)

NewPopulatedAppEUI returns random AppEUI

func ParseAppEUI

func ParseAppEUI(input string) (eui AppEUI, err error)

ParseAppEUI parses a 64-bit hex-encoded string to an AppEUI

func (AppEUI) Bytes

func (eui AppEUI) Bytes() []byte

Bytes returns the AppEUI as a byte slice

func (AppEUI) Equal

func (eui AppEUI) Equal(other AppEUI) bool

Equal returns whether eui is equal to other

func (AppEUI) GoString

func (eui AppEUI) GoString() string

GoString implements the GoStringer interface.

func (AppEUI) IsEmpty

func (eui AppEUI) IsEmpty() bool

func (AppEUI) Marshal

func (eui AppEUI) Marshal() ([]byte, error)

Marshal implements the Marshaler interface.

func (AppEUI) MarshalBinary

func (eui AppEUI) MarshalBinary() ([]byte, error)

MarshalBinary implements the BinaryMarshaler interface.

func (AppEUI) MarshalText

func (eui AppEUI) MarshalText() ([]byte, error)

MarshalText implements the TextMarshaler interface.

func (*AppEUI) MarshalTo

func (eui *AppEUI) MarshalTo(b []byte) (int, error)

MarshalTo is used by Protobuf

func (*AppEUI) Size

func (eui *AppEUI) Size() int

Size is used by Protobuf

func (AppEUI) String

func (eui AppEUI) String() string

String implements the Stringer interface.

func (*AppEUI) Unmarshal

func (eui *AppEUI) Unmarshal(data []byte) error

Unmarshal implements the Unmarshaler interface.

func (*AppEUI) UnmarshalBinary

func (eui *AppEUI) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*AppEUI) UnmarshalText

func (eui *AppEUI) UnmarshalText(data []byte) error

UnmarshalText implements the TextUnmarshaler interface.

type AppKey

type AppKey AES128Key

AppKey (Application Key) is used for LoRaWAN OTAA.

func NewPopulatedAppKey

func NewPopulatedAppKey(r Rand) (key *AppKey)

NewPopulatedAppKey returns random AppKey

func ParseAppKey

func ParseAppKey(input string) (key AppKey, err error)

ParseAppKey parses a 64-bit hex-encoded string to an AppKey

func (AppKey) Bytes

func (key AppKey) Bytes() []byte

Bytes returns the AppKey as a byte slice

func (AppKey) Equal

func (key AppKey) Equal(other AppKey) bool

Equal returns whether key is equal to other

func (AppKey) GoString

func (key AppKey) GoString() string

GoString implements the GoStringer interface.

func (AppKey) IsEmpty

func (key AppKey) IsEmpty() bool

func (AppKey) Marshal

func (key AppKey) Marshal() ([]byte, error)

Marshal implements the Marshaler interface.

func (AppKey) MarshalBinary

func (key AppKey) MarshalBinary() ([]byte, error)

MarshalBinary implements the BinaryMarshaler interface.

func (AppKey) MarshalText

func (key AppKey) MarshalText() ([]byte, error)

MarshalText implements the TextMarshaler interface.

func (*AppKey) MarshalTo

func (key *AppKey) MarshalTo(b []byte) (int, error)

MarshalTo is used by Protobuf

func (*AppKey) Size

func (key *AppKey) Size() int

Size is used by Protobuf

func (AppKey) String

func (key AppKey) String() string

func (*AppKey) Unmarshal

func (key *AppKey) Unmarshal(data []byte) error

Unmarshal implements the Unmarshaler interface.

func (*AppKey) UnmarshalBinary

func (key *AppKey) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*AppKey) UnmarshalText

func (key *AppKey) UnmarshalText(data []byte) error

UnmarshalText implements the TextUnmarshaler interface.

type AppNonce

type AppNonce [3]byte

AppNonce for LoRaWAN

func NewPopulatedAppNonce

func NewPopulatedAppNonce(r Rand) (nonce *AppNonce)

NewPopulatedAppNonce returns random AppNonce

func (AppNonce) Bytes

func (n AppNonce) Bytes() []byte

Bytes returns the AppNonce as a byte slice

func (AppNonce) Equal

func (n AppNonce) Equal(other AppNonce) bool

Equal returns whether n is equal to other

func (AppNonce) GoString

func (n AppNonce) GoString() string

GoString implements the GoStringer interface.

func (AppNonce) Marshal

func (n AppNonce) Marshal() ([]byte, error)

Marshal implements the Marshaler interface.

func (AppNonce) MarshalBinary

func (n AppNonce) MarshalBinary() ([]byte, error)

MarshalBinary implements the BinaryMarshaler interface.

func (AppNonce) MarshalText

func (n AppNonce) MarshalText() ([]byte, error)

MarshalText implements the TextMarshaler interface.

func (*AppNonce) MarshalTo

func (n *AppNonce) MarshalTo(b []byte) (int, error)

MarshalTo is used by Protobuf

func (*AppNonce) Size

func (n *AppNonce) Size() int

Size is used by Protobuf

func (AppNonce) String

func (n AppNonce) String() string

func (*AppNonce) Unmarshal

func (n *AppNonce) Unmarshal(data []byte) error

Unmarshal implements the Unmarshaler interface.

func (*AppNonce) UnmarshalBinary

func (n *AppNonce) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*AppNonce) UnmarshalText

func (n *AppNonce) UnmarshalText(data []byte) error

UnmarshalText implements the TextUnmarshaler interface.

type AppSKey

type AppSKey AES128Key

AppSKey (Application Session Key) is used for LoRaWAN payload encryption.

func NewPopulatedAppSKey

func NewPopulatedAppSKey(r Rand) (key *AppSKey)

NewPopulatedAppSKey returns random AppSKey

func ParseAppSKey

func ParseAppSKey(input string) (key AppSKey, err error)

ParseAppSKey parses a 64-bit hex-encoded string to an AppSKey

func (AppSKey) Bytes

func (key AppSKey) Bytes() []byte

Bytes returns the AppSKey as a byte slice

func (AppSKey) Equal

func (key AppSKey) Equal(other AppSKey) bool

Equal returns whether key is equal to other

func (AppSKey) GoString

func (key AppSKey) GoString() string

GoString implements the GoStringer interface.

func (AppSKey) IsEmpty

func (key AppSKey) IsEmpty() bool

func (AppSKey) Marshal

func (key AppSKey) Marshal() ([]byte, error)

Marshal implements the Marshaler interface.

func (AppSKey) MarshalBinary

func (key AppSKey) MarshalBinary() ([]byte, error)

MarshalBinary implements the BinaryMarshaler interface.

func (AppSKey) MarshalText

func (key AppSKey) MarshalText() ([]byte, error)

MarshalText implements the TextMarshaler interface.

func (*AppSKey) MarshalTo

func (key *AppSKey) MarshalTo(b []byte) (int, error)

MarshalTo is used by Protobuf

func (*AppSKey) Size

func (key *AppSKey) Size() int

Size is used by Protobuf

func (AppSKey) String

func (key AppSKey) String() string

func (*AppSKey) Unmarshal

func (key *AppSKey) Unmarshal(data []byte) error

Unmarshal implements the Unmarshaler interface.

func (*AppSKey) UnmarshalBinary

func (key *AppSKey) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*AppSKey) UnmarshalText

func (key *AppSKey) UnmarshalText(data []byte) error

UnmarshalText implements the TextUnmarshaler interface.

type DataRate

type DataRate struct {
	SpreadingFactor uint `json:"spreading_factor,omitempty"`
	Bandwidth       uint `json:"bandwidth,omitempty"`
}

func ConvertDataRate

func ConvertDataRate(input band.DataRate) (datr *DataRate, err error)

func ParseDataRate

func ParseDataRate(input string) (datr *DataRate, err error)

ParseDataRate parses a 32-bit hex-encoded string to a Devdatr

func (DataRate) Bytes

func (datr DataRate) Bytes() []byte

Bytes returns the DataRate as a byte slice

func (DataRate) GoString

func (datr DataRate) GoString() string

GoString implements the GoStringer interface.

func (DataRate) Marshal

func (datr DataRate) Marshal() ([]byte, error)

Marshal implements the Marshaler interface.

func (DataRate) MarshalBinary

func (datr DataRate) MarshalBinary() ([]byte, error)

MarshalBinary implements the BinaryMarshaler interface.

func (DataRate) MarshalText

func (datr DataRate) MarshalText() ([]byte, error)

MarshalText implements the TextMarshaler interface.

func (DataRate) MarshalTo

func (datr DataRate) MarshalTo(b []byte) (int, error)

MarshalTo is used by Protobuf

func (DataRate) Size

func (datr DataRate) Size() int

Size is used by Protobuf

func (DataRate) String

func (datr DataRate) String() string

String implements the Stringer interface.

func (*DataRate) Unmarshal

func (datr *DataRate) Unmarshal(data []byte) error

Unmarshal implements the Unmarshaler interface.

func (*DataRate) UnmarshalBinary

func (datr *DataRate) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*DataRate) UnmarshalText

func (datr *DataRate) UnmarshalText(data []byte) error

UnmarshalText implements the TextUnmarshaler interface.

type DevAddr

type DevAddr [4]byte

DevAddr is a non-unique address for LoRaWAN devices.

func NewPopulatedDevAddr

func NewPopulatedDevAddr(r Rand) (devAddr *DevAddr)

NewPopulatedDevAddr returns random DevAddr

func ParseDevAddr

func ParseDevAddr(input string) (addr DevAddr, err error)

ParseDevAddr parses a 32-bit hex-encoded string to a DevAddr

func (DevAddr) Bytes

func (addr DevAddr) Bytes() []byte

Bytes returns the DevAddr as a byte slice

func (DevAddr) Equal

func (addr DevAddr) Equal(other DevAddr) bool

Equal returns whether addr is equal to other

func (DevAddr) GoString

func (addr DevAddr) GoString() string

GoString implements the GoStringer interface.

func (DevAddr) HasPrefix

func (addr DevAddr) HasPrefix(prefix DevAddrPrefix) bool

HasPrefix returns true if the DevAddr has a prefix of given length

func (DevAddr) IsEmpty

func (addr DevAddr) IsEmpty() bool

func (DevAddr) Marshal

func (addr DevAddr) Marshal() ([]byte, error)

Marshal implements the Marshaler interface.

func (DevAddr) MarshalBinary

func (addr DevAddr) MarshalBinary() ([]byte, error)

MarshalBinary implements the BinaryMarshaler interface.

func (DevAddr) MarshalText

func (addr DevAddr) MarshalText() ([]byte, error)

MarshalText implements the TextMarshaler interface.

func (DevAddr) MarshalTo

func (addr DevAddr) MarshalTo(b []byte) (int, error)

MarshalTo is used by Protobuf

func (DevAddr) Mask

func (addr DevAddr) Mask(bits int) (masked DevAddr)

Mask returns a copy of the DevAddr with only the first "bits" bits

func (DevAddr) Size

func (addr DevAddr) Size() int

Size is used by Protobuf

func (DevAddr) String

func (addr DevAddr) String() string

String implements the Stringer interface.

func (*DevAddr) Unmarshal

func (addr *DevAddr) Unmarshal(data []byte) error

Unmarshal implements the Unmarshaler interface.

func (*DevAddr) UnmarshalBinary

func (addr *DevAddr) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*DevAddr) UnmarshalText

func (addr *DevAddr) UnmarshalText(data []byte) error

UnmarshalText implements the TextUnmarshaler interface.

func (DevAddr) WithPrefix

func (addr DevAddr) WithPrefix(prefix DevAddrPrefix) (prefixed DevAddr)

WithPrefix returns the DevAddr, but with the first length bits replaced by the Prefix

type DevAddrPrefix

type DevAddrPrefix struct {
	DevAddr DevAddr
	Length  int
}

DevAddrPrefix is a DevAddr with a prefix length

func ParseDevAddrPrefix

func ParseDevAddrPrefix(prefixString string) (prefix DevAddrPrefix, err error)

ParseDevAddrPrefix parses a DevAddr in prefix notation (01020304/24) to a prefix

func (DevAddrPrefix) Bytes

func (prefix DevAddrPrefix) Bytes() (bytes []byte)

Bytes returns the DevAddrPrefix as a byte slice

func (DevAddrPrefix) Marshal

func (prefix DevAddrPrefix) Marshal() ([]byte, error)

Marshal implements the Marshaler interface.

func (DevAddrPrefix) MarshalBinary

func (prefix DevAddrPrefix) MarshalBinary() ([]byte, error)

MarshalBinary implements the BinaryMarshaler interface.

func (DevAddrPrefix) MarshalText

func (prefix DevAddrPrefix) MarshalText() ([]byte, error)

MarshalText implements the TextMarshaler interface.

func (DevAddrPrefix) MarshalTo

func (prefix DevAddrPrefix) MarshalTo(b []byte) (int, error)

MarshalTo is used by Protobuf

func (DevAddrPrefix) Size

func (prefix DevAddrPrefix) Size() int

Size is used by Protobuf

func (DevAddrPrefix) String

func (prefix DevAddrPrefix) String() string

String implements the fmt.Stringer interface

func (*DevAddrPrefix) Unmarshal

func (prefix *DevAddrPrefix) Unmarshal(data []byte) error

Unmarshal implements the Unmarshaler interface.

func (*DevAddrPrefix) UnmarshalBinary

func (prefix *DevAddrPrefix) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*DevAddrPrefix) UnmarshalText

func (prefix *DevAddrPrefix) UnmarshalText(data []byte) error

UnmarshalText implements the TextUnmarshaler interface.

type DevEUI

type DevEUI EUI64

DevEUI is a unique identifier for devices.

func NewPopulatedDevEUI

func NewPopulatedDevEUI(r Rand) (devEUI *DevEUI)

NewPopulatedDevEUI returns random DevEUI

func ParseDevEUI

func ParseDevEUI(input string) (eui DevEUI, err error)

ParseDevEUI parses a 64-bit hex-encoded string to an DevEUI

func (DevEUI) Bytes

func (eui DevEUI) Bytes() []byte

Bytes returns the DevEUI as a byte slice

func (DevEUI) Equal

func (eui DevEUI) Equal(other DevEUI) bool

Equal returns whether eui is equal to other

func (DevEUI) GoString

func (eui DevEUI) GoString() string

GoString implements the GoStringer interface.

func (DevEUI) IsEmpty

func (eui DevEUI) IsEmpty() bool

func (DevEUI) Marshal

func (eui DevEUI) Marshal() ([]byte, error)

Marshal implements the Marshaler interface.

func (DevEUI) MarshalBinary

func (eui DevEUI) MarshalBinary() ([]byte, error)

MarshalBinary implements the BinaryMarshaler interface.

func (DevEUI) MarshalText

func (eui DevEUI) MarshalText() ([]byte, error)

MarshalText implements the TextMarshaler interface.

func (*DevEUI) MarshalTo

func (eui *DevEUI) MarshalTo(b []byte) (int, error)

MarshalTo is used by Protobuf

func (*DevEUI) Size

func (eui *DevEUI) Size() int

Size is used by Protobuf

func (DevEUI) String

func (eui DevEUI) String() string

String implements the Stringer interface.

func (*DevEUI) Unmarshal

func (eui *DevEUI) Unmarshal(data []byte) error

Unmarshal implements the Unmarshaler interface.

func (*DevEUI) UnmarshalBinary

func (eui *DevEUI) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*DevEUI) UnmarshalText

func (eui *DevEUI) UnmarshalText(data []byte) error

UnmarshalText implements the TextUnmarshaler interface.

type DevNonce

type DevNonce [2]byte

DevNonce for LoRaWAN

func NewPopulatedDevNonce

func NewPopulatedDevNonce(r Rand) (nonce *DevNonce)

NewPopulatedDevNonce returns random DevNonce

func (DevNonce) Bytes

func (n DevNonce) Bytes() []byte

Bytes returns the DevNonce as a byte slice

func (DevNonce) Equal

func (n DevNonce) Equal(other DevNonce) bool

Equal returns whether n is equal to other

func (DevNonce) GoString

func (n DevNonce) GoString() string

GoString implements the GoStringer interface.

func (DevNonce) Marshal

func (n DevNonce) Marshal() ([]byte, error)

Marshal implements the Marshaler interface.

func (DevNonce) MarshalBinary

func (n DevNonce) MarshalBinary() ([]byte, error)

MarshalBinary implements the BinaryMarshaler interface.

func (DevNonce) MarshalText

func (n DevNonce) MarshalText() ([]byte, error)

MarshalText implements the TextMarshaler interface.

func (*DevNonce) MarshalTo

func (n *DevNonce) MarshalTo(b []byte) (int, error)

MarshalTo is used by Protobuf

func (*DevNonce) Size

func (n *DevNonce) Size() int

Size is used by Protobuf

func (DevNonce) String

func (n DevNonce) String() string

func (*DevNonce) Unmarshal

func (n *DevNonce) Unmarshal(data []byte) error

Unmarshal implements the Unmarshaler interface.

func (*DevNonce) UnmarshalBinary

func (n *DevNonce) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*DevNonce) UnmarshalText

func (n *DevNonce) UnmarshalText(data []byte) error

UnmarshalText implements the TextUnmarshaler interface.

type DeviceEvent

type DeviceEvent struct {
	AppID string
	DevID string
	Event EventType
	Data  interface{}
}

DeviceEvent represents an application-layer event message for a device event

type DeviceEventData

type DeviceEventData struct {
	Latitude  float32   `json:"latitude,omitempty"`
	Longitude float32   `json:"longitude,omitempty"`
	Altitude  int32     `json:"altitude,omitempty"`
	UpdatedAt time.Time `json:"update_at,omitempty"`
}

DeviceEventData contains the updated of a set/updated device

type DownlinkEventConfigInfo

type DownlinkEventConfigInfo struct {
	Modulation string        `json:"modulation,omitempty"`
	DataRate   string        `json:"data_rate,omitempty"`
	BitRate    uint          `json:"bit_rate,omitempty"`
	Airtime    time.Duration `json:"airtime,omitempty"`
	FCnt       uint          `json:"counter,omitempty"`
	Frequency  uint          `json:"frequency,omitempty"`
	Power      int           `json:"power,omitempty"`
}

DownlinkEventConfigInfo contains configuration information for a downlink message, all fields are optional

type DownlinkEventData

type DownlinkEventData struct {
	ErrorEventData
	Payload   []byte                   `json:"payload,omitempty"`
	Message   *DownlinkMessage         `json:"message,omitempty"`
	GatewayID string                   `json:"gateway_id,omitempty"`
	Config    *DownlinkEventConfigInfo `json:"config,omitempty"`
}

DownlinkEventData is added to downlink events

type DownlinkMessage

type DownlinkMessage struct {
	AppID         string                 `json:"app_id,omitempty"`
	DevID         string                 `json:"dev_id,omitempty"`
	FPort         uint8                  `json:"port"`
	Confirmed     bool                   `json:"confirmed,omitempty"`
	Schedule      ScheduleType           `json:"schedule,omitempty"` // allowed values: "replace" (default), "first", "last"
	PayloadRaw    []byte                 `json:"payload_raw,omitempty"`
	PayloadFields map[string]interface{} `json:"payload_fields,omitempty"`
}

DownlinkMessage represents an application-layer downlink message

type EUI64

type EUI64 [8]byte

EUI64 is used for AppEUIs and DevEUIs.

func ParseEUI64

func ParseEUI64(input string) (eui EUI64, err error)

ParseEUI64 parses a 64-bit hex-encoded string to an EUI64.

func (EUI64) Bytes

func (eui EUI64) Bytes() []byte

Bytes returns the EUI64 as a byte slice

func (EUI64) Equal

func (eui EUI64) Equal(other EUI64) bool

Equal returns whether eui is equal to other

func (EUI64) GoString

func (eui EUI64) GoString() string

GoString implements the GoStringer interface.

func (EUI64) IsEmpty

func (eui EUI64) IsEmpty() bool

func (EUI64) Marshal

func (eui EUI64) Marshal() ([]byte, error)

Marshal implements the Marshaler interface.

func (EUI64) MarshalBinary

func (eui EUI64) MarshalBinary() ([]byte, error)

MarshalBinary implements the BinaryMarshaler interface.

func (EUI64) MarshalText

func (eui EUI64) MarshalText() ([]byte, error)

MarshalText implements the TextMarshaler interface.

func (*EUI64) MarshalTo

func (eui *EUI64) MarshalTo(b []byte) (int, error)

MarshalTo is used by Protobuf

func (*EUI64) Size

func (eui *EUI64) Size() int

Size is used by Protobuf

func (EUI64) String

func (eui EUI64) String() string

func (*EUI64) Unmarshal

func (eui *EUI64) Unmarshal(data []byte) error

Unmarshal implements the Unmarshaler interface.

func (*EUI64) UnmarshalBinary

func (eui *EUI64) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*EUI64) UnmarshalText

func (eui *EUI64) UnmarshalText(data []byte) error

UnmarshalText implements the TextUnmarshaler interface.

type ErrorEventData

type ErrorEventData struct {
	Error string `json:"error,omitempty"`
}

ErrorEventData is added to error events

type EventType

type EventType string

EventType represents the type of event

const (
	UplinkErrorEvent EventType = "up/errors"

	DownlinkScheduledEvent EventType = "down/scheduled"
	DownlinkSentEvent      EventType = "down/sent"
	DownlinkErrorEvent     EventType = "down/errors"
	DownlinkAckEvent       EventType = "down/acks"

	ActivationEvent      EventType = "activations"
	ActivationErrorEvent EventType = "activations/errors"

	CreateEvent EventType = "create"
	UpdateEvent EventType = "update"
	DeleteEvent EventType = "delete"
)

Event types

func (EventType) Data

func (e EventType) Data() interface{}

Data type of the event payload, returns nil if no payload

type GatewayMetadata

type GatewayMetadata struct {
	GtwID                  string   `json:"gtw_id,omitempty"`
	GtwTrusted             bool     `json:"gtw_trusted,omitempty"`
	Timestamp              uint32   `json:"timestamp,omitempty"`
	FineTimestamp          uint64   `json:"fine_timestamp,omitempty"`
	FineTimestampEncrypted []byte   `json:"fine_timestamp_encrypted,omitempty"`
	Time                   JSONTime `json:"time,omitempty"`
	Antenna                uint8    `json:"antenna,omitempty"`
	Channel                uint32   `json:"channel"`
	RSSI                   float32  `json:"rssi"`
	SNR                    float32  `json:"snr"`
	RFChain                uint32   `json:"rf_chain"`
	LocationMetadata
}

GatewayMetadata contains metadata for each gateway that received a message

type JSONTime

type JSONTime time.Time

JSONTime is a time.Time that marshals to/from RFC3339Nano format

func BuildTime

func BuildTime(unixNano int64) JSONTime

BuildTime builds a new JSONTime

func (JSONTime) MarshalText

func (t JSONTime) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface

func (*JSONTime) UnmarshalText

func (t *JSONTime) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface

type LocationMetadata

type LocationMetadata struct {
	Latitude  float32 `json:"latitude,omitempty"`
	Longitude float32 `json:"longitude,omitempty"`
	Altitude  int32   `json:"altitude,omitempty"`
	Accuracy  int32   `json:"location_accuracy,omitempty"`

	// The source can be: gps, config, registry, ip_geolocation or unknown (unknown may be left out)
	// See proto definition for more info
	Source string `json:"location_source,omitempty"`
}

LocationMetadata contains GPS coordinates

type Metadata

type Metadata struct {
	Time       JSONTime          `json:"time,omitempty,omitempty"`
	Frequency  float32           `json:"frequency,omitempty"`
	Modulation string            `json:"modulation,omitempty"`
	DataRate   string            `json:"data_rate,omitempty"`
	Bitrate    uint32            `json:"bit_rate,omitempty"`
	Airtime    time.Duration     `json:"airtime,omitempty"`
	CodingRate string            `json:"coding_rate,omitempty"`
	Gateways   []GatewayMetadata `json:"gateways,omitempty"`
	LocationMetadata
}

Metadata contains metadata of a message

type NetID

type NetID [3]byte

NetID for LoRaWAN

func NewPopulatedNetID

func NewPopulatedNetID(r Rand) (id *NetID)

NewPopulatedNetID returns random NetID

func (NetID) Bytes

func (n NetID) Bytes() []byte

Bytes returns the NetID as a byte slice

func (NetID) Equal

func (n NetID) Equal(other NetID) bool

Equal returns whether n is equal to other

func (NetID) GoString

func (n NetID) GoString() string

GoString implements the GoStringer interface.

func (NetID) IsEmpty

func (n NetID) IsEmpty() bool

func (NetID) Marshal

func (n NetID) Marshal() ([]byte, error)

Marshal implements the Marshaler interface.

func (NetID) MarshalBinary

func (n NetID) MarshalBinary() ([]byte, error)

MarshalBinary implements the BinaryMarshaler interface.

func (NetID) MarshalText

func (n NetID) MarshalText() ([]byte, error)

MarshalText implements the TextMarshaler interface.

func (*NetID) MarshalTo

func (n *NetID) MarshalTo(b []byte) (int, error)

MarshalTo is used by Protobuf

func (*NetID) Size

func (n *NetID) Size() int

Size is used by Protobuf

func (NetID) String

func (n NetID) String() string

func (*NetID) Unmarshal

func (n *NetID) Unmarshal(data []byte) error

Unmarshal implements the Unmarshaler interface.

func (*NetID) UnmarshalBinary

func (n *NetID) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*NetID) UnmarshalText

func (n *NetID) UnmarshalText(data []byte) error

UnmarshalText implements the TextUnmarshaler interface.

type NwkSKey

type NwkSKey AES128Key

NwkSKey (Network Session Key) is used for LoRaWAN MIC calculation.

func NewPopulatedNwkSKey

func NewPopulatedNwkSKey(r Rand) (key *NwkSKey)

NewPopulatedNwkSKey returns random NwkSKey

func ParseNwkSKey

func ParseNwkSKey(input string) (key NwkSKey, err error)

ParseNwkSKey parses a 64-bit hex-encoded string to an NwkSKey

func (NwkSKey) Bytes

func (key NwkSKey) Bytes() []byte

Bytes returns the NwkSKey as a byte slice

func (NwkSKey) Equal

func (key NwkSKey) Equal(other NwkSKey) bool

Equal returns whether key is equal to other

func (NwkSKey) GoString

func (key NwkSKey) GoString() string

GoString implements the GoStringer interface.

func (NwkSKey) IsEmpty

func (key NwkSKey) IsEmpty() bool

func (NwkSKey) Marshal

func (key NwkSKey) Marshal() ([]byte, error)

Marshal implements the Marshaler interface.

func (NwkSKey) MarshalBinary

func (key NwkSKey) MarshalBinary() ([]byte, error)

MarshalBinary implements the BinaryMarshaler interface.

func (NwkSKey) MarshalText

func (key NwkSKey) MarshalText() ([]byte, error)

MarshalText implements the TextMarshaler interface.

func (*NwkSKey) MarshalTo

func (key *NwkSKey) MarshalTo(b []byte) (int, error)

MarshalTo is used by Protobuf

func (*NwkSKey) Size

func (key *NwkSKey) Size() int

Size is used by Protobuf

func (NwkSKey) String

func (key NwkSKey) String() string

String implements the Stringer interface.

func (*NwkSKey) Unmarshal

func (key *NwkSKey) Unmarshal(data []byte) error

Unmarshal implements the Unmarshaler interface.

func (*NwkSKey) UnmarshalBinary

func (key *NwkSKey) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*NwkSKey) UnmarshalText

func (key *NwkSKey) UnmarshalText(data []byte) error

UnmarshalText implements the TextUnmarshaler interface.

type Rand

type Rand interface {
	Int63() int64
}

A Rand is a source of random int64 numbers

type Right string

Right is the type that represents a right to do something on TTN

func (*Right) String

func (r *Right) String() string

type ScheduleType

type ScheduleType string

ScheduleType can be "replace" (default), "first", "last"

const (
	ScheduleReplace ScheduleType = "replace"
	ScheduleFirst   ScheduleType = "first"
	ScheduleLast    ScheduleType = "last"
)

ScheduleTypes

type UplinkMessage

type UplinkMessage struct {
	AppID          string                 `json:"app_id,omitempty"`
	DevID          string                 `json:"dev_id,omitempty"`
	HardwareSerial string                 `json:"hardware_serial,omitempty"`
	FPort          uint8                  `json:"port"`
	FCnt           uint32                 `json:"counter"`
	Confirmed      bool                   `json:"confirmed,omitempty"`
	IsRetry        bool                   `json:"is_retry,omitempty"`
	PayloadRaw     []byte                 `json:"payload_raw"`
	PayloadFields  map[string]interface{} `json:"payload_fields,omitempty"`
	Metadata       Metadata               `json:"metadata,omitempty"`
	Attributes     map[string]string      `json:"attributes,omitempty"`
}

UplinkMessage represents an application-layer uplink message

Jump to

Keyboard shortcuts

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