3 Replies Latest reply on Sep 7, 2017 6:38 AM by e.pratt_1639216

    How to refresh the BLE Limited period timeout pro-grammatically ?

    jagir_2673086

      Hello,

      I am novice to BLE Development.

      Im ny project my BLE device GAP role is peripheral.

      In my project i want to start BLE stack advertising on SW2 switch press & wait for 30s to connect any central device.

      If any central device does not connect in 30s it should power BLE stack automatically.

      In this case when my device start advertising & wait for timeout if anyone press sw2 again it should refresh timeout period to pre-defined value(30s).

      Can i do this without using timer component ?

      If yes then How ?

        • 1. Re: How to refresh the BLE Limited period timeout pro-grammatically ?
          e.pratt_1639216

          You will need to write software to handle the operation, but if you set the BLE component to timeout the advertising after 30 seconds, and just stop then start the advertisement whenever you receive a button press, then it should be feasible to do this without any timing components besides the BLE component's internal timing.

          (You can always write a timer in software with interrupts if you are okay with a software abstraction of the timer component).

          • Setup the BLE component to do a fast + slow timeout total of 30 seconds.
          • Upon button press, check if BLE advertising already
          • If yes, then restart advertisement (stop, then start); I don't know for sure if there is a way to reset the advertisement timeout count?
          • If no, then start advertisement
          • After 30 seconds handle the timeout event on the advertisement and turn off the BLE advertisement (might automatically turn off the advertisement on its own)
          1 of 1 people found this helpful
          • 2. Re: How to refresh the BLE Limited period timeout pro-grammatically ?
            jagir_2673086

            Hi Pratt,

            Thanks for your guidance.

            I dig some deep & get to know that there is pre-defined library function CYBLE_API_RESULT_T CyBle_SoftReset (void) To Software reset BLE stack.

            And after any BLE timeout(GAP limited discoverable mode,GAP pairing process,GATT response) CYBLE_EVT_TIMEOUT event will occur to be handled by event handler & consequences Advertisement will restart .

            We can change this order by a block of logic.

            Thank you.

            It seems you have good experience in playing with BLE @ e.pratt_1639216

            • 3. Re: How to refresh the BLE Limited period timeout pro-grammatically ?
              e.pratt_1639216

              Huh; I missed the CyBle_SoftReset() function, but that is useful to know

              That is correct, the CYBLE_EVT_TIMEOUT is the event you will want to do logic on based on the 30s timeout window

              I spent a decent amount of time on a project for work, so I had to learn both the BLE and PSoC simultaneously; Sink or swim is a great way to learn stuff well

              Thanks for the compliment; Good luck with finishing the project jagir_2673086