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.

peripheral+broadcaster issue

Other Parts Discussed in Thread: BLE-STACK

Hi,
I am experiencing a strange issue in the Keyfob peripheral+ broadcaster(keyfob project) device. If i connect keyfob with the master i.e. mobile app and then if i change the scan response of the peripheral + broadcaster, then after disconnection from the master i.e. mobile app keyfob  advertises scannable undirected advertisement instead of connectable undirect advertisement.
Please let me know what is happening or if there is any configuration to be done.

it is a very critical issue in my project,please rply!

Thanks

  • Hello. I assume you are referring to the PLUS_BROADCASTER define in the keyfob project. I just performed the following without any issues:
    1. Scan for the keyfob.
    2. Connect to the keyfob.
    3. Disconnect to the keyfob.
    4. Scan for and reconnect to the keyfob.

    I was able to do this continuously. Have you made any modifications to the keyfob project?
  • Hi,

    Yes I am referring to PLUS_BROADCASTER define in the keyfob project. The only difference i made in the stack is after connection the broadcaster was advertising undirected non-scannble advertisement which i changed to scannable undirected advertisement.

    Just for your information even i checked scanning and connecting and then disconnecting and then again repeating the same it works fine untill i change the scan response data after connection.

    Let me explain you the scenario

    Suppose my scan resp data contains" name + 1 data byte". The data of data byte changes either to 0x01 or 0x00. Now if the scan resp data was "name+0x00" and then if i try to connect it connects successfully but during disconnection if the scan resp data has been changed to "name+0x01"  then after disconnection the device just advertise Scannable undirected advertisement instead of  connectable undirected advertisement.

    whereas if i keep the scan resp data at the time of connection as well at the during disconnection the ble works fine.

    Regards

    Vidula Badhe

  • Hello,

    Any Update or suggestion??

  • Can you post the code changes that you have made?
  • following changes made in peripheralbroadcaster.c

    /////////////////////////////////////////////////////////////////////////////////////////////////////////
    if ( events & START_ADVERTISING_EVT ) { if ( gapRole_AdvEnabled ) { gapAdvertisingParams_t params; // Setup advertisement parameters if ( gapRole_state == GAPROLE_CONNECTED ) { // While in a connection, we can only advertise non-connectable undirected. // params.eventType = GAP_ADTYPE_ADV_NONCONN_IND; params.eventType = GAP_ADTYPE_ADV_SCAN_IND; <<<<<<<< ..................... CHANGE } else if(gapRole_state == GAPROLE_WAITING ) { params.eventType = GAP_ADTYPE_ADV_IND; } else { params.eventType = gapRole_AdvEventType; params.initiatorAddrType = gapRole_AdvDirectType; VOID osal_memcpy( params.initiatorAddr, gapRole_AdvDirectAddr, B_ADDR_LEN ); } params.channelMap = gapRole_AdvChanMap; params.filterPolicy = gapRole_AdvFilterPolicy; if ( GAP_MakeDiscoverable( gapRole_TaskID, &params ) != SUCCESS ) { gapRole_state = GAPROLE_ERROR; if ( pGapRoles_AppCGs && pGapRoles_AppCGs->pfnStateChange ) { pGapRoles_AppCGs->pfnStateChange( gapRole_state ); } } } return ( events ^ START_ADVERTISING_EVT ); }



    ALSO WE ARE UPDATING SCAN RESPONSE DATA.

    SCAN RESPONSE PACKET>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    static uint8 deviceName[] =
    {
      // complete name
      0x0c,   // length of first data structure (11 bytes excluding length byte)
      0x09,   // AD Type = Complete local name 
      0x4b,   // 'K'
      0x65,   // 'e'
      0x65,   // 'e'
      0x66,   // 'f'
      0x6f,   // 'o'
      0x62,   // 'b'
      0x64,   // 'd'
      0x65,   // 'e'
      0x6d,   // 'm'
      0x6f,   // 'o'
      0x00,    // light status byte
      
      
    };
    
    THIS LINE CALLED TO CHANGE SCAN RESPONSE DATA>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> deviceName[12]=1; GAPRole_SetParameter( GAPROLE_SCAN_RSP_DATA, sizeof ( deviceName ), deviceName );
  • Hi,
    I am experiencing a strange issue in the Keyfob peripheral+ broadcaster(keyfob project) device. If i connect keyfob with the master i.e. mobile app and then if i change the scan response of the peripheral + broadcaster, then after disconnection from the master i.e. mobile app keyfob advertises scannable undirected advertisement instead of connectable undirect advertisement.
    Please let me know what is happening or if there is any configuration to be done.

    it is a very critical issue in my project,please rply!

    Thanks
  • Hello Vidula,

    Are you using the BLE-STACK 1.4.1?

    I am not sure if this is allowed in the spec, but I was able to do this on the SimpleBLEPeripheral project by adding the PLUS_BROADCASTER define (used peripheral.c instead of peripheralBroadcaster.c). I changed ADV Type in peripheral.c:

    // Setup advertisement parameters

    if ( gapRole_AdvNonConnEnabled )

    // Only advertise non-connectable undirected.

    //params.eventType = GAP_ADTYPE_ADV_NONCONN_IND;

    params.eventType = GAP_ADTYPE_ADV_SCAN_IND;

    }

    I changed one letter in the scan response when entering the connected state (simpleBLEPeripheral.c):

        case GAPROLE_CONNECTED:

    ....

    scanRspData[2] = 'P';
    GAPRole_SetParameter( GAPROLE_SCAN_RSP_DATA, sizeof ( scanRspData ), scanRspData );

    .....

    You can try to copy the implementation done in simpleBLEPeripheral.c (#ifdef PLUS_BROADCASTER sections) to keyfobdemo.c.