firefly

package
v0.0.0-...-fa42f3f Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationListResponse

type ApplicationListResponse struct {
	DigimondoReponse
	Applications []struct {
		CreatedAt   LocalTimeWithoutZone `json:"created_at"`  // TODO: used in doc but not in example
		InsertedAt  LocalTimeWithoutZone `json:"inserted_at"` // TODO: used in example but not in doc
		Description string               `json:"description"`
		Eui         string               `json:"eui"`
		Id          int                  `json:"id"`
		Name        string               `json:"name"`
		Sink        interface{}          `json:"sink"`
		UpdatedAt   LocalTimeWithoutZone `json:"updated_at"`
	} `json:"applications,omitempty"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(secretApiKey string) *Client

func (Client) AllPackets

func (client Client) AllPackets(params ListAllPacketsParams) (r PacketListResponse, err error)

func (Client) CreateDevice

func (client Client) CreateDevice(request DeviceCreateRequest) (r DeviceResponse, err error)

func (Client) DeleteDevice

func (client Client) DeleteDevice(eui string) (err error)

func (Client) ListDevicePackets

func (client Client) ListDevicePackets(eui string, params ListDevicePacketsParams) (r PacketListResponse, err error)

func (Client) ListEUIsOfApplicationDevices

func (client Client) ListEUIsOfApplicationDevices(applicationId int) (r DevicesEuiListResponse, err error)

func (Client) ListEUIsOfDeviceClassDevices

func (client Client) ListEUIsOfDeviceClassDevices(deviceClassId int) (r DevicesEuiListResponse, err error)

func (Client) SendPacketToDevice

func (client Client) SendPacketToDevice(eui string, request SendPacketRequest) (r SendPacketResponse, err error)

func (*Client) SetDebugLog

func (client *Client) SetDebugLog(val bool)

func (Client) ShowAllDevices

func (client Client) ShowAllDevices() (r DeviceListResponse, err error)

func (Client) ShowApplications

func (client Client) ShowApplications() (r ApplicationListResponse, err error)

func (Client) ShowDeviceByAddress

func (client Client) ShowDeviceByAddress(address string) (r DeviceResponse, err error)

func (Client) ShowDeviceByEui

func (client Client) ShowDeviceByEui(eui string) (r DeviceResponse, err error)

func (Client) ShowDeviceClasses

func (client Client) ShowDeviceClasses() (r DeviceClassesListResponse, err error)

func (Client) ShowSingleDeviceClass

func (client Client) ShowSingleDeviceClass(deviceClassId int) (r DeviceClassResponse, err error)

func (Client) UpdateDevice

func (client Client) UpdateDevice(eui string, request DeviceUpdateRequest) (r DeviceResponse, err error)

func (Client) Url

func (client Client) Url() (u *url.URL)

type CreateDeviceRequest

type CreateDeviceRequest struct {
	Organization int `json:"organization"`
	Application  int `json:"application"`
	Device       struct {
		Otaa        bool   `json:"otaa"`
		Eui         string `json:"eui"`
		Description string `json:"description"`
		Address     string `json:"address"`
		Tags        string `json:"tags"`
	} `json:"device"`
}

type Device

type Device struct {
	Address               string               `json:"address"`
	ApplicationKey        string               `json:"application_key"`
	ApplicationSessionKey string               `json:"application_session_key"`
	Description           string               `json:"description"`
	Eui                   string               `json:"eui"`
	NetworkSessionKey     string               `json:"network_session_key"`
	Otaa                  bool                 `json:"otaa"`
	Tags                  []string             `json:"tags"`
	CreatedAt             LocalTimeWithoutZone `json:"created_at"`
	DeviceClassId         int                  `json:"device_class_id"`
	UpdatedAt             LocalTimeWithoutZone `json:"updated_at"`
}

type DeviceCalculateElement

type DeviceCalculateElement struct {
	Target  string `json:"target"`
	Formula string `json:"formula"`
}

type DeviceClass

type DeviceClass struct {
	Description string               `json:"description"`
	Id          int                  `json:"id"`
	InsertedAt  LocalTimeWithoutZone `json:"inserted_at"`
	Name        string               `json:"name"`
	Script      struct {
		Variables         DeviceVariables          `json:"variables"`
		ParseElements     []DeviceParseElement     `json:"parseElements"`
		CalculateElements []DeviceCalculateElement `json:"calculateElements"`
	} `json:"script"`
	UpdatedAt LocalTimeWithoutZone `json:"updated_at"`
}

type DeviceClassResponse

type DeviceClassResponse struct {
	DigimondoReponse
	DeviceClasses DeviceClass `json:"device_classes,omitempty"` // TODO: typo in doc of really 'device_classes'?
}

type DeviceClassesListResponse

type DeviceClassesListResponse struct {
	DigimondoReponse
	DeviceClasses []DeviceClass `json:"device_classes,omitempty"`
}

type DeviceCreate

type DeviceCreate struct {
	Address               string   `json:"address"`
	ApplicationKey        string   `json:"application_key"`
	ApplicationSessionKey string   `json:"application_session_key"`
	Description           string   `json:"description"`
	Eui                   string   `json:"eui"`
	NetworkSessionKey     string   `json:"network_session_key"`
	Otaa                  bool     `json:"otaa"`
	Tags                  []string `json:"tags"` // TODO: valid? comma separated list in example.
}

type DeviceCreateRequest

type DeviceCreateRequest struct {
	Organization int          `json:"organization"`
	Application  int          `json:"application"`
	Device       DeviceCreate `json:"device"`
}

type DeviceListResponse

type DeviceListResponse struct {
	DigimondoReponse
	Devices []Device `json:"devices,omitempty"`
}

type DeviceParseElement

type DeviceParseElement struct {
	Type   string `json:"type"`
	Target string `json:"target"`
	Bits   string `json:"bits"`
	Signed bool   `json:"signed,omitempty"`
}

type DeviceResponse

type DeviceResponse struct {
	DigimondoReponse
	Device Device `json:"device,omitempty"`
}

type DeviceUpdate

type DeviceUpdate struct {
	Address               string   `json:"address,omitempty"`
	ApplicationKey        string   `json:"application_key,omitempty"`
	ApplicationSessionKey string   `json:"application_session_key,omitempty"`
	Description           string   `json:"description,omitempty"`
	Eui                   string   `json:"eui,omitempty"`
	NetworkSessionKey     string   `json:"network_session_key,omitempty"`
	Otaa                  bool     `json:"otaa,omitempty"`
	Tags                  []string `json:"tags,omitempty"` // TODO: valid?
}

type DeviceUpdateRequest

type DeviceUpdateRequest struct {
	Device DeviceUpdate `json:"device"`
}

type DeviceVariable

type DeviceVariable struct {
	Type string `json:"type"`
	Name string `json:"name"`
}

type DeviceVariables

type DeviceVariables struct {
	Gps          DeviceVariable `json:"gps"`
	BatteryLevel DeviceVariable `json:"batteryLevel"`
	Battery      DeviceVariable `json:"battery"`
}

type DevicesEuiListResponse

type DevicesEuiListResponse struct {
	DigimondoReponse
	Devices []struct {
		Address string `json:"address"`
		Eui     string `json:"eui"`
		Id      string `json:"eui,omitempty"` // Used by "List EUIs of Devices" in device classes but not application
	} `json:"devices,omitempty"`
}

type DigimondoReponse

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

type Gwrx

type Gwrx struct {
	Gweui string    `json:"gweui"`
	Lsnr  float64   `json:"lsnr"`
	Rssi  int       `json:"rssi"`
	Time  time.Time `json:"time"`
	Tmst  int64     `json:"tmst"`
}

type ListAllPacketsParams

type ListAllPacketsParams struct {
	// (optional) when set to asc, it will return the oldest Packets first. When set to desc, it will return the most recent packets. Default is desc.
	Direction string
	// (optional) the amount Packets to be returned. Ordered by creation date, descending (unless otherwise specified through the direction parameter). Default value is 1 Maximum value is 100.
	LimitToLast int
	// (optional) the amount of most recent Packets to skip before returning Packets. Default value is 0.
	Offset int
	// (optional) only return the Payload, Timestamp and Device Address of the Packet. Default is false. Any other value will set this parameter to true.
	PayloadOnly bool
	// (optional) only return packets after this date. If this parameter is used and no limit_to_last value is supplied, limit_to_last will be set to 10. Default is the Unix Epoch Timestamp (meaning that no Packets will be omitted). Specify an ISO 8601 Date String here.
	ReceivedAfter *time.Time
	// 	(optional) do NOT show Packets from Devices that are not directly in the Organization that the API Key is registered for.
	SkipSuborgs bool
}

func ListAllPacketsParamsFromQuery

func ListAllPacketsParamsFromQuery(q url.Values) ListAllPacketsParams

type ListDevicePacketsParams

type ListDevicePacketsParams struct {
	// (optional) when set to asc, it will return the oldest Packets first. When set to desc, it will return the most recent packets. Default is desc.
	Direction string
	// (optional) the amount Packets to be returned. Ordered by creation date, descending (unless otherwise specified through the direction parameter). Default value is 1 Maximum value is 100.
	LimitToLast int
	// (optional) the amount of most recent Packets to skip before returning Packets. Default value is 0.
	Offset int
	// (optional) only return the Payload, the parsed Payload (where applicable), the Timestamp and the Device Address of the Packet. Default is false. Any other value will set this parameter to true.
	PayloadOnly bool
	// (optional) only return packets after this date. If this parameter is used and no limit_to_last value is supplied, limit_to_last will be set to 10. Default is the Unix Epoch Timestamp (meaning that no Packets will be omitted). Specify an ISO 8601 Date String here.
	ReceivedAfter *time.Time
}

func ListDevicePacketsParamsFromQuery

func ListDevicePacketsParamsFromQuery(q url.Values) ListDevicePacketsParams

type LocalTimeWithoutZone

type LocalTimeWithoutZone struct {
	time.Time
}

func (*LocalTimeWithoutZone) MarshalJSON

func (t *LocalTimeWithoutZone) MarshalJSON() ([]byte, error)

func (*LocalTimeWithoutZone) UnmarshalJSON

func (t *LocalTimeWithoutZone) UnmarshalJSON(data []byte) (err error)

func (*LocalTimeWithoutZone) UnmarshalJSONXX

func (t *LocalTimeWithoutZone) UnmarshalJSONXX(data []byte) error

type Packet

type Packet struct {
	Ack              bool                 `json:"ack"`
	Bandwidth        int                  `json:"bandwidth"`
	Codr             string               `json:"codr"`
	Datr             string               `json:"datr"` // TODO: type? Not specified in docu
	DeviceEui        string               `json:"device_eui"`
	Fopts            string               `json:"fopts"`
	Fcnt             int                  `json:"fcnt"`
	Freq             float64              `json:"freq"`
	Gwrx             []Gwrx               `json:"gwrx,omitempty"`
	Modu             string               `json:"modu"`
	Mtype            string               `json:"mtype"`
	Parsed           interface{}          `json:"parsed"`
	Payload          string               `json:"payload"`
	PayloadEncrypted bool                 `json:"payload_encrypted"`
	Port             int                  `json:"port"`
	ReceivedAt       LocalTimeWithoutZone `json:"received_at"`
	Size             int                  `json:"size"`
	SpreadingFactor  int                  `json:"spreading_factor"`
}

type PacketListResponse

type PacketListResponse struct {
	DigimondoReponse
	Packets []Packet `json:"packets"`
}

type SendPacketRequest

type SendPacketRequest struct {
	Payload  string `json:"payload"`
	Encoding string `json:"encoding"`
	Port     int    `json:"port"`
}

type SendPacketResponse

type SendPacketResponse struct {
	DigimondoReponse
	SentPacket struct {
		Fcnt    int    `json:"fcnt"`
		Id      int    `json:"id"`
		Payload string `json:"payload"`
		Port    int    `json:"port"`
	} `json:"sent_packet,omitempty"`
}

type UpdateDeviceRequest

type UpdateDeviceRequest struct {
	Device struct {
		Description string `json:"description"`
	} `json:"device"`
}

Jump to

Keyboard shortcuts

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