1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
90
91
92
98
99
100
101
102
103
104
105
106
107
108
109
110
111
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
142
143
144
145
146
151
152
153
154
155
156
157
158
159
160
164
168
169
170
175
176
177
178
179
180
181
182
183
184
188
192
193
194
199
200
201
202
203
204
205
206
207
208
212
216
217
218
223
236
237
242
255
256
261
274
275
280
291
292
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
330
331
332
333
334
335
339
340
341
344
345
346
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
405
406
407
408
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
486
487
488
489
490
498
499
500
501
502
503
508
509
510
511
512
513
514
515
519
537
547
549
550
551
552
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
578
579
580
581
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
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
661
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
692
693
694
695
696
697
706
707
708
709
719
722
723
724
725
732
737
738
739
744
753
754
759
763
764
765
768
769
/* ... */
#include "DIALOG.h"
#include "k_module.h"
#include "camera_app.h"
#include "camera_res.c"
#include "k_modules_res.h"
#include "k_storage.h"
#include "k_rtc.h"
#include "k_mem.h"
8 includes
/* ... */
/* ... */
Includes
#define ID_WINDOW_0 (GUI_ID_USER + 0x00)
#define ID_BUTTON_CLOSE (GUI_ID_USER + 0x04)
#define ID_BUTTON_CAPTURE (GUI_ID_USER + 0x05)
#define ID_BUTTON_SETTINGS (GUI_ID_USER + 0x06)
#define ID_RADIO (GUI_ID_USER + 0x07)
#define ID_IMAGE (GUI_ID_USER + 0x08)
#define ID_TEXT (GUI_ID_USER + 0x09)
#define ID_FRAMEWIN_0 (GUI_ID_USER + 0x10)
#define ID_MULTIPAGE (GUI_ID_USER + 0x11)
#define ID_BUTTON_OK (GUI_ID_USER + 0x12)
#define ID_BUTTON_CANCEL (GUI_ID_USER + 0x13)
#define ID_TEXT_0 (GUI_ID_USER + 0x20)
#define ID_TEXT_1 (GUI_ID_USER + 0x21)
#define ID_TEXT_2 (GUI_ID_USER + 0x22)
#define ID_SLIDER_0 (GUI_ID_USER + 0x23)
#define ID_SLIDER_1 (GUI_ID_USER + 0x24)
#define ID_TEXT_3 (GUI_ID_USER + 0x25)
#define ID_TEXT_4 (GUI_ID_USER + 0x26)
#define ID_FOLDER (GUI_ID_USER + 0x30)
#define ID_BROWSE (GUI_ID_USER + 0x31)
#define ID_FOLDER_CAPTION (GUI_ID_USER + 0x32)
21 defines
Private defines
CameraSettingsTypeDef CameraSettings;
static WM_HWIN CAMERA_hWin, hDialogCameraSettings, hDialogFileControl, hSettings;
WM_HWIN hCameraFrame;
static __IO uint32_t FrameAvailable = 0;
static WM_HWIN chooser_select_folder;
static uint8_t capture_folder[FILEMGR_FULL_PATH_SIZE];
static uint8_t camera_disabled = 0;
CHOOSEFILE_INFO *pFileInfo;
static char const *apDrives[2] = {"0:", "1:"};
const char acMask_folder[] = ".dir";
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] =
{
{ WINDOW_CreateIndirect, "Camera", ID_WINDOW_0, 0, 0, 320, 215, 0, 0x0, 0 },
{ RADIO_CreateIndirect, "Radio", ID_RADIO, 10, 77, 80, 138, 0, 0x1407, 0 },
{ IMAGE_CreateIndirect, "Image", ID_IMAGE, 6, 2, 48, 48, 0, 0, 0 },
{ TEXT_CreateIndirect, "Effects", ID_TEXT, 7, 52, 48, 20, 0, 0x0, 0 },
...};
static const GUI_WIDGET_CREATE_INFO _aSettingsDialogCreate[] =
{
{ FRAMEWIN_CreateIndirect, "Settings", ID_FRAMEWIN_0, 20, 10, 280, 170, 0, 0x0, 0 },
{ MULTIPAGE_CreateIndirect, "Multipage", ID_MULTIPAGE, 10, 15, 190, 120, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "OK", ID_BUTTON_OK, 210, 18, 50, 50, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "Cancel", ID_BUTTON_CANCEL, 210, 85, 50, 50, 0, 0x0, 0 }
...};
static const GUI_WIDGET_CREATE_INFO _aDialogCameraSettings[] =
{
{ WINDOW_CreateIndirect, "", 0, 0, 0, 260, 140, FRAMEWIN_CF_MOVEABLE },
{ TEXT_CreateIndirect, "Brightness", ID_TEXT_0, 20, 20, 63, 20, 0, 0x64, 0 },
{ TEXT_CreateIndirect, "Contrast", ID_TEXT_1, 20, 60, 61, 20, 0, 0x0, 0 },
{ SLIDER_CreateIndirect, "Slider_Br", ID_SLIDER_0, 100, 20, 80, 20, 0, 0x0, 0 },
{ SLIDER_CreateIndirect, "Slider_Co", ID_SLIDER_1, 100, 60, 80, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "-2 -1 0 1 2", ID_TEXT_3, 100, 05, 80, 20, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "-2 -1 0 1 2", ID_TEXT_4, 100, 45, 80, 20, 0, 0x64, 0 }
...};
static const GUI_WIDGET_CREATE_INFO _aDialogFileControl[] =
{
{ WINDOW_CreateIndirect, "", 0, 0, 0, 260, 140, FRAMEWIN_CF_MOVEABLE },
{ TEXT_CreateIndirect, "Capture Folder : ", ID_FOLDER_CAPTION, 15, 30, 120, 20, 0, 0x64, 0 },
{ EDIT_CreateIndirect, "Edit", ID_FOLDER, 15, 50, 100, 20, 0, 0x64, 0 },
{ BUTTON_CreateIndirect, "Browse", ID_BROWSE, 130, 50, 50, 20, 0, 0x0, 0 },
...};
GUI_BITMAP frame0 =
{
160,
120,
320,
16,
(unsigned char *)(CAMERA_FRAME_BUFFER),
NULL,
GUI_DRAW_BMPM565
...};
Private variables
static void Startup(WM_HWIN hWin, uint16_t xpos, uint16_t ypos);
static uint8_t IsFrameAvailable(void);
K_ModuleItem_Typedef camera_capture =
{
12,
"Camera",
&bmcamera,
Startup,
NULL,
...}
;
Private function prototypes
/* ... */
static void _OnPaint_close(BUTTON_Handle hObj)
{
int Index;
GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor());
GUI_Clear();
Index = (WIDGET_GetState(hObj) & BUTTON_STATE_PRESSED) ? 1 : 0;
if(Index)
{
GUI_DrawBitmap(&bmclose_pressed, 0, 0);
}if (Index) { ... }
else
{
GUI_DrawBitmap(&bmclose_not_pressed, 0, 0);
}else { ... }
}{ ... }
/* ... */
static void _OnPaint_capture(BUTTON_Handle hObj)
{
int Index;
GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor());
GUI_Clear();
Index = (WIDGET_GetState(hObj) & BUTTON_STATE_PRESSED) ? 1 : 0;
if(Index)
{
GUI_DrawBitmap(&bmcapturebutton_pressed, 0, 0);
}if (Index) { ... }
else
{
GUI_DrawBitmap(&bmcapturebutton_not_pressed, 0, 0);
}else { ... }
}{ ... }
/* ... */
static void _OnPaint_settings(BUTTON_Handle hObj)
{
int Index;
GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor());
GUI_Clear();
Index = (WIDGET_GetState(hObj) & BUTTON_STATE_PRESSED) ? 1 : 0;
if(Index)
{
GUI_DrawBitmap(&bmsettings_button_pressed, 0, 0);
}if (Index) { ... }
else
{
GUI_DrawBitmap(&bmsettings_button_not_pressed, 0, 0);
}else { ... }
}{ ... }
/* ... */
static void _cbButton_close(WM_MESSAGE * pMsg)
{
switch (pMsg->MsgId)
{
case WM_PAINT:
_OnPaint_close(pMsg->hWin);
break;case WM_PAINT:
default:
BUTTON_Callback(pMsg);
break;default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static void _cbButton_capture(WM_MESSAGE * pMsg)
{
switch (pMsg->MsgId)
{
case WM_PAINT:
_OnPaint_capture(pMsg->hWin);
break;case WM_PAINT:
default:
BUTTON_Callback(pMsg);
break;default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static void _cbButton_settings(WM_MESSAGE * pMsg)
{
switch (pMsg->MsgId)
{
case WM_PAINT:
_OnPaint_settings(pMsg->hWin);
break;case WM_PAINT:
default:
BUTTON_Callback(pMsg);
break;default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static void _Check_DefaultPath (uint8_t *path)
{
if ((*((char *)(CAMERA_SAVE_PATH )) == '0') || (*((char *)(CAMERA_SAVE_PATH)) == '1'))
{
strncpy((char *)path, (char *)(CAMERA_SAVE_PATH), FILEMGR_FULL_PATH_SIZE);
}if ((*((char *)(CAMERA_SAVE_PATH )) == '0') || (*((char *)(CAMERA_SAVE_PATH)) == '1')) { ... }
else
{
strcpy((char *)path, "0:");
}else { ... }
}{ ... }
/* ... */
static void _cbCameraSettings(WM_MESSAGE * pMsg)
{
WM_HWIN hItem;
switch (pMsg->MsgId)
{
case WM_INIT_DIALOG:
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
TEXT_SetFont(hItem, GUI_FONT_13B_1);
TEXT_SetTextAlign(hItem, GUI_TA_RIGHT | GUI_TA_VCENTER);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1);
TEXT_SetFont(hItem, GUI_FONT_13B_1);
TEXT_SetTextAlign(hItem, GUI_TA_RIGHT | GUI_TA_VCENTER);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_3);
TEXT_SetFont(hItem, GUI_FONT_13_1);
TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_4);
TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
hItem = WM_GetDialogItem(pMsg->hWin, ID_SLIDER_0);
SLIDER_SetRange(hItem, 1, 5);
SLIDER_SetNumTicks(hItem, 5);
if(CameraSettings.b.brightness == 0)
{
CameraSettings.b.brightness = 3;
}if (CameraSettings.b.brightness == 0) { ... }
SLIDER_SetValue(hItem, CameraSettings.b.brightness);
hItem = WM_GetDialogItem(pMsg->hWin, ID_SLIDER_1);
SLIDER_SetRange(hItem, 1, 5);
SLIDER_SetNumTicks(hItem, 5);
if(CameraSettings.b.contrast == 0)
{
CameraSettings.b.contrast = 3;
}if (CameraSettings.b.contrast == 0) { ... }
SLIDER_SetValue(hItem, CameraSettings.b.contrast);
break;case WM_INIT_DIALOG:
default:
WM_DefaultProc(pMsg);
break;default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static void _cbFileControl(WM_MESSAGE * pMsg)
{
WM_HWIN hItem;
int NCode;
int Id;
int result;
switch (pMsg->MsgId)
{
case WM_INIT_DIALOG:
hItem = WM_GetDialogItem(pMsg->hWin, ID_FOLDER_CAPTION);
TEXT_SetFont(hItem, GUI_FONT_13B_1);
hItem = WM_GetDialogItem(pMsg->hWin, ID_FOLDER);
EDIT_SetText(hItem, (char *)capture_folder);
break;
case WM_INIT_DIALOG:
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
switch(Id)
{
case ID_BROWSE:
switch(NCode)
{
case WM_NOTIFICATION_RELEASED:
pFileInfo->pfGetData = k_GetData;
pFileInfo->pMask = acMask_folder;
chooser_select_folder = CHOOSEFILE_Create(CAMERA_hWin, 20, 20, 200, 150, apDrives, GUI_COUNTOF(apDrives), 0, "Select a folder", 0, pFileInfo);
WM_MakeModal(chooser_select_folder );
result = GUI_ExecCreatedDialog(chooser_select_folder);
if (result == 0)
{
if(((pFileInfo->pRoot[0] == '0' ) || (pFileInfo->pRoot[0] == '1' )))
{
hItem = WM_GetDialogItem(hDialogFileControl, ID_FOLDER);
EDIT_SetText(hItem, (char *)pFileInfo->pRoot);
chooser_select_folder = 0;
WM_InvalidateWindow(hDialogFileControl);
WM_Paint(hDialogFileControl);
strncpy((char *)(CAMERA_SAVE_PATH),pFileInfo->pRoot , FILEMGR_FULL_PATH_SIZE);
strncpy((char *)capture_folder,pFileInfo->pRoot , FILEMGR_FULL_PATH_SIZE);
}if (((pFileInfo->pRoot[0] == '0' ) || (pFileInfo->pRoot[0] == '1' ))) { ... }
}if (result == 0) { ... }
break;case WM_NOTIFICATION_RELEASED:
}switch (NCode) { ... }
break;case ID_BROWSE:
}switch (Id) { ... }
break;
case WM_NOTIFY_PARENT:
default:
WM_DefaultProc(pMsg);
break;default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static void _cbSettingsDialog(WM_MESSAGE * pMsg)
{
int Id, NCode;
WM_HWIN hItem;
switch (pMsg->MsgId)
{
case WM_INIT_DIALOG:
hItem = pMsg->hWin;
FRAMEWIN_AddCloseButton(hItem, FRAMEWIN_BUTTON_RIGHT, 0);
hItem = WM_GetDialogItem(pMsg->hWin, ID_MULTIPAGE);
hDialogCameraSettings = GUI_CreateDialogBox(_aDialogCameraSettings,
GUI_COUNTOF(_aDialogCameraSettings),
&_cbCameraSettings, WM_UNATTACHED, 0, 0);
MULTIPAGE_AddPage(hItem, hDialogCameraSettings, "Camera Settings");
hDialogFileControl = GUI_CreateDialogBox(_aDialogFileControl,
GUI_COUNTOF(_aDialogFileControl),
&_cbFileControl, WM_UNATTACHED, 0, 0);
MULTIPAGE_AddPage(hItem, hDialogFileControl, "File Settings");
MULTIPAGE_SelectPage(hItem, 0);
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_OK);
BUTTON_SetFont(hItem, GUI_FONT_13B_1);
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_CANCEL);
BUTTON_SetFont(hItem, GUI_FONT_13B_1);
break;
case WM_INIT_DIALOG:
case WM_DELETE:
camera_disabled = 0;
hSettings = 0;
WM_DeleteWindow(chooser_select_folder);
break;
case WM_DELETE:
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
switch (Id)
{
case ID_BUTTON_OK:
switch (NCode)
{
case WM_NOTIFICATION_RELEASED:
hItem = WM_GetDialogItem(hDialogCameraSettings, ID_SLIDER_0);
CameraSettings.b.brightness = SLIDER_GetValue(hItem);
hItem = WM_GetDialogItem(hDialogCameraSettings, ID_SLIDER_1);
CameraSettings.b.contrast = SLIDER_GetValue(hItem);
hItem = WM_GetDialogItem(CAMERA_hWin, ID_RADIO);
RADIO_SetValue(hItem, 0);
if(CAMERA_GetState() != CAMERA_ERROR)
{
CAMERA_Set_ContrastBrightness(CameraSettings.b.contrast, CameraSettings.b.brightness);
}if (CAMERA_GetState() != CAMERA_ERROR) { ... }
GUI_EndDialog(pMsg->hWin, 0);
break;case WM_NOTIFICATION_RELEASED:
}switch (NCode) { ... }
break;case ID_BUTTON_OK:
case ID_BUTTON_CANCEL:
switch (NCode)
{
case WM_NOTIFICATION_RELEASED:
GUI_EndDialog(pMsg->hWin, 0);
break;case WM_NOTIFICATION_RELEASED:
}switch (NCode) { ... }
break;case ID_BUTTON_CANCEL:
}switch (Id) { ... }
break;case WM_NOTIFY_PARENT:
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static void _cbCameraWindow(WM_MESSAGE * pMsg)
{
GUI_RECT r;
switch (pMsg->MsgId)
{
case WM_CREATE:
CAMERA_Init();
break;
case WM_CREATE:
case WM_PAINT:
if(IsFrameAvailable() > 0)
{
GUI_DrawBitmap(&frame0, 0, 0);
}if (IsFrameAvailable() > 0) { ... }
else
{
WM_GetInsideRect(&r);
GUI_ClearRectEx(&r);
if(CAMERA_GetState() == CAMERA_ERROR)
{
GUI_DispStringAt("Error while Initializing Camera Interface", 45, 120);
GUI_DispStringAt("Please, check if the camera module is mounted.", 35, 140);
}if (CAMERA_GetState() == CAMERA_ERROR) { ... }
}else { ... }
break;
case WM_PAINT:
case WM_POST_PAINT:
if(IsFrameAvailable() > 0)
{
if(camera_disabled == 0)
{
CAMERA_Resume();
}if (camera_disabled == 0) { ... }
}if (IsFrameAvailable() > 0) { ... }
break;
case WM_POST_PAINT:
default:
WM_DefaultProc(pMsg);default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static void _cbHint(WM_MESSAGE * pMsg)
{
GUI_RECT Rect;
switch (pMsg->MsgId)
{
case WM_PAINT:
GUI_SetBkColor(GUI_LIGHTBLUE);
GUI_Clear();
GUI_SetColor(GUI_WHITE);
GUI_SetFont(&GUI_Font16_1HK);
GUI_DispStringHCenterAt("Saving image...", 50 , 10);
GUI_SetFont(GUI_DEFAULT_FONT);
WM_GetClientRect(&Rect);
GUI_SetColor(GUI_DARKGRAY);
GUI_DrawRectEx(&Rect);
break;
case WM_PAINT:
default:
WM_DefaultProc(pMsg);
break; default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static void _cbDialog(WM_MESSAGE * pMsg)
{
WM_HWIN hItem, Hint;
GUI_RECT r;
int NCode, Id;
uint32_t tmp_param = 0;
switch (pMsg->MsgId)
{
case WM_INIT_DIALOG:
pFileInfo = (CHOOSEFILE_INFO *)k_malloc(sizeof(CHOOSEFILE_INFO));
CameraSettings.d32 = k_BkupRestoreParameter(CALIBRATION_CAMERA_SETTING_BKP);
hItem = WM_GetDialogItem(pMsg->hWin, ID_IMAGE);
IMAGE_SetBitmap(hItem, &bmwizard);
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT);
TEXT_SetFont(hItem, GUI_FONT_16B_1);
hItem = WM_GetDialogItem(pMsg->hWin, ID_RADIO);
RADIO_SetText(hItem, "None", 0);
RADIO_SetText(hItem, "B&W", 1);
RADIO_SetText(hItem, "Negative", 2);
RADIO_SetText(hItem, "Antique", 3);
RADIO_SetText(hItem, "Blue", 4);
RADIO_SetText(hItem, "Green", 5);
RADIO_SetText(hItem, "Red", 6);
hItem = WM_GetClientWindow(pMsg->hWin);
WM_GetClientRectEx(hItem, &r);
hCameraFrame = WM_CreateWindowAsChild(r.x0 + 79,
r.y0 + 49, r.x1 - 159,
r.y1 - 93,
hItem,
WM_CF_SHOW | WM_CF_LATE_CLIP,
_cbCameraWindow,
0);
hItem = BUTTON_CreateEx(266, 175, 30, 30, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_CLOSE);
WM_SetCallback(hItem, _cbButton_close);
hItem = BUTTON_CreateEx(256, 79, 50, 50, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_CAPTURE);
WM_SetCallback(hItem, _cbButton_capture);
hItem = BUTTON_CreateEx(266, 14, 30, 30, pMsg->hWin, WM_CF_SHOW, 0, ID_BUTTON_SETTINGS);
WM_SetCallback(hItem, _cbButton_settings);
_Check_DefaultPath (capture_folder);
FrameAvailable = 0;
break;
case WM_INIT_DIALOG:
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
if(hSettings == 0)
{
switch(Id)
{
case ID_RADIO:
if(NCode == WM_NOTIFICATION_VALUE_CHANGED)
{
hItem = WM_GetDialogItem(pMsg->hWin, ID_RADIO);
if(CAMERA_GetState() != CAMERA_ERROR)
{
CAMERA_SelectEffect(RADIO_GetValue(hItem));
}if (CAMERA_GetState() != CAMERA_ERROR) { ... }
}if (NCode == WM_NOTIFICATION_VALUE_CHANGED) { ... }
break;case ID_RADIO:
case ID_BUTTON_CLOSE:
switch(NCode)
{
case WM_NOTIFICATION_RELEASED:
k_free(pFileInfo);
CAMERA_Stop();
GUI_EndDialog(pMsg->hWin, 0);
break;case WM_NOTIFICATION_RELEASED:
}switch (NCode) { ... }
break;case ID_BUTTON_CLOSE:
case ID_BUTTON_CAPTURE:
switch(NCode)
{
case WM_NOTIFICATION_RELEASED:
if(CAMERA_GetState() == CAMERA_OK)
{
Hint = WM_CreateWindowAsChild(100,
90,
120, 32,
pMsg->hWin,
WM_CF_SHOW ,
_cbHint,
0);
GUI_Exec();
if(CAMERA_GetState() == CAMERA_OK)
{
CAMERA_SaveToFile(capture_folder);
}if (CAMERA_GetState() == CAMERA_OK) { ... }
WM_DeleteWindow(Hint);
}if (CAMERA_GetState() == CAMERA_OK) { ... }
break;case WM_NOTIFICATION_RELEASED:
}switch (NCode) { ... }
break;case ID_BUTTON_CAPTURE:
case ID_BUTTON_SETTINGS:
switch(NCode)
{
case WM_NOTIFICATION_RELEASED:
camera_disabled = 1;
hSettings = GUI_CreateDialogBox(_aSettingsDialogCreate, GUI_COUNTOF(_aSettingsDialogCreate), _cbSettingsDialog, CAMERA_hWin, 0, 0);
break;case WM_NOTIFICATION_RELEASED:
}switch (NCode) { ... }
break;case ID_BUTTON_SETTINGS:
}switch (Id) { ... }
}if (hSettings == 0) { ... }
break;case WM_NOTIFY_PARENT:
case WM_DELETE:
tmp_param = k_BkupRestoreParameter(CALIBRATION_CAMERA_SETTING_BKP);
if(CameraSettings.d32 != tmp_param)
{
k_BkupSaveParameter(CALIBRATION_CAMERA_SETTING_BKP, CameraSettings.d32);
}if (CameraSettings.d32 != tmp_param) { ... }
break;
case WM_DELETE:
default:
WM_DefaultProc(pMsg);
break;default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static void Startup(WM_HWIN hWin, uint16_t xpos, uint16_t ypos)
{
camera_disabled = 0;
CAMERA_hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, hWin, xpos, ypos);
}{ ... }
/* ... */
void BSP_CAMERA_FrameEventCallback(void)
{
CAMERA_Suspend();
if(FrameAvailable == 0)
{
FrameAvailable = 1;
}if (FrameAvailable == 0) { ... }
WM_InvalidateWindow(hCameraFrame);
}{ ... }
/* ... */
static uint8_t IsFrameAvailable(void)
{
return FrameAvailable;
}{ ... }
/* ... */
/* ... */