Class name starts with uppercase/ style
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30336 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
3861c65e89
commit
620b8b6e4c
|
@ -1,8 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
* Copyright 2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
||||||
*
|
|
||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -27,8 +25,10 @@ DumpInfo(LocalDevice* device)
|
||||||
classString << " |";
|
classString << " |";
|
||||||
cod.GetMinorDeviceClass(classString);
|
cod.GetMinorDeviceClass(classString);
|
||||||
printf("\t\t%s: \n", classString.String());
|
printf("\t\t%s: \n", classString.String());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
LocalDeviceError(status_t status)
|
LocalDeviceError(status_t status)
|
||||||
{
|
{
|
||||||
|
@ -53,14 +53,14 @@ main(int argc, char *argv[])
|
||||||
// show all devices
|
// show all devices
|
||||||
LocalDevice* ld = NULL;
|
LocalDevice* ld = NULL;
|
||||||
|
|
||||||
printf("Listing %ld Bluetooth Local Devices ...\n", LocalDevice::GetLocalDeviceCount());
|
printf("Listing %ld Bluetooth Local Devices ...\n",
|
||||||
|
LocalDevice::GetLocalDeviceCount());
|
||||||
for (uint32 index = 0 ; index < LocalDevice::GetLocalDeviceCount() ; index++) {
|
for (uint32 index = 0 ; index < LocalDevice::GetLocalDeviceCount() ; index++) {
|
||||||
|
|
||||||
ld = LocalDevice::GetLocalDevice();
|
ld = LocalDevice::GetLocalDevice();
|
||||||
if (ld == NULL)
|
if (ld == NULL)
|
||||||
return LocalDeviceError(ENODEV);
|
return LocalDeviceError(ENODEV);
|
||||||
DumpInfo(ld);
|
DumpInfo(ld);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <bluetooth/LocalDevice.h>
|
|
||||||
#include <bluetooth/bdaddrUtils.h>
|
#include <bluetooth/bdaddrUtils.h>
|
||||||
|
#include <bluetooth/LocalDevice.h>
|
||||||
|
|
||||||
#include <bluetooth/DeviceClass.h>
|
#include <bluetooth/DeviceClass.h>
|
||||||
#include <bluetooth/DiscoveryAgent.h>
|
#include <bluetooth/DiscoveryAgent.h>
|
||||||
|
@ -15,11 +15,12 @@
|
||||||
|
|
||||||
thread_id mainThread;
|
thread_id mainThread;
|
||||||
|
|
||||||
class simpleDiscoveryListener : public DiscoveryListener {
|
class SimpleDiscoveryListener : public DiscoveryListener {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
simpleDiscoveryListener() : DiscoveryListener()
|
SimpleDiscoveryListener()
|
||||||
|
: DiscoveryListener()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,13 +31,15 @@ DeviceDiscovered(RemoteDevice* btDevice, DeviceClass cod)
|
||||||
{
|
{
|
||||||
BString classString;
|
BString classString;
|
||||||
|
|
||||||
printf("\t%s: Device %s discovered.\n",__FUNCTION__, bdaddrUtils::ToString(btDevice->GetBluetoothAddress()));
|
printf("\t%s: Device %s discovered.\n",__FUNCTION__,
|
||||||
|
bdaddrUtils::ToString(btDevice->GetBluetoothAddress()));
|
||||||
|
|
||||||
cod.GetServiceClass(classString);
|
cod.GetServiceClass(classString);
|
||||||
classString << " |";
|
classString << " |";
|
||||||
cod.GetMajorDeviceClass(classString);
|
cod.GetMajorDeviceClass(classString);
|
||||||
classString << " |";
|
classString << " |";
|
||||||
cod.GetMinorDeviceClass(classString);
|
cod.GetMinorDeviceClass(classString);
|
||||||
|
|
||||||
printf("\t\t%s: \n", classString.String());
|
printf("\t\t%s: \n", classString.String());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,10 +47,8 @@ DeviceDiscovered(RemoteDevice* btDevice, DeviceClass cod)
|
||||||
void
|
void
|
||||||
InquiryCompleted(int discType)
|
InquiryCompleted(int discType)
|
||||||
{
|
{
|
||||||
|
|
||||||
printf("\t%s: Inquiry process has finished ...\n",__FUNCTION__);
|
printf("\t%s: Inquiry process has finished ...\n",__FUNCTION__);
|
||||||
(void)send_data(mainThread, discType, NULL, 0);
|
(void)send_data(mainThread, discType, NULL, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,7 +76,7 @@ DumpInfo(LocalDevice* device)
|
||||||
(device->GetFriendlyName()).String(),
|
(device->GetFriendlyName()).String(),
|
||||||
bdaddrUtils::ToString(device->GetBluetoothAddress()));
|
bdaddrUtils::ToString(device->GetBluetoothAddress()));
|
||||||
|
|
||||||
simpleDiscoveryListener* dListener = new simpleDiscoveryListener();
|
SimpleDiscoveryListener* dListener = new SimpleDiscoveryListener();
|
||||||
|
|
||||||
dAgent->StartInquiry(BT_GIAC, dListener);
|
dAgent->StartInquiry(BT_GIAC, dListener);
|
||||||
|
|
||||||
|
@ -87,12 +88,14 @@ DumpInfo(LocalDevice* device)
|
||||||
for (int32 index = 0 ; index < dAgent->RetrieveDevices(0).CountItems(); index++ ) {
|
for (int32 index = 0 ; index < dAgent->RetrieveDevices(0).CountItems(); index++ ) {
|
||||||
|
|
||||||
RemoteDevice* rDevice = dAgent->RetrieveDevices(0).ItemAt(index);
|
RemoteDevice* rDevice = dAgent->RetrieveDevices(0).ItemAt(index);
|
||||||
printf("\t%s \t@ %s ...\n", rDevice->GetFriendlyName(true).String(), bdaddrUtils::ToString(rDevice->GetBluetoothAddress()));
|
printf("\t%s \t@ %s ...\n", rDevice->GetFriendlyName(true).String(),
|
||||||
|
bdaddrUtils::ToString(rDevice->GetBluetoothAddress()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
LocalDeviceError(status_t status)
|
LocalDeviceError(status_t status)
|
||||||
{
|
{
|
||||||
|
@ -105,7 +108,6 @@ LocalDeviceError(status_t status)
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
mainThread = find_thread(NULL);
|
mainThread = find_thread(NULL);
|
||||||
|
|
||||||
if (argc == 2) {
|
if (argc == 2) {
|
||||||
|
@ -120,7 +122,8 @@ main(int argc, char *argv[])
|
||||||
// show all devices
|
// show all devices
|
||||||
LocalDevice* device = NULL;
|
LocalDevice* device = NULL;
|
||||||
|
|
||||||
printf("Performing discovery for %ld Bluetooth Local Devices ...\n", LocalDevice::GetLocalDeviceCount());
|
printf("Performing discovery for %ld Bluetooth Local Devices ...\n",
|
||||||
|
LocalDevice::GetLocalDeviceCount());
|
||||||
|
|
||||||
for (uint32 index = 0 ; index < LocalDevice::GetLocalDeviceCount() ; index++) {
|
for (uint32 index = 0 ; index < LocalDevice::GetLocalDeviceCount() ; index++) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue