api

package
v0.0.0-...-60b8695 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Algorithm_TDOA     = "Tdoa"
	Algorithm_RSSI     = "Rssi"
	Algorithm_RSSITDOA = "RssiTdoaCombined"
)

Variables

View Source
var (
	DefaultServerURL *url.URL
)

Functions

This section is empty.

Types

type Client

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

Client is an API client for the LoRa Cloud Device Management v1 service.

func New

func New(cl *http.Client, opts ...Option) (*Client, error)

New creates a new Client with the given options.

func (*Client) Do

func (c *Client) Do(ctx context.Context, method, category, operation string, body io.Reader) (*http.Response, error)

Do executes a new HTTP request with the given parameters and body and returns the response.

func (*Client) SolveSingleFrame

func (c *Client) SolveSingleFrame(ctx context.Context, request *SingleFrameRequest) (*ExtendedSingleFrameResponse, error)

SolveSingleFrame attempts to solve the location of the end-device using the provided request.

type ExtendedSingleFrameResponse

type ExtendedSingleFrameResponse struct {
	SingleFrameResponse

	Raw *json.RawMessage
}

ExtendedSingleFrameResponse extends SingleFrameResponse with the raw JSON representation.

func (ExtendedSingleFrameResponse) MarshalJSON

func (r ExtendedSingleFrameResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. Note that the Raw representation takes precedence in the marshaling process, if it is available.

func (*ExtendedSingleFrameResponse) UnmarshalJSON

func (r *ExtendedSingleFrameResponse) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Marshaler.

type Frame

type Frame []Uplink

Frame contains the uplink metadata for each reception. https://www.loracloud.com/documentation/geolocation?url=v3.html#frame

type Gateway

type Gateway struct {
	GatewayID string  `json:"gatewayId"`
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
	Altitude  float64 `json:"altitude"`
}

Gateway contains the description of a LoRaWAN gateway. https://www.loracloud.com/documentation/geolocation?url=v3.html#gateway

type Location

type Location struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
	Tolerance uint64  `json:"toleranceHoriz"`
}

Location contains the coordinates contained in a location query result.

type LocationSolverResult

type LocationSolverResult struct {
	UsedGateways uint8    `json:"numUsedGateways"`
	HDOP         *float64 `json:"HDOP"`
	Algorithm    string   `json:"algorithmType"`
	Location     Location `json:"locationEst"`
}

LocationSolverResult contains the result of a location query. https://www.loracloud.com/documentation/geolocation?url=v3.html#locationsolverresult

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option is an option for the API client.

func WithBaseURL

func WithBaseURL(baseURL *url.URL) Option

WithBaseURL uses the given base URL for the requests of the client.

func WithToken

func WithToken(token string) Option

WithToken uses the given authentication token in the client.

type OptionFunc

type OptionFunc func(*Client)

OptionFunc is an Option implemented as a function.

type SingleFrameRequest

type SingleFrameRequest struct {
	Gateways []Gateway `json:"gateways"`
	Frame    Frame     `json:"frame"`
}

SingleFrameRequest contains the location query request for a single LoRaWAN frame. https://www.loracloud.com/documentation/geolocation?url=v3.html#singleframe-http-request

func BuildSingleFrameRequest

func BuildSingleFrameRequest(metadata []*ttnpb.RxMetadata) *SingleFrameRequest

BuildSingelFrameRequest builds a SingleFrameRequest from the provided metadata.

type SingleFrameResponse

type SingleFrameResponse struct {
	Result   *LocationSolverResult `json:"result"`
	Errors   []string              `json:"errors"`
	Warnings []string              `json:"warnings"`
}

SingleFrameResponse contains the location query response for a single LoRaWAN frame. https://www.loracloud.com/documentation/geolocation?url=v3.html#singleframe-http-request

type Uplink struct {
	GatewayID string
	AntennaID *uint32
	TDOA      *uint64
	RSSI      float64
	SNR       float64
}

Uplink contains the metadata of a LoRaWAN uplink. https://www.loracloud.com/documentation/geolocation?url=v3.html#uplink

func (*Uplink) MarshalJSON

func (u *Uplink) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Uplink) UnmarshalJSON

func (u *Uplink) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

Jump to

Keyboard shortcuts

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