00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00036 #ifndef __DRIVER1_DEV_H__
00037 #define __DRIVER1_DEV_H__
00038
00042 class DDriver1Factory : public DLogicalDevice
00043 {
00044 public:
00045 DDriver1Factory();
00046 ~DDriver1Factory();
00047
00048
00049 virtual TInt Install();
00050 virtual void GetCaps(TDes8& aDes) const;
00051 virtual TInt Create(DLogicalChannelBase*& aChannel);
00052 };
00053
00054 class DDriver1;
00055
00059 class DDriver1Channel : public DLogicalChannel
00060 {
00061 public:
00062 DDriver1Channel();
00063 virtual ~DDriver1Channel();
00064
00065
00066 virtual TInt RequestUserHandle(DThread* aThread, TOwnerType aType);
00067
00068
00069 virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
00070
00071
00072 virtual void HandleMsg(TMessageBase* aMsg);
00073 private:
00074
00075 enum TPanic
00076 {
00077
00078 ERequestAlreadyPending = 1
00079 };
00080
00081
00082 TInt DoControl(TInt aFunction, TAny* a1, TAny* a2);
00083 TInt DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2);
00084 void DoCancel(TUint aMask);
00085
00086 inline DDriver1* Pdd();
00087
00088 TInt GetConfig(TDes8* aConfigBuf);
00089 TInt SetConfig(const TDesC8* aConfigBuf);
00090 void CurrentConfig(RDriver1::TConfig& aConfig);
00091
00092 TInt SendData(TRequestStatus* aStatus,const TDesC8* aData);
00093 void SendDataCancel();
00094 void DoSendDataComplete();
00095 static void SendDataDfc(TAny* aPtr);
00096
00097 TInt ReceiveData(TRequestStatus* aStatus,TDes8* aBuffer);
00098 void ReceiveDataCancel();
00099 void DoReceiveDataComplete();
00100 static void ReceiveDataDfc(TAny* aPtr);
00101 public:
00102
00103 virtual void SendDataComplete(TInt aResult);
00104 virtual void ReceiveDataComplete(TInt aResult);
00105 private:
00106 DThread* iClient;
00107
00108 TRequestStatus* iSendDataStatus;
00109 TDfc iSendDataDfc;
00110 TInt iSendDataResult;
00111 TBuf8<256> iSendDataBuffer;
00112
00113 TDes8* iReceiveDataDescriptor;
00114 TRequestStatus* iReceiveDataStatus;
00115 TDfc iReceiveDataDfc;
00116 TInt iReceiveDataResult;
00117 TBuf8<256> iReceiveDataBuffer;
00118 };
00119
00120 inline DDriver1* DDriver1Channel::Pdd()
00121 { return (DDriver1*)iPdd; }
00122
00126 class DDriver1 : public DBase
00127 {
00128 public:
00132 class TCaps
00133 {
00134 public:
00135 TVersion iVersion;
00136 };
00137 public:
00138 virtual TInt BufferSize() const =0;
00139 virtual TInt Speed() const =0;
00140 virtual TInt SetSpeed(TInt aSpeed) =0;
00141 virtual TInt SendData(const TDesC8& aData) =0;
00142 virtual void SendDataCancel() =0;
00143 virtual TInt ReceiveData(TDes8& aBuffer) =0;
00144 virtual void ReceiveDataCancel() =0;
00145 public:
00146 DDriver1Channel* iLdd;
00147 };
00148
00149 #endif
00150