7 Replies Latest reply on Oct 16, 2017 12:45 AM by yssu

    Help with Observer Role

    user_478787221

      I have one Pioneer Kit I have set up as Broadcaster.    This broadcaster can be seen by Cysmart app.    I can also see this broadcaster using the 100 proj 100 days Observer project on a second Pioneer Kit.   But I am unable to see it in my program which uses the same constructs as the Observer program.  In fact, if I cut and paste the section of code from the Observer project under the CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT case statement, into my own code, I still don't see my broadcaster reported, with code that works in another project.

       

      I see broadcasts from other sources, all of type RANDOM generated addresses, but I don't see my broadcaster which is PUBLIC.   Note that I am not a dedicated Observer, as is the case with the Observer project.  

       

      Also, in the original code, when my device is an advertiser and not a broadcaster, this information IS picked up by me.   It is only when I am broadcasting that I am unable to detect anything.

       

      Any idea why this might be happening, why I am not able to pick up my broadcasts?

        • 1. Re: Help with Observer Role
          user_478787221

          A little more information on this.  I was thinking that scanning was scanning, whether you were scanning for advertisement packets to potentially make a connection or for broadcasts when acting like an observer.  Documentation says that your scanType must equal Passive(0x00) when you are acting as an observer and that your scanType must equal Active(0x01) when an active scanner for establishing a connection.   Clouding this however is that statement that as a passive device, you only receive partial transmission - without scan response data - while as an Active scanner, you generally get both Advertising and Scan Response Data.

           

          I have one device set up as a Broadcaster.  This is picked up by Cysmart and by the Observer Project (100 project 100 days), but it is NOT picked up by the Central/Observer Project (100 project 100 days) nor by my code.  Interestingly, the scanner in the Observer Project which does work is set to active scanning, not passive, which contradicts the statement made in the documentation.    Also apparent is that fact that there is a problem with the Central/Observer Project and it is not functioning as intended.

           

          I wondered about the Radio button in the Observer Project - selecting Observer.   It must be setting a mode somewhere so it is behaving normally as an observer.   I have been reading the documentation on the EZ Serial and it does imply there are different mode settings for Central Role.

           

           

          Is this the difference?  Is this why I am not seeing broadcasters, since I still am operating in General Discovery Mode?  But how is this changed in code?  I can see how they change it using the EZ serial platform, but what if I am not using this platform?  Also, if scanning and observing really require two different states, how does it appear that Cysmart is doing both simultaneously.  This is really the behavior I desire.   I really don't want to have to stop scanning before I can start scanning via a required state change.

          • 2. Re: Help with Observer Role
            user_478787221

            Correction:  I really don't want to have to stop scanning before I can start OBSERVING via a required state change.

            • 3. Re: Help with Observer Role
              yssu

              Hi James,

               

              Let me try to clarify a few things for you.

              1) There are 3 types of discovery mode during advertisements: General, Limited and Non-discoverable

              2) Broadcasters have discovery mode set to Non-discoverable

              3) There are 3 types of discovery procedure during scanning: Limited, General and Observation

              4) Observers have discovery procedure set to Observation

               

              Now comes the important part:

              5) Devices performing observation receives data from devices performing advertisement or broadcast in all 3 modes, namely general, limited and non-discoverable.

              6) Devices scanning with discovery procedure set to General receives data from devices performing general advertisement or limited advertisement.

              7) Devices scanning with discovery procedure set to Limited receives data from only from devices performing limited advertisement.

               

              Also, Active and Passive scanning have nothing to do with the discovery procedure. This is a separate parameter and has nothing to do with the discovery procedure.

              • 4. Re: Help with Observer Role
                user_478787221

                Thank you.  What is the procedure (i.e., mode change) to switch me from scanning with discovery procedure set to General to Devices performing observation?  This is what I am missing.  And I assume that I have to stop scanning before actually changing modes.

                • 5. Re: Help with Observer Role
                  user_478787221

                  By the way, this is where I got the passive versus active.  Can you explain?   This is from Page 113 of the BLE Component Datasheet.  Under the CyBle_GapcStartScan() procedure

                   

                   

                  ·         Observation procedure: A device performing the observer role receives only advertisement data from devices irrespective of their discoverable mode settings. Advertisement data received is provided by the event, CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT. This procedure requires the scanType sub parameter to be passive scanning.

                   

                   

                  ·         General Discovery procedure: A device performing the general discovery procedure receives the advertisement data and scan response data from devices in both limited discoverable mode and the general discoverable mode. Received data is provided by the event, CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT. This procedure requires the scanType sub-parameter to be active scanning.

                   

                   

                  Clearly, they are implying that the scan type is reliant on passive versus active, though I agree with you, it does not seem to be.

                  • 6. Re: Help with Observer Role
                    user_478787221

                    OK,   there does appear to be a bug in the Central/Observer (<100 projects/100 days) which prevents the device from acting like an Observer. The mode change was never implemented, so my broadcaster was never detected. 

                     

                    Make certain you are not scanning (CyBle_GapcStopScan(); )  for change to take effect.  Then 

                     

                    CYBLE_GAPC_DISC_INFO_T                   cyBle_discoveryInfo;

                     

                    cyBle_discoveryInfo.discProcedure = CYBLE_GAPC_OBSER_PROCEDURE;

                    //This should trigger CYBLE_EVT_GAPC_SCAN_START_STOP again

                    CyBle_GapcStartDiscovery(&cyBle_discoveryInfo);

                     

                    To change back to normal scanning mode, again you must stop observing/scanning (CyBle_GapcStopScan();)   Then you can either

                     

                    cyBle_discoveryInfo.discProcedure = CYBLE_GAPC_GEN_DISC_PROCEDURE; for general discovery.

                    //This should trigger CYBLE_EVT_GAPC_SCAN_START_STOP again

                    CyBle_GapcStartDiscovery(&cyBle_discoveryInfo);

                     

                    Or you can simply:

                     

                    CyBle_GapcStartScan(CYBLE_SCANNING_FAST);

                    • 7. Re: Help with Observer Role
                      yssu

                      Actually, the spec says:

                      "A device performing the observation procedure may use passive scanning or active scanning to receive advertising events."

                      and regarding limited and general discovery, it says "The Host should configure the Controller to use active scanning."

                       

                      However, the word should is used to indicate that among several possibilities one is recommended as particularly suitable without mentioning or excluding others.

                       

                      I guess that's why the datasheet says so. I understand, it's a bit confusing.