Hi, I'm continuing work on BLE on the NRF52832 and I would like to instantiate a GATT server (to eventually provide HID over GATT for providing a bluetooth mouse). Looking at the upper layers of BLE in NuttX you can see that it ends up in a network device which exposes different functionality via IOCTL calls. While there are calls to access GATT attributes as a client (discovering, reading, writing, etc. to a remote GATT server), there's no interface for instantiating a server.
Looking at bt_gatt.h, there are definitions which can be used to register a table of characteristics using bt_gatt_register() call. Now, this table holds pointers to callback functions which are invoked to retrieve the value of each characteristic, as it is requested by the remote client. This means that if I were to expose this bt_gatt_register() function via an IOCTL call (receiving a pointer to the table), the networking layer would be calling into a userspace function. As this is undesireable I'm thinking what would be the best way to support this. An alternative would be to skip the network layer completely, writing a device driver representing the mouse itself and have that driver interact with bt_* functions. This way, all of this is at OS level. However, there's a lot of functionality on the bt_netdev level which I would be losing and I'm not sure if it is supposed to be used like this (ie, having something in parallel to the network layer accessing BLE from a driver). Anyone with knowledge of BLE have any hints? I don't know how for example Linux decouples this. Best, Matias