More Stylistic changes
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26705 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
b48fa68ace
commit
26e7ba5602
|
@ -11,7 +11,6 @@
|
|||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/DeviceClass.h>
|
||||
|
||||
|
||||
#include <Messenger.h>
|
||||
#include <Message.h>
|
||||
|
||||
|
@ -21,22 +20,22 @@
|
|||
namespace Bluetooth {
|
||||
|
||||
class BluetoothDevice {
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
|
||||
virtual BString GetFriendlyName()=0;
|
||||
virtual DeviceClass GetDeviceClass()=0;
|
||||
|
||||
virtual BString GetProperty(const char* property)=0;
|
||||
virtual void GetProperty(const char* property, uint32* value)=0;
|
||||
virtual DeviceClass GetDeviceClass()=0;
|
||||
|
||||
virtual BString GetProperty(const char* property)=0;
|
||||
virtual void GetProperty(const char* property, uint32* value)=0;
|
||||
|
||||
virtual bdaddr_t GetBluetoothAddress()=0;
|
||||
|
||||
virtual bdaddr_t GetBluetoothAddress()=0;
|
||||
|
||||
protected:
|
||||
bdaddr_t fBdaddr;
|
||||
DeviceClass fDeviceClass;
|
||||
bdaddr_t fBdaddr;
|
||||
DeviceClass fDeviceClass;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#ifndef _BT_USE_EXPLICIT_NAMESPACE
|
||||
|
|
|
@ -14,50 +14,50 @@ namespace Bluetooth {
|
|||
|
||||
class DeviceClass {
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
DeviceClass(int record)
|
||||
{
|
||||
this->record = record;
|
||||
}
|
||||
DeviceClass(int record)
|
||||
{
|
||||
this->record = record;
|
||||
}
|
||||
|
||||
DeviceClass()
|
||||
{
|
||||
this->record = 0;
|
||||
}
|
||||
DeviceClass()
|
||||
{
|
||||
this->record = 0;
|
||||
}
|
||||
|
||||
|
||||
int GetServiceClasses()
|
||||
{
|
||||
return (record & 0x00FFE000) >> 13;
|
||||
}
|
||||
int GetServiceClasses()
|
||||
{
|
||||
return (record & 0x00FFE000) >> 13;
|
||||
}
|
||||
|
||||
|
||||
int GetMajorDeviceClass()
|
||||
{
|
||||
return (record & 0x00001F00) >> 8;
|
||||
}
|
||||
int GetMajorDeviceClass()
|
||||
{
|
||||
return (record & 0x00001F00) >> 8;
|
||||
}
|
||||
|
||||
|
||||
void GetMajorDeviceClass(BString* str)
|
||||
{
|
||||
void GetMajorDeviceClass(BString* str)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int GetMinorDeviceClass()
|
||||
{
|
||||
int GetMinorDeviceClass()
|
||||
{
|
||||
return (record & 0x000000FF) >> 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GetMinorDeviceClass(BString* str)
|
||||
{
|
||||
void GetMinorDeviceClass(BString* str)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
int record;
|
||||
}
|
||||
|
||||
private:
|
||||
int record;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
#define BT_GIAC 0x9E8B33
|
||||
#define BT_LIAC 0x9E8B00
|
||||
|
||||
#define BT_MAX_RESPONSES (32)
|
||||
#define BT_BASE_INQUIRY_TIME (1.28)
|
||||
#define BT_DEFAULT_INQUIRY_TIME (0x15*BT_BASE_INQUIRY_TIME) /* TODO: REVIEW SPECS! */
|
||||
#define BT_MAX_RESPONSES (32)
|
||||
#define BT_BASE_INQUIRY_TIME (1.28)
|
||||
#define BT_DEFAULT_INQUIRY_TIME (0x15*BT_BASE_INQUIRY_TIME) /* TODO: REVIEW SPECS! */
|
||||
|
||||
namespace Bluetooth {
|
||||
|
||||
|
@ -30,31 +30,29 @@ class RemoteDevice;
|
|||
|
||||
class DiscoveryAgent {
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
static const int GIAC = BT_GIAC;
|
||||
static const int LIAC = BT_LIAC;
|
||||
static const int GIAC = BT_GIAC;
|
||||
static const int LIAC = BT_LIAC;
|
||||
|
||||
static const int PREKNOWN = BT_PREKNOWN;
|
||||
static const int CACHED = BT_CACHED;
|
||||
static const int NOT_DISCOVERABLE = BT_NOT_DISCOVERABLE;
|
||||
static const int PREKNOWN = BT_PREKNOWN;
|
||||
static const int CACHED = BT_CACHED;
|
||||
static const int NOT_DISCOVERABLE = BT_NOT_DISCOVERABLE;
|
||||
|
||||
RemoteDevicesList RetrieveDevices(int option); /* TODO */
|
||||
status_t StartInquiry(int accessCode, DiscoveryListener* listener); /* Throwing */
|
||||
status_t StartInquiry(uint32 accessCode, DiscoveryListener* listener, bigtime_t secs);
|
||||
status_t CancelInquiry(DiscoveryListener* listener);
|
||||
RemoteDevicesList RetrieveDevices(int option); /* TODO */
|
||||
status_t StartInquiry(int accessCode, DiscoveryListener* listener); /* Throwing */
|
||||
status_t StartInquiry(uint32 accessCode, DiscoveryListener* listener, bigtime_t secs);
|
||||
status_t CancelInquiry(DiscoveryListener* listener);
|
||||
|
||||
/*
|
||||
int searchServices(int[] attrSet,
|
||||
UUID[] uuidSet,
|
||||
RemoteDevice btDev,
|
||||
DiscoveryListener discListener);
|
||||
/*
|
||||
int searchServices(int[] attrSet, UUID[] uuidSet, RemoteDevice btDev,
|
||||
DiscoveryListener discListener);
|
||||
|
||||
bool cancelServiceSearch(int transID);
|
||||
BString selectService(UUID uuid, int security, boolean master);
|
||||
*/
|
||||
bool cancelServiceSearch(int transID);
|
||||
BString selectService(UUID uuid, int security, boolean master);
|
||||
*/
|
||||
|
||||
private:
|
||||
private:
|
||||
DiscoveryAgent(LocalDevice* ld);
|
||||
~DiscoveryAgent();
|
||||
void SetLocalDeviceOwner(LocalDevice* ld);
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
#include <bluetooth/RemoteDevice.h>
|
||||
|
||||
|
||||
#define BT_INQUIRY_COMPLETED 0x01 // HCI_EVENT_X check specs
|
||||
#define BT_INQUIRY_TERMINATED 0x02 // HCI_EVENT_X
|
||||
#define BT_INQUIRY_ERROR 0x03 // HCI_EVENT_X
|
||||
#define BT_INQUIRY_COMPLETED 0x01 // HCI_EVENT_X check specs
|
||||
#define BT_INQUIRY_TERMINATED 0x02 // HCI_EVENT_X
|
||||
#define BT_INQUIRY_ERROR 0x03 // HCI_EVENT_X
|
||||
|
||||
|
||||
namespace Bluetooth {
|
||||
|
@ -29,42 +29,42 @@ class LocalDevice;
|
|||
|
||||
class DiscoveryListener : public BLooper {
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
static const int INQUIRY_COMPLETED = BT_INQUIRY_COMPLETED;
|
||||
static const int INQUIRY_TERMINATED = BT_INQUIRY_TERMINATED;
|
||||
static const int INQUIRY_ERROR = BT_INQUIRY_ERROR;
|
||||
|
||||
static const int SERVICE_SEARCH_COMPLETED = 0x01;
|
||||
static const int SERVICE_SEARCH_TERMINATED = 0x02;
|
||||
static const int SERVICE_SEARCH_ERROR = 0x03;
|
||||
static const int SERVICE_SEARCH_NO_RECORDS = 0x04;
|
||||
static const int SERVICE_SEARCH_DEVICE_NOT_REACHABLE = 0x06;
|
||||
|
||||
virtual void DeviceDiscovered(RemoteDevice* btDevice, DeviceClass cod);
|
||||
/*
|
||||
virtual void servicesDiscovered(int transID, ServiceRecord[] servRecord);
|
||||
virtual void serviceSearchCompleted(int transID, int respCode);
|
||||
*/
|
||||
virtual void InquiryCompleted(int discType);
|
||||
static const int INQUIRY_COMPLETED = BT_INQUIRY_COMPLETED;
|
||||
static const int INQUIRY_TERMINATED = BT_INQUIRY_TERMINATED;
|
||||
static const int INQUIRY_ERROR = BT_INQUIRY_ERROR;
|
||||
|
||||
static const int SERVICE_SEARCH_COMPLETED = 0x01;
|
||||
static const int SERVICE_SEARCH_TERMINATED = 0x02;
|
||||
static const int SERVICE_SEARCH_ERROR = 0x03;
|
||||
static const int SERVICE_SEARCH_NO_RECORDS = 0x04;
|
||||
static const int SERVICE_SEARCH_DEVICE_NOT_REACHABLE = 0x06;
|
||||
|
||||
virtual void DeviceDiscovered(RemoteDevice* btDevice, DeviceClass cod);
|
||||
/*
|
||||
virtual void servicesDiscovered(int transID, ServiceRecord[] servRecord);
|
||||
virtual void serviceSearchCompleted(int transID, int respCode);
|
||||
*/
|
||||
virtual void InquiryCompleted(int discType);
|
||||
|
||||
/* JSR82 non-defined methods */
|
||||
virtual void InquiryStarted(status_t status);
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
|
||||
RemoteDevicesList GetRemoteDevicesList(void);
|
||||
|
||||
void MessageReceived(BMessage* msg);
|
||||
|
||||
void MessageReceived(BMessage* msg);
|
||||
|
||||
LocalDevice* fLocalDevice;
|
||||
RemoteDevicesList fRemoteDevicesList;
|
||||
|
||||
|
||||
friend class DiscoveryAgent;
|
||||
|
||||
protected:
|
||||
DiscoveryListener();
|
||||
void SetLocalDeviceOwner(LocalDevice* ld);
|
||||
DiscoveryListener();
|
||||
void SetLocalDeviceOwner(LocalDevice* ld);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -48,13 +48,13 @@ typedef struct bt_hci_statistics {
|
|||
|
||||
} bt_hci_statistics;
|
||||
|
||||
/* TODO: Possible Hooks which drivers will have to provide */
|
||||
/* TODO: Possible hooks which drivers will have to provide */
|
||||
typedef struct bt_hci_transport {
|
||||
|
||||
status_t (*SendCommand)(hci_id hci_dev, net_buffer* snbuf);
|
||||
status_t (*SendPacket)(hci_id hci_dev, net_buffer* nbuf );
|
||||
status_t (*SendSCO)(hci_id hci_dev, net_buffer* nbuf );
|
||||
status_t (*DeliverStatistics)(bt_hci_statistics* statistics);
|
||||
status_t (*SendCommand)(hci_id hci_dev, net_buffer *snbuf);
|
||||
status_t (*SendPacket)(hci_id hci_dev, net_buffer *nbuf );
|
||||
status_t (*SendSCO)(hci_id hci_dev, net_buffer *nbuf );
|
||||
status_t (*DeliverStatistics)(bt_hci_statistics *statistics);
|
||||
|
||||
transport_type kind;
|
||||
char name[B_OS_NAME_LENGTH];
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
/*
|
||||
* Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
||||
* Copyright 2008 Mika Lindqvist, monni1995_at_gmail.com
|
||||
*
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _BDADDR_UTILS_H
|
||||
#define _BDADDR_UTILS_H
|
||||
|
||||
|
@ -16,62 +17,54 @@ namespace Bluetooth {
|
|||
|
||||
class bdaddrUtils {
|
||||
|
||||
public:
|
||||
public:
|
||||
static inline bdaddr_t NullAddress()
|
||||
{
|
||||
|
||||
return ((bdaddr_t) {{0, 0, 0, 0, 0, 0}});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static inline bdaddr_t LocalAddress()
|
||||
{
|
||||
|
||||
return ((bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static inline bdaddr_t BroadcastAddress()
|
||||
{
|
||||
|
||||
return ((bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}});
|
||||
}
|
||||
|
||||
|
||||
static bool Compare(bdaddr_t* ba1, bdaddr_t* ba2)
|
||||
|
||||
|
||||
static bool Compare(bdaddr_t *ba1, bdaddr_t *ba2)
|
||||
{
|
||||
return (memcmp(ba1, ba2, sizeof(bdaddr_t)) == 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static char* ToString(const bdaddr_t bdaddr)
|
||||
{
|
||||
// TODO: not safe
|
||||
static char str[18];
|
||||
|
||||
|
||||
sprintf(str,"%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",bdaddr.b[0],
|
||||
bdaddr.b[1],
|
||||
bdaddr.b[2],
|
||||
bdaddr.b[3],
|
||||
bdaddr.b[4],
|
||||
bdaddr.b[5]);
|
||||
|
||||
bdaddr.b[1], bdaddr.b[2], bdaddr.b[3], bdaddr.b[4],
|
||||
bdaddr.b[5]);
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
static bdaddr_t FromString(const char * addr)
|
||||
{
|
||||
int b0, b1, b2, b3, b4, b5;
|
||||
size_t count = sscanf(addr, "%2X:%2X:%2X:%2X:%2X:%2X",
|
||||
&b0,
|
||||
&b1,
|
||||
&b2,
|
||||
&b3,
|
||||
&b4,
|
||||
&b5);
|
||||
|
||||
if (count == 6)
|
||||
return ((bdaddr_t) {{b0, b1, b2, b3, b4, b5}});
|
||||
if (addr != NULL) {
|
||||
size_t count = sscanf(addr, "%2X:%2X:%2X:%2X:%2X:%2X",
|
||||
&b0, &b1, &b2, &b3, &b4, &b5);
|
||||
|
||||
if (count == 6)
|
||||
return ((bdaddr_t) {{b0, b1, b2, b3, b4, b5}});
|
||||
}
|
||||
|
||||
return NullAddress();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue