apppayload

package module
v0.0.0-...-1198ff1 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: MIT Imports: 5 Imported by: 2

README

LoRaWAN Application Payload

See pkg.go.dev for usage.

License

Source code for The Things Network is released under the MIT License, which can be found in the LICENSE file. A list of authors can be found in the AUTHORS file.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InferGNSS

func InferGNSS(m map[string]interface{}) ([]byte, bool)

InferGNSS uses a predefined set of rules in order to infer a GNSS payload from the provided map.

The following keys are checked for hexadecimal payloads: - nav

If no GNSS payload can be inferred, this function returns false.

Types

type AccessPoint

type AccessPoint struct {
	BSSID [6]byte
	RSSI  float64
}

AccessPoint is the signal description of a particular WiFi access point.

func InferWiFiAccessPoints

func InferWiFiAccessPoints(m map[string]interface{}) ([]AccessPoint, bool)

InferWiFiAccessPoints uses a predefined set of rules in order to infer the WiFi Access Point information from the provided map.

The function will attempt to parse the following structures: - An entry in the map called `access_points` which is an array of objects. The objects are expected to have the AP BSSID inside the `bssid` key and the RSSI in the `rssi` key. - An entry in the map called `wifi` which is an array of objects. The objects are expected to have the AP BSSID inside the `mac` key and the RSSI inside the `rssi` key.

The BSSIDs are expected to be in hexadecimal format. Separators such as - and : are stripped before the BSSID is parsed.

All numeric values are assumed to be float64.

If no access points can be inferred, this function returns false.

type Location

type Location struct {
	Latitude,
	Longitude,
	Altitude,
	Accuracy float64
}

Location is a geographical location.

func InferLocation

func InferLocation(m map[string]interface{}) (res Location, ok bool)

InferLocation uses a set of predefined rules to determine the location from the given map.

If the map contains a key with the format gps_#, the latitude, longitude and altitude is assumed to be value map.

Otherwise, this function checks for the following key combinations for latitude, longitude and altitude:

  • lat, lon, alt
  • lat, lng, alt
  • lat, long, alt
  • latitude, longitude, altitude
  • Latitude, Longitude, Altitude
  • latitudeDeg, longitudeDeg, altitude
  • latitudeDeg, longitudeDeg, height
  • gps_lat, gps_lng, gps_alt
  • gps_lat, gps_lng, gpsalt

And the following keys for accuracy in metres:

  • acc
  • accuracy
  • hacc

HDOP and satellite count are currently not used.

All numeric values are assumed to be float64.

If no location can be inferred, this function returns false.

func (Location) GoString

func (l Location) GoString() string

GoString returns the textual representation of location.

func (Location) Valid

func (l Location) Valid() bool

Valid returns if the location is valid. A location is considered valid if all fields are well defined (not infinity or NaN), latitude is between -90 and 90 degrees, and longitude is between -180 and 180 degrees.

Jump to

Keyboard shortcuts

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