-
C / Bluetooth Question
Hello All Forum Goers,
I am a programmer at an intermediate level. I am at the moment developing an application that is going to be used in a Bluetooth busy environment.
I am wondering if it is possible to narrow down what a BT Devices searches for in a Bluetooth busy environment.
Is it possible to distinguish BT enabled phone device from a BT enabled GPS when scanning (Discovering).
I have being investigating this myself and I have come across one possible solution of checking the Device Class Attribute and coupling this attribute with Bluetooth Assigned Numbers(https://programs.bluetooth.org/apps/...?doc_id=49709). I have found this code in java which is below but was wndering if this is possible with an non OO language i.e. C :,
---------------------------------------------------------------------------------------------------
Code:
public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) {
System.out.println("Found device = " + btDevice.getBluetoothAddress());
/*
* Since service search takes time and we are already forced to
* complete an inquiry, we will not do a service
* search on any device that is not an Imaging device.
* The device class of 0x600 is Imaging as
* defined in the Bluetooth Assigned Numbers document.
*/
// if (cod.getMajorDeviceClass() == 0x600) {
/*
* Imaging devices could be a display, camera, scanner, or
* printer. If the imaging device is a printer,
* then bit 7 should be set from its minor device
* class according to the Bluetooth Assigned
* Numbers document.
*/
// if ((cod.getMinorDeviceClass() & 0x80) != 0) {
/*
* Now we know that it is a printer. Now we will verify that
* it has a rendering service on it. A rendering service may
* allow us to print. We will have to do a service search to
* get more information if a rendering service exists. If this
* device has a rendering service then bit 18 will be set in
* the major service classes.
*/
// if ((cod.getServiceClasses() & 0x40000) != 0) {
deviceList.addElement(btDevice);
// }
// }
// }
}
----------------------------------------------------------------------------------------------------
Thanks,
Michael
-
Quite nearly everything you can do in OO you can do in C, the question is how much harder it would be.
In your case, the body of the method seems like it could almost be ported as is, but instead as receiving an object as a parameter, you'd have to receive a majorDeviceClass, a minorDeviceClass and a serviceClasses (which all appear to be integers).
With that being said, I don't know what additional info is contained in the btDevice and the DeviceClass classes, so it could make the problem a little more difficult.
-
C / Bluetooth Question
Thanks a million,
Just as it happens C is my third language so not really up on the Bluetooth Libraries etc. I have taken this job just to get my foot in the door as i really like the C language. Could you lead me to any bluetooth Libraries where i could get more info on this "Device Class Attribute". This would be much easier in an OO language but execution time is extremly important here so C is my choice,
Thanks for your speedy reply,
Michael
-
Here's an open source, C Bluetooth library for linux. I don't know if that'll help you out, but the rest you'll have to google and find on your own.
-
C / Bluetooth Question
Thanks a Million for your replies,
I will have a look through this. I have being "Googling" this alot but not much seems to be popping up. Any else that has a comment to make or any sample code that i could start off with would help me out big time,
Thanks for yer time,
Michael
-
C / Bluetooth Question
Before this message leaves the main page and never seen again!!!!!!!!!!!!!!,
Could anyone provide some pseudocode that i could use to start me off!!!
Thanks,
Michael
-
-
C / Bluetooth
Okaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaay,
Michael