7 Replies Latest reply on Jun 7, 2017 9:41 AM by e.pratt_1639216

    Newbie Question - BLE Serial Communication

    user_478787221

      I am using the UART-BLE program for central and peripheral devices, and noticed the use of the friendly name "BLE_Serial" for setting up advertising packets in the peripheral device in the GUI that is provided.  However, if I search for BLE_Serial programmatically, I don't see it in any of the files.  I assume this is how the devices pair automatically, be see it neither in the set of files for peripheral or central devices.   Thinking instead they are using the public address to pair, I also search for either of these identifiers but don't seem them codified either.   Not certain therefore why 1) these values are found in the gui but no where to be seen in the code, and 2) what exactly is the central device receiving that lets it know it automatically wants to pair and communicate with the peripheral device.

        • 1. Re: Newbie Question - BLE Serial Communication
          anpm

          Hi Jim,

             

          In the UART BLE projects, the devices (central and peripheral) is getting connected automatically by checking the scan response data (manufacture specific data). Not by checking the BLE device name of peripheral.

             

          Check the comparison done in CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT event. If the data matches, we are setting a flag peerDeviceFound true and is sending connect request if the flag sets.

             

          Thanks & Regards,
          Anjana

          • 2. Re: Newbie Question - BLE Serial Communication
            cypress_1675071

            I have changed the 'Device Name' to something different in the GAP Settings tab for the peripheral server workspace.

               

            However, I also still see 'BLE_Serial' shown during CySmart connecting as well as when scanning using LightBlue Explorer iOS app from PunchThrough Design.

               

            Where is this text string defined and how can it be changed?

               

            Not sure if this string is cached somewhere on the iPhone since the module was probably called 'BLE_Serial' at one point in time.

            • 3. Re: Newbie Question - BLE Serial Communication
              jrow

              Hi John,

                 

              iOS does cache the name. Basically, the internal CoreBluetooth APIs provides a ".name" property on a peripheral device object that appears in the scan. This value will be:

                 
                    
              1. Whatever is in the "Device Name" GATT characteristic if the peripheral has connected before, OR
              2.     
              3. Whatever is in the advertisement/scan response data if the peripheral has not connected before but has a Name field in the adv/scanrsp data, OR
              4.     
              5. Empty if the peripheral has never been connected and has not provided any Name data in advertisements yet
              6.    
                 

              ...in that order. However, scan result structures also provide direct access to the advertised name value separately, which will contain whatever is actually in the advertisement or scan response data even if it is not the same as what's in the (cached) GATT structure. Usually mobile apps use what is in the .name property on the object for simplicity. It is possible to write code that pulls the name from advertisement data first (if possible), but usually this is overkill since most production apps don't need to worry about a dynamically changing name.

                 

              In your case, you should be able to clear the iOS cache for that device by (1) cycling Bluetooth off and back on again, and/or (2) removing that device's bond info from the phone in Bluetooth Settings, if it has bonded before.

                 

              Jeff

              • 4. Re: Newbie Question - BLE Serial Communication
                cypress_1675071

                Ok Jeff.

                   

                I already tried cycling the BT capability in the iOS Settings GUI. I don't remember if I ever bonded it since I used the BLE UART demo workspace verbatim which doesn't have ANCS. But, I might have bonded it during a modification test a few months ago. In any event, I would have removed it from iOS 'My Devices' list.... and it is not listed anymore.

                   

                So, not sure what's happening here. Using CySmart does indeed show the new device name in the advertised list, but when clicking on the device,,, a splash shows up with the nagging "BLE_Serial" name listed as the device being connected instead of the new device name listed in the advertised list.

                • 5. Re: Newbie Question - BLE Serial Communication
                  jrow

                  Hi John,

                     

                  You're correct that if the device isn't in the list, then there's no current bond data stored. I just searched for additional relevant info online, and this Apple Developer Forum post indicates that you actually have to reset the iOS device in order to clear the cache that includes the name:

                     

                  https://forums.developer.apple.com/thread/19381

                     

                  Someone on staff at Apple said so in the confirmed answer. So, I would try rebooting and see if that takes care of it.

                     

                  Jeff

                  • 6. Re: Newbie Question - BLE Serial Communication
                    ranjit.ombale

                    hello jrow And Anjana Murlidharan

                       

                    I Have Problem Related with Write And Read Data From App Using BLE CYBL-10161

                       

                    In My Project I use The Third Party App, When I Connect The BLE to App It Get Connected Successfully,And After That App Shows "" Reading System Please Wait.."".

                       

                    This means that App Asking For Or Wants To  Read Some Attributes From BLE( I'm Replacing Previous BLE with CYBL-10161 BLE With Same App),

                       

                    So Can I know that Exactly Which Attribute App Ask Or Want's To Read.

                       

                    And I Also Wants To Know Exactly Which Event Occur When App Ask Or Wants To Read Attribute

                       

                    My Project Stuck Here

                       

                    ""When BLE Wants To Write Data On App And When App Wants To Read Data From BLE"".

                       

                    I'm New To Cypress BLE's.

                       

                    Please Give Your Valuable Response To me.

                    • 7. Re: Newbie Question - BLE Serial Communication
                      e.pratt_1639216

                      Look under the BLE_Stack.h file for the event CYBLE_EVT_GATTC_READ_ events, as those will be related with the different methods of the app reading data from the chip.

                         

                      When one of the events occurs, they will have associated event parameters that will describe what is being read/requested, and other related information.