Documentation ¶
Index ¶
- type DeviceInfo
- type DeviceSettings
- type DeviceUplinkResponse
- type DeviceUplinkResponses
- type DeviceUplinks
- type EUI
- type FUOTARequestParam
- type File
- type FileDoneRequestParam
- type GetInfoRequestParam
- type Hex
- type InfoFields
- type LoRaDnlink
- type LoRaUplink
- type LoRaUplinkType
- type LogMessage
- type PendingRequest
- type PendingRequests
- type PositionSolution
- type Request
- type RequestType
- type ResetRequestParam
- type SetConfRequestParam
- type StatusField
- type Stream
- type StreamPar
- type StreamSession
- type TokenInfo
- type UplinkResponse
- type UploadSession
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeviceInfo ¶
type DeviceInfo struct { // DMPorts contains the ports currently accepted as "dmport". DMPorts []uint8 `json:"dmports"` // InfoFields is the current view of modem fields by service. InfoFields InfoFields `json:"info_fields"` // UploadSessions contains the current upload sessions. UploadSessions []UploadSession `json:"upload_sessions"` // StreamSessions contains the current streaming sessions. StreamSessions []StreamSession `json:"stream_sessions"` PendingRequests *PendingRequests `json:"pending_requests"` // LogMessages contains the from service related to this device. LogMessages []LogMessage `json:"log_messages"` // UploadedFiles contains the history of uploaded files. UploadedFiles []File `json:"uploaded_files"` // UploadedStreamRecords contains the history of uploaded records. UploadedStreamRecords []Stream `json:"uploaded_stream_records"` // LastUplink is the last handled uplink. LastUplink LoRaUplink `json:"last_uplink"` }
DeviceInfo encapsulates the current state of a modem as known to the server.
type DeviceSettings ¶
type DeviceSettings struct { DMPorts *int32 `json:"dmports,omitempty"` Streams []struct { Port int32 `json:"port"` AppSz int32 `json:"appsz"` } `json:"streams,omitempty"` }
DeviceSettings holds the initial settings for a device.
type DeviceUplinkResponse ¶
type DeviceUplinkResponse struct { Result UplinkResponse `json:"result"` Error string `json:"error"` }
DeviceUplinkResponse contains the uplink response and the error if applicable.
type DeviceUplinkResponses ¶
type DeviceUplinkResponses map[EUI]DeviceUplinkResponse
DeviceUplinkResponses maps the device EUIs to the DeviceUplinkResponse.
func (DeviceUplinkResponses) UnmarshalJSON ¶
func (d DeviceUplinkResponses) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type DeviceUplinks ¶
type DeviceUplinks map[EUI]*LoRaUplink
DeviceUplinks maps device EUIs to LoRaUplink
func (DeviceUplinks) MarshalJSON ¶
func (u DeviceUplinks) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
type EUI ¶
EUI represents a dash-separated EUI64.
func (EUI) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*EUI) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type FUOTARequestParam ¶
type FUOTARequestParam Hex
FUOTARequestParam is the FUOTA binary chunk of a FUOTA request.
func (FUOTARequestParam) MarshalJSON ¶
func (f FUOTARequestParam) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*FUOTARequestParam) UnmarshalJSON ¶
func (f *FUOTARequestParam) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
type File ¶
type File struct { SCtr uint8 `json:"sctr"` Timestamp float64 `json:"timestamp"` Port uint8 `json:"port"` Data Hex `json:"data"` Hash Hex `json:"hash"` EncMode bool `json:"encmode"` Message *string `json:"message,omitempty"` }
File carries the contents of an uploaded, defragmented file by a modem to the service.
type FileDoneRequestParam ¶
FileDoneRequestParam is the configuration of a file upload request of a FileDone request.
type GetInfoRequestParam ¶
type GetInfoRequestParam []string
GetInfoRequestParam contains the requested fields of a GetInfo request.
type Hex ¶
type Hex []byte
Hex represents hex encoded bytes.
func (Hex) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*Hex) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type InfoFields ¶
type InfoFields struct { Status *struct { Timestamp float64 `json:"timestamp"` Value StatusField `json:"value"` } `json:"status"` Charge *struct { Timestamp float64 `json:"timestamp"` Value uint16 `json:"value"` } `json:"charge"` Voltage *struct { Timestamp float64 `json:"timestamp"` Value float64 `json:"value"` } `json:"voltage"` Temp *struct { Timestamp float64 `json:"timestamp"` Value int32 `json:"value"` } `json:"temp"` Signal *struct { Timestamp float64 `json:"timestamp"` Value struct { RSSI float64 `json:"rssi"` SNR float64 `json:"snr"` } `json:"value"` } `json:"signal"` Uptime *struct { Timestamp float64 `json:"timestamp"` Value uint16 `json:"value"` } `json:"uptime"` RxTime *struct { Timestamp float64 `json:"timestamp"` Value uint16 `json:"value"` } `json:"rxtime"` Firmware *struct { Timestamp float64 `json:"timestamp"` Value struct { FwCRC string `json:"fwcrc"` FwCnt uint16 `json:"fwcnt"` } `json:"value"` } `json:"firmware"` ADRMode *struct { Timestamp float64 `json:"timestamp"` Value uint8 `json:"value"` } `json:"adrmode"` JoinEUI *struct { Timestamp float64 `json:"timestamp"` Value EUI `json:"value"` } `json:"joineui"` Interval *struct { Timestamp float64 `json:"timestamp"` Value uint8 `json:"value"` } `json:"interval"` Region *struct { Timestamp float64 `json:"timestamp"` Value uint8 `json:"value"` } `json:"region"` OpMode *struct { Timestamp float64 `json:"timestamp"` Value uint32 `json:"value"` } `json:"opmode"` CrashLog *struct { Timestamp float64 `json:"timestamp"` Value string `json:"value"` } `json:"crashlog"` RstCount *struct { Timestamp float64 `json:"timestamp"` Value uint16 `json:"value"` } `json:"rstcount"` DevEUI *struct { Timestamp float64 `json:"timestamp"` Value EUI `json:"value"` } `json:"deveui"` FactRst *struct { Timestamp float64 `json:"timestamp"` Value uint16 `json:"value"` } `json:"factrst"` Session *struct { Timestamp float64 `json:"timestamp"` Value uint16 `json:"value"` } `json:"session"` ChipEUI *struct { Timestamp float64 `json:"timestamp"` Value uint16 `json:"value"` } `json:"chipeui"` StreamPar *struct { Timestamp float64 `json:"timestamp"` Value StreamPar `json:"value"` } `json:"streampar"` AppStatus *struct { Timestamp float64 `json:"timestamp"` Value string `json:"value"` } `json:"appstatus"` }
InfoFields contains the value of the various information fields and the timestamp of their last update.
type LoRaDnlink ¶
LoRaDnlink is a specification for a modem device.
func (LoRaDnlink) Fields ¶
func (u LoRaDnlink) Fields() map[string]interface{}
Fields implements log.Fielder.
type LoRaUplink ¶
type LoRaUplink struct { Type LoRaUplinkType `json:"msgtype"` FCnt *uint32 `json:"fcnt,omitempty"` Port *uint8 `json:"port,omitempty"` Payload *Hex `json:"payload,omitempty"` DR *uint8 `json:"dr,omitempty"` Freq *uint32 `json:"freq,omitempty"` Timestamp *float64 `json:"timestamp,omitempty"` DownlinkMTU *uint32 `json:"dn_mtu,omitempty"` GNSSCaptureTime *float64 `json:"gnss_capture_time,omitempty"` GNSSCaptureTimeAccuracy *float64 `json:"gnss_capture_time_accuracy,omitempty"` GNSSAssistPosition []float64 `json:"gnss_assist_position,omitempty"` GNSSAssistAltitude *float64 `json:"gnss_assist_altitude,omitempty"` GNSSUse2DSolver *bool `json:"gnss_use_2D_solver,omitempty"` }
LoRaUplink encapsulates the information of a LoRa message.
type LoRaUplinkType ¶ added in v3.9.0
type LoRaUplinkType uint8
const ( // UplinkUplinkType is LoRaWAN Message Type. UplinkUplinkType LoRaUplinkType = iota // ModemUplinkType is DAS Protocol Message Type. ModemUplinkType // JoiningUplinkType is Session Reset Message Type. JoiningUplinkType // GNSSUplinkType is DAS GNSS Message Type. GNSSUplinkType )
func (LoRaUplinkType) MarshalJSON ¶ added in v3.9.0
func (t LoRaUplinkType) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (*LoRaUplinkType) UnmarshalJSON ¶ added in v3.9.0
func (t *LoRaUplinkType) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unarmshaler.
type LogMessage ¶
type LogMessage struct { LogMsg string `json:"logmsg"` Level string `json:"level"` Timestamp float64 `json:"timestamp"` }
LogMessage is a log message associated with a device.
type PendingRequest ¶
type PendingRequest struct { ID uint32 `json:"id"` Cookie interface{} `json:"cookie"` Timestamp float64 `json:"timestamp"` Request Request `json:"request"` }
PendingRequest encapsulates a pending request.
type PendingRequests ¶ added in v3.9.0
type PendingRequests struct { // Upcount is the "upcount" communicated to modem. Upcount uint8 `json:"upcount"` // Updelay is the "updelay" communicated to modem. Updelay uint8 `json:"updelay"` Requests []PendingRequest `json:"requests"` }
type PositionSolution ¶ added in v3.9.0
type PositionSolution struct { ECEF []float64 `json:"ecef"` LLH []float64 `json:"llh"` CaptureTimeGPS float64 `json:"capture_time_gps"` GDOP float64 `json:"gdop"` Accuracy float64 `json:"accuracy"` Timestamp float64 `json:"timestamp"` }
PositionSolution is the solution of a position calculation.
type Request ¶
type Request struct { Type RequestType `json:"type"` Param requestParam `json:"param,omitempty"` }
Request encapsulates a modem request.
func (*Request) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type RequestType ¶
type RequestType uint8
RequestType is the type of a modem request.
const ( // ResetRequestType identifies a RESET request. ResetRequestType RequestType = iota // RejoinRequestType identifiers a REJOIN request. RejoinRequestType // MuteRequestType identifies a MUTE request. MuteRequestType // GetInfoRequestType identifies a GETINFO request. GetInfoRequestType // SetConfRequestType identifies a SETCONF request. SetConfRequestType // FileDoneRequestType identifies a FILEDONE request. FileDoneRequestType // FUOTARequestType identifies a FUOTA request. FUOTARequestType )
func (RequestType) MarshalJSON ¶
func (t RequestType) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (*RequestType) UnmarshalJSON ¶
func (t *RequestType) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unarmshaler.
type ResetRequestParam ¶
type ResetRequestParam uint8
ResetRequestParam is the reset type of a Reset request.
type SetConfRequestParam ¶
type SetConfRequestParam struct { ADRMode *uint8 `json:"adrmode,omitempty"` JoinEUI EUI `json:"joineui,omitempty"` Interval *uint8 `json:"interval,omitempty"` Region *uint8 `json:"region,omitempty"` OpMode *uint32 `json:"opmode,omitempty"` }
SetConfRequestParam is the configuration request of a SetConf request.
type StatusField ¶
type StatusField struct { Brownout bool `json:"brownout"` Crash bool `json:"crash"` Mute bool `json:"mute"` Joined bool `json:"joined"` Suspend bool `json:"suspend"` Upload bool `json:"upload"` }
StatusField contains the status flags of a device.
type Stream ¶
type Stream struct { Timestamp float64 `json:"timestamp"` Port uint8 `json:"port"` Data Hex `json:"data"` Off uint16 `json:"off"` }
Stream is a fully assembled record of the stream session stored in the stream record history with the device state.
type StreamSession ¶
StreamSession contains information for a defined streaming session.
type TokenInfo ¶
type TokenInfo struct { Name string `json:"name"` Token string `json:"token"` Capabilities []string `json:"capabilities"` }
TokenInfo holds token information.
type UplinkResponse ¶
type UplinkResponse struct { File *File `json:"file"` StreamRecords [][]interface{} `json:"stream_records"` PositionSolution *PositionSolution `json:"position_solution"` PendingRequests *PendingRequests `json:"pending_requests"` FullfiledRequests []Request `json:"fulfilled_requests"` Downlink *LoRaDnlink `json:"dnlink"` InfoFields InfoFields `json:"info_fields"` LogMessages []LogMessage `json:"log_messages"` }
UplinkResponse contains the state changes and completed items due to an uplink message.