mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/recorder/openmaxalrecorditftests.cpp
changeset 14 80975da52420
child 53 eabc8c503852
equal deleted inserted replaced
12:5a06f39ad45b 14:80975da52420
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "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 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 * 
       
    14 * Description: This file contains testclass implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 // [INCLUDE FILES] - do not remove
       
    19 #include <e32svr.h>
       
    20 #include <StifParser.h>
       
    21 #include <StifTestInterface.h>
       
    22 #include "openmaxaltestmodule.h"
       
    23 
       
    24 // EXTERNAL DATA STRUCTURES
       
    25 //extern  ?external_data;
       
    26 
       
    27 // EXTERNAL FUNCTION PROTOTYPES  
       
    28 //extern ?external_function( ?arg_type,?arg_type );
       
    29 
       
    30 // CONSTANTS
       
    31 //const ?type ?constant_var = ?constant;
       
    32 
       
    33 // MACROS
       
    34 //#define ?macro ?macro_def
       
    35 
       
    36 // LOCAL CONSTANTS AND MACROS
       
    37 //const ?type ?constant_var = ?constant;
       
    38 //#define ?macro_name ?macro_def
       
    39 
       
    40 // MODULE DATA STRUCTURES
       
    41 //enum ?declaration
       
    42 //typedef ?declaration
       
    43 
       
    44 // LOCAL FUNCTION PROTOTYPES
       
    45 //?type ?function_name( ?arg_type, ?arg_type );
       
    46 void RecordItfCallback (
       
    47     XARecordItf caller,
       
    48     void * pContext,
       
    49     XAuint32 event
       
    50 );
       
    51 // FORWARD DECLARATIONS
       
    52 //class ?FORWARD_CLASSNAME;
       
    53 
       
    54 // ============================= LOCAL FUNCTIONS ===============================
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // ?function_name ?description.
       
    58 // ?description
       
    59 // Returns: ?value_1: ?description
       
    60 //          ?value_n: ?description_line1
       
    61 //                    ?description_line2
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 /*
       
    65 ?type ?function_name(
       
    66     ?arg_type arg,  // ?description
       
    67     ?arg_type arg)  // ?description
       
    68     {
       
    69 
       
    70     ?code  // ?comment
       
    71 
       
    72     // ?comment
       
    73     ?code
       
    74     }
       
    75 */
       
    76 
       
    77 TInt COpenMAXALTestModule::al_recorditf_SetRecordState( CStifItemParser& aItem )
       
    78     {
       
    79     TInt status(KErrNone);
       
    80     TInt state(0);
       
    81     XAresult res;
       
    82     status = aItem.GetNextInt(state);
       
    83     if(!status)
       
    84         {
       
    85         if(m_RecordItf)
       
    86             {
       
    87             res = (*m_RecordItf)->SetRecordState(
       
    88                     m_RecordItf, state);              
       
    89             status = res;
       
    90             }
       
    91         else
       
    92             {
       
    93             status = KErrNotFound;
       
    94             }    
       
    95         }
       
    96 
       
    97     return status;
       
    98     }
       
    99 
       
   100 TInt COpenMAXALTestModule::al_recorditf_GetRecordState( CStifItemParser& /*aItem*/ )
       
   101     {
       
   102     TInt status(KErrNone);
       
   103     XAresult res;
       
   104     XAuint32 state;
       
   105     if(m_RecordItf)
       
   106         {
       
   107         res = (*m_RecordItf)->GetRecordState(
       
   108                 m_RecordItf, &state);              
       
   109         status = res;
       
   110         }
       
   111     else
       
   112         {
       
   113         status = KErrNotFound;
       
   114         }    
       
   115 
       
   116     return status;
       
   117     }
       
   118 
       
   119 TInt COpenMAXALTestModule::al_recorditf_SetDurationLimit( CStifItemParser& aItem )
       
   120     {
       
   121     TInt status(KErrNone);
       
   122     TUint duration(0);
       
   123     XAresult res;
       
   124     status = aItem.GetNextInt(duration);
       
   125     if(!status)
       
   126         {
       
   127         if(m_RecordItf)
       
   128             {
       
   129             res = (*m_RecordItf)->SetDurationLimit(
       
   130                     m_RecordItf, duration);              
       
   131             status = res;
       
   132             }
       
   133         else
       
   134             {
       
   135             status = KErrNotFound;
       
   136             }    
       
   137         }
       
   138 
       
   139     return status;
       
   140     }
       
   141 
       
   142 TInt COpenMAXALTestModule::al_recorditf_GetPosition( CStifItemParser& /*aItem*/ )
       
   143     {
       
   144     TInt status(KErrNone);
       
   145     XAresult res;
       
   146     XAmillisecond pos;
       
   147     if(m_RecordItf)
       
   148         {
       
   149         res = (*m_RecordItf)->GetPosition(
       
   150                 m_RecordItf, &pos);              
       
   151         status = res;
       
   152         }
       
   153     else
       
   154         {
       
   155         status = KErrNotFound;
       
   156         }    
       
   157 
       
   158     return status;
       
   159     }
       
   160 
       
   161 TInt COpenMAXALTestModule::al_recorditf_RegisterCallback( CStifItemParser& /*aItem*/ )
       
   162     {
       
   163     TInt status(KErrNone);
       
   164     XAresult res;
       
   165 
       
   166     if(m_RecordItf)
       
   167         {
       
   168         res = (*m_RecordItf)->RegisterCallback(
       
   169                 m_RecordItf, &RecordItfCallback, (void*)this);              
       
   170         status = res;
       
   171         }
       
   172     else
       
   173         {
       
   174         status = KErrNotFound;
       
   175         }    
       
   176 
       
   177     return status;
       
   178     }
       
   179 
       
   180 TInt COpenMAXALTestModule::al_recorditf_SetCallbackEventsMask( CStifItemParser& aItem )
       
   181     {
       
   182     TInt status(KErrNone);
       
   183     TUint flags(0);
       
   184     XAresult res;
       
   185     status = aItem.GetNextInt(flags);
       
   186     if(!status)
       
   187         {
       
   188         if(m_RecordItf)
       
   189             {
       
   190             res = (*m_RecordItf)->SetCallbackEventsMask(
       
   191                     m_RecordItf, flags);              
       
   192             status = res;
       
   193             }
       
   194         else
       
   195             {
       
   196             status = KErrNotFound;
       
   197             }    
       
   198         }
       
   199 
       
   200     return status;
       
   201     }
       
   202 
       
   203 TInt COpenMAXALTestModule::al_recorditf_GetCallbackEventsMask( CStifItemParser& /*aItem*/ )
       
   204     {
       
   205     TInt status(KErrNone);
       
   206     XAresult res;
       
   207     XAuint32 flags;
       
   208     if(m_RecordItf)
       
   209         {
       
   210         res = (*m_RecordItf)->GetCallbackEventsMask(
       
   211                 m_RecordItf, &flags);              
       
   212         status = res;
       
   213         }
       
   214     else
       
   215         {
       
   216         status = KErrNotFound;
       
   217         }    
       
   218 
       
   219     return status;
       
   220     }
       
   221 
       
   222 TInt COpenMAXALTestModule::al_recorditf_SetMarkerPosition( CStifItemParser& aItem )
       
   223     {
       
   224     TInt status(KErrNone);
       
   225     TUint pos(0);
       
   226     XAresult res;
       
   227     status = aItem.GetNextInt(pos);
       
   228     if(!status)
       
   229         {
       
   230         if(m_RecordItf)
       
   231             {
       
   232             res = (*m_RecordItf)->SetMarkerPosition(
       
   233                     m_RecordItf, pos);              
       
   234             status = res;
       
   235             }
       
   236         else
       
   237             {
       
   238             status = KErrNotFound;
       
   239             }    
       
   240         }
       
   241 
       
   242     return status;
       
   243     }
       
   244 
       
   245 TInt COpenMAXALTestModule::al_recorditf_ClearMarkerPosition( CStifItemParser& /*aItem*/ )
       
   246     {
       
   247     TInt status(KErrNone);
       
   248     XAresult res;
       
   249 
       
   250     if(m_RecordItf)
       
   251         {
       
   252         res = (*m_RecordItf)->ClearMarkerPosition(m_RecordItf);              
       
   253         status = res;
       
   254         }
       
   255     else
       
   256         {
       
   257         status = KErrNotFound;
       
   258         }    
       
   259 
       
   260     return status;
       
   261     }
       
   262 
       
   263 TInt COpenMAXALTestModule::al_recorditf_GetMarkerPosition( CStifItemParser& /*aItem*/ )
       
   264     {
       
   265     TInt status(KErrNone);
       
   266     XAresult res;
       
   267     XAmillisecond pos;
       
   268     if(m_RecordItf)
       
   269         {
       
   270         res = (*m_RecordItf)->GetMarkerPosition(
       
   271                 m_RecordItf, &pos);              
       
   272         status = res;
       
   273         }
       
   274     else
       
   275         {
       
   276         status = KErrNotFound;
       
   277         }    
       
   278 
       
   279     return status;
       
   280     }
       
   281 
       
   282 TInt COpenMAXALTestModule::al_recorditf_SetPositionUpdatePeriod( CStifItemParser& aItem )
       
   283     {
       
   284     TInt status(KErrNone);
       
   285     TUint updatePeriod(0);
       
   286     XAresult res;
       
   287     status = aItem.GetNextInt(updatePeriod);
       
   288     if(!status)
       
   289         {
       
   290         if(m_RecordItf)
       
   291             {
       
   292             res = (*m_RecordItf)->SetPositionUpdatePeriod(
       
   293                     m_RecordItf, updatePeriod);              
       
   294             status = res;
       
   295             }
       
   296         else
       
   297             {
       
   298             status = KErrNotFound;
       
   299             }    
       
   300         }
       
   301 
       
   302     return status;
       
   303     }
       
   304 
       
   305 TInt COpenMAXALTestModule::al_recorditf_GetPositionUpdatePeriod( CStifItemParser& /*aItem*/ )
       
   306     {
       
   307     TInt status(KErrNone);
       
   308     XAresult res;
       
   309     XAmillisecond pos;
       
   310     if(m_RecordItf)
       
   311         {
       
   312         res = (*m_RecordItf)->GetPositionUpdatePeriod(
       
   313                 m_RecordItf, &pos);              
       
   314         status = res;
       
   315         }
       
   316     else
       
   317         {
       
   318         status = KErrNotFound;
       
   319         }    
       
   320 
       
   321     return status;
       
   322     }
       
   323