From 7b855018c9229753c4664fc76d3ea3e31bc2e29f Mon Sep 17 00:00:00 2001 From: Oliver Ruiz Dorantes Date: Thu, 21 Feb 2008 22:29:40 +0000 Subject: [PATCH] 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 --- src/bin/bt_dev_info.cpp | 68 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/bin/bt_dev_info.cpp diff --git a/src/bin/bt_dev_info.cpp b/src/bin/bt_dev_info.cpp new file mode 100644 index 0000000000..9886db4dd2 --- /dev/null +++ b/src/bin/bt_dev_info.cpp @@ -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 +#include + +#include + + +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; + } +}