Small tool to check all the installed Bluetooth Local devices, will be usefull until we have a decent preference or a blue icon in the deskbar for testing.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24051 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Ruiz Dorantes 2008-02-21 22:29:40 +00:00
parent df05c82d14
commit 7b855018c9

68
src/bin/bt_dev_info.cpp Normal file
View File

@ -0,0 +1,68 @@
/*
* Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
*
* All rights reserved. Distributed under the terms of the MIT License.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <bluetooth/LocalDevice.h>
void
DumpInfo(LocalDevice* device)
{
}
static status_t
LocalDeviceError(status_t status)
{
// switch (status) {}
fprintf(stderr,"No Device/s found");
return status;
}
int
main(int argc, char *argv[])
{
LocalDevice* ld = NULL;
if(argc == 2) {
// device specified
ld = LocalDevice::GetLocalDevice(atoi(argv[0]));
if (ld == NULL)
return LocalDeviceError(ENODEV);
DumpInfo(ld);
} else if (argc == 1) {
// show all devices
LocalDevice* firstLocalDevice = LocalDevice::GetLocalDevice();
if (firstLocalDevice == NULL)
return LocalDeviceError(ENODEV);
printf("Listing %ld Bluetooth devices ...\n", LocalDevice::GetLocalDeviceCount());
ld = firstLocalDevice;
do {
DumpInfo(ld);
ld = LocalDevice::GetLocalDevice();
} while (ld != firstLocalDevice);
return B_OK;
} else {
fprintf(stderr,"Usage: bt_dev_info [device]\n");
return B_ERROR;
}
}