diff -r f345bda72bc4 -r 43e37759235e Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/driver1__dev_8h-source.html --- a/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/driver1__dev_8h-source.html Tue Mar 30 11:56:28 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +0,0 @@ - -
-00001 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). -00002 // All rights reserved. -00003 // This component and the accompanying materials are made available -00004 // under the terms of "Eclipse Public License v1.0" -00005 // which accompanies this distribution, and is available -00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html". -00007 // -00008 // Initial Contributors: -00009 // Nokia Corporation - initial contribution. -00010 // -00011 // Contributors: -00012 // -00013 // Description: -00014 // Kernel side interfaces to the example Logical and Physical Device Drivers -00015 // -00016 -00017 -00018 -00023 #ifndef __DRIVER1_DEV_H__ -00024 #define __DRIVER1_DEV_H__ -00025 -00029 class DDriver1Factory : public DLogicalDevice -00030 { -00031 public: -00032 DDriver1Factory(); -00033 ~DDriver1Factory(); -00034 -00035 // Inherited from DLogicalDevice -00036 virtual TInt Install(); -00037 virtual void GetCaps(TDes8& aDes) const; -00038 virtual TInt Create(DLogicalChannelBase*& aChannel); -00039 }; -00040 -00041 class DDriver1; -00042 -00046 class DDriver1Channel : public DLogicalChannel -00047 { -00048 public: -00049 DDriver1Channel(); -00050 virtual ~DDriver1Channel(); -00051 -00052 // Inherited from DObject -00053 virtual TInt RequestUserHandle(DThread* aThread, TOwnerType aType); -00054 -00055 // Inherited from DLogicalChannelBase -00056 virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer); -00057 -00058 // Inherited from DLogicalChannel -00059 virtual void HandleMsg(TMessageBase* aMsg); -00060 private: -00061 // Panic reasons -00062 enum TPanic -00063 { -00064 // A request was issued when one is outstanding. -00065 ERequestAlreadyPending = 1 -00066 }; -00067 -00068 // Implementation of the different kinds of messages sent through RBusLogicalChannel -00069 TInt DoControl(TInt aFunction, TAny* a1, TAny* a2); -00070 TInt DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2); -00071 void DoCancel(TUint aMask); -00072 // Accessor for the PDD -00073 inline DDriver1* Pdd(); -00074 // Methods for configuration -00075 TInt GetConfig(TDes8* aConfigBuf); -00076 TInt SetConfig(const TDesC8* aConfigBuf); -00077 void CurrentConfig(RDriver1::TConfig& aConfig); -00078 // Methods for processing a SendData request -00079 TInt SendData(TRequestStatus* aStatus,const TDesC8* aData); -00080 void SendDataCancel(); -00081 void DoSendDataComplete(); -00082 static void SendDataDfc(TAny* aPtr); -00083 // Methods for processing a ReceiveData request -00084 TInt ReceiveData(TRequestStatus* aStatus,TDes8* aBuffer); -00085 void ReceiveDataCancel(); -00086 void DoReceiveDataComplete(); -00087 static void ReceiveDataDfc(TAny* aPtr); -00088 public: -00089 // Interface methods for use by PDD -00090 virtual void SendDataComplete(TInt aResult); -00091 virtual void ReceiveDataComplete(TInt aResult); -00092 private: -00093 DThread* iClient; -00094 // Members used for processing a SendData request -00095 TRequestStatus* iSendDataStatus; -00096 TDfc iSendDataDfc; -00097 TInt iSendDataResult; -00098 TBuf8<256> iSendDataBuffer; -00099 // Members used for processing a ReceiveData request -00100 TDes8* iReceiveDataDescriptor; -00101 TRequestStatus* iReceiveDataStatus; -00102 TDfc iReceiveDataDfc; -00103 TInt iReceiveDataResult; -00104 TBuf8<256> iReceiveDataBuffer; -00105 }; -00106 -00107 inline DDriver1* DDriver1Channel::Pdd() -00108 { return (DDriver1*)iPdd; } -00109 -00113 class DDriver1 : public DBase -00114 { -00115 public: -00119 class TCaps -00120 { -00121 public: -00122 TVersion iVersion; -00123 }; -00124 public: -00125 virtual TInt BufferSize() const =0; -00126 virtual TInt Speed() const =0; -00127 virtual TInt SetSpeed(TInt aSpeed) =0; -00128 virtual TInt SendData(const TDesC8& aData) =0; -00129 virtual void SendDataCancel() =0; -00130 virtual TInt ReceiveData(TDes8& aBuffer) =0; -00131 virtual void ReceiveDataCancel() =0; -00132 public: -00133 DDriver1Channel* iLdd; -00134 }; -00135 -00136 #endif -00137 -