diff --git a/headers/os/bluetooth/DiscoveryListener.h b/headers/os/bluetooth/DiscoveryListener.h index 3fd358e7f9..bf8440fde6 100644 --- a/headers/os/bluetooth/DiscoveryListener.h +++ b/headers/os/bluetooth/DiscoveryListener.h @@ -42,6 +42,9 @@ class DiscoveryListener : BLooper { virtual void serviceSearchCompleted(int transID, int respCode); */ virtual void InquiryCompleted(int discType); + + /* JSR82 non-defined methods */ + virtual void InquiryStarted(status_t status); private: DiscoveryListener(); diff --git a/headers/os/bluetooth/RemoteDevice.h b/headers/os/bluetooth/RemoteDevice.h index e89af98af9..ea7bbbec99 100644 --- a/headers/os/bluetooth/RemoteDevice.h +++ b/headers/os/bluetooth/RemoteDevice.h @@ -42,6 +42,7 @@ class RemoteDevice { protected: RemoteDevice(BString address); + RemoteDevice(bdaddr_t address); /* Instances of this class only will be done by Discovery[Listener|Agent] TODO */ friend class DiscoveryListener; diff --git a/headers/private/bluetooth/bluetoothserver_p.h b/headers/private/bluetooth/bluetoothserver_p.h index 611023db5b..d74a2561f7 100644 --- a/headers/private/bluetooth/bluetoothserver_p.h +++ b/headers/private/bluetooth/bluetoothserver_p.h @@ -4,6 +4,9 @@ #define BLUETOOTH_SIGNATURE "application/x-vnd.Be-bluetooth_server" +/* Kit Comunication */ + +// LocalDevice #define BT_MSG_COUNT_LOCAL_DEVICES 'btCd' #define BT_MSG_ADQUIRE_LOCAL_DEVICE 'btAd' #define BT_MSG_GET_FRIENDLY_NAME 'btFn' @@ -11,5 +14,12 @@ #define BT_MSG_HANDLE_SIMPLE_REQUEST 'btsR' #define BT_MSG_ADD_DEVICE 'btDD' +// Discovery +#define BT_MSG_INQUIRY_STARTED 'IqSt' +#define BT_MSG_INQUIRY_COMPLETED 'IqCM' +#define BT_MSG_INQUIRY_TERMINATED 'IqTR' +#define BT_MSG_INQUIRY_ERROR 'IqER' +#define BT_MSG_INQUIRY_DEVICE 'IqDE' + #endif diff --git a/src/kits/bluetooth/DiscoveryListener.cpp b/src/kits/bluetooth/DiscoveryListener.cpp index afc04e42bc..ad0b4ee293 100644 --- a/src/kits/bluetooth/DiscoveryListener.cpp +++ b/src/kits/bluetooth/DiscoveryListener.cpp @@ -9,19 +9,14 @@ #include #include +#include + #include namespace Bluetooth { -/* Move to some private header */ -#define B_BT_INQUIRY_COMPLETED_MSG 'IqCM' -#define B_BT_INQUIRY_TERMINATED_MSG 'IqTR' -#define B_BT_INQUIRY_ERROR_MSG 'IqER' -#define B_BT_INQUIRY_DEVICE_MSG 'IqDE' - /* hooks */ - void DiscoveryListener::DeviceDiscovered(RemoteDevice btDevice, DeviceClass cod) { @@ -30,6 +25,14 @@ DiscoveryListener::DeviceDiscovered(RemoteDevice btDevice, DeviceClass cod) } +void +DiscoveryListener::InquiryStarted(status_t status) +{ + +} + + + void DiscoveryListener::InquiryCompleted(int discType) { @@ -37,19 +40,19 @@ DiscoveryListener::InquiryCompleted(int discType) } -/* private */ - +/* private */ DiscoveryListener::DiscoveryListener() { } + void DiscoveryListener::MessageReceived(BMessage* message) { switch (message->what) { - case B_BT_INQUIRY_DEVICE_MSG: + case BT_MSG_INQUIRY_DEVICE: /* TODO: Extract info from BMessage to create a proper RemoteDevice, message should be passed from Agent??? */ @@ -59,17 +62,17 @@ DiscoveryListener::MessageReceived(BMessage* message) break; - case B_BT_INQUIRY_COMPLETED_MSG: + case BT_MSG_INQUIRY_COMPLETED: InquiryCompleted(B_BT_INQUIRY_COMPLETED); break; - case B_BT_INQUIRY_TERMINATED_MSG: + case BT_MSG_INQUIRY_TERMINATED: InquiryCompleted(B_BT_INQUIRY_TERMINATED); break; - case B_BT_INQUIRY_ERROR_MSG: + case BT_MSG_INQUIRY_ERROR: InquiryCompleted(B_BT_INQUIRY_ERROR);