Distance monitoring implementation

The SDT uses a combination of Connectable advertising and passive scanning to allow the devices to monitor each other as well as Dialog WiRa mechanism to provide accurate distance estimation

The device executes the following sequence at startup

fsm_adv

Advertising parameters

The detection is done based on the advertised service. The device also advertise a unique device identifier.

The advertising data is in the following format:

Field Size (bytes) Description
SDT Service UUID 16 C6E9794D-EF6F-41E7-A1B7-7F1547D843D6
Device identifier 8 Device Identifier

Device Identifier fields

Position

Length

Description

0

1

device type :
0 - Wearable
X - Reserved

1

4

SDT Unique ID

5

1

Dialog Wireless Ranging (WiRa):
0 - Not available
1 - available
X - Reserved

6

1

Connect-to-me’ flag:
0 - Do not connect to me
1 - Connect to me
X - Reserved

7

4

Reserved (set to 0xFF)

Advertising response:

Field Description
Name Device name (SDT)

Scanning state machine

The scanning mechanism is handled by two separate state machines. The first one is in charge of the scanning schedule.

fsm_scan

The second state machine is in charge of handling the advertising report and sorting the discovered devices for further processing.

fsm_adv_rep

Advertising and scanning state machines are supervised by the following state machine which will manage the connection to the devices entering the warning state.

fsm_discovery

Distance processing

Remote RSSI service

In order to improve the coarse ranging the SDT offers a GATT service which allow it to report the RSSI reading from the peer device. The peer RSSI reading is used to increase the quality of the distance measurement evaluation.

The GATT service is defined in the following way:

Type Access UUID Description
Service N.A. 8522C64B-ED9D-4789-A95D-0F56E9246D4E RSSI exchange Service
Property Read 8522C64B-ED9D-4789-A95D-000000000001 Remote read RSSI
Property Write 8522C64B-ED9D-4789-A95D-000000000002 Remote Write RSSI

WiRa service

The WiRa algorithm requires its own service in order to exchange the data required to process the distance assessment.

Type Access UUID Description
Service N.A. 4F120CA4-85D3-11E8-ABC0-FA7AE01BBEBC WiRa service
Property Write 4F120CA4-85D3-11E8-ABC0-000000000001 DATA_I_RESULT
Property Notify 4F120CA4-85D3-11E8-ABC0-000000000002 DATA_R_RESULT

Distance and alert processing

The SDT uses a mix of ranging and RSSI based distance estimation in order to save power while maintaining a high level of accuracy. The SDT processes the peer devices information in the area at a configurable interval. This time period is called PROXIMITY SCANNING DURATION (PSD) and is statically set at compile time. Regardless of the scan/advertising scheme implementation, at the end of the PSD, the list of discovered devices is processed to get individual average RSSI in order to determine if a device crossed the threshold requiring a coarse ranging.

When the average RSSI from scanning during PSD indicates any zone other than the Limit Zone, then the SDT initiates a connection to the target SDT. After connection, the two SDT devices send through GATT the connection RSSI to the peer device. The operation is repeated 4 times. The strongest signal out of all the exchanged RSSI is the indication of the current zone.

  • If the current zone is DANGER, then give the Danger zone audio/visual feedback.

  • If the current zone is WARNING, then give the Warning zone audio/visual feedback.

The audio/visual feedback is defined in the application as a macro allowing a final application to define any suitable alert mechanism. Once the Audio/Visual prompt is triggered, the devices disconnect (while alert feedback is in progress) and restarts the detection and scanning process for any other devices in range.

The process is detailed in the diagram below

_images/fsm_distance.svg