BLE: How to send Notify to Service

I am trying to control a BLE device, and have sniffed some traffic via Wireshark. While I do see some a small number of "Send Write Request", the actual commands to control the device are decoded as "Sent Handle Value Notification".

Interacting with the device has been a bit of a handful, as the device does not seem to return Service or Characteristic UUIDs until paired, but I have managed to get as far as pairing the device (after scanning, and triggering the pair by device name for now), and then I can fetch the Service, Characteristic and Descriptor. I can issue a requestWrite on the Characteristic and Descriptor, which return success, but there is no observed effect on the device. I suspect this is because it is issuing a regular Write, and not this "Handle Value Notification"

Here is what the frame that I have captured while sniffing looks like:

My Service and Characteristic UUIDs are registered, and I am getting those objects back, but ultimately my call doesn't seem to work: (I do get back STATUS_SUCCESS in onCharacteristicWrite though)

getCharacteristic().requestWrite([0x0b]b, {});

I'm not sure exactly what the transmitted packet looks like, in order to tell what the Opcode and Handle are of what is being sent. 

I followed some other instructions to write [0x01,0x00] to my descriptor to enable notifications, and I do get realtime calls to onCharacteristicChanged when interacting with the device with status updates, but I'm still unclear on how to send notifications back to the device.

Does the information included with the frame provide enough information for someone to steer me in the correct direction?

Thanks in advance!
  • The Nordic sample in the SDK Turns on notify,

    but basically, you do (where char is the characteristic)

                var cccd = char.getDescriptor(Ble.cccdUuid());
                cccd.requestWrite([0x01,0x00]b);
    An you want to use a queue, so if you 
    -turn on notifications
    -read a characteristic
    you want to wait for onDescriptorWrite in the Ble Delegate before you do the read.
  • Receiving notifications is working fine, the trouble I'm having is sending notifications back to the device. On the read side, I have done the write to the cccd descriptor, and can monitor for device->sim notifications in onCharacteristicChanged().

    The wireshark frame I included is an example captured from Phone->Device. I am effectively looking to replay that same notification from the sim/garmin edge in order to control the device.

    From a bit more research online, it looks like I may have to get CiQ configured as a Server, and the BLE device would then be registering as a client, and then I could send notifications, but it doesn't look like CiQ supports that level of BLE configuration.

    I could be misinterpreting what I've read though - so I'm hoping that there is some way via a characteristic or descriptor requestWrite() that I can replicate the command that I captured.

  • Not sure you want to send a notification from the Garmin side.  Are you sure you don't want to just do a requestWrite for a specific characteristic?  Can you see what's happening on the non-garmin end?  What it's seeing?

  • Can't debug the bluetooth device, and can't capture packets while sending from the sim.

    All I can tell for sure is that when testing with the device's companion iPhone app, I see the phone consistently sending Notifications and the device responding to them. I have partially decoded the content of the notification that is sent, including what is sent when turning the device off, as well as cycling through presets, so the content of the notification that I have captured in Wireshark does look like it is the right frame for controlling the device -- there are no write packets sent that seem to do any control.

    From the captured trace, there are some writes sent immediately after connecting, but after that, all the Phone -> Device packets are as notifications.

    My next best step to verify behavior would be to use another BLE device that is more programmable. I have some ESP32s with BLE lying around I could try to set up for this, but it's looking like if I do get it to work as a sent notification, there won't be a path to supporting that on Garmin, so I'm not in a rush to confirm that.