source: svn/trunk/zasc/app/DST_WinRFUpdate.cpp @ 22

Last change on this file since 22 was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
File size: 3.0 KB
Line 
1#include "DST_WinManager.h"
2#include "DST_OSDImage.h"
3#include "DST_CommonAPI.h"
4#include "DST_UserInterface.h"
5#include "DST_DataStrings.h"
6#include "DST_Updates.h"
7
8void JST_RFUpdate(DS_U8 RF);
9
10#if 0
11____CRFUpdateWin___()
12#endif
13
14class CRFUpdateWin : public CWindow
15{
16        int nReceivePos;
17        int nWritePos;
18        char strVersion[8];
19public:
20        CRFUpdateWin(SWinEventMsg event):CWindow(event)
21        {
22                DST_g_RFUpdateState = 0;
23                RegisterAllKey();
24                rect.w = DST_GetScreenWidth();
25                rect.h = DST_GetScreenHeight();
26                rect.x = 0;
27                rect.y = 0;
28                SetTimeOut(0);
29//              JST_RFUpdate(10);
30                nReceivePos = 0;
31                nWritePos = 0;
32                strVersion[0] = 0;
33        }
34        ~CRFUpdateWin()
35        {
36                JST_Stop();     
37        }
38       
39        virtual void OnMessage(SWinEventMsg event)
40        {
41                switch (event.cmd)
42                {
43                        case WM_RF_UPDATE:
44                                switch(event.data32[0])
45                                {
46                                        case DATA_RECEIVING: // DATA RECEIVING
47                                                memcpy(strVersion, &event.data32[2], 8);
48                                                nReceivePos = event.data32[1];
49                                                nWritePos = 0;
50                                                break;
51                                        case DATA_RECEIVING_COMPLETE: // DATA RECEIVING COMPLETE
52                                                nReceivePos = 100;
53                                                nWritePos = 0;
54                                                break;
55                                        case FLASH_WRITING: // FLASH WRITING
56                                                nReceivePos = 100;
57                                                nWritePos = event.data32[1];
58                                                DST_g_RFUpdateState = 1;
59                                                break;
60                                        case FLASH_WRITING_COMPLETE: // FLASH WRITING COMPLETE
61                                                nReceivePos = 100;
62                                                nWritePos = 100;
63                                                break;
64                                        case FLASH_WRITING_FAIL: // FLASH WRITING FAIL
65                                                nReceivePos = 100;
66                                                nWritePos = 100;
67                                                break;                                         
68                                        case 100: // Different model
69                                                DST_g_RFUpdateState = 2;
70                                                break;
71                                        case 101: // Same Version
72                                                memcpy(strVersion, &event.data32[2], 8);
73                                                DST_Printf("strVersion = %s\n", strVersion);
74                                                nReceivePos = 100;
75                                                nWritePos = 100;
76                                                DST_g_RFUpdateState = 1;
77                                                break;
78                                }
79                                Show();
80                                break;
81                }
82        }
83
84        virtual void Show()
85        {
86                char strText[64];
87                DrawBox32(0,0,rect.w, rect.h, CONV32_16(0xFF808080));
88               
89                setFontStyle(30, 0xFFFFFFF, ALIGN_MIDDLE,ALIGN_CENTER);
90                DrawText(0,   60, rect.w, 60, "RF Update", &font);
91               
92                sprintf(strText, "Data Receiving : %s", strVersion);
93                setFontStyle(25, 0xFFC8C8C8, ALIGN_MIDDLE,ALIGN_CENTER);
94                DrawText(0, 150, rect.w, 40, strText, &font);
95               
96                DrawBox32(60-1, 200    ,    600+2, 50, CONV32_16(0xFFFFFFFF));
97                DrawBox32(  60, 200 + 1, nReceivePos * 6, 48, CONV32_16(0xFF00FF00));
98                 
99                sprintf(strText, "%d%%", nReceivePos);
100                setFontStyle(25, 0xFF000000, ALIGN_MIDDLE,ALIGN_CENTER);
101                DrawText(0, 200, rect.w, 50, strText, &font);
102               
103                setFontStyle(25, 0xFFC8C8C8, ALIGN_MIDDLE,ALIGN_CENTER);
104                DrawText(0, 300, rect.w, 40, "Flash Writing", &font);
105               
106                DrawBox32(60-1, 350    ,    600+2, 50, CONV32_16(0xFFFFFFFF));
107                DrawBox32(  60, 350 + 1, nWritePos * 6, 48, CONV32_16(0xFF00FF00));
108               
109//              strText[5];
110                sprintf(strText, "%d%%", nWritePos);
111                setFontStyle(25, 0xFF000000, ALIGN_MIDDLE,ALIGN_CENTER);
112                DrawText(0, 350, rect.w, 50, strText, &font);
113        }
114};
115void DST_CreateRFUpdateWindow(SWinEventMsg event)
116{
117        if (DST_GetWin(WIN_RF_UPDATE)) return;
118       
119        DST_RemoveAllWindowExceptBasicWin();
120        DST_AddWin((WinID)(event.data[0]), new CRFUpdateWin(event));
121}
Note: See TracBrowser for help on using the repository browser.