Hi,
as I'm not familiar in programming BB I have the following problem:
I want to have a listener which listens for a special bluetooth device. So I tried it with the following code (it's just a snippet) using javax.bluetooth:
Code:
public void startApp() {
try {
LocalDevice localDevice = LocalDevice.getLocalDevice();
DiscoveryAgent discoveryAgent = localDevice.getDiscoveryAgent();
discoveryAgent.startInquiry(DiscoveryAgent.GIAC, this);
} catch (Exception e) {
}
}
public void deviceDiscovered(RemoteDevice remoteDevice, DeviceClass deviceClass) {
founded = "Discovered Device: " + remoteDevice.getFriendlyName(true);
}
public void inquiryCompleted(int num) {
}
public void servicesDiscovered(int transId, ServiceRecord[] serviceRecords) {
}
public void serviceSearchCompleted(int arg0, int arg1) {
}
When the inquiry ist completed public void inquiryCompleted(int num) is called. But I want that my BB is listening all the time for the special device. How can I do that? Do I need a loop?
Secondly as mentioned above I want to listen for a special already paired device and not for all bluetooth devices. How can I do that?
Thank you very much.