2 Replies Latest reply on Aug 9, 2016 2:20 AM by ionascu.marianemanuel_1654946

    PSOC 4 BLE Notification of custom characteristinc returns ERROR code 1

    ionascu.marianemanuel_1654946

      Hello Everybody,

         

      Today I reach another strange topic that I personally do not get it.

         

      I have a big custom characteristic of 44 bytes(11 int32 fields) that changes often( once at 4 seconds) and therefore I want them to notify the cell phone when the value changed.  Since the code is very long I will put here only the notification part. I may say that a simple slider example works perfectly. Also this example works in some conditions.

         

      <code>

         


       tstSensorsForBLE tstValue;
         
          
          tstValue.CO = astSensor[0].i32AvgValue;
          tstValue.SO2 = astSensor[1].i32AvgValue;
          tstValue.NO2 = astSensor[2].i32AvgValue;
          tstValue.O3 = astSensor[3].i32AvgValue;
          tstValue.NO = astSensor[4].i32AvgValue;
          tstValue.Spec = astSensor[5].i32AvgValue;
          tstValue.CO2 = astSensor[6].i32AvgValue;
          tstValue.VOC = astSensor[7].i32AvgValue;
          tstValue.T = astSensor[8].i32AvgValue;
          tstValue.H = astSensor[9].i32AvgValue;
          tstValue.P = astSensor[10].i32AvgValue;

         


       if(u8ConnectionFlag != 0)
          {
              /* Get a handle for the notification characteristic */
              CYBLE_GATTS_HANDLE_VALUE_NTF_T tempHandle;
              /* Take the characteristic */
              tempHandle.attrHandle = CYBLE_SENSORSSERVICE_SENSORSVALUE_CHAR_HANDLE;
              /* Update the value and specify the lenght */
              tempHandle.value.val = (uint8 *)&tstValue;
              tempHandle.value.len = 44;
             
              CyBle_GattsWriteAttributeValue(&tempHandle, 0, &cyBle_connHandle, 0);
             
              /* If the BLE is connected with the phone notify it */
              if(u8Notif != 0)
              {
                 char str[20];
                  CYBLE_API_RESULT_T result;
                  /* Notify the phone that the values are update */
                  result  = CyBle_GattsNotification(cyBle_connHandle,  &tempHandle);
                  sprintf(str, "ERORR: %d wsdfgrfthjhuy\n",result);
                  UART_UartPutString(str);
              }
          }

         

      </code>

         

      The result code is always 1 which mean that one input parameter is not correct.

         

      I track the problem to the size of the characteristic. If Instead of 44 length I put 20 then there is no error and it notifies correctly but above 20 I always have code 1.

         

      My questions is: Is there a problem because I try to notify a characterstic of 44 bytes? If yes How can I do this notification of such big characteristic? 

         

       

         

      Thanks!