cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB55 - aci_gatt_update_char_value() - Not Showing updated characters in Serial Bluetooth Term

ICMosquera
Associate III

Hi Sirs, 

I've fiddled around Cable Replacement Example code (CRS for server). I successfully created a custom function to send a char string to the peripheral upon pushing SW1. Now my problem is when I made a new project, with  an .oic file, created a custom service with read and write characteristics (write specifically my concern), then ported my custom function.

When I debug my code, I was able to call the event by pressing the SW1, up to the code aci_gatt_update_char_value(), but nothing is showing on the terminal. Im sure this works on the Cable replacement code. I even copied the UUIDs of the service and characteristics of Cable replacement. but to no avail.

 

Here is the initialization of my write service

 

 

/**
   *  CharW01
   */
  COPY_CHARW01_UUID(uuid.Char_UUID_128);
  ret = aci_gatt_add_char(CustomContext.CustomMysvcHdle,
                          UUID_TYPE_128, &uuid,
                          SizeCharw01,
                          CHAR_PROP_READ | CHAR_PROP_WRITE_WITHOUT_RESP,
                          ATTR_PERMISSION_NONE,
                          GATT_NOTIFY_ATTRIBUTE_WRITE,
                          0x10,
                          CHAR_VALUE_LEN_VARIABLE,
                          &(CustomContext.CustomCharw01Hdle));

 

 

Here is the code for updating the characteristic (CHARW01)

 

 

 

tBleStatus Custom_STM_App_Update_Char(Custom_STM_Char_Opcode_t CharOpcode, uint8_t *pPayload)
{
  tBleStatus ret = BLE_STATUS_INVALID_PARAMS;
  uint8_t size;
  size = 0;
  while(pPayload[size] != '\0'){
    size++;
  }
  switch (CharOpcode)
  {
    case CUSTOM_STM_CHARW01:
      ret = aci_gatt_update_char_value(CustomContext.CustomMysvcHdle,
                                       CustomContext.CustomCharw01Hdle,
                                       0, /* charValOffset */
                                       size, /* charValueLen */
                                       (uint8_t *)  pPayload);
      break;
    case CUSTOM_STM_CHARN02:
      ret = aci_gatt_update_char_value(CustomContext.CustomMysvcHdle,
                                       CustomContext.CustomCharn02Hdle,
                                       0, /* charValOffset */
                                       SizeCharn02, /* charValueLen */
                                       (uint8_t *)  pPayload);
      break;
    default:
      break;
  }
  return ret;
}

 

 

 

When I use this code under cable replacement and then download it on nucleo device, I am able to send strings, but not on my project.

Have I missed something in porting this code on my new project? Im not quite sure if I need to follow some GATT coding in order for me to correctly replicate the cable replacement.

 

Thank you so much. 

 

Ian

0 REPLIES 0