os/ossrv/genericopenlibs/posixrealtimeextensions/src/timerclient.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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:
    15 *
    16 */
    17 
    18 
    19 #include "timerutils.h"
    20 #include "timerclient.h"
    21 #include "timerhandler.h"
    22 #include <errno.h>
    23 #include <e32atomics.h>
    24 
    25 // -------------------------------------------------------------------------------
    26 // RTimerSession::Connect
    27 // -------------------------------------------------------------------------------
    28 
    29 TInt RTimerSession::Connect(RServer2 aServer)
    30     {
    31 	TInt ret = CreateSession(aServer, TVersion(0, 0, 0), 1,EIpcSession_Sharable);
    32 	return ret;
    33     }
    34 
    35 //-------------------------------------------------------------------------------
    36 // Function Name : 	RTimerSession::OnDemandConnect()
    37 // Description   : 	To create connection to server on demand
    38 //					
    39 //-------------------------------------------------------------------------------	
    40 TInt RTimerSession::OnDemandConnect(RServer2 aServer)
    41 	{
    42 	TInt err = KErrNone;
    43 	//On Demand connection
    44 	if ( !iIsConnected )
    45 		{
    46 		Lock();
    47 		if ( !iIsConnected )
    48 			{
    49 			err = Connect (aServer);
    50 			if ( KErrNone == err)
    51 				{
    52 				iIsConnected = ETrue;
    53 				}
    54 			}
    55 		UnLock();
    56 		}
    57 	return err;
    58 	}
    59 //--------------------------------------------------------------------------------
    60 //This sends a timer delete request to the server.
    61 //--------------------------------------------------------------------------------
    62 
    63 TInt RTimerSession::DeleteTimer(TInt aTimerId)
    64 	{
    65 	TInt ret = SendReceive(EDeleteTimer,TIpcArgs(aTimerId));
    66 	return ret;
    67 	}
    68 
    69 //--------------------------------------------------------------------------------
    70 //This sends a set timer request to the timer server.
    71 //--------------------------------------------------------------------------------
    72 
    73 TInt RTimerSession::SetTime(TInt aTimerId)
    74 	{
    75 	TInt ret = SendReceive(ESetTimer,TIpcArgs(aTimerId));
    76 	return ret;
    77 	}
    78