BLE central device connecting to mobile peripheral advertisements?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
rotu_3236376
Level 3
Level 3
First like received

Hello all-

I have technial question regarding Cypress semiconductors.  That I hope I can get some clarity on. 

I was given a custom made device supporting Bluetooth 4 standard BLE.  The device has the Cypress BLE semiconductor built in and we are  have a Cypress USB dongle for accessing and connecting to it, this one:

http://www.cypress.com/documentation/development-kitsboards/cy5670-cysmart-usb-dongle

The connection and communcation is setup up with Bluetooth 4.0. 

The device is programmed in central mode and the dongle is configured in peripheral mode.  The connection between the processor and BLE module is a universal "pass-through" type of link (RS232).

I have been asked to build a mobile application (Android & iOS) that can be programmed as a peripheral to replicate the actions of the dongle.  My question is what are some of the minimal requirements needed to pass with my peripheral advertisments? And how will the connection will be made. I have an app developed and advertising but I am not sure what advertising data needs to be discovered by the device for the semiconductor. 

I have some screenshots of the Profile and GAP settings that the USB dongle was programmed in.  I also have PSOC programmer and CySmart installed along with the actual dongle.  I am trying to replicate the same settings within my mobile application but I cannot tell if the device is discovering it.  Here is a look at the data I passing for Advertisement:

{

      service: "CDD0",

      name: "BLE_Serial",

      characteristics: [

        {

          uuid: "CDD1",

          permissions: {

            read: true,

            write: true,

            //readEncryptionRequired: true,

            //writeEncryptionRequired: true,

          },

          properties : {

            read: true,

            writeWithoutResponse: true,

            write: true,

            notify: true,

            //indicate: true,

            //authenticatedSignedWrites: true,

            //notifyEncryptionRequired: true,

            //indicateEncryptionRequired: true,

          }

        },

        {

          uuid: "CDD2",

          permissions: {

            read: true,

            write: true,

            //readEncryptionRequired: true,

            //writeEncryptionRequired: true,

          },

          properties : {

            read: true,

            writeWithoutResponse: true,

            write: true,

            notify: true,

            //indicate: true,

            //authenticatedSignedWrites: true,

            //notifyEncryptionRequired: true,

            //indicateEncryptionRequired: true,

          }

        }

      ]

    }

Overall, is this effort actually feasible or is there limitations with the semiconductor that would prevent this from working?  And have anything similar to this been done before?   Any information anyone can provide would be greatly appreciated.  I feel this is possible but I also dont want to keep spinning my wheels.

Thanks all in advance.

Ron

0 Likes
1 Solution

Good news!  I am now able to see my service.  Apparently that function doesnt get called on my Samsung S7 but it does work on my daughter's LG VS501.   No idea why because both phones are Android 7.0 w/ API 24.  Now its time for me to test out the device connectivity.

Now I can see my custom service:

phone-connected.png

View solution in original post

8 Replies
Anonymous
Not applicable

What you are trying to do should work easily and simply.

The custom device/cypress application will be deciding whether to connect, and what services/data to use for making decisions; this means that the application could be making decisions on a flag in the advertisements, a decision on discovering services upon connection, or something else.

If you can post the application, we could look through it and tell you exactly how it interacts, but without the central-device's code, it would be seeing what it works with using trial and error.

Essentially, you will need to mimic the attributes, services, and advertisements of the dongle with the phone, and have the data be in the same formats.

If there are no tricky behaviors (like requiring a read to a certain attribute before a write to another attribute works, etc.), then it should be straightforward of mimicking what you can see when scanning and connecting/reading the peripheral(s).

0 Likes

Thank you for your response.  And it confirms precisely my intial thoughts and approach to this.  Unfortunately I do not have the source code written for the custom device.  But the source code written on the mobile device is producing standard BLE advertising packets (using Java).  I think you are spot on with the fact that I need to mimick the attributes, services, characteristic, etc of the dongle and this has been my approach. 

I will continue to take the trial/error approach until I achieve the results I am expecting.  I will keep this question open for now and update everyone with the progress.  I might even post the code as it may be useful for other projects in the future.  As I was hoping something similar already existed but am unable to find anything.

0 Likes
Anonymous
Not applicable

😕

If you use a custom central device like cysmart to connect to the advertising dongle, you can read/discover the services on the device and the attributes/values to see how the structure is at least setup to begin with. This would remove all of the guessing for which services are present, and merely change to how to interact with the services/attributes from the backend of the custom code.

There is a USB dongle like the CY5670 that allows you to manually control a central BLE device and read/write data to another BLE device without needing to run it through a command-line. CY5670: CySmart USB Dongle

0 Likes

Here is an update...

Still stuck with this puzzle unfortunately.  But progress has been made.  I was able to create a Peripheral Gatt server on my Android phone that closely replicates the same properties being advertised from the Dongle.  However, I am unable to see my custom service eventhough the Java code compiles and shows that the service has been added.  While I believe this is just a development limitation on my part, I am still not certain that my device with the Cypress Semiconductor will actually view the phone app in the same way it views the dongle.

Below are some comparison screenshots that compare the similarities:

Dongle Advertising
dongle-advertising.png
  Phone Advertising
phone-advertising.png
Dongle Connected
dongle-connected.png
Phone Connected
phone-connected.png

Notice that I am missing the "Unknown Service" which is the only service I am actually trying to connect to from the device.

FYI - I am using the Nordic NRF Connect App to inspect all the services attributes and characteristics.

0 Likes
Anonymous
Not applicable

Yeah, the unknown service would be what you need to mimic on the phone. The BR/EDR flags for the phone should be fine btw (They just signal compatibility for the different bluetooth modes/versions. And the LE ones are enabled on both and should work.)

You are going to want to mimic the services attributes (variables basically) available, and how they read/write/interact. Also, making the UUID EXACTLY the same is probably important to make sure the central/cypress device gets a positive match when comparing.

0 Likes

Good news!  I am now able to see my service.  Apparently that function doesnt get called on my Samsung S7 but it does work on my daughter's LG VS501.   No idea why because both phones are Android 7.0 w/ API 24.  Now its time for me to test out the device connectivity.

Now I can see my custom service:

phone-connected.png

Just want to close this out... I am able to make a successful connection to my mobile device.  Everything is working as expected now. Thank you!

  successful-writes-after-connection-Dongle.png

Anonymous
Not applicable

Nice job! Congratulations!

0 Likes