srsf/vcommandexecutorbearer/src/nssvcexecutorbearerimpl.cpp
branchRCL_3
changeset 19 e36f3802f733
parent 0 bf1d17376201
equal deleted inserted replaced
18:cad71a31b7fc 19:e36f3802f733
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Bearer plugin API Implementation file
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <e32def.h>
       
    21 #include <remcon/remconbearerobserver.h>
       
    22 #include <remcon/remconconverterplugin.h>
       
    23 #include <remconaddress.h>
       
    24 #include <remconcoreapi.h>
       
    25 
       
    26 // Include this once it is exported
       
    27 // #include <RemConExtensionApi.h>
       
    28 
       
    29 #include "nssvcexecutorbearerimpl.h"                                     
       
    30 
       
    31 //Constants
       
    32 _LIT8( KFormatString, "%c" );
       
    33 
       
    34 // ---------------------------------------------------------
       
    35 // NssVCExecutorBearer::NewL()
       
    36 // Description: Factory function.
       
    37 // return: Ownership of a new NssVCExecutorBearer.
       
    38 // ---------------------------------------------------------
       
    39 //
       
    40 NssVCExecutorBearer* NssVCExecutorBearer::NewL( TBearerParams& aParams )
       
    41     {
       
    42     NssVCExecutorBearer* self = new(ELeave) NssVCExecutorBearer( aParams );
       
    43     CleanupStack::PushL(self);
       
    44     self->ConstructL();
       
    45     CleanupStack::Pop(self);
       
    46     return self;
       
    47     }
       
    48 
       
    49 // ---------------------------------------------------------
       
    50 // NssVCExecutorBearer::~NssVCExecutorBearer()
       
    51 // Destructor.
       
    52 // ---------------------------------------------------------
       
    53 //
       
    54 NssVCExecutorBearer::~NssVCExecutorBearer()
       
    55     {    
       
    56     }
       
    57 
       
    58 // ---------------------------------------------------------
       
    59 // NssVCExecutorBearer::NssVCExecutorBearer()
       
    60 // construction.
       
    61 // ---------------------------------------------------------
       
    62 //
       
    63 NssVCExecutorBearer::NssVCExecutorBearer( TBearerParams& aParams )
       
    64 :   CRemConBearerPlugin( aParams )
       
    65     {
       
    66     //Pass
       
    67     }
       
    68 
       
    69 // ---------------------------------------------------------
       
    70 // NssVCExecutorBearer::ConstructL()
       
    71 // 2nd-phase construction.
       
    72 // ---------------------------------------------------------
       
    73 //
       
    74 void NssVCExecutorBearer::ConstructL()
       
    75     {
       
    76     // throw an indication up to RemCon.
       
    77     TRemConAddress addr;
       
    78     addr.BearerUid() = Uid();
       
    79     TInt err = Observer().ConnectIndicate( addr );
       
    80     }
       
    81     
       
    82 // ---------------------------------------------------------
       
    83 // NssVCExecutorBearer::ConnectRequest()
       
    84 // Rem Con server send connect request to Bearer Plugin
       
    85 // ---------------------------------------------------------
       
    86 //
       
    87 void NssVCExecutorBearer::ConnectRequest(const TRemConAddress& /*aAddr*/)
       
    88     {
       
    89     // Pass
       
    90     }
       
    91 // ---------------------------------------------------------
       
    92 // NssVCExecutorBearer::DisconnectRequest()
       
    93 // Rem Con server send disconnect request to Bearer Plugin
       
    94 // ---------------------------------------------------------
       
    95 //
       
    96 void NssVCExecutorBearer::DisconnectRequest(const TRemConAddress& /*aAddr*/)
       
    97     {
       
    98     // Pass
       
    99     }
       
   100 // ---------------------------------------------------------
       
   101 // NssVCExecutorBearer::SendResponse()
       
   102 // @see MRemConBearerInterface::SendResponse()
       
   103 // ---------------------------------------------------------
       
   104 //
       
   105 TInt NssVCExecutorBearer::SendResponse(TUid /* aInterfaceUid */, 
       
   106         TUint /*aOperationId*/, 
       
   107         TUint /*aTransactionId*/, // we don't care about this transaction ID
       
   108         RBuf8& /* aData */, 
       
   109         const TRemConAddress& /*aAddr*/)
       
   110     {
       
   111     return KErrNone;
       
   112     }
       
   113 // ---------------------------------------------------------
       
   114 // NssVCExecutorBearer::SendCommand()
       
   115 // @see MRemConBearerInterface::SendCommand()
       
   116 // ---------------------------------------------------------
       
   117 //
       
   118 TInt NssVCExecutorBearer::SendCommand( TUid  /*aInterfaceUid */ , 
       
   119         TUint  aOperationId , 
       
   120         TUint /* aTransactionId */,  
       
   121         RBuf8& /* aData */, 
       
   122         const TRemConAddress& /*aAddr*/)
       
   123     {
       
   124     // 1. Button click
       
   125     iData.Format( KFormatString, ERemConCoreApiButtonClick );
       
   126     
       
   127     // 2. Operation id. No conversion is done.
       
   128     iOperationId = aOperationId;
       
   129     
       
   130     // 3. Interface ID is required when GetCommand is called
       
   131     iInterfaceUid = TUid::Uid( KRemConCoreApiUid ); // from Remconcoreapi.h
       
   132     
       
   133     // 4. Transaction ID
       
   134     iTransactionId = Observer().NewTransactionId();
       
   135     
       
   136     // 5. Addr 
       
   137     TRemConAddress addr;
       
   138     addr.BearerUid() = Uid();
       
   139     addr.Addr() = KNullDesC8();
       
   140     
       
   141     // Msgtype  is ERemConCommand
       
   142     TInt aError = Observer().NewCommand( addr );
       
   143     
       
   144     return KErrNone;
       
   145     }
       
   146 // ---------------------------------------------------------
       
   147 // NssVCExecutorBearer::GetResponse()
       
   148 // @see MRemConBearerInterface::GetResponse()
       
   149 // ---------------------------------------------------------
       
   150 //
       
   151 TInt NssVCExecutorBearer::GetResponse( TUid& /* aInterfaceUid */, 
       
   152         TUint& /* aTransactionId*/, 
       
   153         TUint& /* aOperationId */, 
       
   154         RBuf8& /* aData */, 
       
   155         TRemConAddress& /*aAddr */)
       
   156     {
       
   157     return KErrNone;
       
   158     }
       
   159 // ---------------------------------------------------------
       
   160 // NssVCExecutorBearer::GetCommand()
       
   161 // @see MRemConBearerInterface::GetCommand()
       
   162 // ---------------------------------------------------------
       
   163 //
       
   164 TInt NssVCExecutorBearer::GetCommand( TUid& aInterfaceUid, 
       
   165                                       TUint& aTransactionId, 
       
   166                                       TUint& aOperationId, 
       
   167                                       RBuf8& aData,
       
   168                                       TRemConAddress& aAddr )
       
   169     {
       
   170     TInt error( KErrNone );
       
   171     
       
   172     aInterfaceUid = iInterfaceUid;
       
   173     aOperationId = iOperationId;
       
   174 
       
   175     // Pass ownership of this to RemCon.
       
   176     error = aData.Create( iData );
       
   177     
       
   178     if ( error == KErrNone )
       
   179         {
       
   180         aAddr.BearerUid() = Uid();
       
   181         aAddr.Addr() = KNullDesC8();
       
   182     
       
   183         aTransactionId = iTransactionId;
       
   184         }
       
   185     
       
   186     return error;
       
   187     }
       
   188 
       
   189 
       
   190 // ---------------------------------------------------------
       
   191 // NssVCExecutorBearer::SecurityPolicy()
       
   192 // @see MRemConBearerInterface::SecurityPolicy()
       
   193 // ---------------------------------------------------------
       
   194 //
       
   195 TSecurityPolicy NssVCExecutorBearer::SecurityPolicy() const
       
   196     {
       
   197     return TSecurityPolicy(ECapabilityLocalServices);
       
   198     }
       
   199 // ---------------------------------------------------------
       
   200 // NssVCExecutorBearer::ClientStatus()
       
   201 // @see MRemConBearerInterface::ClientStatus()
       
   202 // ---------------------------------------------------------
       
   203 //
       
   204 void NssVCExecutorBearer::ClientStatus(TBool /*aControllerPresent*/, 
       
   205                                 TBool /*aTargetPresent*/)
       
   206     {
       
   207     //Pass
       
   208     }
       
   209 // ---------------------------------------------------------
       
   210 // NssVCExecutorBearer::GetInterface()
       
   211 // @see CRemConBearerPlugin::GetInterface()
       
   212 // ---------------------------------------------------------
       
   213 //
       
   214 TAny* NssVCExecutorBearer::GetInterface(TUid aUid)
       
   215     {
       
   216     TAny* ret = NULL;
       
   217     if ( aUid == TUid::Uid( KRemConBearerInterface1 ) )
       
   218         {
       
   219         ret = reinterpret_cast<TAny*>(
       
   220                     static_cast<MRemConBearerInterface*>(this)
       
   221                     );
       
   222         }
       
   223     return ret;
       
   224 
       
   225     }
       
   226 
       
   227 
       
   228 // End of file