Dynamic GATT: BleApp_GattServerCallback doesn't work

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dynamic GATT: BleApp_GattServerCallback doesn't work

787 Views
giuliano_errico
Contributor II

Hi all,

I'm still working on MKW31Z and got stuck on another problem, this time about BLE and GATT services, in particular the wireless uart service. If I use static GATT everything works well, however, if I implement dynamic GATT, when I write the charateristic (via BLE scanner app with Android phone or iPhone) the BleApp_GattServerCallback function is never called.

Here the code I used to enable the profiles:

bleResult_t BleApp_GATTDB_DynamicDefinition(){
   bleResult_t serviceResult;
   serviceResult = GattDbDynamic_AddGattService(&gattProfile);
   if(serviceResult != gBleSuccess_c) return serviceResult;

   serviceResult = GattDbDynamic_AddGapService(&gapProfile);
   if(serviceResult != gBleSuccess_c) return serviceResult;

   serviceResult = GattDbDynamic_AddWirelessUartService();
   return serviceResult;
}

bleResult_t GattDbDynamic_AddWirelessUartService()
{
serviceResult = GattDbDynamic_AddPrimaryServiceDeclaration(gBleUuidType128_c,&uuid_service_wireless_uart,&service_wireless_uart);

if(serviceResult != gBleSuccess_c) return serviceResult;

   serviceResult = GattDbDynamic_AddCharacteristicDeclarationAndValue(gBleUuidType128_c,&uuid_uart_stream,(gGattCharPropWriteWithoutRsp_c),gAttMaxWriteDataSize_d(gAttMaxMtu_c),1,value_uart_stream_initialvalues,(gPermissionFlagWritable_c),&wirelessUartProfile);

   return serviceResult;
}

 

Am i missing something? Please help me!! :smileycry:

Thanks in advance

Tags (1)
0 Kudos
4 Replies

693 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Giuliano, I hope you're doing well!

 

I took a look at your code and initialization, and it looks correct.

Could you please confirm if the gGattDbDynamic_d macro was added to the app_preinclude.h header file like so?:

#define gGattDbDynamic_d                                1

 

Could you also please let me know which BLE example are you using?

 

Best regards,

Sebastian

0 Kudos

693 Views
giuliano_errico
Contributor II

Hi Sebastian,

Thanks for your response. Yes, I confirm that the gGattDbDynamic macro is defines and equals to 1, both in the app_preinclude.h file and in the gatt_database.c (where is originally defines). The BLE example is the wireless_uart. 

Thank you

Giuliano

0 Kudos

693 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Giuliano,

 

I'm sorry for the delayed response.

 

For implementing a dynamic GATT database, we recommend checking the BLE Shell example provided in the SDK archive.

 

This example implements the use of a dynamic GATT database, and allows the user to add and remove database entries by sending the gattdb command through the shell with different arguments.

 

The application uses the following functions to manage the database:

  • ShellGattDb_Write
  • ShellGattDb_Read
  • ShellGattDb_AddService
  • ShellGattDb_Erase

The example allows the user to add services for a Heart Rate, Battery Service, Device Information and Ipss.

 

These commands can be found in the "shell_gattdb.c" source file, in the source folder of the BLE Shell SDK example:

<…\SDK_2.2.1_QN908XCDK\boards\qn908xcdk\wireless_examples\bluetooth\ble_shell>

 

Please let me know if you need any more information or have further issues.

 

Best regards,

Sebastian

0 Kudos

693 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Giuliano,

 

I am in the process of performing some tests with dynamic GATT database, and will get back to you as soon as I have some results.

 

Please let me know if you have any other questions, or need any more information.

 

Best regards,

Sebastian

0 Kudos