esp_ble_gatts_create_attr_tab() with multiple Services

richardl
Posts: 12
Joined: Sun Nov 18, 2018 5:02 pm

esp_ble_gatts_create_attr_tab() with multiple Services

Postby richardl » Sun Jan 06, 2019 11:55 pm

I am trying to set up a GATT server which has multiple service.

I did this by adding my services to the end of the current esp_gatts_attr_db_t. However when trying to pass them to the API I get:

E (620) BT_BTC: Each service table can only created one primary service or secondly service.
E (630) GATTS_TABLE_DEMO: create attribute table failed, error code=0x85

Do I need to call the routine with each service in its own esp_gatts_attr_db_t[]?

if so what do I set SVC_INST_ID to for the 2nd etc service please?

Any examples of how to use multiple services with esp_ble_gatts_create_attr_tab() would be very helpful.

Regards

Richard

chegewara
Posts: 2230
Joined: Wed Jun 14, 2017 9:00 pm

Re: esp_ble_gatts_create_attr_tab() with multiple Services

Postby chegewara » Mon Jan 07, 2019 2:08 am

It would help if you paste your code with services table. Also there is nice topic on forum explaining how to create services and characteristics with attr table example.

richardl
Posts: 12
Joined: Sun Nov 18, 2018 5:02 pm

Re: esp_ble_gatts_create_attr_tab() with multiple Services

Postby richardl » Mon Jan 07, 2019 7:43 am

Many thanks, the only links I could find were creating a single service, which was not my issue, if you could point me in the right direction that would be great.

I solved this by making a separate per service table and then called esp_ble_gatts_create_attr_tab() & esp_ble_gatts_start_service() for each.

Regards

Richard

frazan-un
Posts: 2
Joined: Wed Apr 03, 2019 10:07 am

Re: esp_ble_gatts_create_attr_tab() with multiple Services

Postby frazan-un » Wed Apr 03, 2019 10:19 am

Hi all,
I'm trying to make a profile with 2 services with the same UUID (same service table) using the attribute tables.
The function that create that (esp_ble_gatts_create_attr_tab()) is ok because there is an argument srvc_inst_id, and so I can call it 2 times with different service instances. My problem is that in the event generated (ESP_GATTS_CREAT_ATTR_TAB_EVT) I can't find a reference to the service instance in order to save the handles in different places: gatts_add_attr_tab_evt_param contains only a esp_bt_uuid_t not a esp_gatt_srvc_id_t like the gatts_create_evt_param (ESP_GATTS_CREATE_EVT) where instance ID can be found.
Is there a way to resolve this or can't be done using attr tables?
Thanks!

Who is online

Users browsing this forum: No registered users and 112 guests