This is really for information and to invite comments.
I have a B4A app which uses BLE 2 to communicate with a piece of test equipment. The test equipment uses the AdaFruit LE Uart friend. The tablet is the master and sends commands and data read requests to the test equipment. A transaction occurs about every 500ms. Commands are acknowledged and data read requests result in messages ranging from a few characters to 22. All replies are terminated with c/r.
The BLE 2 Manager_DataAvailable routine generally gets called two or three times before the longer reply messages are fully assembled/received. This is possibly due to the test equipment not sending characters as fast as it could or perhaps because it uses 9600 baud between the LE friend and the control uP. This is not really an issue. I assume each call back corresponds to a received BLE packet.
What i am finding is that when the equipment is used in WiFi dense area there seems to be an occasional loss of packets (perhaps every 10-20 minutes) from the equipment to the tablet. The Android literature suggests this is a relatively common problem. The "lost" packets could be in the middle of a reply message or at the end (including the terminating c/r). In a WiFi quiet area there us usually no loss of packets.
The evidence is that the serial data to the LE Uart can be seen to include all characters but the DataAvailable routine does not get called enough times or with enough characters to assemble the complete message. Looking at the call back timing it is possible to see the gap where a call back with a packet should have occurred. The next call back that does happen has more of the message but after a gap.
I am beginning to think about protecting the messages with a checksum to spot missing segments in the middle and a timeout to spot the loss of the c/r packet. This will have to be supported with a "please send again" command.
Comments and thoughts of others invited.
I have a B4A app which uses BLE 2 to communicate with a piece of test equipment. The test equipment uses the AdaFruit LE Uart friend. The tablet is the master and sends commands and data read requests to the test equipment. A transaction occurs about every 500ms. Commands are acknowledged and data read requests result in messages ranging from a few characters to 22. All replies are terminated with c/r.
The BLE 2 Manager_DataAvailable routine generally gets called two or three times before the longer reply messages are fully assembled/received. This is possibly due to the test equipment not sending characters as fast as it could or perhaps because it uses 9600 baud between the LE friend and the control uP. This is not really an issue. I assume each call back corresponds to a received BLE packet.
What i am finding is that when the equipment is used in WiFi dense area there seems to be an occasional loss of packets (perhaps every 10-20 minutes) from the equipment to the tablet. The Android literature suggests this is a relatively common problem. The "lost" packets could be in the middle of a reply message or at the end (including the terminating c/r). In a WiFi quiet area there us usually no loss of packets.
The evidence is that the serial data to the LE Uart can be seen to include all characters but the DataAvailable routine does not get called enough times or with enough characters to assemble the complete message. Looking at the call back timing it is possible to see the gap where a call back with a packet should have occurred. The next call back that does happen has more of the message but after a gap.
I am beginning to think about protecting the messages with a checksum to spot missing segments in the middle and a timeout to spot the loss of the c/r packet. This will have to be supported with a "please send again" command.
Comments and thoughts of others invited.