kits/bluetooth: Style cleanup, add additional vendors
Change-Id: I33ac709fe1dc759bf9b98fe94bd1820278ef33d4 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2471 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
01990a00e8
commit
19733b44fa
@@ -4,13 +4,17 @@
|
|||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "CommandManager.h"
|
|
||||||
|
|
||||||
|
#include "CommandManager.h"
|
||||||
|
|
||||||
#include <bluetooth/bluetooth_error.h>
|
#include <bluetooth/bluetooth_error.h>
|
||||||
#include <bluetooth/debug.h>
|
#include <bluetooth/debug.h>
|
||||||
|
|
||||||
inline void* buildCommand(uint8 ogf, uint8 ocf, void** param, size_t psize,
|
#include "CompanyIdentifiers.h"
|
||||||
|
|
||||||
|
|
||||||
|
inline void*
|
||||||
|
buildCommand(uint8 ogf, uint8 ocf, void** param, size_t psize,
|
||||||
size_t* outsize)
|
size_t* outsize)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
@@ -73,7 +77,8 @@ NonParameterCommandRequest(uint8 ofg, uint8 ocf, int32* result, hci_id hId,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void* buildReset(size_t* outsize)
|
void*
|
||||||
|
buildReset(size_t* outsize)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
return buildCommand(OGF_CONTROL_BASEBAND, OCF_RESET,
|
return buildCommand(OGF_CONTROL_BASEBAND, OCF_RESET,
|
||||||
@@ -81,7 +86,8 @@ void* buildReset(size_t* outsize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void* buildReadLocalName(size_t* outsize)
|
void*
|
||||||
|
buildReadLocalName(size_t* outsize)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
return buildCommand(OGF_CONTROL_BASEBAND, OCF_READ_LOCAL_NAME,
|
return buildCommand(OGF_CONTROL_BASEBAND, OCF_READ_LOCAL_NAME,
|
||||||
@@ -89,7 +95,8 @@ void* buildReadLocalName(size_t* outsize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void* buildReadClassOfDevice(size_t* outsize)
|
void*
|
||||||
|
buildReadClassOfDevice(size_t* outsize)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
return buildCommand(OGF_CONTROL_BASEBAND, OCF_READ_CLASS_OF_DEV,
|
return buildCommand(OGF_CONTROL_BASEBAND, OCF_READ_CLASS_OF_DEV,
|
||||||
@@ -97,7 +104,8 @@ void* buildReadClassOfDevice(size_t* outsize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void* buildReadScan(size_t* outsize)
|
void*
|
||||||
|
buildReadScan(size_t* outsize)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
return buildCommand(OGF_CONTROL_BASEBAND, OCF_READ_SCAN_ENABLE,
|
return buildCommand(OGF_CONTROL_BASEBAND, OCF_READ_SCAN_ENABLE,
|
||||||
@@ -105,7 +113,8 @@ void* buildReadScan(size_t* outsize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void* buildWriteScan(uint8 scanmode, size_t* outsize)
|
void*
|
||||||
|
buildWriteScan(uint8 scanmode, size_t* outsize)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
struct hci_write_scan_enable* param;
|
struct hci_write_scan_enable* param;
|
||||||
@@ -126,7 +135,8 @@ void* buildWriteScan(uint8 scanmode, size_t* outsize)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void* buildRemoteNameRequest(bdaddr_t bdaddr, uint8 pscan_rep_mode,
|
void*
|
||||||
|
buildRemoteNameRequest(bdaddr_t bdaddr, uint8 pscan_rep_mode,
|
||||||
uint16 clock_offset, size_t* outsize)
|
uint16 clock_offset, size_t* outsize)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
@@ -144,7 +154,8 @@ void* buildRemoteNameRequest(bdaddr_t bdaddr, uint8 pscan_rep_mode,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void* buildInquiry(uint32 lap, uint8 length, uint8 num_rsp, size_t* outsize)
|
void*
|
||||||
|
buildInquiry(uint32 lap, uint8 length, uint8 num_rsp, size_t* outsize)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
struct hci_cp_inquiry* param;
|
struct hci_cp_inquiry* param;
|
||||||
@@ -164,14 +175,16 @@ void* buildInquiry(uint32 lap, uint8 length, uint8 num_rsp, size_t* outsize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void* buildInquiryCancel(size_t* outsize)
|
void*
|
||||||
|
buildInquiryCancel(size_t* outsize)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
return buildCommand(OGF_LINK_CONTROL, OCF_INQUIRY_CANCEL, NULL, 0, outsize);
|
return buildCommand(OGF_LINK_CONTROL, OCF_INQUIRY_CANCEL, NULL, 0, outsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void* buildPinCodeRequestReply(bdaddr_t bdaddr, uint8 length, char pincode[16],
|
void*
|
||||||
|
buildPinCodeRequestReply(bdaddr_t bdaddr, uint8 length, char pincode[16],
|
||||||
size_t* outsize)
|
size_t* outsize)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
@@ -193,7 +206,8 @@ void* buildPinCodeRequestReply(bdaddr_t bdaddr, uint8 length, char pincode[16],
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void* buildPinCodeRequestNegativeReply(bdaddr_t bdaddr, size_t* outsize)
|
void*
|
||||||
|
buildPinCodeRequestNegativeReply(bdaddr_t bdaddr, size_t* outsize)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
struct hci_cp_pin_code_neg_reply* param;
|
struct hci_cp_pin_code_neg_reply* param;
|
||||||
@@ -211,13 +225,14 @@ void* buildPinCodeRequestNegativeReply(bdaddr_t bdaddr, size_t* outsize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void* buildAcceptConnectionRequest(bdaddr_t bdaddr, uint8 role, size_t* outsize)
|
void*
|
||||||
|
buildAcceptConnectionRequest(bdaddr_t bdaddr, uint8 role, size_t* outsize)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
struct hci_cp_accept_conn_req* param;
|
struct hci_cp_accept_conn_req* param;
|
||||||
|
|
||||||
void* command = buildCommand(OGF_LINK_CONTROL, OCF_ACCEPT_CONN_REQ,
|
void* command = buildCommand(OGF_LINK_CONTROL, OCF_ACCEPT_CONN_REQ,
|
||||||
(void**) ¶m, sizeof(struct hci_cp_accept_conn_req), outsize);
|
(void**) ¶m, sizeof(struct hci_cp_accept_conn_req), outsize);
|
||||||
|
|
||||||
if (command != NULL) {
|
if (command != NULL) {
|
||||||
param->bdaddr = bdaddr;
|
param->bdaddr = bdaddr;
|
||||||
@@ -228,14 +243,15 @@ void* buildAcceptConnectionRequest(bdaddr_t bdaddr, uint8 role, size_t* outsize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void* buildRejectConnectionRequest(bdaddr_t bdaddr, size_t* outsize)
|
void*
|
||||||
|
buildRejectConnectionRequest(bdaddr_t bdaddr, size_t* outsize)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
struct hci_cp_reject_conn_req* param;
|
struct hci_cp_reject_conn_req* param;
|
||||||
|
|
||||||
void* command = buildCommand(OGF_LINK_CONTROL, OCF_REJECT_CONN_REQ,
|
void* command = buildCommand(OGF_LINK_CONTROL, OCF_REJECT_CONN_REQ,
|
||||||
(void**)¶m, sizeof(struct hci_cp_reject_conn_req),
|
(void**)¶m, sizeof(struct hci_cp_reject_conn_req),
|
||||||
outsize);
|
outsize);
|
||||||
|
|
||||||
if (command != NULL) {
|
if (command != NULL) {
|
||||||
param->bdaddr = bdaddr;
|
param->bdaddr = bdaddr;
|
||||||
@@ -249,7 +265,9 @@ void* buildRejectConnectionRequest(bdaddr_t bdaddr, size_t* outsize)
|
|||||||
#pragma mark - INFORMATIONAL_PARAM -
|
#pragma mark - INFORMATIONAL_PARAM -
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void* buildReadLocalVersionInformation(size_t* outsize)
|
|
||||||
|
void*
|
||||||
|
buildReadLocalVersionInformation(size_t* outsize)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
return buildCommand(OGF_INFORMATIONAL_PARAM, OCF_READ_LOCAL_VERSION,
|
return buildCommand(OGF_INFORMATIONAL_PARAM, OCF_READ_LOCAL_VERSION,
|
||||||
@@ -257,7 +275,8 @@ void* buildReadLocalVersionInformation(size_t* outsize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void* buildReadBufferSize(size_t* outsize)
|
void*
|
||||||
|
buildReadBufferSize(size_t* outsize)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
return buildCommand(OGF_INFORMATIONAL_PARAM, OCF_READ_BUFFER_SIZE,
|
return buildCommand(OGF_INFORMATIONAL_PARAM, OCF_READ_BUFFER_SIZE,
|
||||||
@@ -265,7 +284,8 @@ void* buildReadBufferSize(size_t* outsize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void* buildReadBdAddr(size_t* outsize)
|
void*
|
||||||
|
buildReadBdAddr(size_t* outsize)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
return buildCommand(OGF_INFORMATIONAL_PARAM, OCF_READ_BD_ADDR,
|
return buildCommand(OGF_INFORMATIONAL_PARAM, OCF_READ_BD_ADDR,
|
||||||
@@ -273,88 +293,6 @@ void* buildReadBdAddr(size_t* outsize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* bluetoothManufacturers[] = {
|
|
||||||
"Ericsson Technology Licensing",
|
|
||||||
"Nokia Mobile Phones",
|
|
||||||
"Intel Corp.",
|
|
||||||
"IBM Corp.",
|
|
||||||
"Toshiba Corp.",
|
|
||||||
"3Com",
|
|
||||||
"Microsoft",
|
|
||||||
"Lucent",
|
|
||||||
"Motorola",
|
|
||||||
"Infineon Technologies AG",
|
|
||||||
"Cambridge Silicon Radio",
|
|
||||||
"Silicon Wave",
|
|
||||||
"Digianswer A/S",
|
|
||||||
"Texas Instruments Inc.",
|
|
||||||
"Parthus Technologies Inc.",
|
|
||||||
"Broadcom Corporation",
|
|
||||||
"Mitel Semiconductor",
|
|
||||||
"Widcomm, Inc.",
|
|
||||||
"Zeevo, Inc.",
|
|
||||||
"Atmel Corporation",
|
|
||||||
"Mitsubishi Electric Corporation",
|
|
||||||
"RTX Telecom A/S",
|
|
||||||
"KC Technology Inc.",
|
|
||||||
"Newlogic",
|
|
||||||
"Transilica, Inc.",
|
|
||||||
"Rohde & Schwartz GmbH & Co. KG",
|
|
||||||
"TTPCom Limited",
|
|
||||||
"Signia Technologies, Inc.",
|
|
||||||
"Conexant Systems Inc.",
|
|
||||||
"Qualcomm",
|
|
||||||
"Inventel",
|
|
||||||
"AVM Berlin",
|
|
||||||
"BandSpeed, Inc.",
|
|
||||||
"Mansella Ltd",
|
|
||||||
"NEC Corporation",
|
|
||||||
"WavePlus Technology Co., Ltd.",
|
|
||||||
"Alcatel",
|
|
||||||
"Philips Semiconductors",
|
|
||||||
"C Technologies",
|
|
||||||
"Open Interface",
|
|
||||||
"R F Micro Devices",
|
|
||||||
"Hitachi Ltd",
|
|
||||||
"Symbol Technologies, Inc.",
|
|
||||||
"Tenovis",
|
|
||||||
"Macronix International Co. Ltd.",
|
|
||||||
"GCT Semiconductor",
|
|
||||||
"Norwood Systems",
|
|
||||||
"MewTel Technology Inc.",
|
|
||||||
"ST Microelectronics",
|
|
||||||
"Synopsys",
|
|
||||||
"Red-M (Communications) Ltd",
|
|
||||||
"Commil Ltd",
|
|
||||||
"Computer Access Technology Corporation (CATC)",
|
|
||||||
"Eclipse (HQ España) S.L.",
|
|
||||||
"Renesas Technology Corp.",
|
|
||||||
"Mobilian Corporation",
|
|
||||||
"Terax",
|
|
||||||
"Integrated System Solution Corp.",
|
|
||||||
"Matsushita Electric Industrial Co., Ltd.",
|
|
||||||
"Gennum Corporation",
|
|
||||||
"Research In Motion",
|
|
||||||
"IPextreme, Inc.",
|
|
||||||
"Systems and Chips, Inc",
|
|
||||||
"Bluetooth SIG, Inc",
|
|
||||||
"Seiko Epson Corporation",
|
|
||||||
"Integrated Silicon Solution Taiwain, Inc.",
|
|
||||||
"CONWISE Technology Corporation Ltd",
|
|
||||||
"PARROT SA",
|
|
||||||
"Socket Communications",
|
|
||||||
"Atheros Communications, Inc.",
|
|
||||||
"MediaTek, Inc.",
|
|
||||||
"Bluegiga", /* (tentative) */
|
|
||||||
"Marvell Technology Group Ltd.",
|
|
||||||
"3DSP Corporation",
|
|
||||||
"Accel Semiconductor Ltd.",
|
|
||||||
"Continental Automotive Systems",
|
|
||||||
"Apple, Inc.",
|
|
||||||
"Staccato Communications, Inc."
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const char* linkControlCommands[] = {
|
const char* linkControlCommands[] = {
|
||||||
"Inquiry",
|
"Inquiry",
|
||||||
"Inquiry Cancel",
|
"Inquiry Cancel",
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -20,12 +20,17 @@ void
|
|||||||
DeviceClass::GetServiceClass(BString& serviceClass)
|
DeviceClass::GetServiceClass(BString& serviceClass)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
static const char *services[] = { B_TRANSLATE_MARK("Positioning"),
|
static const char *services[] = {
|
||||||
B_TRANSLATE_MARK("Networking"), B_TRANSLATE_MARK("Rendering"),
|
B_TRANSLATE_MARK("Positioning"),
|
||||||
B_TRANSLATE_MARK("Capturing"), B_TRANSLATE_MARK("Object transfer"),
|
B_TRANSLATE_MARK("Networking"),
|
||||||
B_TRANSLATE_MARK("Audio"), B_TRANSLATE_MARK("Telephony"),
|
B_TRANSLATE_MARK("Rendering"),
|
||||||
B_TRANSLATE_MARK("Information") };
|
B_TRANSLATE_MARK("Capturing"),
|
||||||
|
B_TRANSLATE_MARK("Object transfer"),
|
||||||
|
B_TRANSLATE_MARK("Audio"),
|
||||||
|
B_TRANSLATE_MARK("Telephony"),
|
||||||
|
B_TRANSLATE_MARK("Information")
|
||||||
|
};
|
||||||
|
|
||||||
if (ServiceClass() != 0) {
|
if (ServiceClass() != 0) {
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
@@ -50,11 +55,16 @@ void
|
|||||||
DeviceClass::GetMajorDeviceClass(BString& majorClass)
|
DeviceClass::GetMajorDeviceClass(BString& majorClass)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
static const char *major_devices[] = { B_TRANSLATE_MARK("Miscellaneous"),
|
static const char *major_devices[] = {
|
||||||
B_TRANSLATE_MARK("Computer"), B_TRANSLATE_MARK("Phone"),
|
B_TRANSLATE_MARK("Miscellaneous"),
|
||||||
B_TRANSLATE_MARK("LAN access"), B_TRANSLATE_MARK("Audio/Video"),
|
B_TRANSLATE_MARK("Computer"),
|
||||||
B_TRANSLATE_MARK("Peripheral"), B_TRANSLATE_MARK("Imaging"),
|
B_TRANSLATE_MARK("Phone"),
|
||||||
B_TRANSLATE_MARK("Uncategorized") };
|
B_TRANSLATE_MARK("LAN access"),
|
||||||
|
B_TRANSLATE_MARK("Audio/Video"),
|
||||||
|
B_TRANSLATE_MARK("Peripheral"),
|
||||||
|
B_TRANSLATE_MARK("Imaging"),
|
||||||
|
B_TRANSLATE_MARK("Uncategorized")
|
||||||
|
};
|
||||||
|
|
||||||
if (MajorDeviceClass() >= sizeof(major_devices) / sizeof(*major_devices))
|
if (MajorDeviceClass() >= sizeof(major_devices) / sizeof(*major_devices))
|
||||||
majorClass << B_TRANSLATE("Invalid device class!\n");
|
majorClass << B_TRANSLATE("Invalid device class!\n");
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <bluetooth/bluetooth_error.h>
|
#include <bluetooth/bluetooth_error.h>
|
||||||
#include <bluetooth/DiscoveryAgent.h>
|
#include <bluetooth/DiscoveryAgent.h>
|
||||||
#include <bluetooth/DiscoveryListener.h>
|
#include <bluetooth/DiscoveryListener.h>
|
||||||
@@ -18,6 +19,7 @@
|
|||||||
|
|
||||||
#include "KitSupport.h"
|
#include "KitSupport.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Bluetooth {
|
namespace Bluetooth {
|
||||||
|
|
||||||
|
|
||||||
@@ -42,7 +44,8 @@ DiscoveryAgent::StartInquiry(int accessCode, DiscoveryListener* listener)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
DiscoveryAgent::StartInquiry(uint32 accessCode, DiscoveryListener* listener, bigtime_t secs)
|
DiscoveryAgent::StartInquiry(uint32 accessCode, DiscoveryListener* listener,
|
||||||
|
bigtime_t secs)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
size_t size;
|
size_t size;
|
||||||
@@ -68,12 +71,14 @@ DiscoveryAgent::StartInquiry(uint32 accessCode, DiscoveryListener* listener, big
|
|||||||
|
|
||||||
request.AddInt32("hci_id", fLocalDevice->ID());
|
request.AddInt32("hci_id", fLocalDevice->ID());
|
||||||
|
|
||||||
startInquiryCommand = buildInquiry(accessCode, secs, BT_MAX_RESPONSES, &size);
|
startInquiryCommand = buildInquiry(accessCode, secs, BT_MAX_RESPONSES,
|
||||||
|
&size);
|
||||||
|
|
||||||
// For stating the inquiry
|
// For stating the inquiry
|
||||||
request.AddData("raw command", B_ANY_TYPE, startInquiryCommand, size);
|
request.AddData("raw command", B_ANY_TYPE, startInquiryCommand, size);
|
||||||
request.AddInt16("eventExpected", HCI_EVENT_CMD_STATUS);
|
request.AddInt16("eventExpected", HCI_EVENT_CMD_STATUS);
|
||||||
request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_LINK_CONTROL, OCF_INQUIRY));
|
request.AddInt16("opcodeExpected",
|
||||||
|
PACK_OPCODE(OGF_LINK_CONTROL, OCF_INQUIRY));
|
||||||
|
|
||||||
// For getting each discovered message
|
// For getting each discovered message
|
||||||
request.AddInt16("eventExpected", HCI_EVENT_INQUIRY_RESULT);
|
request.AddInt16("eventExpected", HCI_EVENT_INQUIRY_RESULT);
|
||||||
@@ -113,7 +118,8 @@ DiscoveryAgent::CancelInquiry(DiscoveryListener* listener)
|
|||||||
cancelInquiryCommand = buildInquiryCancel(&size);
|
cancelInquiryCommand = buildInquiryCancel(&size);
|
||||||
request.AddData("raw command", B_ANY_TYPE, cancelInquiryCommand, size);
|
request.AddData("raw command", B_ANY_TYPE, cancelInquiryCommand, size);
|
||||||
request.AddInt16("eventExpected", HCI_EVENT_CMD_STATUS);
|
request.AddInt16("eventExpected", HCI_EVENT_CMD_STATUS);
|
||||||
request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_LINK_CONTROL, OCF_INQUIRY_CANCEL));
|
request.AddInt16("opcodeExpected",
|
||||||
|
PACK_OPCODE(OGF_LINK_CONTROL, OCF_INQUIRY_CANCEL));
|
||||||
|
|
||||||
if (fMessenger->SendMessage(&request, &reply) == B_OK) {
|
if (fMessenger->SendMessage(&request, &reply) == B_OK) {
|
||||||
if (reply.FindInt8("status", &bt_status ) == B_OK ) {
|
if (reply.FindInt8("status", &bt_status ) == B_OK ) {
|
||||||
@@ -148,4 +154,4 @@ DiscoveryAgent::~DiscoveryAgent()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
} /* End namespace Bluetooth */
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
* Copyright 2007 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 <bluetooth/DiscoveryAgent.h>
|
#include <bluetooth/DiscoveryAgent.h>
|
||||||
#include <bluetooth/DiscoveryListener.h>
|
#include <bluetooth/DiscoveryListener.h>
|
||||||
#include <bluetooth/RemoteDevice.h>
|
#include <bluetooth/RemoteDevice.h>
|
||||||
@@ -18,6 +17,7 @@
|
|||||||
|
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
|
|
||||||
|
|
||||||
namespace Bluetooth {
|
namespace Bluetooth {
|
||||||
|
|
||||||
|
|
||||||
@@ -156,4 +156,4 @@ DiscoveryListener::DiscoveryListener()
|
|||||||
Run();
|
Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} /* end namespace Bluetooth */
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* 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 <bluetooth/bluetooth.h>
|
#include <bluetooth/bluetooth.h>
|
||||||
#include <bluetooth/DiscoveryAgent.h>
|
#include <bluetooth/DiscoveryAgent.h>
|
||||||
#include <bluetooth/debug.h>
|
#include <bluetooth/debug.h>
|
||||||
@@ -12,7 +12,9 @@
|
|||||||
|
|
||||||
#include "KitSupport.h"
|
#include "KitSupport.h"
|
||||||
|
|
||||||
BMessenger* _RetrieveBluetoothMessenger(void)
|
|
||||||
|
BMessenger*
|
||||||
|
_RetrieveBluetoothMessenger(void)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
// Fix/review: leaking memory here
|
// Fix/review: leaking memory here
|
||||||
@@ -26,14 +28,16 @@ BMessenger* _RetrieveBluetoothMessenger(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint8 GetInquiryTime()
|
uint8
|
||||||
|
GetInquiryTime()
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
return BT_DEFAULT_INQUIRY_TIME;
|
return BT_DEFAULT_INQUIRY_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SetInquiryTime(uint8 time)
|
void
|
||||||
|
SetInquiryTime(uint8 time)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
((void)(time));
|
((void)(time));
|
||||||
|
|||||||
@@ -5,12 +5,14 @@
|
|||||||
#ifndef KITSUPPORT_H
|
#ifndef KITSUPPORT_H
|
||||||
#define KITSUPPORT_H
|
#define KITSUPPORT_H
|
||||||
|
|
||||||
|
|
||||||
#include <Messenger.h>
|
#include <Messenger.h>
|
||||||
|
|
||||||
|
|
||||||
BMessenger* _RetrieveBluetoothMessenger(void);
|
BMessenger* _RetrieveBluetoothMessenger(void);
|
||||||
|
|
||||||
uint8 GetInquiryTime();
|
uint8 GetInquiryTime();
|
||||||
void SetInquiryTime(uint8 time);
|
void SetInquiryTime(uint8 time);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <bluetooth/bluetooth_error.h>
|
#include <bluetooth/bluetooth_error.h>
|
||||||
|
|
||||||
#include <bluetooth/HCI/btHCI_command.h>
|
#include <bluetooth/HCI/btHCI_command.h>
|
||||||
@@ -215,6 +216,7 @@ struct authentication_t {
|
|||||||
uint8 param;
|
uint8 param;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
LocalDevice::SetAuthentication(bool authentication)
|
LocalDevice::SetAuthentication(bool authentication)
|
||||||
{
|
{
|
||||||
@@ -424,7 +426,8 @@ 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);
|
||||||
|
|
||||||
|
|
||||||
BMessage request(BT_MSG_HANDLE_SIMPLE_REQUEST);
|
BMessage request(BT_MSG_HANDLE_SIMPLE_REQUEST);
|
||||||
@@ -501,6 +504,7 @@ struct pageTimeout_t {
|
|||||||
uint16 param;
|
uint16 param;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
LocalDevice::_ReadTimeouts()
|
LocalDevice::_ReadTimeouts()
|
||||||
{
|
{
|
||||||
@@ -624,4 +628,4 @@ LocalDevice::~LocalDevice()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
} /* end namespace Bluetooth */
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <bluetooth/DeviceClass.h>
|
#include <bluetooth/DeviceClass.h>
|
||||||
#include <bluetooth/DiscoveryAgent.h>
|
#include <bluetooth/DiscoveryAgent.h>
|
||||||
#include <bluetooth/DiscoveryListener.h>
|
#include <bluetooth/DiscoveryListener.h>
|
||||||
@@ -24,15 +25,18 @@
|
|||||||
|
|
||||||
#include "KitSupport.h"
|
#include "KitSupport.h"
|
||||||
|
|
||||||
|
|
||||||
#undef B_TRANSLATION_CONTEXT
|
#undef B_TRANSLATION_CONTEXT
|
||||||
#define B_TRANSLATION_CONTEXT "RemoteDevice"
|
#define B_TRANSLATION_CONTEXT "RemoteDevice"
|
||||||
|
|
||||||
|
|
||||||
namespace Bluetooth {
|
namespace Bluetooth {
|
||||||
|
|
||||||
|
|
||||||
// TODO: Check headers for valid/reserved ranges
|
// TODO: Check headers for valid/reserved ranges
|
||||||
static const uint16 invalidConnectionHandle = 0xF000;
|
static const uint16 invalidConnectionHandle = 0xF000;
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
RemoteDevice::IsTrustedDevice(void)
|
RemoteDevice::IsTrustedDevice(void)
|
||||||
{
|
{
|
||||||
@@ -344,4 +348,4 @@ RemoteDevice::GetDeviceClass()
|
|||||||
return fDeviceClass;
|
return fDeviceClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} /* end namespace Bluetooth */
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
* Copyright 2007-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 <ConnectionIncoming.h>
|
#include <ConnectionIncoming.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -81,4 +80,4 @@ bool ConnectionIncoming::QuitRequested()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
} /* end namespace Bluetooth */
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* 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>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
@@ -35,6 +36,7 @@
|
|||||||
#define V_SEPARATION 10
|
#define V_SEPARATION 10
|
||||||
#define BD_ADDR_LABEL "BD_ADDR: "
|
#define BD_ADDR_LABEL "BD_ADDR: "
|
||||||
|
|
||||||
|
|
||||||
static const uint32 skMessageAcceptButton = 'acCp';
|
static const uint32 skMessageAcceptButton = 'acCp';
|
||||||
static const uint32 skMessageCancelButton = 'mVch';
|
static const uint32 skMessageCancelButton = 'mVch';
|
||||||
|
|
||||||
@@ -46,6 +48,7 @@ namespace Bluetooth {
|
|||||||
#pragma mark -
|
#pragma mark -
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
PincodeWindow::PincodeWindow(bdaddr_t address, hci_id hid)
|
PincodeWindow::PincodeWindow(bdaddr_t address, hci_id hid)
|
||||||
: BWindow(BRect(800, 200, 900, 300), "Pincode request",
|
: BWindow(BRect(800, 200, 900, 300), "Pincode request",
|
||||||
B_FLOATING_WINDOW,
|
B_FLOATING_WINDOW,
|
||||||
@@ -85,7 +88,8 @@ PincodeWindow::InitUI()
|
|||||||
fRemoteInfo = new BStringView("bdaddr","BD_ADDR: ");
|
fRemoteInfo = new BStringView("bdaddr","BD_ADDR: ");
|
||||||
|
|
||||||
// TODO: Pincode cannot be more than 16 bytes
|
// TODO: Pincode cannot be more than 16 bytes
|
||||||
fPincodeText = new BTextControl("pincode TextControl", "PIN code:", "5555", NULL);
|
fPincodeText = new BTextControl("pincode TextControl", "PIN code:",
|
||||||
|
"5555", NULL);
|
||||||
|
|
||||||
fAcceptButton = new BButton("fAcceptButton", "Pair",
|
fAcceptButton = new BButton("fAcceptButton", "Pair",
|
||||||
new BMessage(skMessageAcceptButton));
|
new BMessage(skMessageAcceptButton));
|
||||||
@@ -200,4 +204,4 @@ void PincodeWindow::SetBDaddr(BString address)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
} /* end namespace Bluetooth */
|
||||||
|
|||||||
Reference in New Issue
Block a user