4 Replies Latest reply on Jun 11, 2020 12:21 AM by maze_1672671

    WriteAttrServChanged clarification

    maze_1672671

      Hello all,

       

      I have followed Project051_NOR_Flash_Bootloader, so I copied:

       

      void WriteAttrServChanged(void)

      {

          uint32 value;

          CYBLE_GATT_HANDLE_VALUE_PAIR_T    handleValuePair;

         

          /* Force client to rediscover services in range of bootloader service */

          value = ((uint32)(((uint32) cyBle_btss.btServiceHandle) << 16u)) |

              ((uint32) (cyBle_btss.btServiceInfo[0u].btServiceCharDescriptors[0u]));

       

          handleValuePair.value.val = (uint8 *)&value;

          handleValuePair.value.len = sizeof(value);

       

          handleValuePair.attrHandle = cyBle_gatts.serviceChangedHandle;

          CyBle_GattsWriteAttributeValue(&handleValuePair, 0u, NULL,CYBLE_GATT_DB_LOCALLY_INITIATED);

      }

       

      My colleagues that develop for ios/android complain that they don't receive the indication

       

      Who calls CyBle_GattsIndication?

        • 1. Re: WriteAttrServChanged clarification
          GaneshD_41

          Hi,

           

          >>"Who calls CyBle_GattsIndication?"

          --> PSoC 4 BLE will not send any Indication to the host. The function WriteAttrServChanged() sets serviceChangedHandle for enabling or disabling hidden service. From the PSoC application side, once the functions below are called, the PSoC BLE goes to state where it can accept commands from host for bootloading process.

           

                      ChangeBootloaderServiceState(ENABLE_BTS);

                      bootloadingMode = BOOTLOADING_MODE_ENABLED;

                      bootloadingModeReq = BOOTLOADING_MODE_NOT_REQUESTED;

                      WriteAttrServChanged();

                      BootloaderEmulator_Start();

           

          The host should initiate the firmware upgrade process. From PSoC side the BootloaderEmulator_Start(); is responsible for all the BLE communication and Bootloading process.

           

          If you are developing an application from sctatch, we recommedn you to use the CySmart Android/ios application source code. You can get it from here:

          https://www.cypress.com/documentation/software-and-drivers/cysmart-mobile-app

           

          Hope it helps ! Please reply for more queries.

          Thanks

          Ganesh

          • 2. Re: WriteAttrServChanged clarification
            maze_1672671

            Hello Ganesh

             

            thank you for your answer

             

            I am developing on psoc, I hope that my colleagues already know the demo code for android/ios

             

            I have not read the ble specifications, so I have a couple of questions:

            1) "service changed" has a mandatory indication: must I send it?

             

            As you said: The host should initiate the firmware upgrade process but

            2) what my colleagues can do to know that bts is up? a delay?

             

            Thank you for your patience

            Massimo

            • 3. Re: WriteAttrServChanged clarification
              GaneshD_41

              Hello Massimo,

               

              >>"1) "service changed" has a mandatory indication: must I send it?"

              --> No. The application works without calling WriteAttrServChanged(void) also.

               

              >>'2) what my colleagues can do to know that bts is up? a delay?"

              --> Sorry. I could not understand your query. Can you please elaborate it?

               

              Thanks

              Ganesh

              • 4. Re: WriteAttrServChanged clarification
                maze_1672671

                Hello Ganesh,

                 

                I would like to ask you a mindset like "ble for dummies"

                 

                In our device we have a proprietary command that disables our service and enables bootloader service (aka bts)

                 

                Mobile developers complain that they send the command but do not receive the feedback (I think they have a callback, but I am not a mobile developer)

                 

                I have seen that WriteAttrServChanged does not indicate the srv. chg. attribute

                 

                Can you spend a few words about what happens (in psoc and mobile) when I call WriteAttrServChanged?