javacommons/utils/functionserver/src.s60/os_functionclient.cpp
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2008 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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 #include <memory>
       
    19 
       
    20 #include "functionserver.h"
       
    21 #include "os_functionclient.h"
       
    22 #include "logger.h"
       
    23 #include "javasymbianoslayer.h"
       
    24 
       
    25 using namespace java::util;
       
    26 
       
    27 /**
       
    28  *
       
    29  */
       
    30 
       
    31 OsFunctionClient::OsFunctionClient()
       
    32 {
       
    33     JELOG2(EUtils);
       
    34     mLock.CreateLocal();
       
    35 }
       
    36 
       
    37 OsFunctionClient::~OsFunctionClient()
       
    38 {
       
    39     JELOG2(EUtils);
       
    40     mLock.Close();
       
    41 }
       
    42 
       
    43 TInt OsFunctionClient::connect(const OsFunctionServer& server)
       
    44 {
       
    45     JELOG2(EUtils);
       
    46 
       
    47     int error = CreateSession(server.Server(), TVersion());
       
    48     if (error != KErrNone)
       
    49     {
       
    50         return error;
       
    51     }
       
    52     return ShareAuto();
       
    53 }
       
    54 
       
    55 /**
       
    56  *
       
    57  */
       
    58 TInt OsFunctionClient::execute(const Functor& functor) const
       
    59 {
       
    60     JELOG2(EUtils);
       
    61 //    mLock.Wait();
       
    62     int res = SendReceive(OsFunctionServer::EExecute, TIpcArgs(&functor));
       
    63 //    mLock.Signal();
       
    64 
       
    65     return res;
       
    66 }
       
    67 
       
    68 /**
       
    69  *
       
    70  */
       
    71 TInt OsFunctionClient::sendCloseMessage(FunctionServer* server) const
       
    72 {
       
    73     JELOG2(EUtils);
       
    74     int res = SendReceive(OsFunctionServer::EStop, TIpcArgs(server));
       
    75 
       
    76     return res;
       
    77 }