diff -uNr Framework/Makefile /home/ldapusers/istpischn/EF_P2/Framework/Makefile --- Framework/Makefile 2010-04-22 17:05:16.000000000 +0200 +++ /home/ldapusers/istpischn/EF_P2/Framework/Makefile 2010-04-26 10:49:19.000000000 +0200 @@ -110,6 +110,7 @@ $(BINDIR)/CMiniCommander.o \ $(BINDIR)/CMiniComDriver.o \ $(BINDIR)/CMaxiComReceiver.o \ +$(BINDIR)/CHmiGlDataContainer.o \ $(BINDIR)/main.o \ $(TARGETOBJS) diff -uNr Framework/src/base/CContext.cpp /home/ldapusers/istpischn/EF_P2/Framework/src/base/CContext.cpp --- Framework/src/base/CContext.cpp 2010-04-22 17:05:16.000000000 +0200 +++ /home/ldapusers/istpischn/EF_P2/Framework/src/base/CContext.cpp 2010-04-26 10:47:30.000000000 +0200 @@ -17,6 +17,7 @@ const char* TUNER_COMPONENT_NAME = "TunerComponent"; const char* NAVI_COMPONENT_NAME = "NaviComponent"; const char* CD_COMPONENT_NAME = "CdComponent"; +const char* HMIGL_COMPONENT_NAME = "HmiGlComponent"; const Int32 CContext::ADMIN_STACK_SIZE = 1000; const Int32 CContext::MDISP_STACK_SIZE = 1000; @@ -33,6 +34,7 @@ const CThread::EPriority CContext::TUNER_PRIORITY = CThread::PRIORITY_NORM; const CThread::EPriority CContext::NAVI_PRIORITY = CThread::PRIORITY_NORM; const CThread::EPriority CContext::CD_PRIORITY = CThread::PRIORITY_NORM; +const CThread::EPriority CContext::HMIGL_PRIORITY = CThread::PRIORITY_NORM; const CThread::EPriority CContext::DEFAULT_PRIORITY = CThread::PRIORITY_NORM; // these are the values defining the cpu/thread affinities; @@ -44,6 +46,7 @@ const Int32 CContext::TUNER_AFFINITY = 4; const Int32 CContext::NAVI_AFFINITY = 5; const Int32 CContext::CD_AFFINITY = 6; +const Int32 CContext::HMIGL_AFFINITY = 6; const Int32 CContext::DEFAULT_AFFINITY = 7; const Int32 ADMIN_NORMALQUEUESIZE = 100; // Number of Messages @@ -52,6 +55,7 @@ const Int32 TUNER_NORMALQUEUESIZE = 100; const Int32 NAVI_NORMALQUEUESIZE = 100; const Int32 CD_NORMALQUEUESIZE = 100; +const Int32 HMIGL_NORMALQUEUESIZE = 100; const Int32 ADMIN_SYSTEMQUEUESIZE = 100; const Int32 MDISP_SYSTEMQUEUESIZE = 100; @@ -59,6 +63,7 @@ const Int32 TUNER_SYSTEMQUEUESIZE = 100; const Int32 NAVI_SYSTEMQUEUESIZE = 100; const Int32 CD_SYSTEMQUEUESIZE = 100; +const Int32 HMIGL_SYSTEMQUEUESIZE = 100; const Int32 ADMIN_INTERNALQUEUESIZE = 4; const Int32 MDISP_INTERNALQUEUESIZE = 4; @@ -66,6 +71,7 @@ const Int32 TUNER_INTERNALQUEUESIZE = 4; const Int32 NAVI_INTERNALQUEUESIZE = 4; const Int32 CD_INTERNALQUEUESIZE = 4; +const Int32 HMIGL_INTERNALQUEUESIZE = 4; const Int32 ADMIN_DCSIZE = 0; const Int32 MDISP_DCSIZE = 0; @@ -73,6 +79,7 @@ const Int32 TUNER_DCSIZE = MAKE_ALIGNMENT_SIZE(sizeof(CTunerDataContainer)); // in Byte const Int32 NAVI_DCSIZE = 0; // das wird ersetzt, wenn die Containter eingefuehrt werden const Int32 CD_DCSIZE = 0; +const Int32 HMIGL_DCSIZE = MAKE_ALIGNMENT_SIZE(sizeof(CHmiGlDataContainer)); // in Byte; const Int32 ADMIN_WDLIMIT = 2; const Int32 MDISP_WDLIMIT = 2; @@ -80,6 +87,7 @@ const Int32 TUNER_WDLIMIT = 2; const Int32 NAVI_WDLIMIT = 2; const Int32 CD_WDLIMIT = 2; +const Int32 HMIGL_WDLIMIT = 2; /// Groessenberechnungen durch den Compiler @@ -107,9 +115,11 @@ CD_CONTEXT_SIZE = HEADER_SIZE + QUEUE_SIZE(CD_NORMALQUEUESIZE) + QUEUE_SIZE(CD_SYSTEMQUEUESIZE) + QUEUE_SIZE(CD_INTERNALQUEUESIZE) + CD_DCSIZE, - + HMIGL_CONTEXT_SIZE = HEADER_SIZE + QUEUE_SIZE(HMIGL_NORMALQUEUESIZE) + + QUEUE_SIZE(HMIGL_SYSTEMQUEUESIZE) + QUEUE_SIZE(HMIGL_INTERNALQUEUESIZE) + + HMIGL_DCSIZE, TOTAL_SIZE = ADMIN_CONTEXT_SIZE + MDISP_CONTEXT_SIZE + HMI_CONTEXT_SIZE - + TUNER_CONTEXT_SIZE + NAVI_CONTEXT_SIZE + CD_CONTEXT_SIZE + + TUNER_CONTEXT_SIZE + NAVI_CONTEXT_SIZE + CD_CONTEXT_SIZE + HMIGL_CONTEXT_SIZE }; static const CContextDescription sDescriptionTable[] = @@ -136,7 +146,10 @@ NAVI_DCSIZE, NAVI_WDLIMIT, NAVI_CONTEXT_SIZE }, { CD_INDEX, CD_COMPONENT_NAME, CContext::CD_AFFINITY, CContext::CD_STACK_SIZE, CContext::CD_PRIORITY, CD_NORMALQUEUESIZE, CD_SYSTEMQUEUESIZE, - CD_INTERNALQUEUESIZE, CD_DCSIZE, CD_WDLIMIT, CD_CONTEXT_SIZE } }; + CD_INTERNALQUEUESIZE, CD_DCSIZE, CD_WDLIMIT, CD_CONTEXT_SIZE }, +{ HMIGL_INDEX, HMIGL_COMPONENT_NAME, CContext::HMIGL_AFFINITY, CContext::GL_STACK_SIZE, + CContext::HMIGL_PRIORITY, HMIGL_NORMALQUEUESIZE, HMIGL_SYSTEMQUEUESIZE, + HMIGL_INTERNALQUEUESIZE, HMIGL_DCSIZE, HMIGL_WDLIMIT, HMIGL_CONTEXT_SIZE } }; CComponentContext CContext::sContextTable[NUM_OF_COMPONENTS]; // wg. static @@ -199,6 +212,11 @@ return sContextTable[CD_INDEX]; } +CComponentContext& CContext::getHmiGlContext(void) +{ + return sContextTable[HMIGL_INDEX]; +} + CComponentContext& CContext::getContext(Component_Index Index) { return sContextTable[Index]; diff -uNr Framework/src/base/CContext.h /home/ldapusers/istpischn/EF_P2/Framework/src/base/CContext.h --- Framework/src/base/CContext.h 2010-04-22 17:05:16.000000000 +0200 +++ /home/ldapusers/istpischn/EF_P2/Framework/src/base/CContext.h 2010-04-26 10:47:33.000000000 +0200 @@ -33,6 +33,10 @@ #include "CTunerDataContainer.h" #endif +#ifndef _CHMIGLDATACONTAINER_H + #include "CHmiGlDataContainer.h" +#endif + #ifndef _FWASSERTION_H #include "FWAssertion.h" // for assertion #endif @@ -57,6 +61,7 @@ TUNER_INDEX, NAVI_INDEX, CD_INDEX, + HMIGL_INDEX, /** * Das hat immer als letzter Eintrag nach den adressierbaren * Komponenten zu folgen! @@ -104,6 +109,7 @@ static CComponentContext& getTunerContext(void); static CComponentContext& getNaviContext(void); static CComponentContext& getCdContext(void); + static CComponentContext& getHmiGlContext(void); static CComponentContext& getContext(Component_Index Index); static const Int32 ADMIN_STACK_SIZE; @@ -121,6 +127,7 @@ static const CThread::EPriority TUNER_PRIORITY; static const CThread::EPriority NAVI_PRIORITY; static const CThread::EPriority CD_PRIORITY; + static const CThread::EPriority HMIGL_PRIORITY; static const CThread::EPriority DEFAULT_PRIORITY; static const Int32 ADMIN_AFFINITY; @@ -129,6 +136,7 @@ static const Int32 TUNER_AFFINITY; static const Int32 NAVI_AFFINITY; static const Int32 CD_AFFINITY; + static const Int32 HMIGL_AFFINITY; static const Int32 DEFAULT_AFFINITY; diff -uNr Framework/src/commander/CMiniCommander.h /home/ldapusers/istpischn/EF_P2/Framework/src/commander/CMiniCommander.h --- Framework/src/commander/CMiniCommander.h 2010-04-22 17:05:16.000000000 +0200 +++ /home/ldapusers/istpischn/EF_P2/Framework/src/commander/CMiniCommander.h 2010-04-26 11:40:29.000000000 +0200 @@ -14,7 +14,7 @@ #include -#ifdef __SH__ +#ifdef __QNX__ #define MC_DEVICE "/dev/ser1" #else #define MC_DEVICE "/dev/ttyS0" diff -uNr Framework/src/components/CAdminComponent.cpp /home/ldapusers/istpischn/EF_P2/Framework/src/components/CAdminComponent.cpp --- Framework/src/components/CAdminComponent.cpp 2010-04-22 17:05:16.000000000 +0200 +++ /home/ldapusers/istpischn/EF_P2/Framework/src/components/CAdminComponent.cpp 2010-04-26 10:25:16.000000000 +0200 @@ -101,7 +101,7 @@ /* * GL thread for graphics */ - CHmiGLThread gl; + CHmiGLThread gl(CContext::getHmiGlContext()); CThread GLThread(gl, "GLThread", CContext::GL_STACK_SIZE, CContext::DEFAULT_PRIORITY, CContext::HMI_AFFINITY, false); GLThread.start(); diff -uNr Framework/src/components/CHmiComponent.cpp /home/ldapusers/istpischn/EF_P2/Framework/src/components/CHmiComponent.cpp --- Framework/src/components/CHmiComponent.cpp 2010-04-22 17:05:16.000000000 +0200 +++ /home/ldapusers/istpischn/EF_P2/Framework/src/components/CHmiComponent.cpp 2010-04-26 10:48:37.000000000 +0200 @@ -49,6 +49,9 @@ void CHmiComponent::handleKeyEvent(const CMessage& _m) { const IcmKeyCode keycode = (IcmKeyCode) _m.getOpcode(); // could be used for giving the 'x times-pressed' count + char newtitle[CHmiGlDataContainer::MAX_LINE_LENGTH]; + char newlines[CHmiGlDataContainer::NUM_LINES][CHmiGlDataContainer::MAX_LINE_LENGTH]; + CHmiGlDataContainer* hmiGlContPtr = static_cast( &(CContext::getHmiGlContext().getContainer()) ); switch (keycode) { case CD_KEY: { @@ -59,6 +62,23 @@ * to the GL component and setting its parameters in * the DC. */ + + strcpy(newtitle,"CD MENU"); + strcpy(newlines[CHmiGlDataContainer::LINE_ONE],"CD ONE"); + strcpy(newlines[CHmiGlDataContainer::LINE_TWO],"TRACK ONE"); + strcpy(newlines[CHmiGlDataContainer::LINE_THREE],"GUESS A TRACK TITLE"); + strcpy(newlines[CHmiGlDataContainer::LINE_FOUR],"ONE SECOND PLAYED"); + color4f cdBgCol = {0.0f,1.0f,0.0f,1.0f}; + hmiGlContPtr->setTitle(newtitle); + for(Int32 actLine=0;actLinesetLine(static_cast(actLine),newlines[actLine]); + } + hmiGlContPtr->setBackgroundColor(cdBgCol); + CMessage updMsg(CMessage::Internal_App_Type); + updMsg.setSenderID(HMI_INDEX); + updMsg.setReceiverID(HMIGL_INDEX); + CContext::getMDispContext().getInternalQueue().add(updMsg,false); } break; @@ -70,6 +90,22 @@ * to the GL component and setting its parameters in * the DC. */ + strcpy(newtitle,"TUNER MENU"); + strcpy(newlines[CHmiGlDataContainer::LINE_ONE],"SUPER STATION"); + strcpy(newlines[CHmiGlDataContainer::LINE_TWO],"FREQ X MHZ"); + strcpy(newlines[CHmiGlDataContainer::LINE_THREE],"RDS SAYS NICE WEATHER TODAY"); + strcpy(newlines[CHmiGlDataContainer::LINE_FOUR],""); + color4f tunerBgCol = {0.0f,0.0f,1.0f,1.0f}; + hmiGlContPtr->setTitle(newtitle); + for(Int32 actLine=0;actLinesetLine(static_cast(actLine),newlines[actLine]); + } + hmiGlContPtr->setBackgroundColor(tunerBgCol); + CMessage updMsg(CMessage::Internal_App_Type); + updMsg.setSenderID(HMI_INDEX); + updMsg.setReceiverID(HMIGL_INDEX); + CContext::getMDispContext().getInternalQueue().add(updMsg,false); } break; diff -uNr Framework/src/gl/CHmiGlDataContainer.cpp /home/ldapusers/istpischn/EF_P2/Framework/src/gl/CHmiGlDataContainer.cpp --- Framework/src/gl/CHmiGlDataContainer.cpp 1970-01-01 01:00:00.000000000 +0100 +++ /home/ldapusers/istpischn/EF_P2/Framework/src/gl/CHmiGlDataContainer.cpp 2010-04-26 10:44:21.000000000 +0200 @@ -0,0 +1,53 @@ +/* + * CHmiGlDataContainer.cpp + * + * Created on: 21.04.2010 + * Author: sven + */ +#include "CHmiGlDataContainer.h" + +void CHmiGlDataContainer::setTitle(const char *atitle) +{ + mMutex.take(true); + memset(mTitle,'\0',MAX_LINE_LENGTH); + strcpy(mTitle,atitle); + mMutex.give(); +} +void CHmiGlDataContainer::setLine(const CHmiGlDataContainer::LINES lineIdx, const char *abody) +{ + mMutex.take(true); + memset(mLines[lineIdx],'\0',MAX_LINE_LENGTH); + strcpy(mLines[lineIdx],abody); + mMutex.give(); +} +void CHmiGlDataContainer::setBackgroundColor(color4f& bgCol) +{ + mMutex.take(true); + for (UInt16 i=0;i<4;i++) { + mBackgroundColor[i] = bgCol[i]; + } + mMutex.give(); +} +bool CHmiGlDataContainer::getTitle(char* atitle) +{ + mMutex.take(true); + strcpy(atitle,mTitle); + mMutex.give(); + return true; +} +bool CHmiGlDataContainer::getLine(const CHmiGlDataContainer::LINES lineIdx, char* aline) +{ + mMutex.take(true); + strcpy(aline,mLines[lineIdx]); + mMutex.give(); + return true; +} +bool CHmiGlDataContainer::getBackgroundColor(color4f& aBgColor) +{ + mMutex.take(true); + for (UInt16 i=0;i<4;i++) { + aBgColor[i] = mBackgroundColor[i]; + } + mMutex.give(); + return true; +} diff -uNr Framework/src/gl/CHmiGlDataContainer.h /home/ldapusers/istpischn/EF_P2/Framework/src/gl/CHmiGlDataContainer.h --- Framework/src/gl/CHmiGlDataContainer.h 1970-01-01 01:00:00.000000000 +0100 +++ /home/ldapusers/istpischn/EF_P2/Framework/src/gl/CHmiGlDataContainer.h 2010-04-26 10:47:50.000000000 +0200 @@ -0,0 +1,54 @@ +/* + * CHmiGlDataContainer.h + * + * Created on: 21.04.2010 + * Author: sven + */ +#ifndef _CHMIGLDATACONTAINER_H +#define _CHMIGLDATACONTAINER_H + +#ifdef QNX +#ifdef EGL +#include +#include +#include +#elif GFX +#include "gfx.h" // QNX GF-Framework and freetype library +#endif +#elif LINUX +#include +#include +#endif + +#ifndef _CMUTEX_H + #include "CMutex.h" +#endif +#ifndef CCONTAINER_H_ + #include "CContainer.h" +#endif + +#include + +typedef GLfloat color4f[4]; + +class CHmiGlDataContainer : public CContainer +{ +public: + enum LINES { + LINE_ONE, LINE_TWO, LINE_THREE, LINE_FOUR, NUM_LINES + }; + const static Int32 MAX_LINE_LENGTH=60; + void setTitle(const char*); + void setLine(const CHmiGlDataContainer::LINES, const char*); + void setBackgroundColor(color4f&); + bool getTitle(char*); + bool getLine(const CHmiGlDataContainer::LINES, char*); + bool getBackgroundColor(color4f&); +private: + CMutex mMutex; + char mTitle[MAX_LINE_LENGTH]; + char mLines[NUM_LINES][MAX_LINE_LENGTH]; + color4f mBackgroundColor; +}; + +#endif /* CHMIGLDATACONTAINER_H_ */ diff -uNr Framework/src/gl/CHmiGLThread.cpp /home/ldapusers/istpischn/EF_P2/Framework/src/gl/CHmiGLThread.cpp --- Framework/src/gl/CHmiGLThread.cpp 2010-04-22 17:05:16.000000000 +0200 +++ /home/ldapusers/istpischn/EF_P2/Framework/src/gl/CHmiGLThread.cpp 2010-04-26 11:13:19.000000000 +0200 @@ -28,7 +28,19 @@ GLbyte allindices[] = { 0, 1, 2, 0, 2, 3 }; AGraphicsDriver* CHmiGLThread::graphics = NULL; +CHmiGLThread* CHmiGLThread::sInstancePtr = NULL; +CHmiGLThread::CHmiGLThread(CComponentContext& context) + :mContext(context), mDispatcher(context.getNormalQueue(), + context.getSystemQueue(), context.getInternalQueue(), + context.getTriggerSemaphore()) + { + mDispatcher.setHandler(*this); + CHmiGLThread::sInstancePtr = this; + } +CHmiGLThread::~CHmiGLThread() +{ +} void CHmiGLThread::init() { DEBUG_PRINT("entered"); @@ -75,7 +87,9 @@ counter++; DEBUG_PRINT("entered (counter=%i)",counter) - + DEBUG_PRINT("calling dispatch"); + CHmiGLThread::getInstancePtr()->mDispatcher.dispatch(true); + DEBUG_PRINT("after dispatch"); // /* // * Define the vertices which // * build a panel @@ -98,7 +112,7 @@ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLineWidth(2.0); - +/* if (counter % 2) { glColor4f(1.0, 0.0, 0.0, 1.0); DEBUG_PRINT("color is red") @@ -106,6 +120,11 @@ glColor4f(0.0, 1.0, 0.0, 1.0); DEBUG_PRINT("color is green") } +*/ + CHmiGlDataContainer* hmiGlContPtr = static_cast(&(CHmiGLThread::getInstancePtr()->mContext.getContainer())); + color4f bg; + hmiGlContPtr->getBackgroundColor(bg); + glColor4f(bg[0],bg[1],bg[2],bg[3]); glEnableClientState( GL_VERTEX_ARRAY); glVertexPointer(2, GL_SHORT, 0, verticeArray); @@ -113,15 +132,46 @@ (GLubyte *) allindices); // draw some text below and above the pane - char msg[80]; - sprintf(msg, "Text below (cnt=%d)",counter); + //char msg[80]; + //sprintf(msg, "Text below (cnt=%d)",counter); + + //glColor4f(1.0, 1.0, 1.0, 1.0); - glColor4f(1.0, 1.0, 1.0, 1.0); - graphics->renderText(border, 0, msg); - graphics->renderText(border, height - border, "Text above",CFTRender::FONT_SIZE_MINI); + char title[CHmiGlDataContainer::MAX_LINE_LENGTH]; + char lines[CHmiGlDataContainer::NUM_LINES][CHmiGlDataContainer::MAX_LINE_LENGTH]; + hmiGlContPtr->getTitle(title); + DEBUG_PRINT("Title: %s",title); + for(Int32 actLine = CHmiGlDataContainer::LINE_ONE; + actLine < CHmiGlDataContainer::NUM_LINES; + actLine++) { + hmiGlContPtr->getLine(static_cast(actLine),lines[actLine]); + DEBUG_PRINT("Line %d: %s",actLine,lines[actLine]); + } + + //graphics->renderText(border, 0, msg); + graphics->renderText(border, 0, title); + for(Int32 actLine = CHmiGlDataContainer::LINE_ONE; + actLine < CHmiGlDataContainer::NUM_LINES; + actLine++) { + graphics->renderText(border,(WINDOW_HEIGHT - border - 30) - (30*actLine),lines[actLine]); + } + //graphics->renderText(border, height - border, "Text above",CFTRender::FONT_SIZE_MINI); graphics->finishDraw(); // dependency to graphics driver glFinish(); +/* DEBUG_PRINT("calling dispatch"); + CHmiGLThread::getInstancePtr()->mDispatcher.dispatch(true); + DEBUG_PRINT("after dispatch");*/ + +} +void CHmiGLThread::handleMessage(const CMessage& msg) +{ + DEBUG_PRINT("handle Message"); +} + +CHmiGLThread* CHmiGLThread::getInstancePtr(void) +{ + return sInstancePtr; } diff -uNr Framework/src/gl/CHmiGLThread.h /home/ldapusers/istpischn/EF_P2/Framework/src/gl/CHmiGLThread.h --- Framework/src/gl/CHmiGLThread.h 2010-04-22 17:05:16.000000000 +0200 +++ /home/ldapusers/istpischn/EF_P2/Framework/src/gl/CHmiGLThread.h 2010-04-26 10:34:18.000000000 +0200 @@ -20,9 +20,11 @@ #include #include -class CHmiGLThread : public IRunnable +class CHmiGLThread : public IRunnable, public IMessageHandler { public: + CHmiGLThread(CComponentContext&); + ~CHmiGLThread(); virtual void init(); virtual void run(); virtual void stop(); @@ -30,6 +32,7 @@ virtual void prepareForShutdown() {} virtual void reRun() {} virtual void goToStandby() {} + virtual void handleMessage(const CMessage& msg); /* must be static so it can * be called from the C-function @@ -37,8 +40,13 @@ * CHmiGLThread.cpp */ static void draw(); + static CHmiGLThread* getInstancePtr(); static AGraphicsDriver* graphics; + private: + CComponentContext& mContext; + CDispatcher mDispatcher; + static CHmiGLThread* sInstancePtr; }; #endif // CHMIGLTHREAD_H_