diff -r 43e37759235e -r 51a74ef9ed63 Symbian3/SDK/Source/GUID-E9B97347-D703-4758-A5CE-423A6CB4E474.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-E9B97347-D703-4758-A5CE-423A6CB4E474.dita Wed Mar 31 11:11:55 2010 +0100 @@ -0,0 +1,80 @@ + + + + + +Embedding +camera applications +

In your applications, you can embed other applications that provide services, +such as image capture and voice recording. For example, a multimedia messaging +service (MMS) editor could embed the camera application to capture images +and insert them in multimedia messages.

+

Use the New File Service Client API to create a service client.

+

The binary compatibility of the API plug-ins is not guaranteed either +between platform versions or within a platform version. Test your application +on each device model that the application can be installed on to ensure the +best possible user experience. To prevent application installation on other +than tested devices, define the product IDs (also called manufacturer IDs) +in the package file. +For more information, see Hardware/UI platform dependency.

+
To embed camera +applications
    +
  1. Use the CNewFileServiceClient method +to create a new file service client.

    CNewFileServiceClient* fileClient = NewFileServiceFactory::NewClientL(); +CleanupStack::PushL( fileClient ); +
  2. +
  3. Create an array to hold +the file names for the resulting files.

    CDesCArray* fileNames = new ( ELeave ) CDesCArrayFlat( 1 ); +CleanupStack::PushL( fileNames ); + +
  4. +
  5. Use generic parameters +to control the service.

    CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC();
  6. +
  7. Specify image resolution. +The application matches the value that you enter to the closest resolution +supported (in pixels). Use the value (0,0) for the default MMS resolution, +which is the lowest quality.

    TSize resolution( 1600, 1200 ); // 2 megapixels +

    If the device has two cameras, the camera available at the +time of launching the service client is used. You cannot select whether to +launch the primary or secondary camera. Users cannot switch from the primary +camera to the secondary one after launching the service client. The secondary +camera always uses a fixed resolution that you cannot specify.

  8. +
  9. Package the object.

    TPckgBuf<TSize> buffer( resolution ); +TAiwVariant resolutionVariant( buffer ); +TAiwGenericParam param( EGenericParamResolution, resolutionVariant ); +paramList->AppendL( param ); +
  10. +
  11. Specify the application +to launch. The application UID identifies the application to be started as +a server application.

    const TUid KUidCamera = { 0x101F857A }; // Camera UID for S60 5th edition + +... + +TBool result = fileClient->NewFileL( KUidCamera, *fileNames, paramList, + ENewFileServiceImage, EFalse ); +
  12. +
  13. Access the images. The fileNames array +can hold more than one item.

    if ( result ) + { + CEikonEnv::InfoWinL(_L("Success"),_L("")); + for(TInt i=0;iCount();i++) + { + TPtrC fileName=fileNames->MdcaPoint(i); + ... +} +else + { + CEikonEnv::InfoWinL(_L("Failed"),_L("")); + } + +CleanupStack::PopAndDestroy( fileClient ); +CleanupStack::PopAndDestroy( paramList ); +CleanupStack::PopAndDestroy( fileNames );
  14. +
+
\ No newline at end of file