client

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*Config
	*http.Client
	// contains filtered or unexported fields
}

Client is a Firefly client.

func (*Client) GetAllDevices

func (c *Client) GetAllDevices() ([]Device, error)

GetAllDevices gets all devices that the API key has access to.

func (*Client) GetDeviceByEUI

func (c *Client) GetDeviceByEUI(eui string) (*Device, error)

GetDeviceByEUI gets a device by the EUI.

func (*Client) GetLastPacket

func (c *Client) GetLastPacket(eui string) (*Packet, error)

GetLastPacket gets the last packet for a device.

func (*Client) UpdateDeviceByEUI

func (c *Client) UpdateDeviceByEUI(eui string, dev Device) error

UpdateDevice updates the device.

type Config

type Config struct {
	APIKey     string
	Host       string
	CACertPath string
	UseHTTP    bool
}

Config is the Firefly client configuration.

func (*Config) NewClient

func (cfg *Config) NewClient(ctx context.Context) (*Client, error)

New creates a new Firefly client.

type Device

type Device struct {
	Address               string    `json:"address,omitempty"`
	AdrLimit              int       `json:"adr_limit,omitempty"`
	ApplicationKey        string    `json:"application_key,omitempty"`
	ApplicationSessionKey string    `json:"application_session_key,omitempty"`
	ClassC                bool      `json:"class_c,omitempty"`
	Deduplicate           bool      `json:"deduplicate,omitempty"`
	Description           string    `json:"description,omitempty"`
	DeviceClassID         int       `json:"device_class_id,omitempty"`
	EUI                   string    `json:"eui,omitempty"`
	FrameCounter          int       `json:"frame_counter,omitempty"`
	InsertedAt            string    `json:"inserted_at,omitempty"`
	Location              *Location `json:"location,omitempty"`
	Name                  string    `json:"name,omitempty"`
	NetworkSessionKey     string    `json:"network_session_key,omitempty"`
	OTAA                  bool      `json:"otaa,omitempty"`
	OrganizationID        int       `json:"organization_id,omitempty"`
	OverrideLocation      bool      `json:"override_location,omitempty"`
	Region                string    `json:"region,omitempty"`
	Rx2DataRate           int       `json:"rx2_data_rate,omitempty"`
	SkipFCntCheck         bool      `json:"skip_fcnt_check,omitempty"`
	Tags                  []string  `json:"tags,omitempty"`
	UpdatedAt             string    `json:"updated_at,omitempty"`
}

Device is a Firefly device.

func (Device) WithIncrementedKeys

func (d Device) WithIncrementedKeys() Device

WithIncrementedKeys returns the device with last byte of the keys incremented.

type Location

type Location struct {
	Latitude  float64 `json:"lat"`
	Longitude float64 `json:"lon"`
}

Location is the location of a device.

type Packet

type Packet struct {
	FCnt int `json:"fcnt"`
}

Packet is a LoRaWAN uplink packet.

Source Files

  • client.go
  • messages.go

Jump to

Keyboard shortcuts

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