Documentation ¶
Index ¶
- Variables
- type DownlinkFunctions
- type DownlinkProcessor
- type Handler
- type UplinkFunctions
- func (f *UplinkFunctions) Convert(fields map[string]interface{}, port uint8) (map[string]interface{}, error)
- func (f *UplinkFunctions) Decode(payload []byte, port uint8) (map[string]interface{}, error)
- func (f *UplinkFunctions) Process(payload []byte, port uint8) (map[string]interface{}, bool, error)
- func (f *UplinkFunctions) Validate(fields map[string]interface{}, port uint8) (bool, error)
- type UplinkProcessor
Constants ¶
This section is empty.
Variables ¶
var (
// AMQPDownlinkQueue is the AMQP queue to use for downlink
AMQPDownlinkQueue = "ttn-handler-downlink"
)
var ErrNotNeeded = errors.New("Further processing not needed")
ErrNotNeeded indicates that the processing of a message should be aborted
var MQTTBufferSize = 10
MQTTBufferSize indicates the size for uplink channel buffers
var MQTTTimeout = 2 * time.Second
MQTTTimeout indicates how long we should wait for an MQTT publish
var ResponseDeadline = 100 * time.Millisecond
ResponseDeadline indicates how long
Functions ¶
This section is empty.
Types ¶
type DownlinkFunctions ¶
type DownlinkFunctions struct { // Encoder is a JavaScript function that accepts the payload as JSON and // returns an array of bytes Encoder string // Logger is the logger that will be used to store logs Logger functions.Logger }
DownlinkFunctions encodes payload using JavaScript functions
type DownlinkProcessor ¶
type DownlinkProcessor func(ctx log.Interface, appDown *types.DownlinkMessage, ttnDown *pb_broker.DownlinkMessage) error
DownlinkProcessor processes an application-layer downlink message to a downlik protobuf
type Handler ¶
type Handler interface { component.Interface component.ManagementInterface WithMQTT(username, password string, brokers ...string) Handler WithAMQP(username, password, host, exchange string) Handler HandleUplink(uplink *pb_broker.DeduplicatedUplinkMessage) error HandleActivationChallenge(challenge *pb_broker.ActivationChallengeRequest) (*pb_broker.ActivationChallengeResponse, error) HandleActivation(activation *pb_broker.DeduplicatedDeviceActivationRequest) (*pb.DeviceActivationResponse, error) EnqueueDownlink(appDownlink *types.DownlinkMessage) error }
Handler component
func NewRedisHandler ¶
NewRedisHandler creates a new Redis-backed Handler
type UplinkFunctions ¶
type UplinkFunctions struct { // Decoder is a JavaScript function that accepts the payload as byte array and // returns an object containing the decoded values Decoder string // Converter is a JavaScript function that accepts the data as decoded by // Decoder and returns an object containing the converted values Converter string // Validator is a JavaScript function that validates the data is converted by // Converter and returns a boolean value indicating the validity of the data Validator string // Logger is the logger that will be used to store logs Logger functions.Logger }
UplinkFunctions decodes, converts and validates payload using JavaScript functions
func (*UplinkFunctions) Convert ¶
func (f *UplinkFunctions) Convert(fields map[string]interface{}, port uint8) (map[string]interface{}, error)
Convert converts the values in the specified map to a another map using the Converter function. If the Converter function is not set, this function returns the data as-is
func (*UplinkFunctions) Decode ¶
func (f *UplinkFunctions) Decode(payload []byte, port uint8) (map[string]interface{}, error)
Decode decodes the payload using the Decoder function into a map
type UplinkProcessor ¶
type UplinkProcessor func(ctx log.Interface, ttnUp *pb_broker.DeduplicatedUplinkMessage, appUp *types.UplinkMessage) error
UplinkProcessor processes an uplink protobuf to an application-layer uplink message