This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/CC2640R2F: CCS

Part Number: CC2640R2F

Tool/software: Code Composer Studio

I want to enable and disable advertising with simple peripheral on  cc2640r2f  ?

How i can do it ?

Help Me please !!! 

  • You can use “GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &adv_enabled_status );” and set adv_enabled_status to TRUE or FALSE to toggle advertising.
  • hi,

    YK's response is correct, you might also like to review this: dev.ti.com/.../ble_scan_adv_basic.html
  • I know, but I would like to turn on and off advertising using a timer .....
    I do not want to do it manually by putting Vraiou Faux to activate and deactivate the advertisement.

    I would like with a timer; for example the advertisement will be activated 3 minutes, then it will be deactivated with a timer.
  • MY MY

    Look into using a Timer Driver then: dev.ti.com/.../index.html

    Create a task function that manages the turning off/on of advertising and a callback that triggers each time your time expires and in it have it enqueues a message meant for your task function.
  • You can try to refer to SBP_PERIODIC_EVT in simple_peripheral to see how to start a periodic event and add toggle advertising in a periodic event by yourself.
  • Hey,

    I am trying to do this,
    but I have not managed to do it

    Help me please
  • The steps are as the followings:
    1. Add "#define SBP_PERIODIC_EVT 0x0004"
    2. Add "#define SBP_PERIODIC_EVT_PERIOD 5000" which is how often to perform periodic event (in msec).
    3. Claim "static Clock_Struct periodicClock;"
    3. Implement SBP_clockHandler
    static void SBP_clockHandler(UArg arg)
    {
    // Store the event.
    events |= arg;

    // Wake up the application.
    Semaphore_post(sem);
    }
    4. Call "Util_constructClock(&periodicClock, SBP_clockHandler,SBP_PERIODIC_EVT_PERIOD, 0, false, SBP_PERIODIC_EVT);" and "Util_startClock(&periodicClock);" in your application init function like SimpleBLEPeripheral_init.
    5. Add SBP_PERIODIC_EVT event processing case in for-loop of application task function like SimpleBLEPeripheral_taskFxn.

    if (events & SBP_PERIODIC_EVT)
    {
    events &= ~SBP_PERIODIC_EVT;

    Util_startClock(&periodicClock);

    // Perform your application periodic task here!!!
    }