StatusReporterModule (moduleId 3)

Purpose

This module should report the node’s status according to a configured interval. Furthermore, it provides methods for directly requesting different kinds of device info, status, etc,…​ data.

Functionality

The StatusReporterModule can periodically send out different kinds of information messages. It will also feed the watchdog once keep alive messages are received. It is responsible for sending out logged error codes and for measuring the necessary data for its messages such as the battery power.

Terminal Commands

Device Information

Generic information about a node that does not change or very seldomly - only through enrollment or firmware update, can be requested via the get_device_info command.

//Request the full device info from some nodes
action [nodeId] status get_device_info

Status Information

Information that is bound to change from time to time can be requested using the get_status command.

//Request the status
action [nodeId] status get_status

Connection Information

Information about the mesh connections of a node can be requested with the following command.

//Retrieve the connections from all nodes in the network
action [nodeId] status get_connections
//Return nearby nodes from the JOIN_ME buffer
action [nodeId] status get_nearby

Livereports

Livereports are a way to send information about errors, connections, disconnections and other important events to the user through the mesh. Each livereport has a unique id according to its importance. Setting the livereport level to a level greater than 0 will activate the reporting. The different levels are:

  • Off (0)

  • Error (50)

  • Warn (100)

  • Info (150)

  • Debug (200)

Live Reports can be generated in the firmware using the SendLiveReport method. Two extra parameters can be given that can contain additional information for the specific report/error.

//Set the livereport level
action [nodeId] status livereports [liveReportLevel]

//Activate livereports for all errors on all nodes
action 0 status livereports 50

Live Reports are printed on the terminal of a sink node and can be used to debug a problem in a running system:

{"type":"live_report","nodeId":123,"module":3,"code":1,"extra":2,"extra2":3}

Messages

Device Info

Request

actionType: GET_DEVICE_INFO

Bytes Type Description

8

connPacketModule

Response

actionType: DEVICE_INFO

The device info contains information about the device that is not changing often, e.g. only after a firmware update or an enrollment.

Bytes Type Description

8

connPacketModule

2

manufacturerId

Id according to Bluetooth SIG Assigned numbers company identifiers

5

serialNumber

Serial number as ASCII without terminating 0 character

8

chipId

A unique ID of the nrf chip

7

gapAddress

1 byte address type, 6 byte ble address

2

networkid

The network id

4

nodeVersion

Version of the node (10000000 * MAJOR + 10000 * MINOR + PATCH)

1

dbmRx

Receive dbm signed

1

dbmTx

Transmit dbm signed

1

deviceType

Refer to DeviceTypes

1

calibratedTx

calibrated tx power at 1m distance, signed

2

chipGroupId

groupid for the chip (e.g. NRF51 or NRF52)

2

featuresetGroupId

groupid for the firmware featureset (used for firmware update, matching groups are allowed to receive the firmware.

2

bootloaderVersion

version of the bootloader

Device Info

Request

actionType: GET_DEVICE_INFO_V2

Bytes Type Description

8

connPacketModule

Response

actionType: DEVICE_INFO_V2

The device info contains information about the device that is not changing often, e.g. only after a firmware update or an enrollment.

Bytes Type Name Description

8

connPacketModule

2

u16

manufacturerId

Id according to Bluetooth SIG Assigned numbers company identifiers

4

u32

serialNumberIndex

Index of the serial number, can be converted with alphabet

8

u64

chipId

A unique ID of the nrf chip

7

gapAddress

1

byte address type, 6 byte ble address

2

u16

networkid

The network id

4

u32

nodeVersion

Version of the node (10000000 * MAJOR + 10000 * MINOR + PATCH)

1

i8

dbmRx

Receive dbm signed

1

i8

dbmTx

Transmit dbm signed

1

u8

deviceType

Refer to DeviceTypes

1

i8

calibratedTx

calibrated tx power at 1m distance, signed

2

u16

chipGroupId

groupid for the chip (e.g. NRF51 or NRF52)

2

u16

featuresetGroupId

groupid for the firmware featureset (used for firmware update, matching groups are allowed to receive the firmware.

2

u16

bootloaderVersion

version of the bootloader

Status

Request

actionType: GET_STATUS

Bytes Type Description

8

connPacketModule

Response actionType: STATUS

The device status contains information that is changing from time to time.

Bytes Type Description

8

connPacketModule

2

clusterSize

Size of the cluster that the node is connected to (current mesh size)

2

inConnectionPartner

NodeId of the node that is connected to the one and only peripheral connection with this node.

1

inConnectionRssi

RSSI of the incoming connection

2 bit

freeIn

Number of free mesh connections as peripheral

6 bit

freeOut

Number of free mesh connections as central

1

batteryInfo

Voltage of the battery

1

connectionLossCounter

Counter on how many mesh connections were dropped

1 bit

initializedByGateway

If the gateway has initialized this beacon and sent the SET_INITIALIZED command, this bit will be 1 until a reboot is encountered

7 bit

reserved

Connections

Query all nodeIDs that a node is connected to including the connection rssi. The first entry is the incoming connection, the others are outgoing.

Request

actionType: GET_ALL_CONNECTIONS

Bytes Type Description

8

connPacketModule

Response

actionType: ALL_CONNECTIONS

The device status contains information that is changing from time to time.

Bytes Type Description

8

connPacketModule

3*x

connections

Returns an array of all partnerEntries

PartnerEntry
Bytes Type Description

2

partnerId

The nodeId of the connected node

1

rssi

the rssi as a signed integer

Nearby Nodes

Returns all nodes (limited to some maximum count) that are surrounding the node with the same networkid.

Request

actionType: GET_NEARBY_NODES

Bytes Type Description

8

connPacketModule

Response

actionType: NEARBY_NODES

Bytes Type Description

8

connPacketModule

3*x

nearbyNodes

Returns an array of NearbyNodeEntries

NearbyNodeEntry
Bytes Type Description

2

nodeId

The nodeId of the nearby node

1

rssi

the rssi as a signed integer

Live Reports

The statusReporterModule can send live reports that notify the user over various state changes and error conditions. A live Report is generated on a node and is then broadcasted over the mesh. This allows us to do live debugging of mesh errors, e.g. if two nodes are not connecting to each other. Live Reports are also received over MeshAccessConnections which means we can find an error after we connect to the disconnected part of the mesh using a MeshAccessConnection.

enum LiveReportTypes {
    LIVE_REPORT_TYPES_ERROR = 0,
    LIVE_REPORT_TYPES_WARN = 50,
    //========
    LIVE_REPORT_TYPES_INFO = 100,
    LIVE_REPORT_TYPE_GAP_CONNECTED_INCOMING, //extra is connHandle, extra2 is 4 bytes of gap addr
    LIVE_REPORT_TYPE_GAP_TRYING_AS_MASTER, //extra is partnerId, extra2 is 4 bytes of gap addr
    LIVE_REPORT_TYPE_GAP_CONNECTED_OUTGOING, //extra is connHandle, extra2 is 4 byte of gap addr
    LIVE_REPORT_TYPE_GAP_DISCONNECTED, //extra is partnerid, extra2 is hci code

    LIVE_REPORT_TYPE_HANDSHAKE_FAIL,
    LIVE_REPORT_TYPE_MESH_CONNECTED, //extra is partnerid, extra2 is asWinner
    LIVE_REPORT_TYPE_MESH_DISCONNECTED, //extra is partnerid, extra2 is appDisconnectReason

    //========
    LIVE_REPORT_TYPES_DEBUG = 150,
    LIVE_REPORT_TYPE_DECISION_RESULT //extra is decision type, extra2 is preferedPartner
};

Event

actionType: LIVE_REPORT

Bytes Type Description

8

connPacketModule

MESSAGE_TYPE_MODULE_GENERAL

1

reportType

Is of type LiveReportType

4

extra

Additional data regarding the event, depending on the reportType

4

extra2

Additional data regarding the event, depending on the reportType