It’s been a struggle but I have an S130 simultaneously listening for broadcasts, while advertising, and able to listen for UI connections.

Receiving a broadcast advertising packet from another node called “Z1”.  The example packet contains a maximally-sized 20-byte block of “proprietary data”, i.e. it doesn’t conform to the BLE standard and will only make sense to TS devices.
TS (7) [c7.60.61.56.c1.bf] – BLE_GAP_EVT_ADV_REPORT                              
  T9(2)NAME Z1    Field type and length                                  
  T1(1)FLAGS 04                                                                  
  T255(22)TS_PROPRIETARY_DATA [(20), 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 ]

It requests second block of data from the broadcaster – the so-called scan response data.   (For some reason this appears to come from a different MAC address – 0xbe instead of 0xbf?? )  This block contains the state of the sender’s battery, and the temp – just random bits of data it was easy to provide.
TS (8) [c7.60.61.56.c1.be] – BLE_GAP_EVT_ADV_REPORT
  T22(3)BLE_UUID_BATTERY_SERVICE 100%              
  T22(6)BLE_UUID_HEALTH_THERMOMETER_SERVICE 34C    

Now I use my Android phone and an off-the-shelf applciation to make a “TS_UART” connection to the S130.  TS_UART is a connection that simply sends and receives strings of characters (up to 20).
———————-
UI connected.
———————-

While waiting for some activity on the connection it continues to report broadcast packets…
TS (9) [c7.60.61.56.c1.c6] – BLE_GAP_EVT_ADV_REPORT                              
  T9(2)NAME Z1                                                                   
  T1(1)FLAGS 04                                                                  
  T255(22)TS_PROPRIETARY_DATA [(20), 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 ]                                                                 
TS (10) [c7.60.61.56.c1.c6] – BLE_GAP_EVT_ADV_REPORT                             
  T22(3)BLE_UUID_BATTERY_SERVICE 100%                                            
  T22(6)BLE_UUID_HEALTH_THERMOMETER_SERVICE 34C                                  
TS (11) [c7.60.61.56.c1.c6] – BLE_GAP_EVT_ADV_REPORT                             
  T9(2)NAME Z1                                                                   
  T1(1)FLAGS 04                                                                  
  T255(22)TS_PROPRIETARY_DATA [(20), 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 ]  

I type a string “buddy” into my phone UI and press “send”.  This is the interim mechanism I intend to use to configure each node, and to query it for statistics and so forth.
———————-    
UI received string “buddy”
———————-    

.
.
At the same time, in another typescript window, a peer is receiving broadcast packets from the S130, demonstrating that (with some kludgery) it is possible to send and receive broadcast packets at the same time.

Z1 (22157) [92.3d.42.c2.f1.f8] -62dB BLE_GAP_EVT_SCAN_REQ_REPORT
Z1 (22158) [92.3d.42.c2.f1.f8] -61dB BLE_GAP_EVT_SCAN_REQ_REPORT
Z1 (22159) [92.3d.42.c2.f1.f8] -68dB BLE_GAP_EVT_SCAN_REQ_REPORT
Z1 (22160) [92.3d.42.c2.f1.f8] -67dB BLE_GAP_EVT_SCAN_REQ_REPORT
Z1 (22161) [92.3d.42.c2.f1.f8] -69dB BLE_GAP_EVT_SCAN_REQ_REPORT
Z1 (22162) [92.3d.42.c2.f1.f8] -68dB BLE_GAP_EVT_SCAN_REQ_REPORT
Z1 (22163) [92.3d.42.c2.f1.f8] -67dB BLE_GAP_EVT_SCAN_REQ_REPORT
I have not yet managed to send UI responses back to the phone, but I’m pretty confident that it’s just a small program bug.

The code is a complete haystack, and will take a few days to clean up.

Leave a Reply