First public contribution.
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // timer message header file
19 #ifndef __TIMERMESSAGE__H
20 #define __TIMERMESSAGE__H
23 const TInt KTimerMsgMaxLen = 12;
25 //encapsulates the timer request message.
29 TRtTimerMsg(const TInt& aTimerId, const TInt& aAction = 0): iTimerId(aTimerId), iRqstAct(aAction){}
31 inline TInt Serialize(TDes8& aTo) const;
32 inline TInt DeSerialize(const TDes8& aFrom);
39 TInt iTimerId; // timer id
43 //serialize the timer request.
44 TInt TRtTimerMsg::Serialize(TDes8& aTo) const
47 if(aTo.MaxSize() != KTimerMsgMaxLen)
51 TUint8 lBuf[KTimerMsgMaxLen];
52 Mem::FillZ(&lBuf[0], KTimerMsgMaxLen);
54 Mem::Copy(&lBuf[0], &iTimerId, sizeof(TInt));
55 Mem::Copy(&lBuf[sizeof (TInt)], &iRqstAct, sizeof(TInt));
58 aTo.Append(lBuf,KTimerMsgMaxLen);
64 //deserialize the timer request.
65 TInt TRtTimerMsg::DeSerialize(const TDes8& aFrom)
68 if(aFrom.MaxSize() != KTimerMsgMaxLen)
72 const TUint8* lBuf = aFrom.Ptr();
73 Mem::Copy(&iTimerId, &lBuf[0], sizeof(TInt));
74 Mem::Copy(&iRqstAct, &lBuf[sizeof (TInt)], sizeof(TInt));
80 #endif // __TIMERMESSAGE__H