1 /* 2 * Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com 3 * 4 * All rights reserved. Distributed under the terms of the MIT License. 5 * 6 */ 7 8 #ifndef _DISCOVERY_LISTENER_H 9 #define _DISCOVERY_LISTENER_H 10 11 #include <Looper.h> 12 #include <ObjectList.h> 13 14 #include <bluetooth/RemoteDevice.h> 15 16 17 #define BT_INQUIRY_COMPLETED 0x01 // HCI_EVENT_X check specs 18 #define BT_INQUIRY_TERMINATED 0x02 // HCI_EVENT_X 19 #define BT_INQUIRY_ERROR 0x03 // HCI_EVENT_X 20 21 22 namespace Bluetooth { 23 24 typedef BObjectList<RemoteDevice> RemoteDevicesList; 25 26 class RemoteDevice; 27 class DeviceClass; 28 class LocalDevice; 29 30 class DiscoveryListener : public BLooper { 31 32 public: 33 34 static const int INQUIRY_COMPLETED = BT_INQUIRY_COMPLETED; 35 static const int INQUIRY_TERMINATED = BT_INQUIRY_TERMINATED; 36 static const int INQUIRY_ERROR = BT_INQUIRY_ERROR; 37 38 static const int SERVICE_SEARCH_COMPLETED = 0x01; 39 static const int SERVICE_SEARCH_TERMINATED = 0x02; 40 static const int SERVICE_SEARCH_ERROR = 0x03; 41 static const int SERVICE_SEARCH_NO_RECORDS = 0x04; 42 static const int SERVICE_SEARCH_DEVICE_NOT_REACHABLE = 0x06; 43 44 virtual void DeviceDiscovered(RemoteDevice* btDevice, DeviceClass cod); 45 /* 46 virtual void servicesDiscovered(int transID, ServiceRecord[] servRecord); 47 virtual void serviceSearchCompleted(int transID, int respCode); 48 */ 49 virtual void InquiryCompleted(int discType); 50 51 /* JSR82 non-defined methods */ 52 virtual void InquiryStarted(status_t status); 53 54 private: 55 DiscoveryListener(); 56 void SetLocalDeviceOwner(LocalDevice* ld); 57 RemoteDevicesList GetRemoteDevicesList(void); 58 59 void MessageReceived(BMessage* msg); 60 61 LocalDevice* fLocalDevice; 62 RemoteDevicesList fRemoteDevicesList; 63 64 friend class DiscoveryAgent; 65 }; 66 67 } 68 69 #endif 70