- Completed the command line tool. Discovers and after finishing asks the names of the discovered devices
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24989 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -20,6 +20,7 @@ public:
|
|||||||
|
|
||||||
simpleDiscoveryListener(LocalDevice *ld) : DiscoveryListener()
|
simpleDiscoveryListener(LocalDevice *ld) : DiscoveryListener()
|
||||||
{
|
{
|
||||||
|
/* TODO: Should not be needed */
|
||||||
SetLocalDeviceOwner(ld);
|
SetLocalDeviceOwner(ld);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,21 +28,23 @@ simpleDiscoveryListener(LocalDevice *ld) : DiscoveryListener()
|
|||||||
void
|
void
|
||||||
DeviceDiscovered(RemoteDevice* btDevice, DeviceClass cod)
|
DeviceDiscovered(RemoteDevice* btDevice, DeviceClass cod)
|
||||||
{
|
{
|
||||||
printf("Device Discovered!!\n");
|
printf("\t%s: Device %s discovered.\n",__FUNCTION__, bdaddrUtils::ToString(btDevice->GetBluetoothAddress()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InquiryCompleted(int discType)
|
InquiryCompleted(int discType)
|
||||||
{
|
{
|
||||||
printf("%s: Inquiry process has finished ...\n",__FUNCTION__);
|
|
||||||
|
printf("\t%s: Inquiry process has finished ...\n",__FUNCTION__);
|
||||||
|
// send_data(thread, discType, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InquiryStarted(status_t status)
|
InquiryStarted(status_t status)
|
||||||
{
|
{
|
||||||
printf("%s: Inquiry process has started ...\n",__FUNCTION__);
|
printf("\t%s: Inquiry process has started ...\n",__FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -57,24 +60,34 @@ DumpInfo(LocalDevice* device)
|
|||||||
printf("DiscoveryAgent could not be located\n");
|
printf("DiscoveryAgent could not be located\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* printf("Discovering for [LocalDevice] %s\t%s\n",
|
printf("Discovering for [LocalDevice] %s\t%s\n\n",
|
||||||
(device->GetFriendlyName()).String(),
|
(device->GetFriendlyName()).String(),
|
||||||
bdaddrUtils::ToString(device->GetBluetoothAddress()));
|
bdaddrUtils::ToString(device->GetBluetoothAddress()));
|
||||||
*/
|
|
||||||
simpleDiscoveryListener* sdl = new simpleDiscoveryListener(device);
|
simpleDiscoveryListener* sdl = new simpleDiscoveryListener(device);
|
||||||
|
|
||||||
da->StartInquiry(BT_GIAC, sdl);
|
da->StartInquiry(BT_GIAC, sdl);
|
||||||
|
|
||||||
|
printf("Press any key to retrieve names ...\n");
|
||||||
getchar();
|
getchar();
|
||||||
|
|
||||||
|
for (int32 index = 0 ; index < da->RetrieveDevices(0).CountItems(); index++ ) {
|
||||||
|
|
||||||
|
RemoteDevice* rd = da->RetrieveDevices(0).ItemAt(index);
|
||||||
|
printf("%s \t@ %s ...\n", rd->GetFriendlyName(false).String(), bdaddrUtils::ToString(rd->GetBluetoothAddress()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getchar();
|
||||||
}
|
}
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
LocalDeviceError(status_t status)
|
LocalDeviceError(status_t status)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"No Device/s found");
|
fprintf(stderr,"No Device/s found");
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user