2 Replies Latest reply on Nov 21, 2018 10:07 AM by DheerajK_81

    Using CySmart API CyReadMultipleCharacteristicResult / byte count limited to 16

      Hi to everybody,

       

      based on the CySmart library (C#) I am working on a GUI to transfer data between a peripheral sensor and the Cypress BLE Dongle. I used the CySmart examples available.

      I like to get some informations from the sensor after the first connection as name, manufacturer, firmware version and so on.

      Using the API CyReadMultipleCharacteristicResult I get two problems:

      1. I am not shure how to use the API. I would like to have an example for this.

       

      My code based on the CySmart example is:

       

             /// GATT client callback class

              /// </summary>

              class GattClientCb : CyGattClientCallback

              {

                  public CySmart.Common.Base.Compatibility.Net20.Action<CyReadMultipleCharacteristicResult, CyStatus> ReadMultipleChHandles { get; set; }

                  public override void OnReadMultipleCharacteristics(CyReadMultipleCharacteristicResult result, CyStatus status)

                  {

                      if (ReadMultipleChHandles != null)

                           ReadMultipleChHandles(result, status);

                  }

              }                            

       

              //Read sensor infos

              private void Read_Sensor_Infos()

              {

                  AutoResetEvent sync = new AutoResetEvent(false);

                  CyApiErr err = CyApiErr.OK;

       

      //...

      GATTClientEventCallback.ReadMultipleChHandles = (CyConnectResult, status) =>

                  {

                      //copy byte values to variables?

                     //...

                      sync.Set();

                  };

       

                  err = GattClient.ReadMultipleCharacteristic(new CyReadMultipleCharacteristicInfo

                          (COMPLETE_NAME, MANUFACTURER, HARDWARE, FIRMWARE, MODEL_NUMBER, LABEL));

              }

       

      2. The Callback ReadMultipleChHandles delivers only 16 bytes, not more.

      The length seems to be truncated to 16. The handle LABEL in my list alone has got 64 bytes. I tried something like the following changing the delivered length, but this doesn't work. What is going wrong?

       

      BLEManagerCallBack.GetDefaultDataLengthHandler = (result, status) =>

      {

           //write debug line...

      }

      BLEManager.GetDefaultDataLength();

       

       

      Thanks for your help!