Go Down

Topic: Nature of Bluetooth - Questions about Connecting Android and Arduino by BT (Read 1 time) previous topic - next topic


May 01, 2013, 12:26 am Last Edit: May 01, 2013, 12:28 am by 012anonymousxyz Reason: 1
I'm looking to initiate a connection between my Arduino and Android phone. I've already set up my code to test tomorrow when I get back in class, but I have a few questions about the nature of Bluetooth connections.

What is the difference between being in a "paired/bonded state" and "connected state"? And for that matter, what does it mean to be "paired."
How do the devices recognize each other? Keep reading below because this pertains to another question below (the fact that we choose our UUID).

What is a UUID? What are their applications? What are the differences the different types?
I attempted to use the bluetoothchat sample apk but I could not connect to my board. I THINK it is because of the UUID.
The android website says this:

Hint: If you are connecting to a Bluetooth serial board then try using the well-known SPP UUID 00001101-0000-1000-8000-00805F9B34FB. However if you are connecting to an Android peer then please generate your own unique UUID.

I'm just at a loss. Just... why do I need THAT UUID for serial communication? Are they pre-determined? Then why do we choose/generate other unique ones? The wiki articles and etc. are just too tough to read. All I got is that they are for identification, but it makes sense but also doesn't. Whats the point of identification if each end CHOOSES his Id? How can devices remember each other (the fact that they are "paired", and can't devices feign to be another device if they can simple say their UUID is so and so?
This leads to my last question.

If anyone has read the bluetoothChat example, how does it determine if a device is "secure" or "insecure"? I get that secure uses encrypted data transfer, but how does it decide to create a secure/insecure connection. Additionally, how is encryption method decided between the two devices.
If your not an android app designer, I will still greatly appreciate a philosophical answer.
I was able to backtrack to this part of the code:

   public boolean onOptionsItemSelected(MenuItem item) {
       Intent serverIntent = null;
       switch (item.getItemId()) {
       case R.id.secure_connect_scan:
           // Launch the DeviceListActivity to see devices and do scan
           serverIntent = new Intent(this, DeviceListActivity.class);
           startActivityForResult(serverIntent, REQUEST_CONNECT_DEVICE_SECURE);
           return true;
       case R.id.insecure_connect_scan:
           // Launch the DeviceListActivity to see devices and do scan
           serverIntent = new Intent(this, DeviceListActivity.class);
           startActivityForResult(serverIntent, REQUEST_CONNECT_DEVICE_INSECURE);
           return true;
       case R.id.discoverable:
           // Ensure this device is discoverable by others
           return true;
       return false;

Go Up