Hi,

I am looking to issue a response to a write characteristic, and seem to be
just getting a null response.

Is there anything I need to do special with the write data, before writing
back some data.

Here's my code, it's based off the peripheral tutorial from 0.80.


Inside static const struct ble_gatt_svc_def gatt_svr_svcs[] = {

....

 [4] = {
         /*** Service: TXPWR */
         .type = BLE_GATT_SVC_TYPE_PRIMARY,
         .uuid128 = (void *)p_uuid_base,
         .characteristics = (struct ble_gatt_chr_def[]) { {
             .uuid128 = (void *)p_uuid_id,
             .access_cb = gatt_svr_chr_txpwrlvl_cb,
             .flags = BLE_GATT_CHR_F_READ,
         }, {
             .uuid128 = (void *)p_uuid_command_nonce,
             .access_cb = gatt_svr_p_command_nonce_cb,
             .flags = BLE_GATT_CHR_F_READ,
         }, {
          .uuid128 = (void *)p_uuid_command,
             .access_cb = gatt_svr_p_command_cb,
             .flags = BLE_GATT_CHR_F_WRITE,
         }, {
             0, /* No more characteristics in this service. */
         } },
     },


...


static int
gatt_svr_p_command_cb(uint16_t conn_handle, uint16_t attr_handle, uint8_t
op,
                         union ble_gatt_access_ctxt *ctxt, void *arg)
{
static uint8_t command_int = 0x05;
    ctxt->chr_access.data = &command_int;
    ctxt->chr_access.len = 1;

    return 0;
}

Cheers
James

Reply via email to