* Add one more inquiry process hook function for notify when it has started

* Move Messages id to a private header
* New constructor for RemoteDevice



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24376 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Ruiz Dorantes
2008-03-12 21:18:23 +00:00
parent a2ca07f4ec
commit b8c8202d4d
4 changed files with 30 additions and 13 deletions
+3
View File
@@ -42,6 +42,9 @@ class DiscoveryListener : BLooper {
virtual void serviceSearchCompleted(int transID, int respCode); virtual void serviceSearchCompleted(int transID, int respCode);
*/ */
virtual void InquiryCompleted(int discType); virtual void InquiryCompleted(int discType);
/* JSR82 non-defined methods */
virtual void InquiryStarted(status_t status);
private: private:
DiscoveryListener(); DiscoveryListener();
+1
View File
@@ -42,6 +42,7 @@ class RemoteDevice {
protected: protected:
RemoteDevice(BString address); RemoteDevice(BString address);
RemoteDevice(bdaddr_t address);
/* Instances of this class only will be done by Discovery[Listener|Agent] TODO */ /* Instances of this class only will be done by Discovery[Listener|Agent] TODO */
friend class DiscoveryListener; friend class DiscoveryListener;
@@ -4,6 +4,9 @@
#define BLUETOOTH_SIGNATURE "application/x-vnd.Be-bluetooth_server" #define BLUETOOTH_SIGNATURE "application/x-vnd.Be-bluetooth_server"
/* Kit Comunication */
// LocalDevice
#define BT_MSG_COUNT_LOCAL_DEVICES 'btCd' #define BT_MSG_COUNT_LOCAL_DEVICES 'btCd'
#define BT_MSG_ADQUIRE_LOCAL_DEVICE 'btAd' #define BT_MSG_ADQUIRE_LOCAL_DEVICE 'btAd'
#define BT_MSG_GET_FRIENDLY_NAME 'btFn' #define BT_MSG_GET_FRIENDLY_NAME 'btFn'
@@ -11,5 +14,12 @@
#define BT_MSG_HANDLE_SIMPLE_REQUEST 'btsR' #define BT_MSG_HANDLE_SIMPLE_REQUEST 'btsR'
#define BT_MSG_ADD_DEVICE 'btDD' #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 #endif
+16 -13
View File
@@ -9,19 +9,14 @@
#include <bluetooth/RemoteDevice.h> #include <bluetooth/RemoteDevice.h>
#include <bluetooth/DeviceClass.h> #include <bluetooth/DeviceClass.h>
#include <bluetoothserver_p.h>
#include <Message.h> #include <Message.h>
namespace Bluetooth { 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 */ /* hooks */
void void
DiscoveryListener::DeviceDiscovered(RemoteDevice btDevice, DeviceClass cod) DiscoveryListener::DeviceDiscovered(RemoteDevice btDevice, DeviceClass cod)
{ {
@@ -30,6 +25,14 @@ DiscoveryListener::DeviceDiscovered(RemoteDevice btDevice, DeviceClass cod)
} }
void
DiscoveryListener::InquiryStarted(status_t status)
{
}
void void
DiscoveryListener::InquiryCompleted(int discType) DiscoveryListener::InquiryCompleted(int discType)
{ {
@@ -37,19 +40,19 @@ DiscoveryListener::InquiryCompleted(int discType)
} }
/* private */ /* private */
DiscoveryListener::DiscoveryListener() DiscoveryListener::DiscoveryListener()
{ {
} }
void void
DiscoveryListener::MessageReceived(BMessage* message) DiscoveryListener::MessageReceived(BMessage* message)
{ {
switch (message->what) switch (message->what)
{ {
case B_BT_INQUIRY_DEVICE_MSG: case BT_MSG_INQUIRY_DEVICE:
/* TODO: Extract info from BMessage to create a /* TODO: Extract info from BMessage to create a
proper RemoteDevice, message should be passed from Agent??? */ proper RemoteDevice, message should be passed from Agent??? */
@@ -59,17 +62,17 @@ DiscoveryListener::MessageReceived(BMessage* message)
break; break;
case B_BT_INQUIRY_COMPLETED_MSG: case BT_MSG_INQUIRY_COMPLETED:
InquiryCompleted(B_BT_INQUIRY_COMPLETED); InquiryCompleted(B_BT_INQUIRY_COMPLETED);
break; break;
case B_BT_INQUIRY_TERMINATED_MSG: case BT_MSG_INQUIRY_TERMINATED:
InquiryCompleted(B_BT_INQUIRY_TERMINATED); InquiryCompleted(B_BT_INQUIRY_TERMINATED);
break; break;
case B_BT_INQUIRY_ERROR_MSG: case BT_MSG_INQUIRY_ERROR:
InquiryCompleted(B_BT_INQUIRY_ERROR); InquiryCompleted(B_BT_INQUIRY_ERROR);