Symbian3/SDK/Source/GUID-E9B97347-D703-4758-A5CE-423A6CB4E474.dita
changeset 0 89d6a7a84779
child 2 ebc84c812384
equal deleted inserted replaced
-1:000000000000 0:89d6a7a84779
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-E9B97347-D703-4758-A5CE-423A6CB4E474" xml:lang="en"><title>Embedding
       
    13 camera applications</title><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <p>In your applications, you can embed other applications that provide services,
       
    15 such as image capture and voice recording. For example, a multimedia messaging
       
    16 service (MMS) editor could embed the camera application to capture images
       
    17 and insert them in multimedia messages.</p>
       
    18 <p>Use the New File Service Client API to create a service client. You can
       
    19 download the API from the <xref href="http://wiki.forum.nokia.com/index.php/SDK_API_Plug-in" scope="external">SDK API plug-in page</xref> on Forum Nokia.</p>
       
    20 <note><p>The binary compatibility of the API plug-ins is not guaranteed either
       
    21 between platform versions or within a platform version. Test your application
       
    22 on each device model that the application can be installed on to ensure the
       
    23 best possible user experience. To prevent application installation on other
       
    24 than tested devices, define the product IDs (also called manufacturer IDs)
       
    25 in the <xref href="GUID-7F1B2577-2FEF-45F9-B32F-745DFE0F0D95.dita">package file</xref>.
       
    26 For more information, see <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/ToolsAndUtilities94/Installing-ref/PKG_format/PKG_dependency.html" format="application/java-archive">Hardware/UI platform dependency</xref>.</p></note>
       
    27 <section id="GUID-A7CFB0D3-0F64-4BCA-93F1-28D7F2F892A0"><title>To embed camera applications</title><ol>
       
    28 <li id="GUID-B945513D-1DBA-46A5-BE66-20F36EF8E4B4"><p>Use the <codeph>CNewFileServiceClient</codeph> method
       
    29 to create a new file service client. </p><codeblock xml:space="preserve">CNewFileServiceClient* fileClient = NewFileServiceFactory::NewClientL();
       
    30 CleanupStack::PushL( fileClient );
       
    31 </codeblock></li>
       
    32 <li id="GUID-3CADBF28-0A9F-44C4-B7AF-AF9628E8F659"><p>Create an array to hold
       
    33 the file names for the resulting files.</p><codeblock xml:space="preserve">CDesCArray* fileNames = new ( ELeave ) CDesCArrayFlat( 1 );
       
    34 CleanupStack::PushL( fileNames );
       
    35 
       
    36 </codeblock></li>
       
    37 <li id="GUID-1D168D25-1D05-4A19-9811-1DA4394F0B1E"><p>Use generic parameters
       
    38 to control the service.</p><codeblock xml:space="preserve">CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC();</codeblock></li>
       
    39 <li id="GUID-B4CDA320-B9F5-47F6-828B-91EC5B8820ED"><p>Specify image resolution.
       
    40 The application matches the value that you enter to the closest resolution
       
    41 supported (in pixels). Use the value (0,0) for the default MMS resolution,
       
    42 which is the lowest quality.</p><codeblock xml:space="preserve">TSize resolution( 1600, 1200 ); // 2 megapixels
       
    43 </codeblock><p>If the device has two cameras, the camera available at the
       
    44 time of launching the service client is used. You cannot select whether to
       
    45 launch the primary or secondary camera. Users cannot switch from the primary
       
    46 camera to the secondary one after launching the service client. The secondary
       
    47 camera always uses a fixed resolution that you cannot specify.</p></li>
       
    48 <li id="GUID-DBB7629D-604E-40B7-8C2E-BA3D439C77F9"><p>Package the object.</p><codeblock xml:space="preserve">TPckgBuf&lt;TSize&gt; buffer( resolution );
       
    49 TAiwVariant resolutionVariant( buffer );
       
    50 TAiwGenericParam param( EGenericParamResolution, resolutionVariant );
       
    51 paramList-&gt;AppendL( param );
       
    52 </codeblock></li>
       
    53 <li id="GUID-206F9549-5A8E-42D1-841E-6DA9A28A061D"><p>Specify the application
       
    54 to launch. The application UID identifies the application to be started as
       
    55 a server application. </p><codeblock xml:space="preserve">const TUid KUidCamera = { 0x101F857A }; // Camera UID for S60 5th edition
       
    56 
       
    57 ...
       
    58 
       
    59 TBool result = fileClient-&gt;NewFileL( KUidCamera, *fileNames, paramList,
       
    60                                ENewFileServiceImage, EFalse );
       
    61 </codeblock></li>
       
    62 <li id="GUID-4C0A3DB0-F8AA-4E75-974E-2AA062268480"><p>Access the images. The <codeph>fileNames</codeph> array
       
    63 can hold more than one item.</p><codeblock xml:space="preserve">if ( result )
       
    64     {
       
    65     CEikonEnv::InfoWinL(_L("Success"),_L(""));
       
    66     for(TInt i=0;iCount();i++)
       
    67        {
       
    68        TPtrC fileName=fileNames-&gt;MdcaPoint(i);
       
    69        ...
       
    70 }
       
    71 else
       
    72     {
       
    73     CEikonEnv::InfoWinL(_L("Failed"),_L(""));
       
    74     }
       
    75 
       
    76 CleanupStack::PopAndDestroy( fileClient );
       
    77 CleanupStack::PopAndDestroy( paramList );
       
    78 CleanupStack::PopAndDestroy( fileNames );</codeblock></li>
       
    79 </ol></section>
       
    80 </conbody></concept>