00001
00002
00003
00004
00005 #ifndef DEVICEDISCOVERER_H
00006 #define DEVICEDISCOVERER_H
00007
00008
00009 #include <e32base.h>
00010 #include <aknviewappui.h>
00011
00012 #include <coecntrl.h>
00013 #include <es_sock.h>
00014 #include <btdevice.h>
00015 #include <bt_sock.h>
00016 #include <btsdp.h>
00017
00018 #include "Common.h"
00019
00020
00021 class MDeviceDiscoObserver
00022 {
00023
00024 public:
00030 virtual void HandleDeviceDiscoveryComplete(TInt aError)=0;
00031
00037 virtual void DeviceDiscovered(const TDeviceData& aDevice)=0;
00038 };
00039
00040
00041 class CDeviceDiscoverer : public CActive
00042 {
00043 public:
00044
00051 static CDeviceDiscoverer* NewL(RSocketServ& aSocketServ,
00052 MDeviceDiscoObserver& aObserver);
00053
00058 static CDeviceDiscoverer* NewLC(RSocketServ& aSocketServ,
00059 MDeviceDiscoObserver& aObserver);
00060
00066 ~CDeviceDiscoverer();
00067
00075 void DiscoverDevicesL(TDeviceDataList* aDevDataList);
00076
00084 TBool HasDevices();
00085
00086
00087 #ifdef ENABLE_LIAC
00088
00094 void SetLIAC( TBool aState );
00095 #endif
00096
00103 void StopDiscovery();
00104
00105 protected:
00106
00112 void RunL();
00113
00119 void DoCancel();
00120
00121
00122 private:
00123
00131 CDeviceDiscoverer(RSocketServ& aSocketServ,
00132 MDeviceDiscoObserver& aObserver);
00133
00138 void ConstructL();
00139
00140 private:
00141
00142
00143 RSocketServ& iSocketServ;
00144
00145 MDeviceDiscoObserver& iObserver;
00146
00147 TDeviceDataList *iDevDataList;
00148
00149 RHostResolver iResolver;
00150 TInquirySockAddr iAddr;
00151 TNameEntry iEntry;
00152
00153 #ifdef ENABLE_LIAC
00154 TBool iLIAC;
00155 #endif
00156
00157 };
00158
00159 #endif