baseport/syborg/webcamera/webcamera_ldd.h
changeset 124 606eafc6d6a8
parent 52 0dfaca43d90e
equal deleted inserted replaced
52:0dfaca43d90e 124:606eafc6d6a8
    17 #ifndef __deviceLDD_H__
    17 #ifndef __deviceLDD_H__
    18 #define __deviceLDD_H__
    18 #define __deviceLDD_H__
    19 
    19 
    20 #include <kernel.h>
    20 #include <kernel.h>
    21 #include "webcamera_device.h"
    21 #include "webcamera_device.h"
    22 
    22 #include <webcamera_driver.h>
    23 #define BUFSIZE  (100*1024)
    23 #ifndef WEBCAMERA_UVC_H_
       
    24 #include "webcamera_uvc.h"
       
    25 #endif
       
    26 #ifndef WEBCAMERACONVERT_H__
       
    27 #include "webcamer_convert.h"
       
    28 #endif
    24 /**
    29 /**
    25  *Logical channel class
    30 Logical channel class
    26  *
    31 */
    27  */
       
    28 class DWebcameraLogicalDevice : public DLogicalDevice
    32 class DWebcameraLogicalDevice : public DLogicalDevice
    29 	{
    33 	{
    30 public:
    34 public:
    31 	DWebcameraLogicalDevice();
    35 	DWebcameraLogicalDevice();
    32 	~DWebcameraLogicalDevice();
    36 	~DWebcameraLogicalDevice();
    33     /**
    37 	/**
    34       Second stage constructor for DDriver1Factory.
    38 	Second stage constructor for DDriver1Factory.
    35       This must at least set a name for the driver object.
    39 	This must at least set a name for the driver object.
    36 
    40 
    37       @return KErrNone if successful, otherwise one of the other system wide error codes.
    41 	@return KErrNone if successful, otherwise one of the other system wide error codes.
    38     */
    42 	*/
    39     virtual TInt Install();
    43 	virtual TInt Install();
    40     /**
    44 
    41       Return the drivers capabilities.
    45 	/**
    42       Called in the response to an RDevice::GetCaps() request.
    46 	Return the drivers capabilities.
    43 
    47 	Called in the response to an RDevice::GetCaps() request.
    44       @param aDes User-side descriptor to write capabilities information into
    48 
    45     */
    49 	@param aDes User-side descriptor to write capabilities information into
    46     virtual void GetCaps(TDes8& aDes) const;
    50 	*/
    47     /**
    51 	virtual void GetCaps(TDes8& aDes) const;
    48       Called by the kernel's device driver framework to create a Logical Channel.
    52 
    49       This is called in the context of the user thread (client) which requested the creation of a Logical Channel
    53 	/**
    50       (E.g. through a call to RBusLogicalChannel::DoCreate)
    54 	Called by the kernel's device driver framework to create a Logical Channel.
    51       The thread is in a critical section.
    55 	This is called in the context of the user thread (client) which requested the creation of a Logical Channel
    52 
    56 	(E.g. through a call to RBusLogicalChannel::DoCreate)
    53       @param aChannel Set to point to the created Logical Channel
    57 	The thread is in a critical section.
    54 
    58 
    55       @return KErrNone if successful, otherwise one of the other system wide error codes.
    59 	@param aChannel Set to point to the created Logical Channel
    56     */
    60 	@return KErrNone if successful, otherwise one of the other system wide error codes.
    57     virtual TInt Create(DLogicalChannelBase*& aChannel);
    61 	*/
       
    62 	virtual TInt Create(DLogicalChannelBase*& aChannel);
    58 	};
    63 	};
    59 
    64 
    60 /**
    65 /**
    61  *
    66 Logical channel base-class.
    62  * 論理チャネルベースクラス
    67 
    63  *
    68 This class provides functions of Logical Channel.
    64  * 本クラスは、論理チャネル機能を提供する。
    69 */
    65  *
       
    66  * @
       
    67  * @
       
    68  *
       
    69  */
       
    70 class DWebcameraLogicalChannel : public DWebcameraLogicalChannelBase
    70 class DWebcameraLogicalChannel : public DWebcameraLogicalChannelBase
    71 	{
    71 	{
    72 public:
    72 public:
    73 	/**
    73 	/**
    74 	  Constructor
    74 	Constructor
    75 	*/
    75 	*/
    76 	DWebcameraLogicalChannel();
    76 	DWebcameraLogicalChannel();
    77 	/**
    77 
    78 	  Destructor
    78 	/**
       
    79 	Destructor
    79 	*/
    80 	*/
    80 	~DWebcameraLogicalChannel();
    81 	~DWebcameraLogicalChannel();
    81 	/**
    82 
    82 	  Called when a user thread requests a handle to this channel.
    83 	/**
    83 	*/
    84 	Called when a user thread requests a handle to this channel.
    84     virtual TInt RequestUserHandle(DThread* aThread, TOwnerType aType);
    85 	*/
    85     /**
    86 	virtual TInt RequestUserHandle(DThread* aThread, TOwnerType aType);
    86       Second stage constructor called by the kernel's device driver framework.
    87 
    87       This is called in the context of the user thread (client) which requested the creation of a Logical Channel
    88 	/**
    88       The thread is in a critical section.
    89 	Second stage constructor called by the kernel's device driver framework.
    89 
    90 	This is called in the context of the user thread (client) which requested the creation of a Logical Channel
    90       @param aUnit The unit argument supplied by the client
    91 	The thread is in a critical section.
    91       @param aInfo The info argument supplied by the client
    92 
    92       @param aVer The version argument supplied by the client
    93 	@param aUnit The unit argument supplied by the client
    93 
    94 	@param aInfo The info argument supplied by the client
    94       @return KErrNone if successful, otherwise one of the other system wide error codes.
    95 	@param aVer The version argument supplied by the client
    95     */
    96 	@return KErrNone if successful, otherwise one of the other system wide error codes.
       
    97 	*/
    96 	virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
    98 	virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
    97 	/**
    99 
    98 	  Process a message for this logical channel.
   100 	/**
    99 	  This function is called in the context of a DFC thread.
   101 	Process a message for this logical channel.
   100 
   102 	This function is called in the context of a DFC thread.
   101 	  @param aMessage The message to process.
   103 
   102 	                  The iValue member of this distinguishes the message type:
   104 	@param aMessage The message to process.
   103 	                  iValue==ECloseMsg, channel close message
   105 					The iValue member of this distinguishes the message type:
   104 	                  iValue==KMaxTInt, a 'DoCancel' message
   106 					iValue==ECloseMsg, channel close message
   105 	                  iValue>=0, a 'DoControl' message with function number equal to iValue
   107 					iValue==KMaxTInt, a 'DoCancel' message
   106 	                  iValue<0, a 'DoRequest' message with function number equal to ~iValue
   108 					iValue>=0, a 'DoControl' message with function number equal to iValue
       
   109 					iValue<0, a 'DoRequest' message with function number equal to ~iValue
   107 	*/
   110 	*/
   108 	virtual void HandleMsg(TMessageBase* aMsg);
   111 	virtual void HandleMsg(TMessageBase* aMsg);
   109 	/**
   112 
   110 	  Process synchronous 'control' requests
   113 	/**
       
   114 	Process synchronous 'control' requests
   111 	*/
   115 	*/
   112 	virtual TInt DoControl(TInt aFunction, TAny* a1, TAny* a2);
   116 	virtual TInt DoControl(TInt aFunction, TAny* a1, TAny* a2);
   113 	/**
   117 
   114 	  Process asynchronous requests.
   118 	/**
       
   119 	Process asynchronous requests.
   115 	*/
   120 	*/
   116 	virtual TInt DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2);
   121 	virtual TInt DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2);
   117 	/**
   122 
   118 	  Process cancelling of asynchronous requests.
   123 	/**
       
   124 	Process cancelling of asynchronous requests.
   119 	*/
   125 	*/
   120 	virtual void DoCancel(TUint aMask);
   126 	virtual void DoCancel(TUint aMask);
   121 	/**
   127 
   122 	  Called by PDD from ISR to indicate that a get oneflame operation has completed.
   128 	/**
   123 	*/
   129 	Called by PDD from ISR to indicate that a get oneflame operation has completed.
   124     virtual void GetOneFlameComplete(TInt aResult);
   130 	*/
   125     /**
   131 	virtual void GetOneFlameComplete(TInt aResult);
   126       Called by PDD from ISR to indicate that a get capture image operation has completed.
   132 
   127     */
   133 	/**
   128     virtual void CaptureComplete(TInt aResult);
   134 	Called by PDD from ISR to indicate that a get capture image operation has completed.
   129     /**
   135 	*/
   130       DFC Callback which gets triggered after the PDD has signalled that get oneflame completed.
   136 //	virtual void CaptureComplete(TInt aResult);
   131       This just casts aPtr and calls DoGetOneFlameComplete().
   137 
   132     */
   138 	/**
   133     static  void GetOneFlameDfc(TAny* aPtr);
   139 	DFC Callback which gets triggered after the PDD has signalled that get oneflame completed.
   134 	/**
   140 	This just casts aPtr and calls DoGetOneFlameComplete().
   135 	  DFC Callback which gets triggered after the PDD has signalled that getting Capture image completed.
   141 	*/
   136 	  This just casts aPtr and calls DoCaptureComplete().
   142 	static  void GetFlameDfc(TAny* aPtr);
   137 	*/
   143 
   138     static  void CaptureDfc(TAny* aPtr);
   144 	/**
   139     /**
   145 	DFC Callback which gets triggered after the PDD has signalled that getting Capture image completed.
   140       Called from a DFC after the PDD has signalled that getting oneflame completed.
   146 	This just casts aPtr and calls DoCaptureComplete().
   141     */
   147 	*/
       
   148 	static  void CaptureDfc(TAny* aPtr);
       
   149 
       
   150 	virtual void DoStartViewFinder();
       
   151 	/**
       
   152 	Called from a DFC after the PDD has signalled that getting oneflame completed.
       
   153 	*/
   142 	virtual void DoGetOneFlameComplete();
   154 	virtual void DoGetOneFlameComplete();
   143 	/**
   155 
   144 	  Called from a DFC after the PDD has signalled that getting Capture image completed.
   156 	/**
       
   157 	Called from a DFC after the PDD has signalled that getting Capture image completed.
   145 	*/
   158 	*/
   146 	virtual void DoCaptureComplete();
   159 	virtual void DoCaptureComplete();
   147     
   160 
   148 	/**
   161 	/**
   149 	  Process a GetConfig control message. This writes the current driver configuration to a
   162 	Process a GetConfig control message. This writes the current driver configuration to a
   150 	  RWebcameraDevice::TConfigBuf supplied by the client.
   163 	RWebcameraDevice::TConfigBuf supplied by the client.
   151 	*/
   164 	*/
   152     TInt GetConfig(TDes8* aConfigBuf);
   165 	TInt GetConfig(TDes8* aConfigBuf);
   153     /**
   166 
   154       Process a SetConfig control message. This sets the driver configuration using a
   167 	/**
   155       RWebcameraDevice::TConfigBuf supplied by the client.
   168 	Process a SetConfig control message. This sets the driver configuration using a
   156     */
   169 	RWebcameraDevice::TConfigBuf supplied by the client.
   157     TInt SetConfig(const TDesC8* aConfigBuf);
   170 	*/
       
   171 	TInt SetConfig(const TDesC8* aConfigBuf);
       
   172 
   158 //  void CurrentConfig(RWebcameraDevice::TConfig& aConfig);
   173 //  void CurrentConfig(RWebcameraDevice::TConfig& aConfig);
   159     /**
   174 
   160      *Get the point to Physical channel.
   175 	/**
   161      */
   176 	Get the point to Physical channel.
   162     DWebcameraDriverBase* Pdd();
   177 	*/
   163     
   178 	DWebcameraDriverBase* Pdd();
       
   179 
       
   180 	/**
       
   181 	Create shared chunk.
       
   182 	*/
       
   183 	TInt CreatSharedChunks();
       
   184 
       
   185 	/**
       
   186 	Open shared chunk that exists.
       
   187 	*/
       
   188 	TInt OpenSharedChunks(RWebcameraDevice::TChunkInfo* aChunkHandle);
       
   189 
       
   190 	/**
       
   191 	Dchunk call it when Shared chunk is destroyed.
       
   192 	*/
       
   193 	void ChunkDestroyed();
       
   194 
       
   195 	/**
       
   196 	Close shared chunk.
       
   197 	*/
       
   198 	void CloseSharedChunks();
       
   199 
   164 private:
   200 private:
   165     /**
   201 	/**
   166      *point to description sent by user-side.
   202 	point to description sent by user-side.
   167      */
   203 	*/
   168     TDes8* iReceiveDataDescriptor;
   204 	TInt* iReceiveDataDescriptor;
   169     /**
   205 
   170      *buffer for one flame.
   206 	/**
   171      */
   207 	power on state.
   172     HBuf8* iReceiveDataBuffer;
   208 	*/
   173     /**
   209 	TBool iPowerOn;
   174      *the status getting one flame.
   210 
   175      */
   211 	/**
       
   212 	the status getting one flame.
       
   213 	*/
   176 	TRequestStatus* iReceiveDataStatus;
   214 	TRequestStatus* iReceiveDataStatus;
   177     /**
   215 
   178      *DFC for getting one flame.
   216 	/**
   179      */
   217 	DFC for getting one flame.
       
   218 	*/
   180 	TDfc iReceiveDataDfc;
   219 	TDfc iReceiveDataDfc;
   181     /**
   220 
   182      *the result of the get oneflame operation.
   221 	/**
   183      */
   222 	the result of the get oneflame operation.
       
   223 	*/
   184 	TInt iReceiveDataResult;
   224 	TInt iReceiveDataResult;
   185     /**
   225 
   186      */
   226 	/**
       
   227 	the status running view finder.
       
   228 	*/
   187 	TBool iReceiving;
   229 	TBool iReceiving;
   188     /**
   230 
   189      *point to description sent by user-side.
   231 	/**
   190      */
   232 	point to description sent by user-side.
   191     TDes8* iCaptureDescriptor;
   233 	*/
   192     /**
   234 	TInt* iCaptureDescriptor;
   193      *buffer for capture image.
   235 
   194      */
   236 	/**
   195 	HBuf8* iCaptureBuffer;
   237 	the status getting capture image.
   196     /**
   238 	*/
   197      *the status getting capture image.
       
   198      */
       
   199 	TRequestStatus* iCaptureStatus;
   239 	TRequestStatus* iCaptureStatus;
   200     /**
   240 
   201      *DFC of capture.
   241 	/**
   202      */
   242 	DFC of capture.
       
   243 	*/
   203 	TDfc iCaptureDfc;
   244 	TDfc iCaptureDfc;
   204     /**
   245 
   205      *the result of the capture operation.
   246 	/**
   206      */
   247 	the result of the capture operation.
       
   248 	*/
   207 	TInt iCaptureResult;
   249 	TInt iCaptureResult;
   208     /**
   250 
   209      *the status getting capture image.
   251 	/**
   210      */
   252 	the status getting capture image.
       
   253 	*/
   211 	TBool iCaptureing;
   254 	TBool iCaptureing;
   212     /**
   255 
   213      *the status of request.
   256 	/**
   214      */	
   257 	the status of request.
       
   258 	*/	
   215 	TBool iRequesting;
   259 	TBool iRequesting;
   216     /**
   260 
   217      *point to memory used to save one frame or capture image.
   261 	/**
   218      */
   262 	Physical adress of contiguous memory.
   219     HBuf8* iComm;
   263 	*/
   220     /**
       
   221      *Physical adress of contiguous memory.
       
   222      */
       
   223 	TUint32 iPhysAddr;
   264 	TUint32 iPhysAddr;
   224     /**
   265 
   225      *the size of buffer used to save one frame or capture image.
   266 	/**
   226      */
   267 	the size of buffer used to save one frame or capture image.
       
   268 	*/
   227 	TInt iSize;
   269 	TInt iSize;
   228     /**
   270 
   229      *chunck.
   271 	/**
   230      */
   272 	the size of received data.
   231 	DPlatChunkHw* iChunk;
   273 	*/
   232     /**
       
   233      *Linear adress of chunck.
       
   234      */
       
   235 	TUint8* iLAdr;
       
   236     /**
       
   237      *the size of received data.
       
   238      */
       
   239 	TInt iSaveSize;
   274 	TInt iSaveSize;
       
   275 
       
   276 	/**
       
   277 	point to the created chunk object.
       
   278 	*/
       
   279 	DChunk* iChunk;
       
   280 
       
   281 	/**
       
   282 	he mmu mapping attributes used for the chunk.
       
   283 	*/
       
   284 	TUint32 iChunkMappingAttr;
       
   285 
       
   286 	/**
       
   287 	the linear address in the kernel process where the chunk's memory starts.
       
   288 	*/
       
   289 	TLinAddr iChunkLinAddr;
       
   290 
       
   291 	/**
       
   292 	camera status.
       
   293 	*/
       
   294 	TInt iWebCameraState;
       
   295 
       
   296 	/**
       
   297 	point to usb header info.
       
   298 	*/
       
   299 	TAny*	iHeaderPtr;
       
   300 
       
   301 	/**
       
   302 	point to description sent to PDD.
       
   303 	*/
       
   304 	TAny*	iDataPtr;
       
   305 
       
   306 	/**
       
   307 	point of convertion object.
       
   308 	*/
       
   309 	DWebCameraConvert* iConvert;
       
   310 
       
   311 	/**
       
   312 	Bitmap data pointer.
       
   313 	*/
       
   314 	TUint8* iBmpBuf;
   240 	};
   315 	};
   241 
   316 
   242 #endif
   317 #endif