baseport/syborg/webcamera/webcamera_driver.inl
changeset 69 634f7e208f90
parent 52 0dfaca43d90e
child 124 606eafc6d6a8
equal deleted inserted replaced
68:c9d64fb26f98 69:634f7e208f90
       
     1 /*
       
     2 * Copyright (c) 2010 ISB.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * ISB - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __deviceIFI_H
       
    19 #define __deviceIFI_H
       
    20 
       
    21 /**
       
    22   Returns the driver's name
       
    23 */
       
    24 inline const TDesC& RWebcameraDevice::Name()
       
    25     {
       
    26     _LIT(KDriverName,"WebcameraDevice");
       
    27     return KDriverName;
       
    28     }
       
    29 
       
    30 /**
       
    31   Returns the version number of the driver
       
    32 */
       
    33 inline TVersion RWebcameraDevice::VersionRequired()
       
    34     {
       
    35     const TInt KMajorVersionNumber=1;
       
    36     const TInt KMinorVersionNumber=1;
       
    37     const TInt KBuildVersionNumber=0;
       
    38     return TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber);
       
    39     }
       
    40 
       
    41 /*
       
    42   NOTE: The following member functions would normally be exported from a seperate client DLL
       
    43   but are included inline in this header file for convenience.
       
    44 */
       
    45 
       
    46 #ifndef __KERNEL_MODE__
       
    47 
       
    48 /**
       
    49   Opens a logical channel to the driver
       
    50 
       
    51   @return One of the system wide error codes.
       
    52 */
       
    53 inline TInt RWebcameraDevice::Open()
       
    54     {
       
    55     return DoCreate(Name(),VersionRequired(),KNullUnit,NULL,NULL,EOwnerThread);
       
    56     }
       
    57 
       
    58 
       
    59 /**
       
    60   Gets the current configuration settings.
       
    61 
       
    62   @param aConfig A structure which will be filled with the configuration settings.
       
    63 
       
    64   @return KErrNone
       
    65 */
       
    66 inline TInt RWebcameraDevice::GetConfig(TConfigBuf& aConfig)
       
    67     {
       
    68     return DoControl(EGetConfig,(TAny*)&aConfig);
       
    69     }
       
    70 
       
    71 
       
    72 /**
       
    73   Sets the current configuration settings.
       
    74 
       
    75   @param aConfig The new configuration settings to be used.
       
    76 
       
    77   @return KErrInUse if there are outstanding data transfer requests.
       
    78           KErrArgument if any configuration values are invalid.
       
    79           KErrNone otherwise
       
    80 */
       
    81 inline TInt RWebcameraDevice::SetConfig(const TConfigBuf& aConfig)
       
    82     {
       
    83     return DoControl(ESetConfig,(TAny*)&aConfig);
       
    84     }
       
    85 
       
    86 /**
       
    87   Receives image from the device.
       
    88   Only one receive request may be pending at any time.
       
    89 
       
    90   @param aStatus The request to be signalled when the data has been received.
       
    91                  The result value will be set to KErrNone on success;
       
    92                  or set to one of the system wide error codes when an error occurs.
       
    93   @param aData   A descriptor to which the received data will be written.
       
    94 */
       
    95 inline void RWebcameraDevice::StartViewFinder(TRequestStatus& aStatus,TDes8& aBuffer)
       
    96     {
       
    97 	TInt length=BUFSIZE;
       
    98     DoRequest(EStart,aStatus,(TAny*)&aBuffer,(TAny*)&length);
       
    99     }
       
   100 
       
   101 
       
   102 /**
       
   103   Cancels a previous StartViewFinder request.
       
   104 */
       
   105 inline void RWebcameraDevice::StartViewFinderCancel()
       
   106     {
       
   107     DoCancel(1<<EStart);
       
   108     }
       
   109 
       
   110 inline void RWebcameraDevice::StopViewFinder()
       
   111 	{
       
   112     DoCancel(1<<EStart);
       
   113 	}
       
   114 
       
   115 /**
       
   116   Capture data from the device.
       
   117   Only one Capture request may be pending at any time.
       
   118 
       
   119   @param aStatus The request to be signalled when the data has been captureed.
       
   120                  The result value will be set to KErrNone on success;
       
   121                  or set to one of the system wide error codes when an error occurs.
       
   122   @param aData   A descriptor to which the captured data will be written.
       
   123 */
       
   124 inline void RWebcameraDevice::Capture(TRequestStatus& aStatus,TDes8& aBuffer)
       
   125     {
       
   126 	TInt length=BUFSIZE;
       
   127     DoRequest(ECapture,aStatus,(TAny*)&aBuffer,(TAny*)&length);
       
   128     }
       
   129 
       
   130 /**
       
   131   Cancels a previous capture request.
       
   132 */
       
   133 inline void RWebcameraDevice::CaptureCancel()
       
   134     {
       
   135 	DoCancel(1<<ECapture);
       
   136     }
       
   137 #endif   // !__KERNEL_MODE__
       
   138 
       
   139 #endif