1 Reply Latest reply on Feb 11, 2016 3:21 AM by vavc

    Passive Whitelist Observer?

    pat.dolan

      Hello,

         

      I've been looking at

         

      PSoC-4-BLE/100_Projects_in_100_Days/Day011_Central_Observer/BLE_Central_Observer/BLE_Central_Observer.cydsn/main.c

         

      on github.

         

      I want a passive observer to receive advertising packets from one particular peripheral.  I am using two CY8CKIT-042-BLE Pioneer Kits, one is the observer and the other is a peripheral.  My packet sniffer indicates that the peripheral is transmitting fine.

         

      On the General tab I choose "Broadcaster/Observer" and below that I choose "observer".

         

      On the Gap tab I use the default slow and fast scan parameters.  I choose "white list only" for the filter policy setting.  For the scanning state I choose "passive".

         

      My Observer main.c file is:

         

      ******************************************

         

      #include <project.h>

         

      CYBLE_GAP_BD_ADDR_T  bdAddr;

         

      Stack_Handler( unit32 eventCode, void *eventParam )

         

      {

         

          switch ( eventCode )

         

          {

         

                           case  CYBLE_EVT_STACK_ON:

         

                           case CYBLE-EVT_GAPC_SCAN_PROGRESS_RESULT:

         

                            /*code to handle advertisement data packet placed here*/

         

                          break;

         

                          default:

         

                          break;

         

          }

         

      }

         

      int main() 

         

      {

         

           CyGlobalIntEnable;

         

      /*address of peripheral*/     

         

      bdAddr.bdAddr[0] = 0x2E;  /*LSB*/

         

      bdAddr.bdAddr[1] = 0x18;

         

      bdAddr.bdAddr[2] = 0x14;

         

      bdAddr.bdAddr[3] = 0x50;

         

      bdAddr.bdAddr[4] = 0xA0;

         

      bdAddr.bdAddr[5] = 0x00; /*MSB*/

         

      bdAddr.type = 0;

         

      CyBle_GapAddDeviceToWhiteList(&bdAddr);

         

      CyBle_Start(Stack_Handler);

         

      for(;;){

         

          CyBle_ProcessEvents();

         

      }

         

      *************************************

         

      The code compiles but the Stack never sends a CYBLE-EVT_GAPC_SCAN_PROGRESS_RESULT as far as I can tell.  I assume that the scanning starts automatically.  Also, what sort of code could I put beneath the "case CYBLE-EVT_GAPC_SCAN_PROGRESS_RESULT:" line that will output to the debugger screen so that I can verify that the Stack has sent a CYBLE-EVT_GAPC_SCAN_PROGRESS_RESULT?

         

      Thanks

        • 1. Re: Passive Whitelist Observer?
          vavc

          try adding this code in CYBLE_EVT_STACK_ON instead of main()

             

           

             

          bdAddr.bdAddr[0] = 0x2E;  /*LSB*/

             

          bdAddr.bdAddr[1] = 0x18;

             

          bdAddr.bdAddr[2] = 0x14;

             

          bdAddr.bdAddr[3] = 0x50;

             

          bdAddr.bdAddr[4] = 0xA0;

             

          bdAddr.bdAddr[5] = 0x00; /*MSB*/

             

          bdAddr.type = 0;

             

          CyBle_GapAddDeviceToWhiteList(&bdAddr);