examples/Base/MessageQueueExample/Inverter/inc/CInverter.h

00001 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
00002 // All rights reserved.
00003 // This component and the accompanying materials are made available
00004 // under the terms of "Eclipse Public License v1.0"
00005 // which accompanies this distribution, and is available
00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
00007 //
00008 // Initial Contributors:
00009 // Nokia Corporation - initial contribution.
00010 //
00011 // Contributors:
00012 //
00013 // Description:
00014 //
00015 
00016 #ifndef CINVERTER_H_
00017 #define CINVERTER_H_
00018 #include "e32base.h" //for using CPeriodic
00019 #include "e32msgqueue.h" 
00020 
00021 class CInverter 
00022 {
00023 public:
00024         static CInverter* NewL();
00025         virtual ~CInverter();
00026         void Start();
00027         
00028         //Recieve message from the messagequeue.
00029         TInt RecieveMsg();      
00030         
00031         //Send message to the InverterOutQ.
00032         void SendMsg();         
00033         
00034         void Stop();  
00035         
00036         //A callback function to be called whenever the timer expires after certain interval of time . 
00037         TInt static StaticWake(TAny*); 
00038         
00039         void ConstructL();
00040         
00041         //Invert the user words input by the user.
00042         void DoInvert();
00043         
00044         //Reverse the word of the sentence coming to the Inverter.
00045         void ReverseWord(TBuf<20> buf);
00046         
00047 private:
00048         // A periodic timer to be used to wake the inverter to start recieving the messages . 
00049         CPeriodic *iTimer;
00050         
00051         //Message queues to be opened and used to send data to inverter. 
00052         RMsgQueue <TBuf<100> > iOutMsgQ;          
00053         
00054         //Message queues to be opened and used to recieve data from inverter. 
00055         RMsgQueue <TBuf<100> > iInMsgQ;
00056         
00057         //Buffer to store inverted message.
00058         TBuf<100> iMsgQData; 
00059         
00060         //Buffer to store the message to be sent to InverterOutQ.
00061         TBuf<100> idestMsg;
00062         
00063         //Temporary buffers to reverse the words of the sentence.
00064         TBuf<20> iwords;
00065         TBuf<20> itmpWord; 
00066 };
00067 
00068 #endif /*CINVERTER_H_*/

Generated by  doxygen 1.6.2