sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // timer message header file sl@0: // sl@0: // sl@0: sl@0: sl@0: #ifndef __TIMERMESSAGE__H sl@0: #define __TIMERMESSAGE__H sl@0: sl@0: #include sl@0: const TInt KTimerMsgMaxLen = 12; sl@0: sl@0: //encapsulates the timer request message. sl@0: class TRtTimerMsg sl@0: { sl@0: public: sl@0: TRtTimerMsg(const TInt& aTimerId, const TInt& aAction = 0): iTimerId(aTimerId), iRqstAct(aAction){} sl@0: TRtTimerMsg(){} sl@0: inline TInt Serialize(TDes8& aTo) const; sl@0: inline TInt DeSerialize(const TDes8& aFrom); sl@0: sl@0: enum sl@0: { sl@0: EDELETETIMER = 2, sl@0: }TRqstAction; sl@0: sl@0: TInt iTimerId; // timer id sl@0: TInt iRqstAct; sl@0: }; sl@0: sl@0: //serialize the timer request. sl@0: TInt TRtTimerMsg::Serialize(TDes8& aTo) const sl@0: { sl@0: TInt lRet = KErrNone; sl@0: if(aTo.MaxSize() != KTimerMsgMaxLen) sl@0: lRet = KErrArgument; sl@0: else sl@0: { sl@0: TUint8 lBuf[KTimerMsgMaxLen]; sl@0: Mem::FillZ(&lBuf[0], KTimerMsgMaxLen); sl@0: sl@0: Mem::Copy(&lBuf[0], &iTimerId, sizeof(TInt)); sl@0: Mem::Copy(&lBuf[sizeof (TInt)], &iRqstAct, sizeof(TInt)); sl@0: sl@0: aTo.Zero(); sl@0: aTo.Append(lBuf,KTimerMsgMaxLen); sl@0: } sl@0: sl@0: return lRet; sl@0: } sl@0: sl@0: //deserialize the timer request. sl@0: TInt TRtTimerMsg::DeSerialize(const TDes8& aFrom) sl@0: { sl@0: TInt lRet = KErrNone; sl@0: if(aFrom.MaxSize() != KTimerMsgMaxLen) sl@0: lRet = KErrArgument; sl@0: else sl@0: { sl@0: const TUint8* lBuf = aFrom.Ptr(); sl@0: Mem::Copy(&iTimerId, &lBuf[0], sizeof(TInt)); sl@0: Mem::Copy(&iRqstAct, &lBuf[sizeof (TInt)], sizeof(TInt)); sl@0: } sl@0: sl@0: return lRet; sl@0: } sl@0: sl@0: #endif // __TIMERMESSAGE__H sl@0: