mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/common/openmaxaldynitfmgmtitftests.cpp
changeset 14 80975da52420
child 16 43d09473c595
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 
       
    47 // FORWARD DECLARATIONS
       
    48 //class ?FORWARD_CLASSNAME;
       
    49 void DynamicInterfaceManagementCallback (
       
    50     XADynamicInterfaceManagementItf caller,
       
    51     void * pContext,
       
    52     XAuint32 event,
       
    53     XAresult result,
       
    54     const XAInterfaceID iid
       
    55 );
       
    56 
       
    57 
       
    58 // ============================= LOCAL FUNCTIONS ===============================
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // ?function_name ?description.
       
    62 // ?description
       
    63 // Returns: ?value_1: ?description
       
    64 //          ?value_n: ?description_line1
       
    65 //                    ?description_line2
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 /*
       
    69 ?type ?function_name(
       
    70     ?arg_type arg,  // ?description
       
    71     ?arg_type arg)  // ?description
       
    72     {
       
    73 
       
    74     ?code  // ?comment
       
    75 
       
    76     // ?comment
       
    77     ?code
       
    78     }
       
    79 */
       
    80 
       
    81 TInt COpenMAXALTestModule::al_dimitf_AddInterface( CStifItemParser& aItem )
       
    82     {
       
    83     TInt status(KErrNone);
       
    84     XAresult res;
       
    85     TInt async(0);
       
    86     TInt interface(0);
       
    87     XAInterfaceID id(NULL);
       
    88 
       
    89 
       
    90     status = aItem.GetNextInt(interface);
       
    91     if(!status)
       
    92         {
       
    93         id = MapInterface(interface);
       
    94         }
       
    95     else
       
    96         {
       
    97         status = KErrGeneral;
       
    98         }
       
    99 
       
   100     status = aItem.GetNextInt(async);
       
   101     if(!status)
       
   102         {
       
   103         if(m_DIMItf)
       
   104             {
       
   105             res = (*m_DIMItf)->AddInterface(m_DIMItf,id,async);
       
   106             status = res;
       
   107             }
       
   108         }
       
   109     else
       
   110         {
       
   111         status = KErrGeneral;
       
   112         }
       
   113     return status;    
       
   114     }
       
   115 
       
   116 TInt COpenMAXALTestModule::al_dimitf_RemoveInterface( CStifItemParser& aItem )
       
   117     {
       
   118     TInt status(KErrNone);
       
   119     XAresult res;
       
   120     TInt async(0);
       
   121     TInt interface(0);
       
   122     XAInterfaceID id(NULL);
       
   123 
       
   124     status = aItem.GetNextInt(interface);
       
   125     if(!status)
       
   126         {
       
   127         id = MapInterface(interface);
       
   128         status = StoreInterface(interface, NULL);
       
   129         }
       
   130     else
       
   131         {
       
   132         status = KErrGeneral;
       
   133         }
       
   134 
       
   135     status = aItem.GetNextInt(async);
       
   136     if(!status)
       
   137         {
       
   138         if(m_DIMItf)
       
   139             {
       
   140             res = (*m_DIMItf)->RemoveInterface(m_DIMItf,id);
       
   141             status = res;
       
   142             }
       
   143         else
       
   144             {
       
   145             status = KErrNotFound;
       
   146             }
       
   147         }
       
   148     else
       
   149         {
       
   150         status = KErrGeneral;
       
   151         }
       
   152     return status;            
       
   153     }
       
   154 
       
   155 TInt COpenMAXALTestModule::al_dimitf_ResumeInterface( CStifItemParser& aItem )
       
   156     {
       
   157     TInt status(KErrNone);
       
   158     XAresult res;
       
   159     TInt async(0);
       
   160     TInt interface(0);
       
   161     XAInterfaceID id(NULL);
       
   162 
       
   163 
       
   164     status = aItem.GetNextInt(interface);
       
   165     if(!status)
       
   166         {
       
   167         id = MapInterface(interface);
       
   168         }
       
   169     else
       
   170         {
       
   171         status = KErrGeneral;
       
   172         }
       
   173 
       
   174     status = aItem.GetNextInt(async);
       
   175     if(!status)
       
   176         {
       
   177         if(m_DIMItf)
       
   178             {
       
   179             res = (*m_DIMItf)->ResumeInterface(m_DIMItf,id,async);
       
   180             status = res;
       
   181             }
       
   182         else
       
   183             {
       
   184             status = KErrNotFound;
       
   185             }
       
   186         }
       
   187     else
       
   188         {
       
   189         status = KErrGeneral;
       
   190         }
       
   191     return status;        
       
   192     }
       
   193 
       
   194 TInt COpenMAXALTestModule::al_dimitf_RegisterCallback( CStifItemParser& /*aItem*/ )
       
   195     {
       
   196     TInt status(KErrNone);
       
   197     XAresult res;
       
   198     if(m_DIMItf)
       
   199         {
       
   200         res = (*m_DIMItf)->RegisterCallback(m_DIMItf,DynamicInterfaceManagementCallback,(void*)this);
       
   201         status = res;
       
   202         }
       
   203     else
       
   204         {
       
   205         status = KErrNotFound;
       
   206         }
       
   207     return status;    
       
   208     }
       
   209 
       
   210 
       
   211