ttn: github.com/TheThingsNetwork/ttn/core/types Index | Files

package types

import "github.com/TheThingsNetwork/ttn/core/types"

Index

Package Files

access_keys.go activation.go data_rate.go dev_addr.go downlink_message.go eui.go event.go gateway_metadata.go json_time.go keys.go location_metadata.go metadata.go parse_hex.go random.go uplink_message.go

func ParseHEX Uses

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

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

type AES128Key Uses

type AES128Key [16]byte

AES128Key is an 128 bit AES key.

func ParseAES128Key Uses

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

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

func (AES128Key) Bytes Uses

func (key AES128Key) Bytes() []byte

Bytes returns the AES128Key as a byte slice

func (AES128Key) Equal Uses

func (key AES128Key) Equal(other AES128Key) bool

Equal returns whether key is equal to other

func (AES128Key) GoString Uses

func (key AES128Key) GoString() string

GoString implements the GoStringer interface.

func (AES128Key) IsEmpty Uses

func (key AES128Key) IsEmpty() bool

func (AES128Key) Marshal Uses

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

Marshal implements the Marshaler interface.

func (AES128Key) MarshalBinary Uses

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

MarshalBinary implements the BinaryMarshaler interface.

func (AES128Key) MarshalText Uses

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

MarshalText implements the TextMarshaler interface.

func (*AES128Key) MarshalTo Uses

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

MarshalTo is used by Protobuf

func (*AES128Key) Size Uses

func (key *AES128Key) Size() int

Size is used by Protobuf

func (AES128Key) String Uses

func (key AES128Key) String() string

String implements the Stringer interface.

func (*AES128Key) Unmarshal Uses

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

Unmarshal implements the Unmarshaler interface.

func (*AES128Key) UnmarshalBinary Uses

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

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*AES128Key) UnmarshalText Uses

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

UnmarshalText implements the TextUnmarshaler interface.

type AccessKey Uses

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 Uses

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

HasRight checks if an AccessKey has a certain right

type Activation Uses

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 Uses

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 Uses

type AppEUI EUI64

AppEUI is a unique identifier for applications.

func NewPopulatedAppEUI Uses

func NewPopulatedAppEUI(r Rand) (appEUI *AppEUI)

NewPopulatedAppEUI returns random AppEUI

func ParseAppEUI Uses

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

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

func (AppEUI) Bytes Uses

func (eui AppEUI) Bytes() []byte

Bytes returns the AppEUI as a byte slice

func (AppEUI) Equal Uses

func (eui AppEUI) Equal(other AppEUI) bool

Equal returns whether eui is equal to other

func (AppEUI) GoString Uses

func (eui AppEUI) GoString() string

GoString implements the GoStringer interface.

func (AppEUI) IsEmpty Uses

func (eui AppEUI) IsEmpty() bool

func (AppEUI) Marshal Uses

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

Marshal implements the Marshaler interface.

func (AppEUI) MarshalBinary Uses

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

MarshalBinary implements the BinaryMarshaler interface.

func (AppEUI) MarshalText Uses

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

MarshalText implements the TextMarshaler interface.

func (*AppEUI) MarshalTo Uses

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

MarshalTo is used by Protobuf

func (*AppEUI) Size Uses

func (eui *AppEUI) Size() int

Size is used by Protobuf

func (AppEUI) String Uses

func (eui AppEUI) String() string

String implements the Stringer interface.

func (*AppEUI) Unmarshal Uses

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

Unmarshal implements the Unmarshaler interface.

func (*AppEUI) UnmarshalBinary Uses

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

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*AppEUI) UnmarshalText Uses

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

UnmarshalText implements the TextUnmarshaler interface.

type AppKey Uses

type AppKey AES128Key

AppKey (Application Key) is used for LoRaWAN OTAA.

func NewPopulatedAppKey Uses

func NewPopulatedAppKey(r Rand) (key *AppKey)

NewPopulatedAppKey returns random AppKey

func ParseAppKey Uses

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

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

func (AppKey) Bytes Uses

func (key AppKey) Bytes() []byte

Bytes returns the AppKey as a byte slice

func (AppKey) Equal Uses

func (key AppKey) Equal(other AppKey) bool

Equal returns whether key is equal to other

func (AppKey) GoString Uses

func (key AppKey) GoString() string

GoString implements the GoStringer interface.

func (AppKey) IsEmpty Uses

func (key AppKey) IsEmpty() bool

func (AppKey) Marshal Uses

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

Marshal implements the Marshaler interface.

func (AppKey) MarshalBinary Uses

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

MarshalBinary implements the BinaryMarshaler interface.

func (AppKey) MarshalText Uses

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

MarshalText implements the TextMarshaler interface.

func (*AppKey) MarshalTo Uses

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

MarshalTo is used by Protobuf

func (*AppKey) Size Uses

func (key *AppKey) Size() int

Size is used by Protobuf

func (AppKey) String Uses

func (key AppKey) String() string

func (*AppKey) Unmarshal Uses

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

Unmarshal implements the Unmarshaler interface.

func (*AppKey) UnmarshalBinary Uses

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

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*AppKey) UnmarshalText Uses

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

UnmarshalText implements the TextUnmarshaler interface.

type AppNonce Uses

type AppNonce [3]byte

AppNonce for LoRaWAN

func NewPopulatedAppNonce Uses

func NewPopulatedAppNonce(r Rand) (nonce *AppNonce)

NewPopulatedAppNonce returns random AppNonce

func (AppNonce) Bytes Uses

func (n AppNonce) Bytes() []byte

Bytes returns the AppNonce as a byte slice

func (AppNonce) Equal Uses

func (n AppNonce) Equal(other AppNonce) bool

Equal returns whether n is equal to other

func (AppNonce) GoString Uses

func (n AppNonce) GoString() string

GoString implements the GoStringer interface.

func (AppNonce) Marshal Uses

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

Marshal implements the Marshaler interface.

func (AppNonce) MarshalBinary Uses

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

MarshalBinary implements the BinaryMarshaler interface.

func (AppNonce) MarshalText Uses

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

MarshalText implements the TextMarshaler interface.

func (*AppNonce) MarshalTo Uses

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

MarshalTo is used by Protobuf

func (*AppNonce) Size Uses

func (n *AppNonce) Size() int

Size is used by Protobuf

func (AppNonce) String Uses

func (n AppNonce) String() string

func (*AppNonce) Unmarshal Uses

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

Unmarshal implements the Unmarshaler interface.

func (*AppNonce) UnmarshalBinary Uses

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

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*AppNonce) UnmarshalText Uses

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

UnmarshalText implements the TextUnmarshaler interface.

type AppSKey Uses

type AppSKey AES128Key

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

func NewPopulatedAppSKey Uses

func NewPopulatedAppSKey(r Rand) (key *AppSKey)

NewPopulatedAppSKey returns random AppSKey

func ParseAppSKey Uses

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

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

func (AppSKey) Bytes Uses

func (key AppSKey) Bytes() []byte

Bytes returns the AppSKey as a byte slice

func (AppSKey) Equal Uses

func (key AppSKey) Equal(other AppSKey) bool

Equal returns whether key is equal to other

func (AppSKey) GoString Uses

func (key AppSKey) GoString() string

GoString implements the GoStringer interface.

func (AppSKey) IsEmpty Uses

func (key AppSKey) IsEmpty() bool

func (AppSKey) Marshal Uses

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

Marshal implements the Marshaler interface.

func (AppSKey) MarshalBinary Uses

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

MarshalBinary implements the BinaryMarshaler interface.

func (AppSKey) MarshalText Uses

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

MarshalText implements the TextMarshaler interface.

func (*AppSKey) MarshalTo Uses

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

MarshalTo is used by Protobuf

func (*AppSKey) Size Uses

func (key *AppSKey) Size() int

Size is used by Protobuf

func (AppSKey) String Uses

func (key AppSKey) String() string

func (*AppSKey) Unmarshal Uses

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

Unmarshal implements the Unmarshaler interface.

func (*AppSKey) UnmarshalBinary Uses

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

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*AppSKey) UnmarshalText Uses

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

UnmarshalText implements the TextUnmarshaler interface.

type DataRate Uses

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

func ConvertDataRate Uses

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

func ParseDataRate Uses

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

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

func (DataRate) Bytes Uses

func (datr DataRate) Bytes() []byte

Bytes returns the DataRate as a byte slice

func (DataRate) GoString Uses

func (datr DataRate) GoString() string

GoString implements the GoStringer interface.

func (DataRate) Marshal Uses

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

Marshal implements the Marshaler interface.

func (DataRate) MarshalBinary Uses

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

MarshalBinary implements the BinaryMarshaler interface.

func (DataRate) MarshalText Uses

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

MarshalText implements the TextMarshaler interface.

func (DataRate) MarshalTo Uses

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

MarshalTo is used by Protobuf

func (DataRate) Size Uses

func (datr DataRate) Size() int

Size is used by Protobuf

func (DataRate) String Uses

func (datr DataRate) String() string

String implements the Stringer interface.

func (*DataRate) Unmarshal Uses

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

Unmarshal implements the Unmarshaler interface.

func (*DataRate) UnmarshalBinary Uses

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

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*DataRate) UnmarshalText Uses

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

UnmarshalText implements the TextUnmarshaler interface.

type DevAddr Uses

type DevAddr [4]byte

DevAddr is a non-unique address for LoRaWAN devices.

func NewPopulatedDevAddr Uses

func NewPopulatedDevAddr(r Rand) (devAddr *DevAddr)

NewPopulatedDevAddr returns random DevAddr

func ParseDevAddr Uses

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

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

func (DevAddr) Bytes Uses

func (addr DevAddr) Bytes() []byte

Bytes returns the DevAddr as a byte slice

func (DevAddr) Equal Uses

func (addr DevAddr) Equal(other DevAddr) bool

Equal returns whether addr is equal to other

func (DevAddr) GoString Uses

func (addr DevAddr) GoString() string

GoString implements the GoStringer interface.

func (DevAddr) HasPrefix Uses

func (addr DevAddr) HasPrefix(prefix DevAddrPrefix) bool

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

func (DevAddr) IsEmpty Uses

func (addr DevAddr) IsEmpty() bool

func (DevAddr) Marshal Uses

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

Marshal implements the Marshaler interface.

func (DevAddr) MarshalBinary Uses

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

MarshalBinary implements the BinaryMarshaler interface.

func (DevAddr) MarshalText Uses

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

MarshalText implements the TextMarshaler interface.

func (DevAddr) MarshalTo Uses

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

MarshalTo is used by Protobuf

func (DevAddr) Mask Uses

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

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

func (DevAddr) Size Uses

func (addr DevAddr) Size() int

Size is used by Protobuf

func (DevAddr) String Uses

func (addr DevAddr) String() string

String implements the Stringer interface.

func (*DevAddr) Unmarshal Uses

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

Unmarshal implements the Unmarshaler interface.

func (*DevAddr) UnmarshalBinary Uses

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

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*DevAddr) UnmarshalText Uses

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

UnmarshalText implements the TextUnmarshaler interface.

func (DevAddr) WithPrefix Uses

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

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

type DevAddrPrefix Uses

type DevAddrPrefix struct {
    DevAddr DevAddr
    Length  int
}

DevAddrPrefix is a DevAddr with a prefix length

func ParseDevAddrPrefix Uses

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

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

func (DevAddrPrefix) Bytes Uses

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

Bytes returns the DevAddrPrefix as a byte slice

func (DevAddrPrefix) Marshal Uses

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

Marshal implements the Marshaler interface.

func (DevAddrPrefix) MarshalBinary Uses

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

MarshalBinary implements the BinaryMarshaler interface.

func (DevAddrPrefix) MarshalText Uses

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

MarshalText implements the TextMarshaler interface.

func (DevAddrPrefix) MarshalTo Uses

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

MarshalTo is used by Protobuf

func (DevAddrPrefix) Size Uses

func (prefix DevAddrPrefix) Size() int

Size is used by Protobuf

func (DevAddrPrefix) String Uses

func (prefix DevAddrPrefix) String() string

String implements the fmt.Stringer interface

func (*DevAddrPrefix) Unmarshal Uses

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

Unmarshal implements the Unmarshaler interface.

func (*DevAddrPrefix) UnmarshalBinary Uses

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

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*DevAddrPrefix) UnmarshalText Uses

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

UnmarshalText implements the TextUnmarshaler interface.

type DevEUI Uses

type DevEUI EUI64

DevEUI is a unique identifier for devices.

func NewPopulatedDevEUI Uses

func NewPopulatedDevEUI(r Rand) (devEUI *DevEUI)

NewPopulatedDevEUI returns random DevEUI

func ParseDevEUI Uses

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

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

func (DevEUI) Bytes Uses

func (eui DevEUI) Bytes() []byte

Bytes returns the DevEUI as a byte slice

func (DevEUI) Equal Uses

func (eui DevEUI) Equal(other DevEUI) bool

Equal returns whether eui is equal to other

func (DevEUI) GoString Uses

func (eui DevEUI) GoString() string

GoString implements the GoStringer interface.

func (DevEUI) IsEmpty Uses

func (eui DevEUI) IsEmpty() bool

func (DevEUI) Marshal Uses

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

Marshal implements the Marshaler interface.

func (DevEUI) MarshalBinary Uses

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

MarshalBinary implements the BinaryMarshaler interface.

func (DevEUI) MarshalText Uses

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

MarshalText implements the TextMarshaler interface.

func (*DevEUI) MarshalTo Uses

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

MarshalTo is used by Protobuf

func (*DevEUI) Size Uses

func (eui *DevEUI) Size() int

Size is used by Protobuf

func (DevEUI) String Uses

func (eui DevEUI) String() string

String implements the Stringer interface.

func (*DevEUI) Unmarshal Uses

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

Unmarshal implements the Unmarshaler interface.

func (*DevEUI) UnmarshalBinary Uses

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

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*DevEUI) UnmarshalText Uses

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

UnmarshalText implements the TextUnmarshaler interface.

type DevNonce Uses

type DevNonce [2]byte

DevNonce for LoRaWAN

func NewPopulatedDevNonce Uses

func NewPopulatedDevNonce(r Rand) (nonce *DevNonce)

NewPopulatedDevNonce returns random DevNonce

func (DevNonce) Bytes Uses

func (n DevNonce) Bytes() []byte

Bytes returns the DevNonce as a byte slice

func (DevNonce) Equal Uses

func (n DevNonce) Equal(other DevNonce) bool

Equal returns whether n is equal to other

func (DevNonce) GoString Uses

func (n DevNonce) GoString() string

GoString implements the GoStringer interface.

func (DevNonce) Marshal Uses

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

Marshal implements the Marshaler interface.

func (DevNonce) MarshalBinary Uses

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

MarshalBinary implements the BinaryMarshaler interface.

func (DevNonce) MarshalText Uses

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

MarshalText implements the TextMarshaler interface.

func (*DevNonce) MarshalTo Uses

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

MarshalTo is used by Protobuf

func (*DevNonce) Size Uses

func (n *DevNonce) Size() int

Size is used by Protobuf

func (DevNonce) String Uses

func (n DevNonce) String() string

func (*DevNonce) Unmarshal Uses

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

Unmarshal implements the Unmarshaler interface.

func (*DevNonce) UnmarshalBinary Uses

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

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*DevNonce) UnmarshalText Uses

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

UnmarshalText implements the TextUnmarshaler interface.

type DeviceEvent Uses

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

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

type DeviceEventData Uses

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 Uses

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 Uses

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 Uses

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 Uses

type EUI64 [8]byte

EUI64 is used for AppEUIs and DevEUIs.

func ParseEUI64 Uses

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

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

func (EUI64) Bytes Uses

func (eui EUI64) Bytes() []byte

Bytes returns the EUI64 as a byte slice

func (EUI64) Equal Uses

func (eui EUI64) Equal(other EUI64) bool

Equal returns whether eui is equal to other

func (EUI64) GoString Uses

func (eui EUI64) GoString() string

GoString implements the GoStringer interface.

func (EUI64) IsEmpty Uses

func (eui EUI64) IsEmpty() bool

func (EUI64) Marshal Uses

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

Marshal implements the Marshaler interface.

func (EUI64) MarshalBinary Uses

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

MarshalBinary implements the BinaryMarshaler interface.

func (EUI64) MarshalText Uses

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

MarshalText implements the TextMarshaler interface.

func (*EUI64) MarshalTo Uses

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

MarshalTo is used by Protobuf

func (*EUI64) Size Uses

func (eui *EUI64) Size() int

Size is used by Protobuf

func (EUI64) String Uses

func (eui EUI64) String() string

func (*EUI64) Unmarshal Uses

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

Unmarshal implements the Unmarshaler interface.

func (*EUI64) UnmarshalBinary Uses

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

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*EUI64) UnmarshalText Uses

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

UnmarshalText implements the TextUnmarshaler interface.

type ErrorEventData Uses

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

ErrorEventData is added to error events

type EventType Uses

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 Uses

func (e EventType) Data() interface{}

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

type GatewayMetadata Uses

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 Uses

type JSONTime time.Time

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

func BuildTime Uses

func BuildTime(unixNano int64) JSONTime

BuildTime builds a new JSONTime

func (JSONTime) MarshalText Uses

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

MarshalText implements the encoding.TextMarshaler interface

func (*JSONTime) UnmarshalText Uses

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

UnmarshalText implements the encoding.TextUnmarshaler interface

type LocationMetadata Uses

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 Uses

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 Uses

type NetID [3]byte

NetID for LoRaWAN

func NewPopulatedNetID Uses

func NewPopulatedNetID(r Rand) (id *NetID)

NewPopulatedNetID returns random NetID

func (NetID) Bytes Uses

func (n NetID) Bytes() []byte

Bytes returns the NetID as a byte slice

func (NetID) Equal Uses

func (n NetID) Equal(other NetID) bool

Equal returns whether n is equal to other

func (NetID) GoString Uses

func (n NetID) GoString() string

GoString implements the GoStringer interface.

func (NetID) IsEmpty Uses

func (n NetID) IsEmpty() bool

func (NetID) Marshal Uses

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

Marshal implements the Marshaler interface.

func (NetID) MarshalBinary Uses

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

MarshalBinary implements the BinaryMarshaler interface.

func (NetID) MarshalText Uses

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

MarshalText implements the TextMarshaler interface.

func (*NetID) MarshalTo Uses

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

MarshalTo is used by Protobuf

func (*NetID) Size Uses

func (n *NetID) Size() int

Size is used by Protobuf

func (NetID) String Uses

func (n NetID) String() string

func (*NetID) Unmarshal Uses

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

Unmarshal implements the Unmarshaler interface.

func (*NetID) UnmarshalBinary Uses

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

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*NetID) UnmarshalText Uses

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

UnmarshalText implements the TextUnmarshaler interface.

type NwkSKey Uses

type NwkSKey AES128Key

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

func NewPopulatedNwkSKey Uses

func NewPopulatedNwkSKey(r Rand) (key *NwkSKey)

NewPopulatedNwkSKey returns random NwkSKey

func ParseNwkSKey Uses

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

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

func (NwkSKey) Bytes Uses

func (key NwkSKey) Bytes() []byte

Bytes returns the NwkSKey as a byte slice

func (NwkSKey) Equal Uses

func (key NwkSKey) Equal(other NwkSKey) bool

Equal returns whether key is equal to other

func (NwkSKey) GoString Uses

func (key NwkSKey) GoString() string

GoString implements the GoStringer interface.

func (NwkSKey) IsEmpty Uses

func (key NwkSKey) IsEmpty() bool

func (NwkSKey) Marshal Uses

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

Marshal implements the Marshaler interface.

func (NwkSKey) MarshalBinary Uses

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

MarshalBinary implements the BinaryMarshaler interface.

func (NwkSKey) MarshalText Uses

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

MarshalText implements the TextMarshaler interface.

func (*NwkSKey) MarshalTo Uses

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

MarshalTo is used by Protobuf

func (*NwkSKey) Size Uses

func (key *NwkSKey) Size() int

Size is used by Protobuf

func (NwkSKey) String Uses

func (key NwkSKey) String() string

String implements the Stringer interface.

func (*NwkSKey) Unmarshal Uses

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

Unmarshal implements the Unmarshaler interface.

func (*NwkSKey) UnmarshalBinary Uses

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

UnmarshalBinary implements the BinaryUnmarshaler interface.

func (*NwkSKey) UnmarshalText Uses

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

UnmarshalText implements the TextUnmarshaler interface.

type Rand Uses

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 Uses

func (r *Right) String() string

type ScheduleType Uses

type ScheduleType string

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

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

ScheduleTypes

type UplinkMessage Uses

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

Package types imports 9 packages (graph) and is imported by 66 packages. Updated 2019-05-23. Refresh now. Tools for package owners.