Headers for the bluetooth kit, based in the Motorola JSR82 API
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22641 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
||||
*
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _DEVICE_CLASS_H
|
||||
#define _DEVICE_CLASS_H
|
||||
|
||||
#include <String.h>
|
||||
|
||||
namespace Bluetooth {
|
||||
|
||||
class DeviceClass {
|
||||
|
||||
public:
|
||||
DeviceClass(int record) {
|
||||
this->record = record;
|
||||
}
|
||||
|
||||
int getServiceClasses() {
|
||||
return (record & 0x00FFE000) >> 13;
|
||||
}
|
||||
|
||||
int getMajorDeviceClass() {
|
||||
return (record & 0x00001F00) >> 8;
|
||||
}
|
||||
|
||||
void getMajorDeviceClass(BString* str) {
|
||||
|
||||
}
|
||||
|
||||
int getMinorDeviceClass() {
|
||||
return (record & 0x000000FF) >> 2;
|
||||
}
|
||||
|
||||
void getMinorDeviceClass(BString* str) {
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
int record;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
||||
*
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _LOCAL_DEVICE_H
|
||||
#define _LOCAL_DEVICE_H
|
||||
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/DeviceClass.h>
|
||||
|
||||
#include <String.h>
|
||||
|
||||
namespace Bluetooth {
|
||||
|
||||
class DiscoveryAgent;
|
||||
|
||||
class LocalDevice {
|
||||
|
||||
public:
|
||||
/* Possible throwing */
|
||||
static LocalDevice* getLocalDevice();
|
||||
static LocalDevice* getLocalDevice(uint8 dev);
|
||||
static LocalDevice* getLocalDevice(bdaddr_t bdaddr);
|
||||
|
||||
DiscoveryAgent* getDiscoveryAgent();
|
||||
BString getFriendlyName();
|
||||
DeviceClass getDeviceClass();
|
||||
/* Possible throwing */
|
||||
bool setDiscoverable(int mode);
|
||||
|
||||
BString getProperty(const char* property);
|
||||
void getProperty(const char* property, uint32* value);
|
||||
|
||||
int getDiscoverable();
|
||||
BString getBluetoothAddress();
|
||||
/*
|
||||
ServiceRecord getRecord(Connection notifier);
|
||||
void updateRecord(ServiceRecord srvRecord);
|
||||
*/
|
||||
private:
|
||||
LocalDevice();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2007 Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
||||
*/
|
||||
|
||||
#ifndef _BDADDR_UTILS_H
|
||||
#define _BDADDR_UTILS_H
|
||||
|
||||
|
||||
namespace Bluetooth {
|
||||
|
||||
class bdaddrUtils {
|
||||
|
||||
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 const char* ToString(bdaddr_t bdaddr) {
|
||||
static char str[12];
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2007 Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
||||
*/
|
||||
|
||||
#ifndef _BLUETOOTH_H
|
||||
#define _BLUETOOTH_H
|
||||
|
||||
#include <ByteOrder.h>
|
||||
|
||||
/* Bluetooth version */
|
||||
#define BLUETOOTH_1_1B 0
|
||||
#define BLUETOOTH_1_1 1
|
||||
#define BLUETOOTH_1_2 2
|
||||
#define BLUETOOTH_2_0 3
|
||||
|
||||
#define BLUETOOTH_VERSION BLUETOOTH_2_0
|
||||
|
||||
|
||||
/* Bluetooth common types */
|
||||
|
||||
/* BD Address */
|
||||
typedef struct {
|
||||
uint8 b[6];
|
||||
} __attribute__((packed)) bdaddr_t;
|
||||
|
||||
/* 128 integer type needed for SDP */
|
||||
struct int128 {
|
||||
int8 b[16];
|
||||
};
|
||||
typedef struct int128 int128;
|
||||
typedef struct int128 uint128;
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user