CheckStyled

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34776 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Ruiz Dorantes
2009-12-25 18:46:53 +00:00
parent 4b68462fe1
commit 1f37b29b5d
+31 -29
View File
@@ -38,15 +38,15 @@ LocalDevice::RequestLocalDeviceID(BMessage* request)
if (messenger == NULL) if (messenger == NULL)
return NULL; return NULL;
if (messenger->SendMessage(request, &reply) == B_OK && if (messenger->SendMessage(request, &reply) == B_OK
reply.FindInt32("hci_id", &hid) == B_OK ) { && reply.FindInt32("hci_id", &hid) == B_OK ) {
if (hid >= 0) if (hid >= 0)
lDevice = new (std::nothrow)LocalDevice(hid); lDevice = new (std::nothrow)LocalDevice(hid);
} }
delete messenger; delete messenger;
return lDevice; return lDevice;
} }
@@ -164,9 +164,8 @@ LocalDevice::SetDiscoverable(int mode)
BMessage request(BT_MSG_HANDLE_SIMPLE_REQUEST); BMessage request(BT_MSG_HANDLE_SIMPLE_REQUEST);
BMessage reply; BMessage reply;
size_t size; size_t size;
int8 bt_status = BT_ERROR; int8 bt_status = BT_ERROR;
request.AddInt32("hci_id", fHid); request.AddInt32("hci_id", fHid);
@@ -217,10 +216,10 @@ LocalDevice::GetBluetoothAddress()
request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_INFORMATIONAL_PARAM, request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_INFORMATIONAL_PARAM,
OCF_READ_BD_ADDR)); OCF_READ_BD_ADDR));
if (fMessenger->SendMessage(&request, &reply) == B_OK) { if (fMessenger->SendMessage(&request, &reply) == B_OK
if (reply.FindData("bdaddr", B_ANY_TYPE, 0, (const void**)&bdaddr, &ssize) == B_OK ) && reply.FindData("bdaddr", B_ANY_TYPE, 0,
(const void**)&bdaddr, &ssize) == B_OK)
return *bdaddr; return *bdaddr;
}
return bdaddrUtils::LocalAddress(); return bdaddrUtils::LocalAddress();
} }
@@ -255,11 +254,9 @@ LocalDevice::GetFriendlyName()
request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_CONTROL_BASEBAND, request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_CONTROL_BASEBAND,
OCF_READ_LOCAL_NAME)); OCF_READ_LOCAL_NAME));
if (fMessenger->SendMessage(&request, &reply) == B_OK && if (fMessenger->SendMessage(&request, &reply) == B_OK
reply.FindString("friendlyname", &friendlyname) == B_OK){ && reply.FindString("friendlyname", &friendlyname) == B_OK)
return friendlyname; return friendlyname;
}
return BString("Unknown|ServerFailed"); return BString("Unknown|ServerFailed");
} }
@@ -286,9 +283,9 @@ LocalDevice::GetDeviceClass()
request.AddInt32("hci_id", fHid); request.AddInt32("hci_id", fHid);
request.AddData("raw command", B_ANY_TYPE, command, size); request.AddData("raw command", B_ANY_TYPE, command, size);
request.AddInt16("eventExpected", HCI_EVENT_CMD_COMPLETE); request.AddInt16("eventExpected", HCI_EVENT_CMD_COMPLETE);
request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_CONTROL_BASEBAND, request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_CONTROL_BASEBAND,
OCF_READ_CLASS_OF_DEV)); OCF_READ_CLASS_OF_DEV));
if (fMessenger->SendMessage(&request, &reply) == B_OK if (fMessenger->SendMessage(&request, &reply) == B_OK
&& reply.FindData("devclass", B_ANY_TYPE, 0, (const void**)&bufferRecord, && reply.FindData("devclass", B_ANY_TYPE, 0, (const void**)&bufferRecord,
@@ -322,7 +319,8 @@ LocalDevice::SetDeviceClass(DeviceClass deviceClass)
BMessage reply; BMessage reply;
request.AddInt32("hci_id", fHid); request.AddInt32("hci_id", fHid);
request.AddData("raw command", B_ANY_TYPE, setDeviceClass.Data(), setDeviceClass.Size()); request.AddData("raw command", B_ANY_TYPE,
setDeviceClass.Data(), setDeviceClass.Size());
request.AddInt16("eventExpected", HCI_EVENT_CMD_COMPLETE); request.AddInt16("eventExpected", HCI_EVENT_CMD_COMPLETE);
request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_CONTROL_BASEBAND, request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_CONTROL_BASEBAND,
OCF_WRITE_CLASS_OF_DEV)); OCF_WRITE_CLASS_OF_DEV));
@@ -340,13 +338,15 @@ LocalDevice::ReadLocalVersion()
{ {
int8 bt_status = BT_ERROR; int8 bt_status = BT_ERROR;
BluetoothCommand<> localVersion(OGF_INFORMATIONAL_PARAM,OCF_READ_LOCAL_VERSION); BluetoothCommand<> localVersion(OGF_INFORMATIONAL_PARAM,
OCF_READ_LOCAL_VERSION);
BMessage request(BT_MSG_HANDLE_SIMPLE_REQUEST); BMessage request(BT_MSG_HANDLE_SIMPLE_REQUEST);
BMessage reply; BMessage reply;
request.AddInt32("hci_id", fHid); request.AddInt32("hci_id", fHid);
request.AddData("raw command", B_ANY_TYPE, localVersion.Data(), localVersion.Size()); request.AddData("raw command", B_ANY_TYPE,
localVersion.Data(), localVersion.Size());
request.AddInt16("eventExpected", HCI_EVENT_CMD_COMPLETE); request.AddInt16("eventExpected", HCI_EVENT_CMD_COMPLETE);
request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_INFORMATIONAL_PARAM, request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_INFORMATIONAL_PARAM,
OCF_READ_LOCAL_VERSION)); OCF_READ_LOCAL_VERSION));
@@ -361,7 +361,7 @@ LocalDevice::ReadLocalVersion()
status_t status_t
LocalDevice::ReadBufferSize() LocalDevice::ReadBufferSize()
{ {
int8 bt_status = BT_ERROR; int8 bt_status = BT_ERROR;
BluetoothCommand<> BufferSize(OGF_INFORMATIONAL_PARAM, OCF_READ_BUFFER_SIZE); BluetoothCommand<> BufferSize(OGF_INFORMATIONAL_PARAM, OCF_READ_BUFFER_SIZE);
@@ -370,7 +370,8 @@ LocalDevice::ReadBufferSize()
BMessage reply; BMessage reply;
request.AddInt32("hci_id", fHid); request.AddInt32("hci_id", fHid);
request.AddData("raw command", B_ANY_TYPE, BufferSize.Data(), BufferSize.Size()); request.AddData("raw command", B_ANY_TYPE,
BufferSize.Data(), BufferSize.Size());
request.AddInt16("eventExpected", HCI_EVENT_CMD_COMPLETE); request.AddInt16("eventExpected", HCI_EVENT_CMD_COMPLETE);
request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_INFORMATIONAL_PARAM, request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_INFORMATIONAL_PARAM,
OCF_READ_BUFFER_SIZE)); OCF_READ_BUFFER_SIZE));
@@ -385,11 +386,10 @@ LocalDevice::ReadBufferSize()
status_t status_t
LocalDevice::Reset() LocalDevice::Reset()
{ {
int8 bt_status = BT_ERROR; int8 bt_status = BT_ERROR;
BluetoothCommand<> Reset(OGF_CONTROL_BASEBAND, OCF_RESET); BluetoothCommand<> Reset(OGF_CONTROL_BASEBAND, OCF_RESET);
BMessage request(BT_MSG_HANDLE_SIMPLE_REQUEST); BMessage request(BT_MSG_HANDLE_SIMPLE_REQUEST);
BMessage reply; BMessage reply;
@@ -432,11 +432,12 @@ LocalDevice::LocalDevice(hci_id hid) : fHid(hid)
// Uncomment this out if your Broadcom dongle is not working properly // Uncomment this out if your Broadcom dongle is not working properly
// Reset(); // Perform a reset to Broadcom buggyland // Reset(); // Perform a reset to Broadcom buggyland
// Uncomment this out if your Broadcom dongle has a null bdaddr
//#define BT_WRITE_BDADDR_FOR_BCM2035 //#define BT_WRITE_BDADDR_FOR_BCM2035
#ifdef BT_WRITE_BDADDR_FOR_BCM2035 #ifdef BT_WRITE_BDADDR_FOR_BCM2035
#warning Writting broadcom bdaddr @ init.
// try write bdaddr to a bcm2035 -> will be moved to an addon // try write bdaddr to a bcm2035 -> will be moved to an addon
int8 bt_status = BT_ERROR; int8 bt_status = BT_ERROR;
BluetoothCommand<typed_command(hci_write_bcm2035_bdaddr)> BluetoothCommand<typed_command(hci_write_bcm2035_bdaddr)>
writeAddress(OGF_VENDOR_CMD, OCF_WRITE_BCM2035_BDADDR); writeAddress(OGF_VENDOR_CMD, OCF_WRITE_BCM2035_BDADDR);
@@ -451,7 +452,8 @@ LocalDevice::LocalDevice(hci_id hid) : fHid(hid)
writeAddress->bdaddr.b[5] = 0x00; writeAddress->bdaddr.b[5] = 0x00;
request.AddInt32("hci_id", fHid); request.AddInt32("hci_id", fHid);
request.AddData("raw command", B_ANY_TYPE, writeAddress.Data(), writeAddress.Size()); request.AddData("raw command", B_ANY_TYPE,
writeAddress.Data(), writeAddress.Size());
request.AddInt16("eventExpected", HCI_EVENT_CMD_COMPLETE); request.AddInt16("eventExpected", HCI_EVENT_CMD_COMPLETE);
request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_VENDOR_CMD, request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_VENDOR_CMD,
OCF_WRITE_BCM2035_BDADDR)); OCF_WRITE_BCM2035_BDADDR));