Knowledgebase

Modem Service JSON Formats

Device Info

“Device Info” objects encapsulate the current state of a modem as known to the server.

DEVICEINFO = {
  "fports":          FPORTS,                  // Current device port settings
  "info_fields":     INFO_FIELDS,             // Current view of modem fields by service
  "pending_requests": {
    "requests":      [ PENDING_REQUEST, .. ]  // List of pending requests
  },
  "log_messages":    [ LOG_MESSAGE, .. ],     // Service-level messages related to this device
  "uploaded_files":  [ FILE, .. ],            // History of uploaded files
  "uploaded_stream_records": [ STREAM, .. ],  // History of uploaded records
  "last_uplink":      UPLINK_MSG              // Most-recently handled uplink
}
  
  • fports: Required. Current DevicePorts settings.
  • info_fields: Required. List of InfoFields objects
  • pending_requests: Required. List of PendingRequest objects
  • log_messages: Required. List of log messages, LogMessage
  • uploaded_files: Required. History of uploaded files, FileObject
  • uploaded_stream_records: Required. History of uploaded records, StreamObject
  • last_uplink: Required. Last uplink, UplinkMsg

An “Uplink Response” object reflects the current device state as well as new items
resulting from the submitted uplink message. In addition to the info_fields and log_messages
fields of the “DeviceInfo” object (DeviceInfo) it contains fields
which signal the following state changes and completed items that are due to an uplink message:

  • operation: Required, one of “gnss”, “wifi”, “modem”, “other”. In case of “other”, the message
    is application specific and can be forwarded to the application. In case of “modem”, “gnss” and “wifi”
    the message may not be handled by the application.
  • file: Optional. FileObject. Contains the data of a file upload if the uplink message
    led to the completion of a file upload session.
  • stream_records: Optional. StreamUpdate. Contains a data stream update entry which signals re-assembled
    stream records. The array might be empty.
  • position_solution: Optional. PositionSolution. Contains the solution of a valid position calculation.
  • fulfilled_requests: Optional. List of PendingRequest objects. Contains all pending requests
    which have been completed by this uplink.
  • dnlink: Optional. LoRaDnlink. If set, the downlink which has to be scheduled with the network server.
  • fports: Required. Current DevicePorts settings.
  • info_fields: Required. List of InfoFields objects
  • pending_requests: Required. List of PendingRequest objects
  • log_messages: Required. List of log messages, LogMessage

INFO_FIELDS

This object contains the value of the various information fields and the timestamp of the last update.

INFO_FIELDS = {
 "status":   null | { "timestamp": FLOAT, "value": STATUS_FIELD },
 "charge":   null | { "timestamp": FLOAT, "value": UINT2 },
 "voltage":  null | { "timestamp": FLOAT, "value": FLOAT },
 "temp":     null | { "timestamp": FLOAT, "value": INT },
 "signal":   null | { "timestamp": FLOAT, "value": { "rssi": INT, "snr": FLOAT }},
 "uptime":   null | { "timestamp": FLOAT, "value": UINT2 },
 "rxtime":   null | { "timestamp": FLOAT, "value": UINT2 },
 "firmware": null | { "timestamp": FLOAT, "value": { "fwcrc": HEX, "fwtotal": UINT2, "fwcompleted": UINT2 }},
 "adrmode":  null | { "timestamp": FLOAT, "value": ADRMODE },
 "joineui":  null | { "timestamp": FLOAT, "value": DEVEUI },
 "interval": null | { "timestamp": FLOAT, "value": REPINTV },
 "region":   null | { "timestamp": FLOAT, "value": UINT1 },
 "crashlog": null | { "timestamp": FLOAT, "value": STRING },
 "rstcount": null | { "timestamp": FLOAT, "value": UINT2 },
 "deveui":   null | { "timestamp": FLOAT, "value": DEVEUI },
 "rfu":      null | { "timestamp": FLOAT, "value": UINT2 },   // Reserved for future use
 "session":  null | { "timestamp": FLOAT, "value": UINT2 },
 "chipeui":  null | { "timestamp": FLOAT, "value": DEVEUI },
 "streampar":null | { "timestamp": FLOAT, "value": STREAMPAR },
 "appstatus":null | { "timestamp": FLOAT, "value": HEX },
 "alcsync":  null | { "timestamp": FLOAT, "value": ALCSYNC_FIELD }.
}

STATUS_FIELD = {
 "brownout":  BOOL,
 "crash":     BOOL,
 "mute":      BOOL,
 "joined":    BOOL,
 "suspend":   BOOL,
 "upload":    BOOL,
}

STREAMPAR = {
 "port":     UINT1,
 "encmode":  BOOL
}

ALCSYNC_FIELD = {
 "token": UINT1,  // Token, selected by modem
 "time":  UINT4   // Time reported by modem for time correction
}
  
  • timestamp: Required. Float. UTC timestamp.

Modem Request

This object encapsulates a modem request. Each request contains a field, type, denoting
the request type and, optionally, a request-specific parameter.

REQUEST = {
  "type":     STRING, // Required. Request type.
  "param":    ANY,    // Optional. Request specific parameter.
}

RESET_REQUEST = {
  "type":      "RESET",   // RESET request
  "param":     UINT1      // 0x1, 0x2 or 0x3
}

REJOIN_REQUEST = {
  "type":      "REJOIN"   // REJOIN request
}

MUTE_REQUEST = {
  "type":      "MUTE"     // MUTE request
  "param":     UINT1      // Mute parameter
}

GETINFO_REQUEST = {
  "type":      "GETINFO", // GETINFO request
  "param":     [ FIELD, .. ]    // Required. List of field names given below
}

FIELD = [ "status", "charge", "voltage", "temp", "signal", "uptime",
          "rxtime", "firmware", "adrmode", "joineui", "interval", "region",
          "crashlog", "rstcount", "deveui", "session", "chipeui" ]

SETCONF_REQUEST = {
  "type":      "SETCONF",  // SETCONF request
  "param":     {           // Required. Map of SETCONF type to value
    "adrmode":   ADRMODE,  // Optional. ADR mode
    "joineui":   JOINEUI,  // Optional. EUI
    "interval":  REPINTV,  // Optional. Reporting interval
    "region":    UINT1,    // Optional. Regulatory region (according to device manual)
  }
}

ADRMODE: UINT1
  0x00: LNS controlled
  0x01: Mobile Long Range
  0x02: Mobile Low Power

REPINTV: UINT1
  Bits 7-6: unit (sec=0x00, day=0x01, hour=0x10, min=0x11)
  Bits 5-0: value (0-63)

FILEDONE_REQUEST = {
  "type":      "FILEDONE", // FILEDONE request
  "param":    {
    "sid":    INT,    // Required. File session id
    "sctr":   INT,    // Required. File counter
  }
}
  
 

Pending Request

This object encapsulates a pending request.

PENDING_REQUEST = {
  "id":        INT,    // Request ID
  "cookie":    ANY,    // Value for request completion check
  "timestamp": FLOAT,  // Timestamp, UTC, of request generation
  "request" :  REQUEST // The request as generated by caller
}
  
  • id: Required. Integer. Request ID.
  • cookie: Required. Internal value for request-completion check.
  • timestamp: Required. Float. UTC timestamp.
  • request: Required. The associated ModemRequest.

STREAM Update

This lists both the signals and the fully-assembled streaming records that are received by the decoder.
Each entry denotes an assembled packet with application data and record offset.

If some of the fragments of a stream record are lost during transmission, they will be reconstructed
based on the following fragments. This may result in records being delivered to the application in a
different order than sent by the device. The application can use the stream offset of each
reconstructed record to re-establish the order.

[ 
  [ UINT,      // Required. Stream offset of the record
    HEX        // Required. HEX string, Stream record data
  ],
  ..
]
  

Position Solution

A Position Solution object contains the position solution calculated from GNSS or Wi-Fi observations.
The algorithm_type field distinguishes between the two cases:

  • gnss: The Position Solution object is a GNSS position solution POSITION_SOLUTION_GNSS
  • gnssng: The Position Solution object is a GNSS-NG position solution POSITION_SOLUTION_GNSSNG
  • wifi: The Position Solution object is a Wi-Fi position solution POSITION_SOLUTION_WIFI
POSITION_SOLUTION = POSITION_SOLUTION_GNSS | POSITION_SOLUTION_GNSSNG | POSITION_SOLUTION_WIFI
  
POSITION_SOLUTION_GNSS = {
  "algorithm_type": "gnss",             // Required.
  "ecef":      [FLOAT, FLOAT, FLOAT],   // Required. Calculated position in ECEF coordinates [m, m, m]
  "llh":       [FLOAT, FLOAT, FLOAT],   // Required. Calculated position in WGS84 llh coordinates [deg, deg, m]
  "capture_time_gps":  FLOAT,           // Required. Calculated capture time in seconds GPST
  "gdop":      FLOAT,                   // Required. Geometric Dilution of Precision
  "accuracy":  FLOAT,                   // Required. Estimate of calculated position accuracy in meters
  "timestamp": FLOAT                    // Required. Uplink message timestamp corresponding to position solution
}
  
  • ecef: Required. Calculated position in Earth-centered, fixed Cartesian coordinates in meters [X,Y,Z].
  • llh: Required. Calculated position in WGS84 latitude [deg], longitude [deg], altitude above
    reference ellipsoid [m].
  • capture_time_gps: Required. Calculated capture time in seconds GPST.
  • gdop: Required. Geometric Dilution of Precision in meters.
  • accuracy: Required. Estimate of calculated position accuracy. Values >0.0 are in meters.
    Value 0.0 means an accuracy estimate is not available.
  • timestamp: Required. Uplink message timestamp corresponding to position solution.
POSITION_SOLUTION_GNSSNG = {
  "algorithm_type": "gnssng",           // Required.
  "ecef":      [FLOAT, FLOAT, FLOAT],   // Required. Calculated position in ECEF coordinates [m, m, m]
  "llh":       [FLOAT, FLOAT, FLOAT],   // Required. Calculated position in WGS84 llh coordinates [deg, deg, m]
  "capture_time_gps":  FLOAT,           // Required. Calculated capture time in seconds GPST
  "capture_times_gps":  [FLOAT|null, ..],    // Required. Calculated capture time in seconds GPST
  "gdop":      FLOAT,                   // Required. Geometric Dilution of Precision
  "accuracy":  FLOAT,                   // Required. Estimate of calculated position accuracy in meters
  "timestamp": FLOAT                    // Required. Uplink message timestamp corresponding to position solution
}
  

The fields are identical to the POSITION_SOLUTION_GNSS object except for the additional field capture_times_gps.

  • capture_times_gps: Required. Calculated capture time of the most recent scan of the group which was considered
    in the solution calculation. In seconds GPST.
POSITION_SOLUTION_WIFI = {
  "algorithm_type": "wifi"              // Required.
  "llh":       [FLOAT, FLOAT, FLOAT],   // Required. Calculated position in WGS84 llh coordinates [deg,]()

  • llh: Required. Calculated position in WGS84 latitude [deg], longitude [deg], altitude
    above reference ellipsoid [m]
  • timestamp: Required. Uplink message timestamp corresponding to position solution

Whenever the msgtype field is omitted, the default message type is updf.

msgtype:joining

The Modem Service protocol is a session-aware protocol. In LoRaWAN, a session reset
corresponds to an OTAA join or re-join event. The joining message type shall be
used to signal such session reset events.

MSG_JOINING = {
  "msgtype":   "joining"      // Required.
  "timestamp": FLOAT,         // Optional. RX timestamp in seconds UTC
  "dr":        UINT1,         // Optional. Data rate
  "freq":      UINT4,         // Optional. Frequency
}
  

msgtype:updf

The updf message type is used to submit any LoRaWAN uplink message.
For updf messages with port set to one of the configured protocol ports (modem, wifi, gnss,
gnssng, stream – see Configure Device Ports) the corresponding message type is inferred and the associated protocol performed.
An updf message may contain fields which are only evaluated by specific protocols and are ignored
by others. The port and payload fields can be omitted when submitting generic uplink events which
provide downlink opportunities for protocols specific to the Modem & Geolocation Services.

MSG_UPDF = {
  "msgtype":                    "updf",         // Optional. 'updf' is implied if not present
  "fcnt":                       UINT4,          // Required. Frame counter
  "port":                       UINT1,          // Optional. Port
  "payload":                    HEX,            // Optional. HEX string with LoRaWAN message payload
  "dr":                         UINT1,          // Optional. Data rate
  "freq":                       UINT4,          // Optional. Frequency
  "timestamp":                  FLOAT,          // Optional. RX timestamp in seconds, UTC
  "dn_mtu":                     UINT4,          // Optional. Downlink MTU
  "gnss_capture_time":          FLOAT,          // Optional. Capture time estimate, GPST
  "gnss_capture_time_accuracy": FLOAT,          // Optional. Capture time accuracy, seconds
  "gnss_assist_position":       [FLOAT, FLOAT], // Optional. Assistance position WGS84, (latitude, longitude) [deg]
  "gnss_assist_altitude":       FLOAT,          // Optional. Assistance altitude, (meters above WGS84 reference ellipsoid) [m]
  "gnss_use_2D_solver":         BOOL            // Optional. True if the value gnss_assist_altitude is considered a precise altitude value. A fixed-altitude 2D fix is performed.
}
  

Description of generic uplink message fields:

  • fcnt: Required. 32-bit LoRaWAN frame counter for this message.
  • port: Optional. LoRaWAN message port.
  • payload: Optional. LoRaWAN message payload. Required if the uplink port is a configured protocol port.
  • dr: Optional. LoRaWAN data rate (0<=dr<=12).
  • freq: Optional. Frequency in Hz.
  • timestamp: Optional. RX timestamp in seconds, UTC. If omitted, the API request time is used.
  • dn_mtu: Optional. Maximum transmission unit for the downlink path, in bytes.
  • gnss_…: Optional fields only evaluated in case of gnss or gnssng protocol messages (msgtype:gnss/gnssng).

msgtype:gnss/gnssng

The message type gnss signals LoRa Edge GNSS Positioning Messages conforming to the LoRa Edge GNSS positioning protocol. The
message type gnssng signals LoRa Edge GNSS Positioning Messages conforming to
the LoRa Edge GNSS-NG (NAV-Group) positioning protocol.
Additional parameters provide means to control the position calculation in case a protocol
message triggers a position calculation.

MSG_GNSS = {
  "msgtype":                    "gnss"|"gnssng", // Required.
  "payload":                    HEX,            // Required. HEX string with valid LoRa Edge GNSS positioning protocol payload
  "dn_mtu":                     UINT4,          // Optional. Downlink MTU
  "timestamp":                  FLOAT,          // Optional. RX timestamp in seconds UTC
  "gnss_capture_time":          FLOAT,          // Optional. Capture time estimate, GPST
  "gnss_capture_time_accuracy": FLOAT,          // Optional. Capture time accuracy, in seconds
  "gnss_assist_position":       [FLOAT, FLOAT], // Optional. Assistance position WGS84, (latitude, longitude) [deg]
  "gnss_assist_altitude":       FLOAT,          // Optional. Assistance altitude, (meters above WGS84 reference ellipsoid) [m]
  "gnss_use_2D_solver":         BOOL            // Optional. True if the value gnss_assist_altitude is considered a precise altitude value. A fixed-altitude 2D fix is performed.
}
  

Description of the fields:

  • payload: Required. HEX string with valid LoRa Edge GNSS positioning protocol/LoRa Edge GNSS-NG (NAV-Group) positioning protocol payload
  • dn_mtu: Optional. Maximum transmission unit for the downlink path in bytes.
  • timestamp: Optional. Timestamp, in seconds UTC. If unspecified, current time on server.
  • gnss_capture_time: Optional. An estimate of the time when the GNSS observation has been taken, in
    seconds GPST. If no gnss_capture_time is given, timestamp is used as an initial estimate for
    the capture time.
  • gnss_capture_time_accuracy: Optional. Capture-time estimate accuracy, in seconds. This value is used
    to check the plausibility of the position solution. Position solutions, where the calculated capture
    time deviates from the estimated capture time by more than gnss_capture_time_accuracy, will be
    rejected. If no value for gnss_capture_time is given, gnss_capture_time_accuracy applies to the
    uplink timestamp. If this value is below 16, the capture time encoded in the binary payload is ignored
    and gnss_capture_time is used as the initial estimate for the iterative position solver. Default
    value: 300 seconds.
  • gnss_assist_position: Optional. Assistance position as latitude and longitude coordinates in
    degrees inside the WGS84 reference frame. In case payload is a U-GNSSLOC-NAV message, this
    position is used as a starting point for the iterative position solver. In case payload is
    a U-GNSSLOC-REQAID message, this position is used to generate the aiding position downlink and is
    hence required in that case.
    Examples: [55.341414, 11.030974], [37.819222, -122.478521], [-33.852482, 151.210686]
  • gnss_assist_altitude: Optional, Precise altitude of the device at capture time, in meters
    above the WGS84 reference ellipsoid. Required if gnss_use_2D_solver is True.
  • gnss_use_2D_solver: If True, the value of gnss_assist_altitude is used as a fixed solution
    coordinate, reducing the required positioning algorithm to a 2D solution problem.
    gnss_assist_altitude should have an accuracy of 10 meters or better. Otherwise,
    the position solution quality is degraded.

Note: Timestamps in GPS time (GPST) are seconds passed since 00:00 UTC (midnight) of January 5th to
6th 1980, without leap seconds.

msgtype:wifi

LoRa Edge Wi-Fi positioning protocol messages directed at the Wi-Fi Location Solver shall be passed with msgtype set to wifi.

MSG_WIFI = {
  "msgtype":    "wifi",       // Required.
  "payload":    HEX,          // Required. HEX string with valid LoRa Edge Wi-Fi positioning protocol payload
  "timestamp":  FLOAT,        // Optional.

Description of the fields:

  • payload: Required. HEX string with valid LoRa Edge Wi-Fi positioning protocol payload. Must contain at least two
    MAC addresses.
  • timestamp: Optional. Timestamp associated to the position solution, in seconds UTC. If
    unspecified, current time on server.

FILE Object

A FILE object carries the contents of a file uploaded and de-fragmented by a modem to the service.

FILE = {
  "sctr":       UINT1,  // Required. File counter.
  "timestamp":  FLOAT,  // Required. UTC timestamp of the last message having led to a fully de-fragmented file
  "port":       UINT1,  // Required. Target port for uploaded files; may be null on error
  "data":       HEX,    // Required. Contents of an uploaded file; may be null on error
  "hash":       HEX,    // Required. SHA256 short hash over plain data (8/4 bytes for plain/encrypted upload); may be null on error
  "encmode":    BOOL,   // Required. File encrypted; may be null on error
  "message":    STRING, // Optional. May contain a log message of the service
}
  

STREAM Object

A fully-assembled record of the streaming session, stored in the stream record history along with the device state.

STREAM = {
  "timestamp":  FLOAT,  // Required. UTC timestamp of the last message having led to a fully de-fragmented stream record
  "port":       UINT1,  // Required. Target port for the uploaded stream
  "data":       HEX,    // Required. Contents of the stream record
  "off":        UINT2   // Required. Application record counter (byte offset)
}
  

Log Message

A log message associated with a device.

LOG_MESSAGE = {
  "logmsg":    STRING,  // Required. Log message
  "level":     STRING,  // Required. "WARNING", "INFO" or "ERROR"
  "timestamp": FLOAT    // Required. Timestamp, UTC, Float
}
  

Device Ports

The configured port settings for a device.

FPORTS = {
  "dmport":      UINT1,   // Configured or default port for Modem messages
  "gnssport":    UINT1,   // Configured or default port for GNSS messages
  "gnssngport":  UINT1,   // Configured or default port for GNSSNG messages
  "wifiport":    UINT1,   // Configured or default port for Wi-Fi messages
  "streamport":  UINT1    // Configured or default port for Stream messages
}
  

Note that streamport and dmport are the same by default as the DM port implicitly
allows for a stream session tunneled through DM messages. If the streamport is
explicitly set for a device, the Modem Service opens a stream session for the specified port
and closes any existing session.

The default ports for devices are 199 for the DM port, 198 for the GNSS port, 197 for the Wi-Fi
port and 192 for the GNSSNG port (Modem Service Protocol Payloads). The default port for Stream messages is
the DM port where the DM protocol allows to stream records by using the tag U-APPSTREAMDATA
(Modem Service Protocol Payloads). It is only necessary to configure the stream port explicitly when the
device sends records on a port different from the DM port and without relying on the DM
protocol for the stream.

The DM, GNSS, GNSSNG, Wi-Fi and stream ports must differ from each other in a device
configuration. In general, LoRa Cloud does not support the multiplexing of different
protocols over a single port besides the DM protocol allowing for embedding GNSS, Wi-Fi or
stream records in tagged DM messages (Modem Service Protocol Payloads).

Did this article help you?

Stay updated with the latest developments. Learn how to build location-aware applications.