baseport/syborg/webcamera/webcamera_driver.h
changeset 124 606eafc6d6a8
parent 52 0dfaca43d90e
equal deleted inserted replaced
52:0dfaca43d90e 124:606eafc6d6a8
    16 */
    16 */
    17 #ifndef __deviceIF_H__
    17 #ifndef __deviceIF_H__
    18 #define __deviceIF_H__
    18 #define __deviceIF_H__
    19 
    19 
    20 #include <e32cmn.h>
    20 #include <e32cmn.h>
    21 #include <e32ver.h>
    21 #ifndef __KERNEL_MODE__
    22 
    22 #include <e32std.h>
    23 #define BUFSIZE  (100*1024)
    23 #endif
       
    24 
       
    25 #define BUFSIZE  (600*1024)
       
    26 #define BITMAPBUFSIZE  (900 * 1024)
    24 
    27 
    25 /**
    28 /**
    26 User interface for 'WebcameraDevice'
    29 User interface for 'WebcameraDevice'
    27 Define of the RBusLogicalChannel that is used in the application
    30 Define of the RBusLogicalChannel that is used in the application
    28 */
    31 */
    29 class RWebcameraDevice : public RBusLogicalChannel
    32 class RWebcameraDevice : public RBusLogicalChannel
    30     {
    33 	{
    31 public:
    34 public:
    32     /**
    35 	/**
    33     Structure for holding driver capabilities information
    36 	Structure for holding driver capabilities information
    34     */
    37 	*/
    35     class TCaps
    38 	class TCaps
    36         {
    39 		{
    37     public:
    40 	public:
    38         TVersion iVersion;
    41 		TVersion iVersion;
    39         };
    42 		};
    40     /**
    43 
    41     Structure for holding driver configuration data
    44 	/**
    42     */
    45 	Structure for holding driver configuration data
    43     class TConfig
    46 	*/
    44         {
    47 	class TConfig
    45     public:
    48 		{
    46         TInt iPddBufferSize;        /**< Size of the PDD's data buffer (not modifiable) */
    49 	public:
    47        //RArray<TSize> iImageSizes /**< size the PDD support*/ //TODO:implement
    50 		TInt iPddBufferSize;        /**< Size of the PDD's data buffer (not modifiable) */
    48         };
    51 		//RArray<TSize> iImageSizes /**< size the PDD support*/ //TODO:implement
    49     typedef TPckgBuf<TConfig> TConfigBuf;
    52 		};
    50 
    53 	typedef TPckgBuf<TConfig> TConfigBuf;
       
    54 
       
    55 	/**
       
    56 	Structure for holding driver chuck information
       
    57 	*/
       
    58 	class TChunkInfo
       
    59 		{
       
    60 	public:
       
    61 		TInt iChunkHandle;
       
    62 		TInt iChunkMaxSize;
       
    63 		TInt iChunkRemSize;
       
    64 		};
    51 public:
    65 public:
    52     /**
    66 	/**
    53       Opens a logical channel to the driver
    67 	Opens a logical channel to the driver
    54 
    68 	@return One of the system wide error codes.
    55       @return One of the system wide error codes.
    69 	*/
    56     */
    70 	inline TInt Open();
    57     inline TInt Open();
    71 
    58     /**
    72 	/**
    59       Gets the current configuration settings.
    73 	Gets the current configuration settings.
    60 
    74 
    61       @param aConfig A structure which will be filled with the configuration settings.
    75 	@param aConfig A structure which will be filled with the configuration settings.
    62 
    76 
    63       @return KErrNone
    77 	@return KErrNone
    64     */
    78 	*/
    65     inline TInt GetConfig(TConfigBuf& aConfig);
    79 	inline TInt GetConfig(TConfigBuf& aConfig);
    66     /**
    80 
    67       Sets the current configuration settings.
    81 	/**
    68 
    82 	Sets the current configuration settings.
    69       @param aConfig The new configuration settings to be used.
    83 
    70 
    84 	@param aConfig The new configuration settings to be used.
    71       @return KErrInUse if there are outstanding data transfer requests.
    85 
    72               KErrArgument if any configuration values are invalid.
    86 	@return KErrInUse if there are outstanding data transfer requests.
    73               KErrNone otherwise
    87 			KErrArgument if any configuration values are invalid.
    74     */
    88 			KErrNone otherwise
    75     inline TInt SetConfig(const TConfigBuf& aConfig);
    89 	*/
    76     /**
    90 	inline TInt SetConfig(const TConfigBuf& aConfig);
    77       Request data from device.
    91 
    78       Only one send request may be pending at any time.
    92 	/**
    79 
    93 	Power on Camera Device.
    80       @param aStatus The request to be signalled when the data has been sent.
    94 	*/
    81                      The result value will be set to KErrNone on success;
    95 	inline void PowerOn(TRequestStatus& aStatus);
    82                      or set to one of the system wide error codes when an error occurs.
    96 
    83       @param aData   A descriptor containing the data to send.
    97 	/**
    84     */
    98 	Power off Camera Device.
    85     inline void StartViewFinder(TRequestStatus& aStatus,TDes8& aBuffer);
    99 	*/
    86     /**
   100 	inline void PowerOff(TRequestStatus& aStatus);
    87       Cancels a previous getdata request.
   101 
    88     */
   102 	/** 
    89     inline void StartViewFinderCancel();
   103 	Init ViewFinder.
    90     /**
   104 	*/
    91       Cancels a previous getdata request and notice device not to send data       
   105 	inline TInt InitViewFinder();
    92     */
   106 
    93     inline void StopViewFinder();
   107 	/**
    94     /**
   108 	Request data from device.
    95       Request data(Capture data) from device.
   109 	Only one send request may be pending at any time.
    96       Only one send request may be pending at any time.
   110 
    97 
   111 	@param aStatus	The request to be signalled when the data has been sent.
    98       @param aStatus The request to be signalled when the data has been sent.
   112 					The result value will be set to KErrNone on success;
    99                      The result value will be set to KErrNone on success;
   113 					or set to one of the system wide error codes when an error occurs.
   100                      or set to one of the system wide error codes when an error occurs.
   114 	@param aData	A descriptor containing the data to send.
   101       @param aData   A descriptor containing the data to send.
   115 	*/
   102     */
   116 	inline void StartViewFinder(TRequestStatus& aStatus,TInt& aChunkLen);
   103     inline void Capture(TRequestStatus& aStatus,TDes8& aBuffer);
   117 
   104     /**
   118 	/**
   105       Cancels a previous getCapturedata request.     
   119 	Cancels a previous getdata request.
   106     */
   120 	*/
       
   121 	inline void StartViewFinderCancel();
       
   122 
       
   123 	/**
       
   124 	Cancels a previous getdata request and notice device not to send data
       
   125 	*/
       
   126 	inline void StopViewFinder();
       
   127 
       
   128 	/**
       
   129 	Request data(Capture data) from device.
       
   130 	Only one send request may be pending at any time.
       
   131 
       
   132 	@param aStatus	The request to be signalled when the data has been sent.
       
   133 					The result value will be set to KErrNone on success;
       
   134 					or set to one of the system wide error codes when an error occurs.
       
   135 	@param aData	A descriptor containing the data to send.
       
   136 	*/
       
   137 	inline void Capture(TRequestStatus& aStatus,TInt& aChunkLen);
       
   138 
       
   139 	/**
       
   140 	Cancels a previous getCapturedata request.
       
   141 	*/
   107 	inline void CaptureCancel();
   142 	inline void CaptureCancel();
   108 	/**
   143 
   109 	  Returns the driver's name
   144 	/**
   110 	*/
   145 	Returns the driver's name
   111     inline static const TDesC& Name();
   146 	*/
   112     /**
   147 	inline static const TDesC& Name();
   113       Returns the version number of the driver
   148 
   114     */
   149 	/**
   115     inline static TVersion VersionRequired();
   150 	Returns the version number of the driver
   116     
   151 	*/
       
   152 	inline static TVersion VersionRequired();
       
   153 
       
   154 	/**
       
   155 	Opens a shared chunk on kernel side and makes a handle to the kernel chunk object
       
   156 	@param aChunk		The object to which the handle will refer
       
   157 	@param aChunkInfo	information of the created chunk.
       
   158 	*/
       
   159 #ifndef __KERNEL_MODE__
       
   160 	inline TInt OpenSharedChunks(RChunk& aChunk,TChunkInfo& aChunkInfo);
       
   161 
       
   162 	/**
       
   163 	Closes ashared chunk
       
   164 	@param aChunk 	The object to which the handle will refer
       
   165 	@param aStatus	The request to be signalled when the data has been sent.
       
   166 					The result value will be set to KErrNone on success;
       
   167 					or set to one of the system wide error codes when an error occurs.
       
   168 	*/
       
   169 	inline TInt CloseSharedChunks(TRequestStatus& aStatus,RChunk& aChunk);
       
   170 #endif
       
   171 
   117 public:
   172 public:
   118     /**
   173 	/**
   119     Enumeration of Control messages.
   174 	Enumeration of Control messages.
   120     */
   175 	*/
   121     enum TControl
   176 	enum TControl
   122         {
   177 		{
   123         EGetConfig,
   178 		EGetConfig,
   124         ESetConfig
   179 		ESetConfig,
   125         };
   180 		EInitViewFinder,
   126     /**
   181 		EOpenSharedChunck
   127     Enumeration of Request messages.
   182 		};
   128     */
   183 	/**
   129     enum TRequest
   184 	Enumeration of Request messages.
   130         {
   185 	*/
   131         EStart,
   186 	enum TRequest
   132         ECapture,
   187 		{
   133         ENumRequests,
   188 		EPowerOff,
   134         EAllRequests = (1<<ENumRequests)-1
   189 		EPowerOn,
   135         };
   190 		EStart,
   136 
   191 		ETransferData,
   137     // Kernel side LDD channel is a friend
   192 		ECapture,
   138     friend class DDriver1Channel;
   193 		ECloseSharedChunck,
   139     };
   194 		ENumRequests,
       
   195 		EAllRequests = (1<<ENumRequests)-1
       
   196 		};
       
   197 
       
   198 	// Kernel side LDD channel is a friend
       
   199 	friend class DWebcameraLogicalChannel;
       
   200 	};
   140 
   201 
   141 // Inline functions
   202 // Inline functions
   142 #include <webcamera_driver.inl>
   203 #include <webcamera_driver.inl>
   143 
   204 
   144 #endif
   205 #endif