Need BLE HoG feature report sample

I've gotten about this far:

enum {
    HIDS_INPUT = 0x01,
    HIDS_OUTPUT = 0x02,
    HIDS_FEATURE = 0x03,
};
static struct hids_report feature = {
    .id = 0x03,
    .type = HIDS_FEATURE,
};
...
    BT_GATT_CHARACTERISTIC(BT_UUID_HIDS_REPORT,
                   BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY,
                   SAMPLE_BT_PERM_READ,
                   NULL, write_feature_report, NULL),
...
    BT_GATT_DESCRIPTOR(BT_UUID_HIDS_REPORT_REF, BT_GATT_PERM_READ, // attr 12
               read_report, NULL, &feature),
...
So now I need the implementation of write_feature_report. I am lost here. Also, the read function parameter probably shouldn't be null, and the characteristic is probably both read and write. Not sure how to finish implementing feature reports in HoG in Zephyr.
Parents
  • Hello,

    Are you looking for an event handler for a device acting as a HID peripheral or a HID central? The difference would be:

    Are you creating a wireless keyboard, interfacing a computer via BLE, or are you creating a device that receives HID commands over BLE, and you need to forward it to USB?

    If it is the first one, then you can check out the hids_outp_rep_write() in nrf\subsys\bluetooth\services\hids.c

    Best regards,
    Edvin

Reply
  • Hello,

    Are you looking for an event handler for a device acting as a HID peripheral or a HID central? The difference would be:

    Are you creating a wireless keyboard, interfacing a computer via BLE, or are you creating a device that receives HID commands over BLE, and you need to forward it to USB?

    If it is the first one, then you can check out the hids_outp_rep_write() in nrf\subsys\bluetooth\services\hids.c

    Best regards,
    Edvin

Children
  • I think I understand how to do input and output reports. I'm stuck on feature reports, which I want for the computer to read and write parameters of the device. It seems the Nordic hid service doesn't really have a thing for this set up already. For input and output reports, I am going off the Zephyr hid sample as I like their approach better than the Nordic hid service, but either way I just need a way for feature reports to work.

  • What may be easier, which I am going to attempt if I can't find anything that exists for what I want, is to just send serialized packets as feature reports in a custom protocol.

  • The nordic hids seems to have stuff for feature reports, even though you still have to manually parse and send, and there are no samples, but I understand what to do now.