언어 설정

Menu
Sites
Language
How to send data to gatt client when the gear is server?

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.
 

 

 


 

 

 

Edited by: 민철 김 on 12 3월, 2018
답변 바로가기

Responses

2 댓글
Mark as answer
K Johnson

Please check in this link if you've met all the prerequisites before using Bluetooth GATT API.

민철 김

I read that link. That doesn't explain Gatt server api.
Thanks anyway, I found what's the problem. 

I really feel tizen code resources is too short.
It is better Tizen team to make example gatt server and supply to developers.