1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
|
diff -uNr FrameworkOrig/src/base/CContext.cpp Framework/src/base/CContext.cpp
--- FrameworkOrig/src/base/CContext.cpp 2010-04-01 19:23:12.000000000 +0200
+++ Framework/src/base/CContext.cpp 2010-04-21 12:46:33.055914910 +0200
@@ -17,14 +17,17 @@
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;
const Int32 CContext::HMI_STACK_SIZE = 1000;
-const Int32 CContext::GL_STACK_SIZE = 120000;
+//const Int32 CContext::GL_STACK_SIZE = 120000;
+const Int32 CContext::GL_STACK_SIZE = 1000;
const Int32 CContext::TUNER_STACK_SIZE = 1000;
const Int32 CContext::NAVI_STACK_SIZE = 1000;
const Int32 CContext::CD_STACK_SIZE = 1000;
+const Int32 CContext::HMIGL_STACK_SIZE = 120000;
const Int32 CContext::DEFAULT_STACK_SIZE = 1000;
const CThread::EPriority CContext::ADMIN_PRIORITY = CThread::PRIORITY_NORM;
@@ -33,6 +36,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 +48,7 @@
const Int32 CContext::TUNER_AFFINITY = 4;
const Int32 CContext::NAVI_AFFINITY = 5;
const Int32 CContext::CD_AFFINITY = 6;
+const Int32 CContext::HMIGL_AFFINITY = 3;
const Int32 CContext::DEFAULT_AFFINITY = 7;
const Int32 ADMIN_NORMALQUEUESIZE = 100; // Number of Messages
@@ -52,6 +57,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 +65,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 +73,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 +81,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));
const Int32 ADMIN_WDLIMIT = 2;
const Int32 MDISP_WDLIMIT = 2;
@@ -80,6 +89,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 +117,13 @@
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
+ + HMIGL_CONTEXT_SIZE
};
static const CContextDescription sDescriptionTable[] =
@@ -136,7 +150,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::HMIGL_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 +216,11 @@
return sContextTable[CD_INDEX];
}
+CComponentContext& CContext::getHMIGLContext(void)
+{
+ return sContextTable[HMIGL_INDEX];
+}
+
CComponentContext& CContext::getContext(Component_Index Index)
{
return sContextTable[Index];
diff -uNr FrameworkOrig/src/base/CContext.h Framework/src/base/CContext.h
--- FrameworkOrig/src/base/CContext.h 2010-04-01 19:23:12.000000000 +0200
+++ Framework/src/base/CContext.h 2010-04-21 12:45:56.263624839 +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;
@@ -113,6 +119,7 @@
static const Int32 TUNER_STACK_SIZE;
static const Int32 NAVI_STACK_SIZE;
static const Int32 CD_STACK_SIZE;
+ static const Int32 HMIGL_STACK_SIZE;
static const Int32 DEFAULT_STACK_SIZE;
static const CThread::EPriority ADMIN_PRIORITY;
@@ -121,6 +128,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 +137,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 FrameworkOrig/src/components/CAdminComponent.cpp Framework/src/components/CAdminComponent.cpp
--- FrameworkOrig/src/components/CAdminComponent.cpp 2010-04-01 20:58:59.000000000 +0200
+++ Framework/src/components/CAdminComponent.cpp 2010-04-22 15:44:25.664810465 +0200
@@ -54,9 +54,9 @@
/*
* GL thread for graphics
*/
- CHmiGLThread gl;
- CThread GLThread(gl, "GLThread", CContext::GL_STACK_SIZE,
- CContext::DEFAULT_PRIORITY, CContext::HMI_AFFINITY, false);
+ CHmiGLThread gl(CContext::getHMIGLContext());
+ CThread GLThread(gl, "HMI_GL_Component_Thread", CContext::HMIGL_STACK_SIZE,
+ CContext::HMIGL_PRIORITY, CContext::HMIGL_AFFINITY, false);
GLThread.start();
CThread CHmiComponent_thread(hmi,
diff -uNr FrameworkOrig/src/components/CAdminComponent.h Framework/src/components/CAdminComponent.h
--- FrameworkOrig/src/components/CAdminComponent.h 2010-04-01 19:23:12.000000000 +0200
+++ Framework/src/components/CAdminComponent.h 2010-04-21 12:35:37.255677517 +0200
@@ -33,6 +33,10 @@
#include "CHmiGLThread.h"
#endif
+#ifndef _CHMIGLDATACONTAINER_H
+ #include "CHmiGlDataContainer.h"
+#endif
+
#ifndef _CTUNERCOMPONENT_H
#include "CTunerComponent.h"
#endif
diff -uNr FrameworkOrig/src/components/CHmiComponent.cpp Framework/src/components/CHmiComponent.cpp
--- FrameworkOrig/src/components/CHmiComponent.cpp 2010-04-01 19:23:12.000000000 +0200
+++ Framework/src/components/CHmiComponent.cpp 2010-04-22 14:48:41.551623726 +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<CHmiGlDataContainer*>( &(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;actLine<CHmiGlDataContainer::NUM_LINES;actLine++)
+ {
+ hmiGlContPtr->setLine(static_cast<CHmiGlDataContainer::LINES>(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;actLine<CHmiGlDataContainer::NUM_LINES;actLine++)
+ {
+ hmiGlContPtr->setLine(static_cast<CHmiGlDataContainer::LINES>(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 FrameworkOrig/src/components/CHmiComponent.h Framework/src/components/CHmiComponent.h
--- FrameworkOrig/src/components/CHmiComponent.h 2010-04-01 21:00:27.000000000 +0200
+++ Framework/src/components/CHmiComponent.h 2010-04-22 14:58:50.319592697 +0200
@@ -25,6 +25,8 @@
#include "Events.h"
#endif
+#include "CHmiGlDataContainer.h"
+
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
diff -uNr FrameworkOrig/src/gl/CHmiGlDataContainer.cpp Framework/src/gl/CHmiGlDataContainer.cpp
--- FrameworkOrig/src/gl/CHmiGlDataContainer.cpp 1970-01-01 01:00:00.000000000 +0100
+++ Framework/src/gl/CHmiGlDataContainer.cpp 2010-04-22 14:38:44.943764102 +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 FrameworkOrig/src/gl/CHmiGlDataContainer.h Framework/src/gl/CHmiGlDataContainer.h
--- FrameworkOrig/src/gl/CHmiGlDataContainer.h 1970-01-01 01:00:00.000000000 +0100
+++ Framework/src/gl/CHmiGlDataContainer.h 2010-04-22 15:08:24.223581008 +0200
@@ -0,0 +1,57 @@
+/*
+ * CHmiGlDataContainer.h
+ *
+ * Created on: 21.04.2010
+ * Author: sven
+ */
+#ifndef _CHMIGLDATACONTAINER_H
+#define _CHMIGLDATACONTAINER_H
+
+#ifdef QNX
+#ifdef EGL
+#include <GLES/gl.h>
+#include <GLES/egl.h>
+#include <gf/gf3d.h>
+#elif GFX
+#include "gfx.h" // QNX GF-Framework and freetype library
+#endif
+#elif LINUX
+#include <GL/gl.h>
+#include <GL/glut.h>
+#endif
+
+#ifndef _CMUTEX_H
+ #include "CMutex.h"
+#endif
+#ifndef CCONTAINER_H_
+ #include "CContainer.h"
+#endif
+#ifndef CFONTRENDERER_H_
+ #include "CFontRenderer.h"
+#endif
+
+#include <string.h>
+
+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 FrameworkOrig/src/gl/CHmiGLThread.cpp Framework/src/gl/CHmiGLThread.cpp
--- FrameworkOrig/src/gl/CHmiGLThread.cpp 2010-04-01 21:00:52.000000000 +0200
+++ Framework/src/gl/CHmiGLThread.cpp 2010-04-22 15:28:14.352408837 +0200
@@ -13,6 +13,8 @@
#include "CHmiGLThread.h"
#include <errno.h>
+CHmiGLThread* CHmiGLThread::sInstancePtr;
+
#ifdef QNX
#ifdef GFX
GfxEglState CHmiGLThread::sGfxEglState;
@@ -29,8 +31,32 @@
int width = WINDOW_WIDTH;
int height = WINDOW_HEIGHT;
+CHmiGLThread::CHmiGLThread(CComponentContext& theContext) :
+ mContext(theContext), mDispatcher(theContext.getNormalQueue(),
+ theContext.getSystemQueue(), theContext.getInternalQueue(),
+ theContext.getTriggerSemaphore())
+{
+ CHmiGLThread::sInstancePtr = this;
+ mDispatcher.setHandler(*this);
+}
+
+CHmiGLThread::~CHmiGLThread()
+{
+ stop();
+}
+
void CHmiGLThread::init()
{
+ CHmiGlDataContainer* hmiGlContPtr = static_cast<CHmiGlDataContainer*>(&mContext.getContainer());
+ char title[CHmiGlDataContainer::MAX_LINE_LENGTH];
+ char body[CHmiGlDataContainer::MAX_LINE_LENGTH];
+ strcpy(title,"EMBEDDED FRAMEWORKS");
+ hmiGlContPtr->setTitle(title);
+ strcpy(body,"THIS IS THE BODY TEXT OF THE PANEL WHERE YOU CAN PRINT INFOS");
+ hmiGlContPtr->setLine(CHmiGlDataContainer::LINE_ONE,body);
+ color4f initialBgColor = {0.38f,0.72f,1.0f,1.0f};
+ hmiGlContPtr->setBackgroundColor(initialBgColor);
+
#ifdef QNX
#ifdef GFX
memset(&sGfxEglState, 0, sizeof(sGfxEglState)); // passiert im Konstrukturaufruf
@@ -236,9 +262,11 @@
glutSwapBuffers();
glutPostRedisplay();
#endif
-
+ DEBUG_PRINT("waiting for new message to dispatch");
+ CHmiGLThread::getInstancePtr()->getDispatcher().dispatch(true);
+ DEBUG_PRINT("returned from dispatch");
//Polling
- usleep(1500000);
+ //usleep(1500000);
}
/**
@@ -287,29 +315,85 @@
WINDOW_WIDTH, WINDOW_HEIGHT, 0 /* top-right*/
};
- glColor4f(0.38, 0.72, 1, 1); // steelblue
-
+ //glColor4f(0.38, 0.72, 1, 1); // steelblue
+ CHmiGlDataContainer* hmiGlContPtr = static_cast<CHmiGlDataContainer*>(&(CHmiGLThread::getInstancePtr()->getComponentContext().getContainer()));
+ color4f bg;
+ hmiGlContPtr->getBackgroundColor(bg);
+ glColor4f(bg[0],bg[1],bg[2],bg[3]);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_SHORT, 0, vPanel);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
-
+ 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<CHmiGlDataContainer::LINES>(actLine),lines[actLine]);
+ DEBUG_PRINT("Line %d: %s",actLine,lines[actLine]);
+ }
/*
* draw child Elements
* hard coded text and position
*/
#ifdef LINUX
CFontRenderer mTitelText;
- CFontRenderer mBodyText;
+ //CFontRenderer mBodyText;
+ CFontRenderer mLinesText[CHmiGlDataContainer::NUM_LINES];
mTitelText.setPosition((WINDOW_WIDTH/2)-CFontRenderer::CHAR_WIDTH*10,
WINDOW_HEIGHT-CFontRenderer::CHAR_HEIGHT);
- mBodyText.setPosition(70, WINDOW_HEIGHT/2);
-
- char titel[] = "EMBEDDED FRAMEWORKS";
- char body[] = "THIS IS THE BODY TEXT OF THE PANEL WHERE YOU CAN PRINT INFOS";
- mTitelText.printString(titel);
- mBodyText.printString(body);
+ mTitelText.printString(title);
+ for(Int32 actLine = CHmiGlDataContainer::LINE_ONE;
+ actLine < CHmiGlDataContainer::NUM_LINES;
+ actLine++) {
+ mLinesText[actLine].setPosition(70, /*WINDOW_HEIGHT/2*/ WINDOW_HEIGHT - ( (CFontRenderer::CHAR_HEIGHT*2) + (CFontRenderer::CHAR_HEIGHT*2*actLine)) );
+ mLinesText[actLine].printString(lines[actLine]);
+ }
#endif
glFlush();
// mHmiComponent->getCurrentDrawable()->draw();
}
+void CHmiGLThread::handleMessage(const CMessage& msg)
+{
+ DEBUG_PRINT("%s handle message", mContext.getContextNamePtr());
+ switch(msg.getMessageType())
+ {
+ case CMessage::Key_Event_Type :
+ handleKeyEvent(msg);
+ break;
+ case CMessage::Internal_App_Type :
+ handleInternalEvent(msg);
+ break;
+ default:
+ break;
+ }
+}
+CDispatcher& CHmiGLThread::getDispatcher(void)
+{
+ return mDispatcher;
+}
+CComponentContext& CHmiGLThread::getComponentContext(void)
+{
+ return mContext;
+}
+CHmiGLThread* CHmiGLThread::getInstancePtr(void)
+{
+ return sInstancePtr;
+}
+void CHmiGLThread::handleKeyEvent(const CMessage& msg)
+{
+
+}
+void CHmiGLThread::handleInternalEvent(const CMessage& msg)
+{
+ switch(msg.getSenderID()) {
+ case HMI_INDEX: {
+
+ break;
+ }
+ default:
+ break;
+ }
+}
diff -uNr FrameworkOrig/src/gl/CHmiGLThread.h Framework/src/gl/CHmiGLThread.h
--- FrameworkOrig/src/gl/CHmiGLThread.h 2010-04-01 19:23:12.000000000 +0200
+++ Framework/src/gl/CHmiGLThread.h 2010-04-22 15:26:56.143700277 +0200
@@ -14,6 +14,9 @@
#include <GL/glut.h>
#endif
+#ifndef _IMESSAGEHANDLER_H
+ #include "IMessageHandler.h"
+#endif
#ifndef _IRUNNABLE_H
#include "IRunnable.h"
#endif
@@ -32,12 +35,24 @@
#include "CFontRenderer.h"
#endif
+#ifndef _CDISPATCHER_H
+ #include "CDispatcher.h"
+#endif
+
+#ifndef _CCONTEXT_H
+ #include "CContext.h"
+#endif
+
+#include "CHmiGlDataContainer.h"
+
#include <stdio.h>
#include <unistd.h>
-class CHmiGLThread : public IRunnable
+class CHmiGLThread : public IRunnable, public IMessageHandler
{
public:
+ CHmiGLThread(CComponentContext&);
+ ~CHmiGLThread();
virtual void init();
virtual void run();
virtual void stop();
@@ -46,6 +61,9 @@
virtual void reRun() {}
virtual void goToStandby() {}
+ virtual void handleMessage(const CMessage& msg);
+ virtual void handleInternalEvent(const CMessage& msg);
+ virtual void handleKeyEvent(const CMessage& msg);
/* must be static so it can
* be called from the C-function
* 'displayFunction()' defined in
@@ -53,11 +71,19 @@
*/
static void draw();
+ static CHmiGLThread* getInstancePtr(void);
+ CComponentContext& getComponentContext(void);
+ CDispatcher& getDispatcher(void);
#ifdef QNX
#ifdef GFX
static GfxEglState sGfxEglState;
#endif
#endif
+
+ private:
+ CComponentContext& mContext;
+ CDispatcher mDispatcher;
+ static CHmiGLThread* sInstancePtr;
};
#endif // CHMIGLTHREAD_H_
|