I implemented to gear as Gatt server.
I created gatt server, 1 service, 2 characteristic and 1 descriptor as below;
-------------------------------------------------------------------
bt_gatt_server_create(&m_hGattServer);
bt_gatt_service_create(UUID_SERVICE, BT_GATT_SERVICE_TYPE_PRIMARY, &m_hGattService);
char wval[] = {0x7d};
err = bt_gatt_characteristic_create(UUID_RX_CHAR, BT_GATT_PERMISSION_WRITE, BT_GATT_PROPERTY_WRITE, wval, 1, &m_hGattRxChar);
char rval[] = {0x01};
err = bt_gatt_characteristic_create(UUID_TX_CHAR, 0, BT_GATT_PROPERTY_NOTIFY, rval, 1, &m_hGattTxChar);
char nval[] = {0x02};
err = bt_gatt_descriptor_create(UUID_DESC, BT_GATT_PROPERTY_NOTIFY, nval, 1, &m_hGattNotiDesc);
err = bt_gatt_characteristic_add_descriptor(m_hGattTxChar, m_hGattNotiDesc);
err = bt_gatt_service_add_characteristic(m_hGattService, m_hGattRxChar);
err = bt_gatt_service_add_characteristic(m_hGattService, m_hGattTxChar);
err = bt_gatt_server_set_write_value_requested_cb(m_hGattRxChar, BleService::GattReadCB, this);
err = bt_gatt_server_register_service(m_hGattServer, m_hGattService);
err = bt_gatt_server_start();
-------------------------------------------------------------------
Receiving data from gatt client is succeeded. I can see data in GattReadCB function. But how can I send data to client?
When I send thru Gatt descriptor, bt_gatt_set_value failed: 0xffffffea(-22)
bt_gatt_set_value(m_hGattNotiDesc, data, len);
If somebody has ideas, please let me know.