cancel
Showing results for 
Search instead for 
Did you mean: 

P2PRouter can't get server accelerometer data

Erica1
Associate

Hello everyone!

I have succesfully connected my p2pRouter (it is a STM32WB5x) to a p2pServer (always STM32WB5x). On the Server there is an IMU and I want to send data from server to router via bluetooth.

If I connect my phone to the server with STBLESensorAPP and select accelerometer feature it works and I can see accelerometer data on my phone. But it doesn't happen the same when I do this with router.

Specifically, on server side, accelerometer data are stored in a service called My_P2PServer using the following functions:

  ret = aci_gatt_add_service(UUID_TYPE_128,

                             (Service_UUID_t *) &uuid,

                             PRIMARY_SERVICE,

                             16,

                             &(CustomContext.CustomMy_P2PsHdle));

 

  ret = aci_gatt_add_char(CustomContext.CustomMy_P2PsHdle,

                          UUID_TYPE_128, &uuid,

                          SizeAccel,

                          CHAR_PROP_NOTIFY,

                          ATTR_PERMISSION_NONE,

                          GATT_NOTIFY_ATTRIBUTE_WRITE,

                          0x10,

                          CHAR_VALUE_LEN_VARIABLE,

                          &(CustomContext.CustomAccelHdle));

 

And accelerometer data are updated like this:

      ret = aci_gatt_update_char_value(CustomContext.CustomMy_P2PsHdle,

                                       CustomContext.CustomAccelHdle,

                                       0, /* charValOffset */

                                       SizeAccel, /* charValueLen */

                                       (uint8_t *)  pPayload);

 

Finally, when the phone connects to the server, the server enters this function:

 

static SVCCTL_EvtAckStatus_t Custom_STM_Event_Handler(void *Event)

{

  SVCCTL_EvtAckStatus_t return_value;

  hci_event_pckt *event_pckt;

  evt_blecore_aci *blecore_evt;

  aci_gatt_attribute_modified_event_rp0 *attribute_modified;

  Custom_STM_App_Notification_evt_t     Notification;

 

  return_value = SVCCTL_EvtNotAck;

  event_pckt = (hci_event_pckt *)(((hci_uart_pckt*)Event)->data);

 

  switch (event_pckt->evt)

  {

    case HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE:

      blecore_evt = (evt_blecore_aci*)event_pckt->data;

      switch (blecore_evt->ecode)

      {

        case ACI_GATT_ATTRIBUTE_MODIFIED_VSEVT_CODE:

          attribute_modified = (aci_gatt_attribute_modified_event_rp0*)blecore_evt->data;

          else if (attribute_modified->Attr_Handle == (CustomContext.CustomAccelHdle + CHARACTERISTIC_DESCRIPTOR_ATTRIBUTE_OFFSET))

          {

            return_value = SVCCTL_EvtAckFlowEnable;

 

            switch (attribute_modified->Attr_Data[0])

            {

              /* Disabled Notification management */

              case (!(COMSVC_Notification)):

                Notification.Custom_Evt_Opcode = CUSTOM_STM_ACCEL_NOTIFY_DISABLED_EVT;

                Custom_STM_App_Notification(&Notification);

                break;

 

              /* Enabled Notification management */

              case COMSVC_Notification:

                Notification.Custom_Evt_Opcode = CUSTOM_STM_ACCEL_NOTIFY_ENABLED_EVT;

                Custom_STM_App_Notification(&Notification);

                break;

 

              default:

              break;

            }

          }

 

to switch on the flag to enable the server to send notifications to the router. 

I tried to enable the flag mentioned above calling the following function on router after the devices' connection:

aci_gatt_write_char_desc(BleApplicationContext.connectionHandleEndDevice1,
27,
2,
(uint8_t *)&enable);

Where 27 is the attribute handle of accelerometer characteristic that I foud debugging server side and enable=1.

Can someone help me?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Erica1
Associate
1 REPLY 1
Erica1
Associate

Solved.