00001 /* 00002 Copyright (c) 2002-2011 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. 00003 00004 Redistribution and use in source and binary forms, with or without 00005 modification, are permitted provided that the following conditions are met: 00006 00007 * Redistributions of source code must retain the above copyright notice, this 00008 list of conditions and the following disclaimer. 00009 * Redistributions in binary form must reproduce the above copyright notice, 00010 this list of conditions and the following disclaimer in the documentation 00011 and/or other materials provided with the distribution. 00012 * Neither the name of Nokia Corporation nor the names of its contributors 00013 may be used to endorse or promote products derived from this software 00014 without specific prior written permission. 00015 00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00017 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00018 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00020 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00021 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00022 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00023 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00024 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00025 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 00027 Description: 00028 */ 00029 00030 #ifndef __COMMOMINTERFACES_H__ 00031 #define __COMMOMINTERFACES_H__ 00032 00033 #include <e32cmn.h> 00034 #include <bttypes.h> 00035 #include <btextnotifiers.h> 00036 #include <es_sock.h> 00037 #include <bt_sock.h> 00038 00039 00040 //INTERFACE DECLARATIONS 00041 00042 //=================================================================================== 00047 class CBluetoothConnectionBase: public CActive 00048 { 00049 public: 00053 virtual ~CBluetoothConnectionBase(); 00054 00059 virtual void SendData(const TDesC8& aData)=0; 00060 00064 virtual void StartL()=0; 00065 00070 inline TInt Handle() const {return iHandle;}; 00071 00076 inline TBool Master() const {return iMaster;}; 00077 00078 protected: 00083 CBluetoothConnectionBase(TBool aMaster); 00084 00085 protected: 00089 TBool iMaster; 00090 00094 TInt iHandle; 00095 }; 00096 00097 //=================================================================================== 00098 00103 class MBluetoothServiceSearcherObserver 00104 { 00105 public: 00111 virtual void OnServiceSearchComplete(TInt aPort, TInt aError)=0; 00112 }; 00113 00114 //=================================================================================== 00115 00120 class MSocketConnectorObserver 00121 { 00122 public: 00127 virtual void OnSockConnectionComplete(TInt aError)=0; 00128 }; 00129 00130 //=================================================================================== 00131 00137 class MBluetoothObserver 00138 { 00139 public: 00145 virtual void ConnectionErr(const TInt aConnHandle, const TInt aError)=0; 00146 00152 virtual void DataReceived(const TInt aConnHandle, const TDesC8& aData)=0; 00153 00158 virtual void SendDataComplete(const TInt aConnHandle)=0; 00159 }; 00160 00161 //=================================================================================== 00162 00167 class MBluetoothDeviceDiscovererObserver 00168 { 00169 public: 00174 virtual void OnDeviceDiscoveryErr(const TInt aError)=0; 00175 00180 virtual void OnDeviceDiscoveryComplete(const TBTDeviceResponseParamsPckg& aResponse)=0; 00181 }; 00182 00183 //=================================================================================== 00184 00189 class MBluetoothServiceAdvertiserObserver 00190 { 00191 public: 00196 virtual void ReportAdvertiserErr(TInt aError)=0; 00197 00201 virtual void AdvertiserComplete()=0; 00202 }; 00203 00204 //=================================================================================== 00205 00210 class MSocketWriterReaderObserver 00211 { 00212 public: 00217 virtual void WriteComplete(TInt aError)=0; 00218 00224 virtual void ReportData(const TDesC8& aData, TInt aError)=0; 00225 }; 00226 00227 //=================================================================================== 00228 #endif // __COMMOMINTERFACES_H__