//---------------------------------------------------- // Copyright (c) 2018, Djyos Open source Development team. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // 1. Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- /* * app_main.c * * Created on: 2014-5-28 * Author: Administrator */ #include "string.h" #include "stdint.h" #include "stddef.h" #include "stdio.h" #include #include "gdd.h" #include "gdd_button.h" #include #include #include #include "wjh_file.h" #include "wjh_OTAConfig.h" bool_t Module_Paint(struct WindowMsg *pMsg){ HWND hwnd = pMsg->hwnd; HDC hdc = GDD_BeginPaint(hwnd); GDD_SetBackGroundColor(hdc,RGB(255,255,255)); GDD_CleanClient(hdc); GDD_EndPaint(hwnd,hdc); } struct MsgProcTable s_gModule[] = { {.MsgCode = MSG_PAINT + MSG_ADOPT_NONE, .MsgProc = Module_Paint}, // 不继承父类的paint消息 {.MsgCode = MSG_TOUCH_DOWN + MSG_ADOPT_NONE, .MsgProc = NULL}, {.MsgCode = MSG_TOUCH_UP + MSG_ADOPT_NONE, .MsgProc = NULL}, {.MsgCode = MSG_TOUCH_MOVE + MSG_ADOPT_NONE, .MsgProc = NULL}, }; // 用户定义的消息链表 struct MsgTableLink Module = { .MsgNum = sizeof(s_gModule) / sizeof(struct MsgProcTable), .myTable = (struct MsgProcTable *)&s_gModule, }; ptu32_t djy_main(void) { // 点屏 Lcd_BackLight_OnOff(1); // 安装utf8字符集 ModuleInstall_CharsetUtf8(NULL); OTA_Initialize(); WinMainInitialize(GDD_GetDesktopWindow(NULL)); // struct stat fp_info; // // 检查文件系统下是否存在升级文件存在删除 // if (stat(OTA_FILE_PATH, &fp_info) == 0) // { // remove(OTA_FILE_PATH); // } // FILE *pFile; // pFile = fopen(OTA_FILE_PATH, "ab"); // 以ab标志末尾追加方式写入 // u32 Write_Size = fwrite(file_demo, 1,1133672, pFile); // fclose(pFile); // // char ProductionTime[4] = {0, 1, 2, 3}; // char ProductionNumber[5] = {4, 5, 6, 7, 8}; // Iboot_SetOtaFilename(OTA_FILE_PATH, strlen(OTA_FILE_PATH) + 1); // WriteAppFromFile(ProductionTime, ProductionNumber); // runiboot("1"); // GDD_CreateWindow("窗口1",&Module,0,0,1024,600, CN_WINBUF_PARENT, 0, CN_SYS_PF_DISPLAY, RGB(255, 255, 255), 0, 0, GDD_GetDesktopWindow(NULL)); while (1) { DJY_EventDelay(500 * 1000); } }