diff --git a/.vscode/settings.json b/.vscode/settings.json index 272047b..52c1faa 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,6 +2,23 @@ "files.associations": { "*.inc": "c", "navigator.h": "c", - "main_loop_simple.h": "c" - } + "main_loop_simple.h": "c", + "pwm.h": "c", + "sfud.h": "c", + "can_protocol.h": "c", + "awtk.h": "c", + "types_def.h": "c", + "gpio_protocol.h": "c", + "data_port.h": "c", + "serial.h": "c", + "ff_stdio.h": "c", + "ff_sfdisk.h": "c", + "universal.h": "c", + "data_communication_send.h": "c", + "object_date_time.h": "c", + "semphr.h": "c", + "user_data.h": "c", + "qr.h": "c" + }, + "cmake.sourceDirectory": "G:/MXC_A58/lib/awtk/awtk/3rd/mbedtls/include" } \ No newline at end of file diff --git a/ArkmicroFiles/libboard-amt630hv100/include/board.h b/ArkmicroFiles/libboard-amt630hv100/include/board.h index 3a931bd..eda3283 100644 --- a/ArkmicroFiles/libboard-amt630hv100/include/board.h +++ b/ArkmicroFiles/libboard-amt630hv100/include/board.h @@ -263,8 +263,8 @@ #ifdef WIFI_SUPPORT #define CARLINK_EY 0 -#define CARLINK_EC 0 -#define CARLINK_CP 1 +#define CARLINK_EC 1 +#define CARLINK_CP 0 #define CARLINK_AA 0 #define WIFI_RESET_IO 12 @@ -287,7 +287,7 @@ #error "Do not choose two car links" #elif (CARLINK_EC && CARLINK_AA) #error "Do not choose two car links" -#elif (CARLINK_CP && CARLINK_AA) +// #elif (CARLINK_CP && CARLINK_AA) #error "Do not choose two car links" #endif @@ -411,7 +411,7 @@ #define UPDATEFILE_MAX_SIZE 0xb00000 #define OTA_MEDIA_OFFSET 0xa00000 #define OTA_MEDIA_SIZE 0x500000 -//#define SPI0_QSPI_MODE +// #define SPI0_QSPI_MODE #elif DEVICE_TYPE_SELECT == EMMC_FLASH #define LOADER_OFFSET 0x0 #define LOADERB_OFFSET 0x100000 @@ -474,7 +474,7 @@ /*********************************************/ /********** update address configuration **********/ -//#define OTA_UPDATE_SUPPORT +#define OTA_UPDATE_SUPPORT #ifdef OTA_UPDATE_SUPPORT //#define WIFI_UPDATE_SUPPORT #if defined(WIFI_UPDATE_SUPPORT) && !defined(USB_SUPPORT) diff --git a/ArkmicroFiles/libboard-amt630hv100/include/sysinfo.h b/ArkmicroFiles/libboard-amt630hv100/include/sysinfo.h index 4d3c942..a9edfb1 100644 --- a/ArkmicroFiles/libboard-amt630hv100/include/sysinfo.h +++ b/ArkmicroFiles/libboard-amt630hv100/include/sysinfo.h @@ -19,7 +19,9 @@ typedef struct { unsigned int image_offset; unsigned int loader_offset; unsigned int loader_size; - unsigned int reserved[12]; + unsigned int reserved[10]; + unsigned int upgrade_flag; + unsigned int upgrade_appsize; unsigned int checksum; } SysInfo; diff --git a/ArkmicroFiles/libboard-amt630hv100/source/animation - 0912.c b/ArkmicroFiles/libboard-amt630hv100/source/animation - 0912.c new file mode 100644 index 0000000..7308c5e --- /dev/null +++ b/ArkmicroFiles/libboard-amt630hv100/source/animation - 0912.c @@ -0,0 +1,656 @@ +#include "FreeRTOS.h" +#include "task.h" +#include "semphr.h" + +#include "board.h" +#include "chip.h" + +#include "sfud.h" +#include "updatefile.h" +#include "mfcapi.h" +#include "dwl.h" +#include "animation.h" + +#if DEVICE_TYPE_SELECT == EMMC_FLASH +#include "mmcsd_core.h" +#endif + +static TaskHandle_t animation_task = NULL; +static SemaphoreHandle_t animation_mutex; +#if ANIMATION_POLICY == ANIMATION_USE_SMALL_MEM +static BANIHEADER ani_header; +static BANIHEADER *aniheader = &ani_header; +#else +static BANIHEADER *aniheader; +#endif +static unsigned int anioffset; +static unsigned int anisize; +static int ani_playing = 0; +static int ani_replay = 0; +static int ani_stop = 0; +static int ani_frames = 0; +static int ani_display_index = 0; +static int ani_take_vdisbuf = 0; +static unsigned int ani_frame_addr; +static uint32_t first_show_done = 0; + + +#if 0 +#include "ff_stdio.h" + +static int get_h264_single_file_from_sd(void *buf, int *len) +{ + #define READ_SIZE (LCD_WIDTH*LCD_HEIGHT*2) + char path_name[64] = "/sd/000.h264"; + static int count = 0; + FF_FILE *fp; + int ret = -1; + + sprintf(path_name, "/sd/%.3d.h264", count++); + *len = 0; + + fp = ff_fopen(path_name, "rb"); + if (fp) { + ret = ff_fread(buf, 1, READ_SIZE, fp); + if (ret <= 0) { + printf("read sdmmc file:%s failed, maybe read done\n", path_name); + return -1; + } + *len = ret; + } else { + printf("### open %s fail.\n", path_name); + count = 0; + return -1; + } + if(fp) + ff_fclose(fp); + + //printf("###read %s len:%d.\n", path_name, *len); + + return 0; +} + +static void h264_decode_test_thread(void *param) +{ + #define H264DEC_SEMIPLANAR_YUV420 0x020001 + #define H264DEC_INBUF_SIZE (LCD_WIDTH*LCD_HEIGHT*2) + #define H264DEC_DISP_COUNTS 2 + + DWLLinearMem_t inBuf; + OutFrameBuffer outBuf = {0}; + uint32_t h264SrcSize = 0; + MFCHandle *handle = NULL; + uint32_t display_addr[H264DEC_DISP_COUNTS] = {0}; + uint32_t display_addr_index = 0; + uint32_t first_show_done = 0; + int ret; + int i; + + void *h264SrcBuf = pvPortMalloc(H264DEC_INBUF_SIZE); + if(!h264SrcBuf) { + printf("%s, h264SrcBuf pvPortMalloc failed.\n", __func__); + return ; + } + + for(i=0; i= H264DEC_DISP_COUNTS) { + display_addr_index = 0; + } + + if(!first_show_done) { + ark_lcd_set_osd_size(LCD_VIDEO_LAYER, /*outBuf.codedWidth, outBuf.codedHeight*/LCD_WIDTH, LCD_HEIGHT); + ark_lcd_set_osd_format(LCD_VIDEO_LAYER, LCD_OSD_FORAMT_YUV420); + ark_lcd_set_osd_yuv420_mode(LCD_VIDEO_LAYER, LCD_OSD_Y_UV420); + ark_lcd_osd_enable(LCD_VIDEO_LAYER, 1); + ark_lcd_osd_enable(LCD_UI_LAYER, 0); + first_show_done = 1; + } + ark_lcd_set_osd_yaddr(LCD_VIDEO_LAYER, yaddr); + ark_lcd_set_osd_uaddr(LCD_VIDEO_LAYER, uaddr); + ark_lcd_set_osd_vaddr(LCD_VIDEO_LAYER, vaddr); + ark_lcd_set_osd_sync(LCD_VIDEO_LAYER); + ark_lcd_set_osd_sync(LCD_UI_LAYER); + ark_lcd_wait_for_vsync(); + } else { + continue; + } + } + } + } + + if(handle) + mfc_uninit(handle); + + if(h264SrcBuf) + vPortFree(h264SrcBuf); + + for(i=0; i 0) { + void *anibuf = pvPortMalloc(anisize); + if (anibuf) { +#if DEVICE_TYPE_SELECT != EMMC_FLASH + sflash = sfud_get_device(0); + sfud_read(sflash, anioffset, anisize, anibuf); +#else + emmc_read(anioffset, anisize, anibuf); +#endif + aniheader = (BANIHEADER*)anibuf; + + if (aniheader->magic != MKTAG('B', 'A', 'N', 'I') +#ifdef PLAY_SHUTDOWN_ANIMATION + && aniheader->magic != MKTAG('S', 'A', 'N', 'I') +#endif + ) { + printf("Read animation file error!\n"); + vPortFree(anibuf); + vTaskDelete(NULL); + return; + } + CP15_clean_dcache_for_dma((uint32_t)anibuf, (uint32_t)anibuf + anisize); + } else { + printf("Error! No enough memory for animation file.\n"); + vTaskDelete(NULL); + return; + } + } else { + printf("Warning! Not found animation in update file.\n"); + vTaskDelete(NULL); + return; + } + + ani_frame_addr = (uint32_t)aniheader + sizeof(BANIHEADER); + for (;;) { + ulTaskNotifyTake(pdTRUE, portMAX_DELAY); + + xSemaphoreTake(animation_mutex, portMAX_DELAY); + if (ani_replay) { + ani_frame_addr = (uint32_t)aniheader + sizeof(BANIHEADER); + ani_frames = 0; + ani_replay = 0; + } + stick = xTaskGetTickCount(); + ani_playing = 1; + + size = *(uint32_t*)ani_frame_addr; + + if (xVideoDisplayBufTake(pdMS_TO_TICKS(10)) == pdTRUE) { + if(!mfc_handle) + mfc_handle = mfc_init(RAW_STRM_TYPE_JPEG); + if(!mfc_handle) { + printf("%s, mfc_init failed.\n", __func__); + continue ; + } + + display_addr = ulVideoDisplayBufGet(); + + JpegHeaderInfo jpegInfo = {0}; + jpegInfo.handle = mfc_handle; + jpegInfo.jpg_addr = ani_frame_addr + 8; + jpegInfo.jpg_size = size; + jpegInfo.dec_addry = display_addr; + +#if LCD_ROTATE_ANGLE != LCD_ROTATE_ANGLE_0 + if(!tmp_addr) { + uint32_t tmp_size = ulVideoDisplayBufGetSize(); + tmp_addr = (u32 *)pvPortMalloc(tmp_size); + if(!tmp_addr) { + printf("tmp_addr pvPortMalloc failed.\n"); + } + } + if(tmp_addr) { + jpegInfo.dec_addry = VIRT_TO_PHY((u32)tmp_addr); + } +#endif + if (mfc_jpegdec(&jpegInfo) != 0) { + printf("animation decode %d frame fail.\n", ani_frames); + vVideoDisplayBufFree(display_addr); + } else { + if(!first_show_done) { +#if LCD_ROTATE_ANGLE == LCD_ROTATE_ANGLE_0 + int align_width = (LCD_WIDTH + 0xF) & (~0xF); + int align_height = (LCD_HEIGHT + 0xF) & (~0xF); + if((align_width == jpegInfo.dec_width) && (align_height == jpegInfo.dec_height)) { + ark_lcd_set_osd_size(LCD_VIDEO_LAYER, LCD_WIDTH, LCD_HEIGHT); + } else { + ark_lcd_set_osd_size(LCD_VIDEO_LAYER, jpegInfo.dec_width, jpegInfo.dec_height); + } + ark_lcd_set_osd_format(LCD_VIDEO_LAYER, LCD_OSD_FORAMT_YUV420); + ark_lcd_set_osd_yuv420_mode(LCD_VIDEO_LAYER, LCD_OSD_Y_UV420); +#else + ark_lcd_set_osd_size(LCD_VIDEO_LAYER, LCD_WIDTH, LCD_HEIGHT); + ark_lcd_set_osd_format(LCD_VIDEO_LAYER, LCD_OSD_FORAMT_RGB565); +#endif + + ark_lcd_osd_enable(LCD_VIDEO_LAYER, 1); + ark_lcd_osd_enable(LCD_UI_LAYER, 0); + first_show_done = 1; + } + animo_flag++; + if(animo_flag == 3){ + BrightnessPowerOnSetting(); + pwm_enable(2); + pwm_enable(3); + } + // printf("animo_flag------------ %d .\r\n",animo_flag); +#if LCD_ROTATE_ANGLE == LCD_ROTATE_ANGLE_0 + ark_lcd_set_osd_yaddr(LCD_VIDEO_LAYER, jpegInfo.dec_addry); + ark_lcd_set_osd_uaddr(LCD_VIDEO_LAYER, jpegInfo.dec_addru); + ark_lcd_set_osd_vaddr(LCD_VIDEO_LAYER, jpegInfo.dec_addrv); +#else + pxp_scaler_rotate(jpegInfo.dec_addry, jpegInfo.dec_addru, jpegInfo.dec_addrv, + PXP_SRC_FMT_YUV2P420, jpegInfo.dec_width, jpegInfo.dec_height, + display_addr, 0, PXP_OUT_FMT_RGB565, LCD_WIDTH, LCD_HEIGHT, LCD_ROTATE_ANGLE); + ark_lcd_set_osd_yaddr(LCD_VIDEO_LAYER, display_addr); +#endif + ark_lcd_set_osd_sync(LCD_VIDEO_LAYER); + ark_lcd_set_osd_sync(LCD_UI_LAYER); + ark_lcd_wait_for_vsync(); + vVideoDisplayBufRender(display_addr); + ani_take_vdisbuf = 1; + } + } + + ani_frame_addr += size; + ani_display_index = !ani_display_index; + + if (ani_stop || (++ani_frames >= aniheader->aniCount + aniheader->hasBootlogo ? 1 : 0) +#if ANIMATION_POLICY == ANIMATION_USE_SMALL_MEM + || (ani_frame_addr > anioffset + anisize)) +#else + || (ani_frame_addr > (uint32_t)aniheader + anisize)) +#endif + { + + printf("animation end.\n"); + extern void Set_sys_power_on_self_test(uint8_t value); + Set_sys_power_on_self_test(50); + ani_stop = 0; + if (aniheader->aniCount > 0) + vTaskDelay(aniheader->aniDelayHideTime); + else if (aniheader->hasBootlogo) + vTaskDelay(aniheader->bootlogoDisplayTime); + +#ifdef PLAY_SHUTDOWN_ANIMATION + if(shutdown_anim) + ani_take_vdisbuf = 0; +#endif + if (ani_take_vdisbuf) { + ark_lcd_osd_enable(LCD_VIDEO_LAYER, 0); + ark_lcd_osd_enable(LCD_UI_LAYER, 1); + ark_lcd_set_osd_sync(LCD_UI_LAYER); + ark_lcd_set_osd_sync(LCD_VIDEO_LAYER); + } + vVideoDisplayBufFree(display_addr); + vVideoDisplayBufGive(); + ani_playing = 0; + if (ani_replay) + xTaskNotifyGive(animation_task); + xSemaphoreGive(animation_mutex); + + if(mfc_handle) { + mfc_uninit(mfc_handle); + mfc_handle = NULL; + } + if(tmp_addr) { + vPortFree(tmp_addr); + tmp_addr = NULL; + } + +#ifdef PLAY_SHUTDOWN_ANIMATION + break; +#endif + continue; + } + + vVideoDisplayBufGive(); + xSemaphoreGive(animation_mutex); + etick = xTaskGetTickCount(); + + if (aniheader->hasBootlogo && ani_frames == 1) + delaytick = pdMS_TO_TICKS(aniheader->bootlogoDisplayTime) > (etick - stick) ? + pdMS_TO_TICKS(aniheader->bootlogoDisplayTime) - (etick - stick) : 0; + else + delaytick = pdMS_TO_TICKS(1000 / aniheader->aniFps) > (etick - stick) ? + pdMS_TO_TICKS(1000 / aniheader->aniFps) - (etick - stick) : 0; + + if (delaytick) + vTaskDelay(delaytick); + + xTaskNotifyGive(animation_task); + } + +#ifdef PLAY_SHUTDOWN_ANIMATION + if(aniheader) { + vPortFree(aniheader); + aniheader = NULL; + } + + animation_task = NULL; + vTaskDelete(NULL); +#endif + +} + +int animation_init(void) +{ + if (animation_task) { + printf("animation is already inited.\n"); + return 0; + } + + animation_mutex = xSemaphoreCreateMutex(); + + /* Create a task to play animation */ + //if (xTaskCreate(h264_decode_test_thread, "h264_decode_test", configMINIMAL_STACK_SIZE*2, NULL, + if (xTaskCreate(animation_thread, "animation", configMINIMAL_STACK_SIZE, NULL, + configMAX_PRIORITIES - 1, &animation_task) != pdPASS) { + printf("create animation task fail.\n"); + animation_task = NULL; + return -1; + } + + return 0; +} + +void animation_start(void) +{ + xSemaphoreTake(animation_mutex, portMAX_DELAY); + first_show_done=0; + if (ani_playing) { + printf("animation is already playing.\n"); + xSemaphoreGive(animation_mutex); + return; + } + +#if ANIMATION_POLICY == ANIMATION_USE_SMALL_MEM + ani_frame_addr = anioffset + sizeof(BANIHEADER); +#else + ani_frame_addr = (uint32_t)aniheader + sizeof(BANIHEADER); +#endif + ani_frames = 0; + if (animation_task) + xTaskNotifyGive(animation_task); + + xSemaphoreGive(animation_mutex); +} + +/* replay animation even if animation is already playing */ +void animation_restart(void) +{ + xSemaphoreTake(animation_mutex, portMAX_DELAY); + first_show_done=0; + ani_stop=0; + if (ani_playing) { + ani_replay = 1; + xSemaphoreGive(animation_mutex); + return; + } + +#if ANIMATION_POLICY == ANIMATION_USE_SMALL_MEM + ani_frame_addr = anioffset + sizeof(BANIHEADER); +#else + ani_frame_addr = (uint32_t)aniheader + sizeof(BANIHEADER); +#endif + ani_frames = 0; + if (animation_task) + xTaskNotifyGive(animation_task); + + xSemaphoreGive(animation_mutex); +} + +#ifdef PLAY_SHUTDOWN_ANIMATION +int play_shutdown_animation(void) +{ +#define TIMEOUT_SEC 10 + uint32_t wait_tick; + + if (animation_task) { + printf("%s, animation is already inited.\n", __func__); + return -1; + } + + xSemaphoreTake(animation_mutex, portMAX_DELAY); + shutdown_anim = 1; + ani_frames = 0; + first_show_done = 0; + ani_stop = 0; + ani_take_vdisbuf = 0; + xSemaphoreGive(animation_mutex); + + if (xTaskCreate(animation_thread, "animation", configMINIMAL_STACK_SIZE, NULL, + configMAX_PRIORITIES - 2, &animation_task) != pdPASS) { + printf("%s, create animation task fail.\n", __func__); + animation_task = NULL; + return -1; + } + + xSemaphoreTake(animation_mutex, portMAX_DELAY); + + if (ani_playing) { + printf("%s, animation is already playing.\n", __func__); + xSemaphoreGive(animation_mutex); + return -1; + } + if (animation_task) + xTaskNotifyGive(animation_task); + xSemaphoreGive(animation_mutex); + + //wait for animation_thread exit. + wait_tick = xTaskGetTickCount(); + while(xTaskGetTickCount() - wait_tick < configTICK_RATE_HZ * TIMEOUT_SEC) { + if(ani_stop) + break; + vTaskDelay(pdMS_TO_TICKS(100)); + } + + return 0; +} +#endif + +void animation_stop(void) +{ + xSemaphoreTake(animation_mutex, portMAX_DELAY); + ani_stop = 1; + xSemaphoreGive(animation_mutex); +} + +int get_animation_status(void) +{ + return ani_playing; +} diff --git a/ArkmicroFiles/libboard-amt630hv100/source/animation.c b/ArkmicroFiles/libboard-amt630hv100/source/animation.c index 540c485..b714713 100644 --- a/ArkmicroFiles/libboard-amt630hv100/source/animation.c +++ b/ArkmicroFiles/libboard-amt630hv100/source/animation.c @@ -418,9 +418,9 @@ static void animation_thread(void *param) #endif if(power){ BrightnessPowerOnSetting(); - pwm_enable(2);//???-????̨????a??31a - pwm_enable(3);//???-????̨????a???1a - } + pwm_enable(2); + pwm_enable(3); + } ark_lcd_osd_enable(LCD_VIDEO_LAYER, 1); ark_lcd_osd_enable(LCD_UI_LAYER, 0); first_show_done = 1; @@ -536,7 +536,7 @@ int animation_init(void) /* Create a task to play animation */ //if (xTaskCreate(h264_decode_test_thread, "h264_decode_test", configMINIMAL_STACK_SIZE*2, NULL, if (xTaskCreate(animation_thread, "animation", configMINIMAL_STACK_SIZE, NULL, - configMAX_PRIORITIES - 2, &animation_task) != pdPASS) { + configMAX_PRIORITIES - 1, &animation_task) != pdPASS) { printf("create animation task fail.\n"); animation_task = NULL; return -1; diff --git a/ArkmicroFiles/libcpu-amt630hv100/include/lcd.h b/ArkmicroFiles/libcpu-amt630hv100/include/lcd.h index 80e64e8..3c2abeb 100644 --- a/ArkmicroFiles/libcpu-amt630hv100/include/lcd.h +++ b/ArkmicroFiles/libcpu-amt630hv100/include/lcd.h @@ -31,6 +31,7 @@ typedef struct { int width; int height; int format; + int stride; unsigned int yaddr; unsigned int uaddr; unsigned int vaddr; diff --git a/ArkmicroFiles/libcpu-amt630hv100/include/sfud_data.h b/ArkmicroFiles/libcpu-amt630hv100/include/sfud_data.h index 9ffb02e..39ba194 100644 --- a/ArkmicroFiles/libcpu-amt630hv100/include/sfud_data.h +++ b/ArkmicroFiles/libcpu-amt630hv100/include/sfud_data.h @@ -31,6 +31,9 @@ typedef struct sfuddata_t{ char r_mac_address[9]; //物理地址 uint32_t maintenance_mileage; //保养里程数max uint32_t mileage_flag; //设置时当前的总里程数 + uint8_t display_mileage; // 里程显示类型 + uint8_t tcs_on_off; //tcs类型 + uint8_t mile_state; //保养里程状态 }SfudData_t; typedef struct sfudmiledata_t{ diff --git a/ArkmicroFiles/libcpu-amt630hv100/source/can.c b/ArkmicroFiles/libcpu-amt630hv100/source/can.c index 3c14d71..412c74d 100644 --- a/ArkmicroFiles/libcpu-amt630hv100/source/can.c +++ b/ArkmicroFiles/libcpu-amt630hv100/source/can.c @@ -5,7 +5,7 @@ #include "FreeRTOS.h" #include "chip.h" -//#define CAN_USE_TX_DEMO +#define CAN_USE_TX_DEMO #define CAN_RX_BUF_NUM 32 #define CAN_TX_BUF_NUM 32 @@ -690,40 +690,66 @@ static void can_txdemo_thread(void *param) { CanPort_t *cap = param; + // CanMsg txmsg = {0}; + // txmsg.IDE = CAN_Id_Standard; + // txmsg.DLC = 4; + // txmsg.Data[0] = 0x11; + // txmsg.Data[1] = 0x22; + // txmsg.Data[2] = 0x33; + // txmsg.Data[3] = 0x44; CanMsg txmsg = {0}; + txmsg.StdId = 0x200; txmsg.IDE = CAN_Id_Standard; - txmsg.DLC = 4; - txmsg.Data[0] = 0x11; - txmsg.Data[1] = 0x22; - txmsg.Data[2] = 0x33; - txmsg.Data[3] = 0x44; - - //uint32_t last_time = get_timer(0); + txmsg.DLC = 8; + txmsg.Data[0] = Get_sys_tcs_on_off()?0x8:0x00; + for (;;) { + txmsg.Data[0] = Get_sys_tcs_on_off()?0x8:0x00; iCanWrite(cap, &txmsg, 1, 0); - - //printf("%d us.\n", get_timer(last_time)); - //last_time = get_timer(0); - vTaskDelay(pdMS_TO_TICKS(1000)); + vTaskDelay(pdMS_TO_TICKS(100)); } } #endif - +uint8_t can101_flag = 0; static void can_rxdemo_thread(void *param) { CanPort_t *cap = param; + int tlv_data_value[8] = {0}; for (;;) { CanMsg rxmsg[8] = {0}; int revlen; int i, j; - if ((revlen = iCanRead(cap, rxmsg, 8, pdMS_TO_TICKS(200))) > 0) { - printf("can receive %d messages:\n", revlen); + if ((revlen = iCanRead(cap, rxmsg, 8, pdMS_TO_TICKS(10))) > 0 && (Get_sys_power_on_self_test() == 100)) { for (i = 0; i < revlen; i++) { - for (j = 0; j < rxmsg[i].DLC; j++) - printf("%.2x, ", rxmsg[i].Data[j]); - printf("\n"); + for (j = 0; j < rxmsg[i].DLC; j++){ + tlv_data_value[j] = rxmsg[i].Data[j]; + } + // printf("can>> Id = %03x",rxmsg[i].StdId); + switch(rxmsg[i].StdId){ + case 0x37B: + tcsworking_event_handing(tlv_data_value);//TCS + break; + case 0x12B: + tcsswitch_event_handing(tlv_data_value);//tcs开关 + break; + case 0x401: + break; + case 0x402://ECU故障码 + break; + case 0xA5://ABS故障码 + abs_dtc_event_handing(tlv_data_value); + break; + case 0xA3://ABS数据 + break; + case 0x101://发送机数据 + if(can101_flag != 10) + can101_flag = 10; + speed_event_handing(tlv_data_value); + break; + default:break; + } } } } @@ -739,13 +765,13 @@ int can_demo(void) return -1; } - vCanInit(cap, CAN250kBaud, CAN_MODE_NORMAL); + vCanInit(cap, CAN500kBaud, CAN_MODE_NORMAL); #if 1 CAN_FilterInitTypeDef canfilter = {0}; /* 只接收ID的第0位为1的帧 */ canfilter.MODE = 1; /* 单滤波器模式 */ - canfilter.ID = 0x1; - canfilter.IDMASK = 0x7fe; + canfilter.ID = 0x37B; + canfilter.IDMASK = 0x7ff; vCanSetFilter(cap, &canfilter); #endif diff --git a/ArkmicroFiles/libcpu-amt630hv100/source/dwspi.c b/ArkmicroFiles/libcpu-amt630hv100/source/dwspi.c index ae72b4f..9ad101c 100644 --- a/ArkmicroFiles/libcpu-amt630hv100/source/dwspi.c +++ b/ArkmicroFiles/libcpu-amt630hv100/source/dwspi.c @@ -160,6 +160,7 @@ struct dw_spi { void (*transfer_handler)(struct dw_spi *dws); u32 current_freq; /* frequency in hz */ u32 current_qspi_freq; + int xfer_ret; /* DMA info */ int dma_inited; @@ -404,6 +405,7 @@ static void dma_transfer(struct dw_spi *dws) dw_readl(dws, DW_SPI_ICR); int_error_stop(dws, "dma_transfer: fifo overrun/underrun"); + dws->xfer_ret = 1; xQueueSendFromISR(dws->xfer_done, NULL, 0); return; @@ -626,6 +628,7 @@ xfer_continue: if (ndf > 0xffff) ndf = 0xffff; dws->dma_mapped = 1; + dws->xfer_ret = 0; dws->rx = (u8*)message->recv_buf + xfer_len; dws->len = (ndf + 1) * dws->n_bytes; dws->rx_end = (u8*)dws->rx + dws->len; @@ -721,11 +724,30 @@ xfer_continue: goto end; } - if (dws->dma_mapped && dws->rx_dummy_buffer) { + if (dws->xfer_ret) { + dws->xfer_ret = 0; + ret = -1; + if (dws->dma_mapped) + dma_stop_channel(dws->dma_rx); + goto end; + } + + if (dws->dma_mapped) { + /* Invalidate cache after dma read, rx and len must align to cacheline(32bytes) */ + portDISABLE_INTERRUPTS(); + if (dws->rx_dummy_buffer) + CP15_invalidate_dcache_for_dma((uint32_t)dws->rx_dummy_buffer, + (uint32_t)dws->rx_dummy_buffer + dws->len); + else + CP15_invalidate_dcache_for_dma((uint32_t)dws->rx, (uint32_t)dws->rx + dws->len); + portENABLE_INTERRUPTS(); + + if (dws->rx_dummy_buffer) { memcpy(dws->rx, dws->rx_dummy_buffer, dws->len); vPortFree(dws->rx_dummy_buffer); dws->rx_dummy_buffer = NULL; } + } dma_stop_channel(dws->dma_rx); @@ -764,8 +786,7 @@ int dw_spi_setup(struct spi_slave *slave, struct spi_configuration *configuratio chip->qspi_clk_div = (DIV_ROUND_UP(dws->max_freq, configuration->qspi_max_hz) + 1) & 0xfffe; dws->current_freq = dws->max_freq / chip->clk_div; dws->current_qspi_freq = dws->max_freq / chip->qspi_clk_div; - printf("spi max_freq %u, current freq %u, qspi_freq %u.\n", dws->max_freq, - dws->current_freq, dws->current_qspi_freq); + printf("spi max_freq %u, current freq %u, qspi_freq %u.\n", dws->max_freq, dws->current_freq, dws->current_qspi_freq); gpio_direction_output(dws->cs_gpio, !(dws->slave.mode & SPI_CS_HIGH)); @@ -909,7 +930,7 @@ static int dw_spi_dma_transfer(struct dw_spi *dws, struct spi_message *message) cfg.direction = DMA_DEV_TO_MEM; cfg.src_addr = REGS_SPI0_BASE + DW_SPI_DR; //if (((u32)dws->rx/* | dws->len*/) & (ARCH_DMA_MINALIGN - 1)) { - if ((u32)dws->rx & 3) { + if ((u32)dws->rx & 31) { dws->rx_dummy_buffer = pvPortMalloc(dws->len); if (!dws->rx_dummy_buffer) return -ENOMEM; diff --git a/ArkmicroFiles/libcpu-amt630hv100/source/pinctrl.c b/ArkmicroFiles/libcpu-amt630hv100/source/pinctrl.c index 5f5b3a8..a1696f4 100644 --- a/ArkmicroFiles/libcpu-amt630hv100/source/pinctrl.c +++ b/ArkmicroFiles/libcpu-amt630hv100/source/pinctrl.c @@ -147,7 +147,7 @@ static xPinGroup_t pin_groups[] = { {.groupid = PGRP_I2C1, .pins_num = 2, .pins = {{50, 1}, {51, 1}}}, {.groupid = PGRP_LCD_TTL_CH0, .pins_num = 28, /* de clk vynsc hsync */ - .pins = {{88, 1}, {89, 1, PAD_DRIVE_2MA}, {90, 1}, {91, 1}, + .pins = {{88, 1}, {89, 1, PAD_DRIVE_2MA}, {90, 0}, {91, 0}, {64, 1}, {65, 1}, {66, 1}, {67, 1}, {68, 1}, {69, 1}, {70, 1}, {71, 1}, /* B0-B7 */ {72, 1}, {73, 1}, {74, 1}, {75, 1}, {76, 1}, {77, 1}, {78, 1}, {79, 1}, /* G0-G7 */ {80, 1}, {81, 1}, {82, 1}, {83, 1}, {84, 1}, {85, 1}, {86, 1}, {87, 1},}}, /* R0-R7 */ @@ -316,6 +316,7 @@ void vPinctrlSetup(void) #endif pinctrl_set_group(PGRP_ITU_CH1_INV); pinctrl_set_group(PGRP_CAN0_CH0); + #ifdef AUDIO_REPLAY #if (AUDIO_REPLAY_I2S == I2S_ID1) diff --git a/ArkmicroFiles/libcpu-amt630hv100/source/sfud_data.c b/ArkmicroFiles/libcpu-amt630hv100/source/sfud_data.c index 16bf600..a701911 100644 --- a/ArkmicroFiles/libcpu-amt630hv100/source/sfud_data.c +++ b/ArkmicroFiles/libcpu-amt630hv100/source/sfud_data.c @@ -12,13 +12,13 @@ #ifndef WITH_MVVM SfudData_t sfud_data_saved ={0}; -#define SFUD_DATA_FLASH_OFFSET 0xfff000 +#define SFUD_DATA_FLASH_OFFSET 0x1fff000 //32Mflash SfudMileData_t sfud_mile_data ={0}; static uint32_t save_addr = 0; static uint16_t User_data_index = 0; #define SFUD_MILE_DATA_FLASH_OFFSET 0xffe000//0xffe000 #define MILE_FLASH_OFFSET 0x1000 - +/* void read_mileage(uint32_t trip_data,uint32_t total_data) { uint32_t i; @@ -96,7 +96,7 @@ void SaveMileageData(uint32_t trip_data,uint32_t total_data){ } } - +*/ void Classify_SaveDataToFlash(SfudData_t user_data,uint8_t type){ uint8_t buff[sizeof(SfudData_t)];//定义buff用于保存结构体 memset(buff,0,sizeof(buff));//将buff内存清零 @@ -137,20 +137,20 @@ void Classify_SaveDataToFlash(SfudData_t user_data,uint8_t type){ void SaveDataToFlash(SfudData_t user_data){ uint8_t buff[sizeof(SfudData_t)];//定义buff用于保存结构体 memset(buff,0,sizeof(buff));//将buff内存清零 - printf("**************save flash***********************\r\n"); + // printf("**************save flash***********************\r\n"); // printf("user_data==> %d-%d-%d-%d-%d,%d",user_data.language,user_data.display_unit,user_data.theme // ,user_data.theme_state,user_data.light_value,user_data.bt_on_off); - printf("mac:%02X%02X%02X%02X%02X%02X , %02X%02X%02X%02X%02X%02X end\r\n",user_data.f_mac_address[0],user_data.f_mac_address[1],user_data.f_mac_address[2] - ,user_data.f_mac_address[3],user_data.f_mac_address[4],user_data.f_mac_address[5] - ,user_data.r_mac_address[0],user_data.r_mac_address[1],user_data.r_mac_address[2] - ,user_data.r_mac_address[3],user_data.r_mac_address[4],user_data.r_mac_address[5]); + // printf("mac:%02X%02X%02X%02X%02X%02X , %02X%02X%02X%02X%02X%02X end\r\n",user_data.f_mac_address[0],user_data.f_mac_address[1],user_data.f_mac_address[2] + // ,user_data.f_mac_address[3],user_data.f_mac_address[4],user_data.f_mac_address[5] + // ,user_data.r_mac_address[0],user_data.r_mac_address[1],user_data.r_mac_address[2] + // ,user_data.r_mac_address[3],user_data.r_mac_address[4],user_data.r_mac_address[5]); // printf("data:%02X %02X%02X , %02X %02X%02X end\r\n" // ,user_data.f_mac_address[6],user_data.f_mac_address[7],user_data.f_mac_address[8] // ,user_data.r_mac_address[6],user_data.r_mac_address[7],user_data.r_mac_address[8]); // printf("*************************************\r\n"); // printf("mile data: %02X,%02X end\r\n" // ,user_data.maintenance_mileage,user_data.mileage_flag); - printf("*************************************\r\n"); + // printf("*************************************\r\n"); if(user_data.light_value==0) user_data.light_value=1; @@ -169,7 +169,10 @@ void SaveDataToFlash(SfudData_t user_data){ strcpy(((SfudData_t *)buff)->r_mac_address,user_data.r_mac_address); ((SfudData_t *)buff)->maintenance_mileage = user_data.maintenance_mileage; ((SfudData_t *)buff)->mileage_flag = user_data.mileage_flag; - + ((SfudData_t *)buff)->display_mileage = user_data.display_mileage; + ((SfudData_t *)buff)->tcs_on_off = user_data.tcs_on_off; + ((SfudData_t *)buff)->mile_state = user_data.mile_state; + sfud_flash *sflash = sfud_get_device(0); if (sfud_erase_write(sflash,SFUD_DATA_FLASH_OFFSET,sizeof(buff),buff)!=SFUD_SUCCESS){ printf("sfud data write error.\r\n"); diff --git a/ArkmicroFiles/libcpu-amt630hv100/source/uart.c b/ArkmicroFiles/libcpu-amt630hv100/source/uart.c index 03a45b7..c8b1d3e 100644 --- a/ArkmicroFiles/libcpu-amt630hv100/source/uart.c +++ b/ArkmicroFiles/libcpu-amt630hv100/source/uart.c @@ -833,7 +833,7 @@ static int uup_rx_data_len = 0; #if DEVICE_TYPE_SELECT != EMMC_FLASH #include "ff_sfdisk.h" #endif - +/* typedef enum { UART_FRAME_START, UART_FRAME_FILEINFO, @@ -855,8 +855,8 @@ typedef enum { #define UUP_MAX_FILE_SIZE 0x1000000 #define UUP_RX_FRAME_NUM 16 #define UUP_MAX_LOADER_SIZE STEPLDR_MAX_SIZE//0x10000 - -static int uup_status = UUP_STATE_IDLE; +*/ +// static int uup_status = UUP_STATE_IDLE; static int uup_file_type = 0; static int uup_file_size = 0; static int uup_packet_num = 0; @@ -877,7 +877,7 @@ static void uup_send_ack(UartPort_t *uap, int type, int ret) iUartWrite(uap, buf, 7, pdMS_TO_TICKS(100)); } - +#if 0 void uup_ota_update(UartPort_t *uap, uint8_t *framebuf, size_t len) { int frametype = framebuf[0]; @@ -1009,6 +1009,9 @@ void uup_ota_update(UartPort_t *uap, uint8_t *framebuf, size_t len) break; } } + +#endif + #else static void uart_tx_demo_thread(void *param) { diff --git a/ArkmicroFiles/libcpu-amt630hv100/source/uart_and_can.c b/ArkmicroFiles/libcpu-amt630hv100/source/uart_and_can.c index 84afe6a..4191ed5 100644 --- a/ArkmicroFiles/libcpu-amt630hv100/source/uart_and_can.c +++ b/ArkmicroFiles/libcpu-amt630hv100/source/uart_and_can.c @@ -69,25 +69,25 @@ static void protocol_uart_tx_thread(void *param) for (;;) { if(uart_tx_flag){ - if (uart_time_request[0] != 0 && uart_time_request[0] == 0xAA) + if (uart_time_request[0] != 0 && (uart_time_request[0] == 0xAA || uart_time_request[0] == 0x27)) { - //printf("UART3 tx-->>> "); + // printf("UART3 tx-->>> "); for (uint8_t i = 0; i < 9; i++) { - //printf("%02x ", uart_time_request[i]); + // printf("%02x ", uart_time_request[i]); uarttx[i] = uart_time_request[i]; } if(uart_time_request[1]==0x10){ for (uint8_t i = 9; i < 19; i++) { - //printf("%02x ", uart_time_request[i]); + // printf("%02x ", uart_time_request[i]); uarttx[i] = uart_time_request[i]; } - //printf("\r\n"); + // printf("\r\n"); iUartWrite(uap, uarttx, 19, pdMS_TO_TICKS(100)); // 发送数据 uart_time_request[0] = 0; }else{ - //printf("\r\n"); + // printf("\r\n"); iUartWrite(uap, uarttx, 9, pdMS_TO_TICKS(100)); // 发送数据 uart_time_request[0] = 0; } @@ -126,7 +126,10 @@ static uint16_t calculate_cumulative_sum(uint8_t *buf) return sum; } -extern uint8_t uart3_flag; +uint8_t device_flag = 0; +uint8_t data_analysis_flag = 0; +uint8_t data_count_flag = 0; +uint8_t uart3_flag = 0; static void protocol_uart_rx_thread(void *param) { UartPort_t *uap = xUartOpen(UART_BT_PORT); @@ -139,7 +142,7 @@ static void protocol_uart_rx_thread(void *param) int i; uint8_t tlv_data_value[128] = {0}; - unsigned char ota_request[8] = {0x7e,0x00,0x05,0x02,0x03,0x01,0x00,0x01}; + // unsigned char ota_request[8] = {0x7e,0x00,0x05,0x02,0x03,0x01,0x00,0x01}; uint32_t sum = 0; uint8_t equipment_data = 0; uint8_t mac_data = 0; @@ -164,142 +167,152 @@ static void protocol_uart_rx_thread(void *param) for (;;) { len = iUartRead(uap, uartrx, BUFFER_LEN, pdMS_TO_TICKS(10)); - if(uart3_flag){ - if(len==0) - uart3_flag = 0; - else - printf("len!=0.\r\n"); - }else if(Get_sys_power_on_self_test() != 150){ - - for(i=0;i data_len+1){ + if(Get_sys_power_on_self_test() != 150 ){ + if(device_flag) + data_count_flag++; + for(i=0;i data_len+1){ + upgrade_state++; + } + break; + case 3: + if (uartrx[i] == 0x0a){ + sum = calculate_cumulative_sum(tlv_data_value); + if(sum != tlv_data_value[str_len-1]){ + printf("error.\r\n"); + }else{ + if(equipment_data){ + device_data_analysis(tlv_data_value); + equipment_data = 0; + if(!data_analysis_flag) + device_flag = 1; + }else if(mac_data){ + tire_pressure_data_analysis(tlv_data_value); + mac_data = 0; + }else{ + data_analysis(tlv_data_value); + if(!data_analysis_flag) + data_analysis_flag = 1; + } + } }else{ - if(equipment_data){ - device_data_analysis(tlv_data_value); - equipment_data = 0; - }else if(mac_data){ - tire_pressure_data_analysis(tlv_data_value); - mac_data = 0; - }else - data_analysis(tlv_data_value); + printf("\nuartrx[i] = %x .\n",uartrx[i]); } - // }else{ - //DEBUG_PRINT("\nuartrx[i] = %x .\n",uartrx[i]); + upgrade_state=0; + str_len = 0; + data_len = 0; + break; } - upgrade_state=0; - str_len = 0; - data_len = 0; - break; - } -/* - switch (uup_rx_state) { - case 0: - if (uartrx[i] == 0x7e) - uup_rx_state++; - break; - case 1: - if (uartrx[i] == 0x05) - uup_rx_state++; - else - uup_rx_state = 0; - break; - case 2: - if (uartrx[i] == 0x02) - uup_rx_state++; - else - uup_rx_state = 0; - break; - case 3: - if (uartrx[i] == 0x03) - uup_rx_state++; - else - uup_rx_state = 0; - break; - case 4: - if (uartrx[i] == 0x01) - uup_rx_state++; - else - uup_rx_state = 0; - break; - case 5: - if (uartrx[i] == Get_sys_softwar_host()) - uup_rx_state++; - else - uup_rx_state = 0; - break; - case 6: - if (uartrx[i] == Get_sys_softwar_order()){ - if(Get_sys_veer_velocity()){ - //DEBUG_PRINT("error ota sj. Speed present\n"); - ota_request[1] = 0x01; - ota_request[6] = Get_sys_softwar_host(); - ota_request[7] = Get_sys_softwar_order(); - TXCMD_Other_Set(ota_request,8); - }else{ - //DEBUG_PRINT("enter ota sj.\n"); - Set_sys_power_on_self_test(150); - // extern uint8_t now_theme_state; - // now_theme_state = 5; - Set_sys_upgrade_Flag(1);//进入ota界面 - ota_request[6] = Get_sys_softwar_host(); - ota_request[7] = Get_sys_softwar_order(); - vTaskDelay(100); - TXCMD_Other_Set(ota_request,8); - - if(timeout) - timeout=0; + switch (uup_rx_state) { + case 0: + if (uartrx[i] == 0x7e) + uup_rx_state++; + break; + case 1: + if (uartrx[i] == 0x05) + uup_rx_state++; + else + uup_rx_state = 0; + break; + case 2: + if (uartrx[i] == 0x02) + uup_rx_state++; + else + uup_rx_state = 0; + break; + case 3: + if (uartrx[i] == 0x03) + uup_rx_state++; + else + uup_rx_state = 0; + break; + case 4: + if (uartrx[i] == 0x01) + uup_rx_state++; + else + uup_rx_state = 0; + break; + case 5: + if (uartrx[i] == Get_sys_softwar_host()) + uup_rx_state++; + else + uup_rx_state = 0; + break; + case 6: + if (uartrx[i] == Get_sys_softwar_order()){ + if(Get_sys_veer_velocity()){ + printf("error ota sj. Speed present\n"); + // ota_request[1] = 0x01; + // ota_request[6] = Get_sys_softwar_host(); + // ota_request[7] = Get_sys_softwar_order(); + // TXCMD_Other_Set(ota_request,8); + Send_ota_state(1); + }else{ + printf("enter ota sj.\n"); + Set_sys_power_on_self_test(150); + Set_sys_upgrade_Flag(1);//进入ota界面 + + // ota_request[6] = Get_sys_softwar_host(); + // ota_request[7] = Get_sys_softwar_order(); + Send_ota_state(0); + + if(timeout) + timeout=0; + } + } - + uup_rx_state = 0; + break; } - uup_rx_state = 0; - break; - } + } - } - + if((!data_analysis_flag) && data_count_flag == 50){ + data_count_flag = 0; + if(uart3_flag){ + printf("uart3 open .\r\n"); + UART3_Type_regression(); + uart3_flag = 0; + }else{ + printf("uart3 close .\r\n"); + UART3_Modification_Type(); + uart3_flag = 1; + } + } }else{//升级逻辑 timeout ++; for (i = 0; i < len; i++) { @@ -335,7 +348,7 @@ static void protocol_uart_rx_thread(void *param) //uup_rx_data_len |= uartrx[i]; uup_rx_data_len = (uartrx[i]<<8) | uup_rx_data_len; if((uup_rx_data_len > UUP_PACKET_A27_SIZE + 2)) { //4096 + 2 - //DEBUG_PRINT("Invalid uup_rx_data_len %d\n", uup_rx_data_len); + printf("Invalid uup_rx_data_len %d\n", uup_rx_data_len); uup_rx_state = 0; } else { uup_rx_state++; @@ -365,27 +378,25 @@ static void protocol_uart_rx_thread(void *param) len = buf[3]<<8 | len; for (i = 0; i < len + 4; i++) checksum ^= buf[i]; - ////DEBUG_PRINT("checksum = 0x%x , buf[len + 4] = 0x%x\n",checksum,buf[len + 4]); + //printf("checksum = 0x%x , buf[len + 4] = 0x%x\n",checksum,buf[len + 4]); if (checksum == buf[len + 4]) { timeout =0; - // uup_ota_update(uap, buf + 4, len); - //DEBUG_PRINT("rev frame checksum err.\n"); + uup_ota_update(uap, buf + 4, len); + } else { + printf("rev frame checksum err.\r\n"); } uup_rx_tail = (uup_rx_tail + 1) % UUP_RX_FRAME_NUM; } if(timeout >= 3000){//超时退出升级 大约40s - //DEBUG_PRINT("exit ota sj.\n"); + printf("exit ota sj.\n"); Set_sys_power_on_self_test(100); Set_sys_upgrade_Flag(2); - //DEBUG_PRINT("UART3_Type_regression .\n"); + printf("UART3_Type_regression .\n"); extern void UART3_Type_regression(void); UART3_Type_regression(); timeout = 0; } - */ - } - } } diff --git a/FreeRTOSConfig.h b/FreeRTOSConfig.h index f5860d5..13f7a62 100644 --- a/FreeRTOSConfig.h +++ b/FreeRTOSConfig.h @@ -67,7 +67,7 @@ // //#define configTOTAL_HEAP_SIZE ( ( size_t ) ( (18.8+32) * 1024 * 1024) ) // google拼音出现异常 //#define configTOTAL_HEAP_SIZE ( ( size_t ) ( (8.5+32) * 1024 * 1024) ) // google拼音正常工作 -#define configTOTAL_HEAP_SIZE ( ( size_t ) ( (3.5+32) * 1024 * 1024) ) // google拼音正常工作 +#define configTOTAL_HEAP_SIZE ( ( size_t ) ( (3.5+30) * 1024 * 1024) ) // google拼音正常工作 #elif defined(REVERSE_TRACK) #define configTOTAL_HEAP_SIZE ( ( size_t ) ( (22+32) * 1024 * 1024) ) diff --git a/app/carlink/AA/include/AndroidAuto.h b/app/carlink/AA/include/AndroidAuto.h index 6b7a979..4ade876 100644 --- a/app/carlink/AA/include/AndroidAuto.h +++ b/app/carlink/AA/include/AndroidAuto.h @@ -89,8 +89,35 @@ struct IAACallbacks void* cb_ctx; }; +typedef struct __auto_cfg_info +{ + short width;//pixel + short height; + short density; + short fps; + char* wifi_ssid; + char* wifi_passwd; + char wifi_channel; + bool disable_auto_audio; + bool video_auto_start; + +} auto_cfg_info; + +extern auto_cfg_info *g_auto_link_info; + int android_auto_init(struct IAACallbacks* cbs); int android_auto_rfcomm_read_data_proc(char *buf, int len); void android_auto_start(); void android_auto_set_rfcomm_info(const char * ssid, const char * passwd, const char * mac, int securityMode, const char * ip, int port); +void android_auto_set_BT_paring_status(bool paired, const char *pinCode, int status); +void android_auto_send_touch_event(unsigned int x, unsigned int y, int action); +void android_auto_send_key_event(unsigned int keycode, int press); +void android_auto_send_knob_event(unsigned int keycode, int delta); +void android_auto_set_night_mode(bool night); + +void android_auto_get_video_focus(int mode); +void android_auto_release_video_focus(int mode); +void android_auto_get_audio_focus(int mode); +void android_auto_release_audio_focus(int mode); + #endif \ No newline at end of file diff --git a/app/carlink/AA/lib/AndroidAuto.a b/app/carlink/AA/lib/AndroidAuto.a index 9110db9..ea18d71 100644 Binary files a/app/carlink/AA/lib/AndroidAuto.a and b/app/carlink/AA/lib/AndroidAuto.a differ diff --git a/app/carlink/AA/src/carlink_aa-bf.c b/app/carlink/AA/src/carlink_aa-bf.c new file mode 100644 index 0000000..d2c0658 --- /dev/null +++ b/app/carlink/AA/src/carlink_aa-bf.c @@ -0,0 +1,302 @@ +#include +#include +#include "carlink_video.h" +#include "carlink_common.h" +#include "AndroidAuto.h" +#include "board.h" + +#if CARLINK_AA + +struct AAHandle +{ + struct ICalinkEventCallbacks carlinkEventCB; + struct IAACallbacks carlinkAACB; + + bool mInitDone; + bool mBTConnected; + bool mRfcommReady; + char mLocalBTMac[6]; + char mRemoteBTMac[6]; + char mIp[32]; + +}; +//extern int debug_buf_ref; + +struct AAHandle gAACtx; +static bool g_aa_disable = false; + + +static void android_auto_notify_event(struct carlink_event *ev, enum CARLINK_EVENT_TYPE type, bool disable_filter) +{ + ev->link_type = CARLINK_AUTO_WIRELESS; + ev->disable_filter = disable_filter; + ev->type = type; + carlink_notify_event(ev); +} + +static void start_aa(struct AAHandle* pctx) +{ + if (!pctx->mInitDone) + return; + //if (pctx->mBTConnected) + // return; + if (!pctx->mRfcommReady) + return; + if (g_aa_disable) + return; + printf("%s:%d\r\n", __func__, __LINE__); + + g_auto_link_info->wifi_ssid = (char *)carlink_get_wifi_ssid(); + g_auto_link_info->wifi_passwd = (char *)carlink_get_wifi_passwd; + android_auto_set_rfcomm_info((const char*)carlink_get_wifi_ssid(), + (const char*)carlink_get_wifi_passwd(), (const char*)carlink_get_wifi_mac(), 5, (const char*)pctx->mIp, 0); + android_auto_start(); +} + +static void onEventAA(void* ctx, const struct carlink_event *ev) +{ + enum CARLINK_EVENT_TYPE type; + struct AAHandle* pctx = (struct AAHandle*)ctx; + if (NULL == ev) + return; + if (ev->link_type != CARLINK_AUTO_WIRELESS && !ev->disable_filter)// skip not aa event + return; + + type = ev->type; + + switch (type) { + case -1: { + break; + } + case CARLINK_EVENT_INIT_DONE: + pctx->mInitDone = true; + start_aa(pctx); + break; + case CARLINK_EVENT_BT_CONNECT: { + pctx->mBTConnected = true; + start_aa(pctx); + break; + } + case CARLINK_EVENT_BT_AA_RFCOMM_READY: { + pctx->mRfcommReady = true; + start_aa(pctx); + break; + } + case CARLINK_EVENT_BT_DISCONNECT: { + pctx->mBTConnected = false; + pctx->mRfcommReady = false; + break; + } + case CARLINK_EVENT_WIFI_CONNECT: { + break; + } + case CARLINK_EVENT_MSG_SESSION_CONNECT: { + break; + } + case CARLINK_EVENT_MSG_SESSION_STOP: { + printf("%s:%d\r\n", __func__, __LINE__); + start_aa(pctx); + break; + } + + default: + break; + } +} + +static void aa_rfcomm_data_read(void* ctx, const void* buf, int len) +{ + struct AAHandle* pctx = (struct AAHandle*)ctx; + + if (!pctx->mRfcommReady) + return; + + android_auto_rfcomm_read_data_proc((char*)buf, len); +} + +static int rf_write_transfer_cb(void* cb_ctx, char *buf, int len) +{ + int ret = -1; + struct AAHandle* pctx = (struct AAHandle*)cb_ctx; + + if (!pctx->mRfcommReady) + return -1; + ret = carlink_auto_rfcomm_data_write(buf, len); + + return ret; +} + +static void video_init_impl(void* cb_ctx, int w, int h, int x, int y) +{ + struct AAHandle* pctx = (struct AAHandle*)cb_ctx; + printf("x:%d y:%d w:%d h:%d\r\n", x, y, w, h); + set_carlink_active_video_info(x, y); + h264_dec_ctx_init(); + set_carlink_display_state(1); + //debug_buf_ref = 1; +} + +static void video_uninit_impl(void* cb_ctx) +{ + struct AAHandle* pctx = (struct AAHandle*)cb_ctx; + + set_carlink_display_state(0); + set_carlink_active_video_info(0, 0); +} + +int g_v_count; +static void video_play_impl(void* cb_ctx, char *buf, int len) +{ + struct AAHandle* pctx = (struct AAHandle*)cb_ctx; + + video_frame_s* frame = NULL; + +get_retry: + frame = get_h264_frame_buf(); + if (NULL == frame) { + //printf("h264 frame is empty\r\n"); + vTaskDelay(pdMS_TO_TICKS(10)); + goto get_retry; + //continue; + } + + memcpy(frame->cur, buf, len); + frame->len = len; + + notify_h264_frame_ready(&frame); + if (g_v_count++ > 50) { + //android_auto_get_video_focus(0); + } +} + +static void audio_init_callback_impl(void* cb_ctx, int type, int sample, int ch, int bits) +{ + struct AAHandle* pctx = (struct AAHandle*)cb_ctx; +} +static void audio_uninit_callback_impl(void* cb_ctx, int type) +{ + struct AAHandle* pctx = (struct AAHandle*)cb_ctx; +} +static void audio_play_impl(void* cb_ctx, int type, char *buf, int len) +{ + struct AAHandle* pctx = (struct AAHandle*)cb_ctx; +} + +static void mic_init_callback_impl(void* cb_ctx, int sample, int ch, int bits) +{ + struct AAHandle* pctx = (struct AAHandle*)cb_ctx; +} +static void mic_uninit_callback_impl(void* cb_ctx) +{ + struct AAHandle* pctx = (struct AAHandle*)cb_ctx; +} +static void mic_capture_impl(void* cb_ctx, char *buf, int len) +{ + struct AAHandle* pctx = (struct AAHandle*)cb_ctx; +} + +static void bt_paring_request_callback_impl(void* cb_ctx, const char *phoneAddr, int pairingMethod) +{ + struct AAHandle* pctx = (struct AAHandle*)cb_ctx; +} + +static void status_notify_impl(void* cb_ctx, int status_type) +{ + struct AAHandle* pctx = (struct AAHandle*)cb_ctx; + struct carlink_event ev = {0}; + + if (status_type == LINK_REMOVED) { + printf("%s:%d\r\n", __func__, __LINE__); + android_auto_notify_event(&ev, CARLINK_EVENT_MSG_SESSION_STOP, 0); + } +} + +static void json_msg_notify_impl(void* cb_ctx, char *buf, int len) +{ + struct AAHandle* pctx = (struct AAHandle*)cb_ctx; +} + + + +int carlink_aa_init() +{ + int ret = -1; + struct AAHandle* pctx = &gAACtx; + struct IAACallbacks* carlinkAACBPtr = NULL; + + memset((void*)pctx, 0, sizeof(struct AAHandle)); + + + g_auto_link_info->width = CARLINK_VIDEO_WIDTH; + g_auto_link_info->height = CARLINK_VIDEO_HEIGHT; + g_auto_link_info->fps = 30; + g_auto_link_info->density = 160; + g_auto_link_info->disable_auto_audio = 1; + g_auto_link_info->video_auto_start = 1; + + set_carlink_display_info(0, 0, CARLINK_VIDEO_WIDTH, CARLINK_VIDEO_HEIGHT); + set_carlink_video_info(CARLINK_VIDEO_WIDTH, CARLINK_VIDEO_HEIGHT, 30); + + ret = carlink_common_init(); + + pctx->carlinkEventCB.onEvent = onEventAA; + pctx->carlinkEventCB.rfcomm_data_read = aa_rfcomm_data_read; + pctx->carlinkEventCB.cb_ctx = (void*)pctx; + + carlink_register_event_callbacks(&pctx->carlinkEventCB); + + ret = carlink_bt_wifi_init(); + + carlinkAACBPtr = &pctx->carlinkAACB; + carlinkAACBPtr->video_init = video_init_impl; + carlinkAACBPtr->video_uninit = video_uninit_impl; + carlinkAACBPtr->video_play = video_play_impl; + carlinkAACBPtr->audio_init_callback = audio_init_callback_impl; + carlinkAACBPtr->audio_uninit_callback = audio_uninit_callback_impl; + carlinkAACBPtr->mic_init_callback = mic_init_callback_impl; + carlinkAACBPtr->mic_uninit_callback = mic_uninit_callback_impl; + carlinkAACBPtr->mic_capture = mic_capture_impl; + carlinkAACBPtr->bt_paring_request_callback = bt_paring_request_callback_impl; + carlinkAACBPtr->status_notify = status_notify_impl; + carlinkAACBPtr->json_msg_notify = json_msg_notify_impl; + + carlinkAACBPtr->rf_read_transfer_cb = NULL; + carlinkAACBPtr->rf_write_transfer_cb = rf_write_transfer_cb; + carlinkAACBPtr->cb_ctx = (void*)pctx; + ret = android_auto_init(&pctx->carlinkAACB); + { + char ip[4] = {0}; + carlink_get_ap_ip_addr(ip); + sprintf(pctx->mIp, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); + } + + + { + struct carlink_event ev = {0}; + android_auto_notify_event(&ev, CARLINK_EVENT_INIT_DONE, 0); + } + return 0; +} + +void carlink_aa_enable(int enable) +{ + if (enable) { + g_aa_disable = false; + } else { + g_aa_disable = true; + } +} + +#else +int carlink_aa_init() +{ + return 0; +} + +void carlink_aa_enable(int enable) +{ + (void)enable; +} + +#endif + diff --git a/app/carlink/AA/src/carlink_aa.c b/app/carlink/AA/src/carlink_aa.c index f6cef19..4f7f63d 100644 --- a/app/carlink/AA/src/carlink_aa.c +++ b/app/carlink/AA/src/carlink_aa.c @@ -11,7 +11,6 @@ struct AAHandle { struct ICalinkEventCallbacks carlinkEventCB; struct IAACallbacks carlinkAACB; - bool mInitDone; bool mBTConnected; @@ -21,8 +20,11 @@ struct AAHandle char mIp[32]; }; +//extern int debug_buf_ref; struct AAHandle gAACtx; +static bool g_aa_disable = false; + static void android_auto_notify_event(struct carlink_event *ev, enum CARLINK_EVENT_TYPE type, bool disable_filter) { @@ -40,7 +42,12 @@ static void start_aa(struct AAHandle* pctx) // return; if (!pctx->mRfcommReady) return; + if (g_aa_disable) + return; printf("%s:%d\r\n", __func__, __LINE__); + + g_auto_link_info->wifi_ssid = (char *)carlink_get_wifi_ssid(); + g_auto_link_info->wifi_passwd = (char *)carlink_get_wifi_passwd; android_auto_set_rfcomm_info((const char*)carlink_get_wifi_ssid(), (const char*)carlink_get_wifi_passwd(), (const char*)carlink_get_wifi_mac(), 5, (const char*)pctx->mIp, 0); android_auto_start(); @@ -119,12 +126,17 @@ static int rf_write_transfer_cb(void* cb_ctx, char *buf, int len) return ret; } +int g_v_count; static void video_init_impl(void* cb_ctx, int w, int h, int x, int y) { struct AAHandle* pctx = (struct AAHandle*)cb_ctx; - + printf("x:%d y:%d w:%d h:%d\r\n", x, y, w, h); + set_carlink_active_video_info(x, y); h264_dec_ctx_init(); set_carlink_display_state(1); + //carlink_bt_close(); + g_v_count = 0; + //debug_buf_ref = 1; } static void video_uninit_impl(void* cb_ctx) @@ -132,6 +144,7 @@ static void video_uninit_impl(void* cb_ctx) struct AAHandle* pctx = (struct AAHandle*)cb_ctx; set_carlink_display_state(0); + set_carlink_active_video_info(0, 0); } static void video_play_impl(void* cb_ctx, char *buf, int len) @@ -153,6 +166,9 @@ get_retry: frame->len = len; notify_h264_frame_ready(&frame); + if (g_v_count++ > 50) {//enable_malloc_debug = 1; + //android_auto_get_video_focus(0); + } } static void audio_init_callback_impl(void* cb_ctx, int type, int sample, int ch, int bits) @@ -204,7 +220,7 @@ static void json_msg_notify_impl(void* cb_ctx, char *buf, int len) -int carlink_aa_init() +int _carlink_aa_init() { int ret = -1; struct AAHandle* pctx = &gAACtx; @@ -212,6 +228,14 @@ int carlink_aa_init() memset((void*)pctx, 0, sizeof(struct AAHandle)); + + g_auto_link_info->width = CARLINK_VIDEO_WIDTH; + g_auto_link_info->height = CARLINK_VIDEO_HEIGHT; + g_auto_link_info->fps = 30; + g_auto_link_info->density = 160; + g_auto_link_info->disable_auto_audio = 1; + g_auto_link_info->video_auto_start = 1; + set_carlink_display_info(0, 0, CARLINK_VIDEO_WIDTH, CARLINK_VIDEO_HEIGHT); set_carlink_video_info(CARLINK_VIDEO_WIDTH, CARLINK_VIDEO_HEIGHT, 30); @@ -255,10 +279,41 @@ int carlink_aa_init() } return 0; } + +static void taskInitCarlinkAA(void* param) +{ + _carlink_aa_init(); + vTaskDelete(NULL); +} + + +int carlink_aa_init() +{ + xTaskCreate(taskInitCarlinkAA, "initThread", 2048 * 4, NULL, 1, NULL); + + return 0; +} + + +void carlink_aa_enable(int enable) +{ + if (enable) { + g_aa_disable = false; + } else { + g_aa_disable = true; + } +} + #else int carlink_aa_init() { return 0; } + +void carlink_aa_enable(int enable) +{ + (void)enable; +} + #endif diff --git a/app/carlink/CP/include/mycommon.h b/app/carlink/CP/include/mycommon.h new file mode 100644 index 0000000..b120d49 --- /dev/null +++ b/app/carlink/CP/include/mycommon.h @@ -0,0 +1,133 @@ +#ifndef MYCOMMON_H_H +#define MYCOMMON_H_H +#ifdef __cplusplus +extern "C" { +#endif +#include +#include + +#ifndef CAPLAY_LINK_TYPE +#define CAPLAY_LINK_TYPE +typedef enum +{ + CARPLAY = 0x00, + CARLIFE, + ANDROID_CARLIFE, + ANDROID_MIRROR = 3, + IOS_CARLIFE, + ANDROID_AUTO = 5, + ECLINK = 0x06, + CARPLAY_WIRELESS +}Link_TYPE; +#endif + +//general function +typedef enum __USB_MODE +{ + UNDEFINED = 0, + HOST, + PERIPHERAL, + OTG +}USB_MODE; + +#define LOGV(...) printf(__VA_ARGS__); printf("\r\n"); + +struct view_area +{ + short w; + short h; + short x; + short y; +}; + +typedef struct __cfg_info +{ + char *iap2_name; + char *iap2_modelIdentifier; + char *iap2_manfacturer; + char *iap2_serialnumber; + char *iap2_sw_ver; + char *iap2_hw_ver; + char *iap2_vehicleInfo_name; + char *iap2_product_uuid; + char *iap2_usb_serial_num; + + char *manfacturer; + char *oem_icon_label; + char *oem_icon_path; + char *os_info; + char *iOSVersionMin; + char *limited_ui_elements; + char *guuid; + char *devid; + char link_type; + char btmac[6]; + bool oem_icon_visible; + bool limited_ui; + bool right_hand_driver; + bool night_mode; + bool has_knob; + bool has_telbutton; + bool has_mediabutton; + bool has_proxsensor; + bool has_EnhancedReqCarUI; + bool has_ETCSupported; + bool HiFiTouch; + bool LoFiTouch; + unsigned short usb_country_code; + unsigned short tp_verndor_code; + unsigned short tp_product_code; + unsigned short tel_verndor_code; + unsigned short tel_product_code; + unsigned short knob_verndor_code; + unsigned short knob_product_code; + unsigned short proxsensor_verndor_code; + unsigned short proxsensor_product_code; + short width;//pixel + short height; + short fps; + short screen_width_phy;//mm + short screen_height_phy; + + char encrypt_ic_i2c_bus_num; + char encrypt_ic_addr; + char usb_idx; + char need_sw_aec; + char aec_delay; + bool tvout_enable; + + bool use_remote_audio; + char video_type; + short icurrent; + int duck_vol; + + char enable_iap_carplay_sess; + char *keychain_path_dir; + + char* wifi_ssid; + char* wifi_passwd; + char* public_key; + char* src_version; + char ip_v4_addr[4]; + char wifi_channel; + short net_port; + + char carplay_net_ready; + char disable_bonjour; + char iap_carplay_rej; + + bool enable_enhanced_siri; + bool enable_single_ui; + + bool is_old_carplay_ver; + + struct view_area area[3]; + char view_area_index; + +}cfg_info; + +extern cfg_info *g_link_info; +#ifdef __cplusplus +} +#endif +#endif diff --git a/app/carlink/CP/lib/carplay.a b/app/carlink/CP/lib/carplay.a index ecf8a30..444b057 100644 Binary files a/app/carlink/CP/lib/carplay.a and b/app/carlink/CP/lib/carplay.a differ diff --git a/app/carlink/CP/src/carlink_cp.c b/app/carlink/CP/src/carlink_cp.c index 4bff380..c3cbbd0 100644 --- a/app/carlink/CP/src/carlink_cp.c +++ b/app/carlink/CP/src/carlink_cp.c @@ -36,6 +36,8 @@ struct carplay_ctx }; struct carplay_ctx g_cp_handle; +static bool g_cp_disable = false; + static void carplay_init_parameter(); void start_mdnsd(); @@ -56,9 +58,22 @@ static void iap2_link_status(void *ctx, IAP2_LINK_STATUS status){} static int iap2_write_data(void *ctx, char *buf, int len) { (void)ctx; + printf("iap2_write_data --------------------------\r\n"); return carlink_iap_data_write((unsigned char *)buf, len); } -static void iap2_msg_time_update(void *ctx, long long time, int zone_offset){} +extern uint32_t tire_front_time; +extern uint32_t tire_rear_time; +extern uint32_t fml_stamp_to_time(uint32_t timep , uint32_t time[]); +static void iap2_msg_time_update(void *ctx, long long time, int zone_offset){ + (void)ctx; + printf("iap2_msg_time_update time ======================================== %lld , %d\r\n",time,zone_offset); + uint32_t time_transfer[6]; + uint32_t sum = (uint32_t)time; + + tire_rear_time = sum; + tire_front_time = sum; + fml_stamp_to_time(sum,time_transfer); +} static void iap2_msg_gps(void *ctx, unsigned char session, int start){} static void iap2_msg_gps_gprmc_data_status(void *ctx, int value_a, int value_v, int value_x){} static void iap2_msg_identify(void *ctx, int type, int ok) @@ -163,6 +178,9 @@ static void start_cp(struct carplay_ctx* pctx) if (pctx->mCarplayConnected) return; + if (g_cp_disable) + return; + g_link_info->enable_iap_carplay_sess = 1; g_link_info->is_old_carplay_ver = 0; g_link_info->wifi_passwd = (char *)carlink_get_wifi_passwd(); @@ -270,6 +288,7 @@ static void taskInitCarlinkCpProc(void* param) (void)param; + iap2_callbacks iap2_cbs; memset((void *)&iap2_cbs, 0, sizeof(iap2_cbs)); iap2_cbs.iap2_link_status_cb = iap2_link_status; @@ -388,8 +407,8 @@ static void carplay_init_parameter() g_link_info->width = CARLINK_VIDEO_WIDTH;//pixel g_link_info->height = CARLINK_VIDEO_HEIGHT; g_link_info->fps = 30; - g_link_info->screen_width_phy = PHYSICAL_WIDTH;//mm - g_link_info->screen_height_phy = PHYSICAL_HEIGHT; + g_link_info->screen_width_phy = CARLINK_VIDEO_WIDTH; + g_link_info->screen_height_phy = CARLINK_VIDEO_HEIGHT; g_link_info->icurrent = 1000; g_link_info->enable_iap_carplay_sess = 1; @@ -424,6 +443,16 @@ int carlink_cp_init() return 0; } +void carlink_cp_enable(int enable) +{ + if (enable) { + g_cp_disable = false; + } else { + g_cp_disable = true; + } +} + + //int mdnsd_task(); static void taskMdnsdProc(void* param) { @@ -442,5 +471,11 @@ int carlink_cp_init() return 0; } +void carlink_cp_enable(int enable) +{ + (void)enable; +} + + #endif diff --git a/app/carlink/CP/src/carlink_cp.h b/app/carlink/CP/src/carlink_cp.h index bbb4a6b..53eaed6 100644 --- a/app/carlink/CP/src/carlink_cp.h +++ b/app/carlink/CP/src/carlink_cp.h @@ -2,5 +2,6 @@ #define _CARLINK_CP_H_ int carlink_cp_init(); +void carlink_cp_enable(int enable); #endif diff --git a/app/carlink/CP/src/carlink_cp_bt_wifi.c b/app/carlink/CP/src/carlink_cp_bt_wifi.c new file mode 100644 index 0000000..245f741 --- /dev/null +++ b/app/carlink/CP/src/carlink_cp_bt_wifi.c @@ -0,0 +1,393 @@ +//#include "os_adapt.h" +#include +#include +#include +#include +#include +#include +#include +#include "board.h" +#include "timer.h" +#include "iot_wifi.h" +#include "mmcsd_core.h" +#include "carlink_utils.h" +#include "console.h" +#include "fsc_bt.h" +#include "iap.h" + +#if !defined(USE_LWIP) || !USE_LWIP +#error "Carplay need lwip!" +#endif + +#include "ethernet.h" +#include "tcpip.h" +#include "lwip/apps/lwiperf.h" +#include "dhcp.h" + +#include "carlink_video.h" +#include "mycommon.h" +#include "wifi_conf.h" +#include "carlink_cp_priv.h" +//#define USE_WLAN_STA + + +static char g_cp_bt_mac[13] = {0}; +static bool g_cp_bt_mac_ready = false; + +static uint8_t cp_ap_ssid[64] = {"ap63011"}; +static uint8_t cp_ap_passwd[16] = {"88888888"}; +extern int wps_connect_done; + + +static const uint8_t ucIPAddress[4] = {192, 168, 13, 1}; +static const uint8_t ucNetMask[4] = {255, 255, 255, 0}; +static const uint8_t ucGatewayAddress[4] = {0, 0, 0, 0}; +static int lwip_tcpip_init_done_flag = 0; + +//static int g_bt_iap_ready = 0; +//static int g_dhcp_client_cp_ready = 0; + +static struct netif gnetif[4]; + +extern int wifi_add_custom_ie(void *cus_ie, int ie_num); +int mmcsd_wait_sdio_ready(int32_t timeout); +static void cp_reset_wifi_ap_info(const char *prefex); +static void cp_start_wlan(); +extern err_t dhcp_server_start(struct netif *netif, ip4_addr_t *start, ip4_addr_t *end); +extern err_t wlan_ethernetif_init(struct netif *netif); +#define lwip_ipv4_addr(addr) ((addr[0]) | (addr[1] << 8) | (addr[2] << 16) | (addr[3] << 24)) + + +static void tcpip_init_done(void *arg) +{ + (void)arg; + //lwip_tcpip_init_done_flag = 1; +} + +void lwiperf_report_cb_impl(void *arg, enum lwiperf_report_type report_type, + const ip_addr_t* local_addr, u16_t local_port, const ip_addr_t* remote_addr, u16_t remote_port, + u32_t bytes_transferred, u32_t ms_duration, u32_t bandwidth_kbitpsec) +{ + (void)arg; + + printf("lwiperf_report_cb_impl bytes:%d %d ms \r\n", bytes_transferred, ms_duration); +} + +int cp_wlan_tcp_ip_is_ready() +{ + return lwip_tcpip_init_done_flag; +} + +//dd3000a0400000020022020961726B6D6963726F0003064C696E75780004030102030606ffffffffffff070666fadde250c0 +static u8 carplay_vendor_ie[] = { + 0xdd, 0x30, 0x00, 0xa0, 0x40, 0x00, 0x00, 0x02, 0x00, 0x22, 0x02, 0x09, 0x61, 0x72, 0x6B, 0x6D, + 0x69, 0x63, 0x72, 0x6F, 0x00, 0x03, 0x06, 0x4C, 0x69, 0x6E, 0x75, 0x78, 0x00, 0x04, 0x03, 0x01, + 0x02, 0x03, 0x06, 0x06, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x06, 0x66, 0xfa, 0xdd, 0xe2, + 0x50, 0xc0 +}; +rtw_custom_ie_t carplay_ie[1] = {{carplay_vendor_ie, PROBE_RSP | BEACON}}; + +void carplay_add_vendor_ie() +{ + wifi_add_custom_ie((void *)carplay_ie, 1); +} + +void carplay_ie_replace_bt_mac(const char* btmac_str, int btmac_str_len) +{ + char btmac[6] = {0}; + string2hex((char *)btmac_str, btmac_str_len, btmac, 6); + memcpy((void*)g_link_info->btmac, (void*)btmac, 6); + //sscanf(btmac_str, "%02x%02x%02x%02x%02x%02x", btmac[0], btmac[1], btmac[2], btmac[3], btmac[4], btmac[5]); + carplay_vendor_ie[36] = btmac[0]; + carplay_vendor_ie[37] = btmac[1]; + carplay_vendor_ie[38] = btmac[2]; + carplay_vendor_ie[39] = btmac[3]; + carplay_vendor_ie[40] = btmac[4]; + carplay_vendor_ie[41] = btmac[5]; + //memcpy((void*)(carplay_vendor_ie + 36), (void*)btmac, 6); + + { + int i; + for (i = 0; i < sizeof(carplay_vendor_ie); i++) { + printf("0x%02x, ", carplay_vendor_ie[i]); + }printf("\r\n"); + } +} + +#if defined(USE_WLAN_STA) +static void dump_ip_addr(const char *msg, const ip_addr_t *server_addr) +{ + printf("%s %d.%d.%d.%d \r\n", msg, + ip4_addr1_16(ip_2_ip4(server_addr)), ip4_addr2_16(ip_2_ip4(server_addr)), ip4_addr3_16(ip_2_ip4(server_addr)), ip4_addr4_16(ip_2_ip4(server_addr))); +} + +static void cp_dhcp_client_status_callback(struct netif *netif, int status, const ip_addr_t *server_addr) +{ + if (&gnetif[0] == netif) { + dump_ip_addr("dhcp server ip :", (const ip_addr_t *)server_addr); + dump_ip_addr("dhcp client ip :", (const ip_addr_t *)&netif->ip_addr); + dump_ip_addr("dhcp client netmask:", (const ip_addr_t *)&netif->netmask); + dump_ip_addr("dhcp client gw :", (const ip_addr_t *)&netif->gw); + ip_addr_t *server_addr1 = (ip_addr_t *)&netif->ip_addr; + g_link_info->ip_v4_addr[0] = ip4_addr1_16(ip_2_ip4(server_addr1)); + g_link_info->ip_v4_addr[1] = ip4_addr2_16(ip_2_ip4(server_addr1)); + g_link_info->ip_v4_addr[2] = ip4_addr3_16(ip_2_ip4(server_addr1)); + g_link_info->ip_v4_addr[3] = ip4_addr4_16(ip_2_ip4(server_addr1)); + //g_dhcp_client_cp_ready = 1; + + //if (g_bt_iap_ready) + //carplay_start(); + } +} +#endif + +void restart_bt_wifi() +{ + cp_bt_close(); + netif_set_down(&gnetif[0]); + WIFI_Off(); + vTaskDelay(pdMS_TO_TICKS(2000)); + cp_bt_open(); + start_ap(36, (const char *)cp_ap_ssid, (const char *)cp_ap_passwd, 1); + carplay_add_vendor_ie(); + netif_set_default(&gnetif[0]); + + netif_set_up(&gnetif[0]); +} + +static void cp_start_wlan() +{ + char ap_prefix[5] = {0}; + + ip4_addr_t ip_addr; + ip4_addr_t netmask; + ip4_addr_t gw; + ip4_addr_t dhcp_addr_start; + ip4_addr_t dhcp_addr_end; + + while(!g_cp_bt_mac_ready) { + vTaskDelay(pdMS_TO_TICKS(10)); + } + memcpy(ap_prefix, g_cp_bt_mac + 8, 4); + cp_reset_wifi_ap_info(ap_prefix); +#if !defined(USE_WLAN_STA) + start_ap(36, (const char *)cp_ap_ssid, (const char *)cp_ap_passwd, 1); +#else + //start_sta((const char *)cp_ap_ssid, (const char *)cp_ap_passwd, 1); + dhcp_regisger_status_callback(cp_dhcp_client_status_callback); +#endif + + ip_addr.addr = lwip_ipv4_addr(ucIPAddress); + netmask.addr = lwip_ipv4_addr(ucNetMask); + gw.addr = lwip_ipv4_addr(ucGatewayAddress); + tcpip_init(tcpip_init_done, NULL); + netif_add(&gnetif[0], +#if LWIP_IPV4 + &ip_addr, &netmask, &gw, +#endif + NULL, wlan_ethernetif_init, tcpip_input); + + netif_set_default(&gnetif[0]); + +#if !defined(USE_WLAN_STA) + uint8_t addr_start[4] = {192, 168, 13, 20}; + uint8_t addr_end[4] = {192, 168, 13, 30}; + dhcp_addr_start.addr = lwip_ipv4_addr(addr_start); + dhcp_addr_end.addr = lwip_ipv4_addr(addr_end); + dhcp_server_start(&gnetif[0], &dhcp_addr_start, &dhcp_addr_end); + //g_dhcp_client_cp_ready = 1; +#endif + + //netif_set_up(&gnetif[0]); + lwiperf_start_tcp_server_default(lwiperf_report_cb_impl, NULL); + lwip_tcpip_init_done_flag = 1; + carplay_add_vendor_ie(); +} + +void cp_wlan_start(void){ + netif_set_up(&gnetif[0]); +} + + +static void cp_reset_wifi_ap_info(const char *prefex) +{ + if (prefex) { + memset(cp_ap_ssid, 0, sizeof(cp_ap_ssid)); + sprintf((char *)cp_ap_ssid, "AP630_CP_%s", prefex); + } + g_link_info->wifi_passwd = cp_ap_passwd; + g_link_info->wifi_ssid = cp_ap_ssid; + g_link_info->wifi_channel = 36; + g_link_info->ip_v4_addr[0] = ucIPAddress[0]; + g_link_info->ip_v4_addr[1] = ucIPAddress[1]; + g_link_info->ip_v4_addr[2] = ucIPAddress[2]; + g_link_info->ip_v4_addr[3] = ucIPAddress[3]; +} + +static void cp_bt_callback(char * cAtStr) +{ + char* cmd_para = NULL; + printf("\r\nfsc_bt_callback_ec %s %d\r\n", cAtStr, strlen(cAtStr)); + struct cp_event ev; + memset((void*)&ev, 0, sizeof(ev)); + ev.type = -1; + + if (0) { + } else if (0 == strncmp(cAtStr, "+IAPDATA=", 9)) { + char ble_buf[256] = {0}; + int data_len, i; + int data_str_len = (strlen(cAtStr) - 9); + cmd_para = cAtStr + 9; + data_len = data_str_len / 2; + string2hex(cmd_para, data_str_len, ble_buf, data_len); + for (i = 0; i < data_len; i++) { + printf("%02x ", ble_buf[i]); + }printf("\r\n"); + iap2_read_data_proc(ble_buf, data_len); + } else if (0 == strncmp(cAtStr, "+GATTDATA=", 10)) { + } else if (0 == strncmp(cAtStr, "+GATTSTAT=1",11)) { + //ev.type = EC_EVENT_BT_DISCONNECT; + printf("TRACE[%s][%d]:EC_EVENT_BT_DISCONNECT\r\n",__func__ ,__LINE__); + ev.type = CP_EVENT_BT_DISCONNECT; + carlink_cp_notify_event(&ev); + } else if (0 == strncmp(cAtStr, "+GATTSTAT=3",11)) { + printf("TRACE[%s][%d]:EC_EVENT_BT_CONNECT\r\n",__func__ ,__LINE__); + + ev.type = CP_EVENT_BT_CONNECT; + carlink_cp_notify_event(&ev); + } else if (0 == strncmp(cAtStr, "+ADDR=", 6)) { + char cmd_str[64] = {0}; + sprintf(cmd_str, "AT+NAME=AP630_CP_%s\r\n", (cAtStr + 6 + 8)); + printf("ADDR:%s\r\n", cAtStr + 6); + console_send_atcmd(cmd_str, strlen(cmd_str));//get mac addr + memset(cmd_str, 0, sizeof(cmd_str)); + sprintf(cmd_str, "AT+LENAME=AP630_CP_%s\r\n", (cAtStr + 6 + 8)); + console_send_atcmd(cmd_str, strlen(cmd_str));//get mac addr + memcpy(g_cp_bt_mac, (cAtStr + 6), 12); + carplay_ie_replace_bt_mac(cAtStr + 6, 12); + g_cp_bt_mac_ready = true; + } else if (0 == strncmp(cAtStr, "+VER", 4)) { + char* cmd = "AT+ADDR\r\n"; + console_send_atcmd(cmd, strlen(cmd));//get mac addr + } else if (0 == strncmp(cAtStr, "+NAME=", 6)) { + char cmd_str[64] = {0}; + sprintf(cmd_str, "AT+LEADDR\r\n"); + console_send_atcmd(cmd_str, strlen(cmd_str));//get LE addr + } else if (0 == strncmp(cAtStr, "+LEADDR=", 6)) { + char hexMacAddr[6] = {0}; + char m_tmp_buf[64] = {0}; + string2hex(&cAtStr[8], 12, hexMacAddr, sizeof(hexMacAddr)); + sprintf(m_tmp_buf, "AT+ADVDATA=%s\r\n", hexMacAddr); + console_send_atcmd(m_tmp_buf, 19); + } else if (0 == strncmp(cAtStr, "+GATTSENT=", 10)) { + return; + } else if (0 == strncmp(cAtStr, "+IAPSTAT=3", 10)) { + //g_bt_iap_ready = 1; + + //if (g_dhcp_client_cp_ready) + //carplay_start(); + + ev.type = CP_EVENT_BT_IAP_READY; + carlink_cp_notify_event(&ev); + + } +} + +int iap_data_write(unsigned char *data, int len) +{ + uint8_t *at_str = NULL, *at_str_ptr = NULL; + uint8_t *at_prefix = "AT+IAPSEND="; + int prefix_len = strlen((char *)at_prefix); + int cmd_len = (len * 2 + prefix_len + 2); + + at_str = (uint8_t *)pvPortMalloc(cmd_len + 1); + memset(at_str, 0, cmd_len + 1); + if (NULL == at_str) + return -1; + at_str_ptr = at_str; + sprintf((char*)at_str_ptr, "%s", (char*)at_prefix); + at_str_ptr += prefix_len; + hex2str(data, len, (char *)at_str_ptr); + at_str_ptr += (len * 2); + *at_str_ptr++ = '\r'; + *at_str_ptr++ = '\n'; + console_send_atcmd((char *)at_str, cmd_len); + vPortFree(at_str); + return len; +} + +void cp_bt_open() +{ + char at_str[] = {"AT+BTEN=1\r\n"}; + console_send_atcmd((char *)at_str, strlen(at_str)); +} + +void cp_bt_close() +{ + char at_str[] = {"AT+BTEN=0\r\n"}; + console_send_atcmd((char *)at_str, strlen(at_str)); +} + + +static void cp_wifi_event_handler( WIFIEvent_t * xEvent ) +{ + WIFIEventType_t xEventType = xEvent->xEventType; + char mac_str[32] = {0}; + char *mac = NULL; + + if (xEvent) { + mac = xEvent->xInfo.xAPStationConnected.ucMac; + sprintf(mac_str, "%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); + } + + wps_connect_done = 0; + + if (0) { + } else if (eWiFiEventConnected == xEventType) {// meter is sta + printf("\r\n The meter is connected to ap \r\n"); + } else if (eWiFiEventDisconnected == xEventType) {// meter is sta + printf("\r\n The meter is disconnected from ap \r\n"); + } else if (eWiFiEventAPStationConnected == xEventType) {// meter is ap + printf("\r\n The meter in AP is connected by sta %s \r\n", mac_str); + } else if (eWiFiEventAPStationDisconnected == xEventType) {// meter is ap + printf("\r\n The sta %s is disconnected from the meter \r\n", mac_str); + } +} + +static BaseType_t cp_wifi_init() +{ + int status; + WIFI_Context_init(); + WIFI_RegisterEvent(eWiFiEventMax, cp_wifi_event_handler); + for (;;) { + status = mmcsd_wait_sdio_ready((int32_t)portMAX_DELAY); + if (status == MMCSD_HOST_PLUGED) { + printf("detect sdio device\r\n"); + break; + } + } + return 0; +} + +static void bt_set_support_carplay() +{ + char cmd_str[64] = {0}; + + sprintf(cmd_str, "AT+PROFILE=33962\r\n"); + console_send_atcmd(cmd_str, strlen(cmd_str)); +} + +int carlink_cp_bt_wifi_init() +{ + carlink_ey_video_init(); + cp_wifi_init(); + console_register_cb(NULL, cp_bt_callback); + fsc_bt_main(); + bt_set_support_carplay(); + cp_bt_open(); + cp_start_wlan(); + printf("bt wlan init is ok\r\n"); + return 0; +} + + diff --git a/app/carlink/CP/src/carlink_cp_bt_wifi1.c b/app/carlink/CP/src/carlink_cp_bt_wifi1.c new file mode 100644 index 0000000..624f7f2 --- /dev/null +++ b/app/carlink/CP/src/carlink_cp_bt_wifi1.c @@ -0,0 +1,262 @@ +#include "os_adapt.h" +#include +#include +#include +#include +#include +#include +#include +#include "board.h" +#include "timer.h" +#include "iot_wifi.h" +#include "mmcsd_core.h" +#include "carlink_utils.h" +#include "console.h" +#include "fsc_bt.h" +#include "iap.h" + +#if !defined(USE_LWIP) || !USE_LWIP +#error "Carplay in freertos must use lwip!" +#endif + +#include "ethernet.h" +#include "tcpip.h" +#include "lwip/apps/lwiperf.h" +#include "dhcp.h" + +#include "carlink_video.h" +#include "mycommon.h" + + +static char g_cp_bt_mac[13] = {0}; +static bool g_cp_bt_mac_ready = false; + +static uint8_t cp_ap_ssid[64] = {"ap63011"}; +static uint8_t cp_ap_passwd[16] = {"88888888"}; +extern int wps_connect_done; + + +static const uint8_t ucIPAddress[4] = {192, 168, 13, 1}; +static const uint8_t ucNetMask[4] = {255, 255, 255, 0}; +static const uint8_t ucGatewayAddress[4] = {0, 0, 0, 0}; +static int lwip_tcpip_init_done_flag = 0; + +static struct netif gnetif[4]; + + +int mmcsd_wait_sdio_ready(int32_t timeout); +static void cp_reset_wifi_ap_info(const char *prefex); +static void cp_start_wlan(); +extern err_t dhcp_server_start(struct netif *netif, ip4_addr_t *start, ip4_addr_t *end); +extern err_t wlan_ethernetif_init(struct netif *netif); +#define lwip_ipv4_addr(addr) ((addr[0]) | (addr[1] << 8) | (addr[2] << 16) | (addr[3] << 24)) + + +static void tcpip_init_done(void *arg) +{ + (void)arg; + //lwip_tcpip_init_done_flag = 1; +} + +void lwiperf_report_cb_impl(void *arg, enum lwiperf_report_type report_type, + const ip_addr_t* local_addr, u16_t local_port, const ip_addr_t* remote_addr, u16_t remote_port, + u32_t bytes_transferred, u32_t ms_duration, u32_t bandwidth_kbitpsec) +{ + (void)arg; + + printf("lwiperf_report_cb_impl bytes:%d %d ms \r\n", bytes_transferred, ms_duration); +} + +int cp_wlan_tcp_ip_is_ready() +{ + return lwip_tcpip_init_done_flag; +} + +static void cp_start_wlan() +{ + const char *customer = "ark630hv100"; + char ap_prefix[5] = {0}; + + ip4_addr_t ip_addr; + ip4_addr_t netmask; + ip4_addr_t gw; + ip4_addr_t dhcp_addr_start; + ip4_addr_t dhcp_addr_end; + + while(!g_cp_bt_mac_ready) { + vTaskDelay(pdMS_TO_TICKS(10)); + } + memcpy(ap_prefix, g_cp_bt_mac + 8, 4); + cp_reset_wifi_ap_info(ap_prefix); + start_ap(36, (const char *)cp_ap_ssid, (const char *)cp_ap_passwd, 1); + + ip_addr.addr = lwip_ipv4_addr(ucIPAddress); + netmask.addr = lwip_ipv4_addr(ucNetMask); + gw.addr = lwip_ipv4_addr(ucGatewayAddress); + tcpip_init(tcpip_init_done, NULL); + netif_add(&gnetif[0], +#if LWIP_IPV4 + &ip_addr, &netmask, &gw, +#endif + NULL, wlan_ethernetif_init, tcpip_input); + + netif_set_default(&gnetif[0]); + + uint8_t addr_start[4] = {192, 168, 13, 20}; + uint8_t addr_end[4] = {192, 168, 13, 30}; + dhcp_addr_start.addr = lwip_ipv4_addr(addr_start); + dhcp_addr_end.addr = lwip_ipv4_addr(addr_end); + dhcp_server_start(&gnetif[0], &dhcp_addr_start, &dhcp_addr_end); + + netif_set_up(&gnetif[0]); + + lwiperf_start_tcp_server_default(lwiperf_report_cb_impl, NULL); + lwip_tcpip_init_done_flag = 1; + +} + + +static void cp_reset_wifi_ap_info(const char *prefex) +{ + memset(cp_ap_ssid, 0, sizeof(cp_ap_ssid)); + sprintf((char *)cp_ap_ssid, "AP630_%s", prefex); + g_link_info->wifi_passwd = cp_ap_passwd; + g_link_info->wifi_ssid = cp_ap_ssid; + g_link_info->wifi_channel = 36; + g_link_info->ip_v4_addr[0] = ucIPAddress[0]; + g_link_info->ip_v4_addr[1] = ucIPAddress[1]; + g_link_info->ip_v4_addr[2] = ucIPAddress[2]; + g_link_info->ip_v4_addr[3] = ucIPAddress[3]; +} + +static void cp_bt_callback(char * cAtStr) +{ + char* cmd_para = NULL; + printf("\r\nfsc_bt_callback_ec %s %d\r\n", cAtStr, strlen(cAtStr)); + + if (0) { + } else if (0 == strncmp(cAtStr, "+IAPDATA=", 9)) { + char ble_buf[256] = {0}; + int data_len, i; + int data_str_len = (strlen(cAtStr) - 9); + cmd_para = cAtStr + 9; + data_len = data_str_len / 2; + string2hex(cmd_para, data_str_len, ble_buf, data_len); + for (i = 0; i < data_len; i++) { + printf("%02x ", ble_buf[i]); + }printf("\r\n"); + iap2_read_data_proc(ble_buf, data_len); + } else if (0 == strncmp(cAtStr, "+GATTDATA=", 10)) { + } else if (0 == strncmp(cAtStr, "+GATTSTAT=1",11)) { + //ev.type = EC_EVENT_BT_DISCONNECT; + printf("TRACE[%s][%d]:EC_EVENT_BT_DISCONNECT\r\n",__func__ ,__LINE__); + } else if (0 == strncmp(cAtStr, "+GATTSTAT=3",11)) { + printf("TRACE[%s][%d]:EC_EVENT_BT_CONNECT\r\n",__func__ ,__LINE__); + } else if (0 == strncmp(cAtStr, "+ADDR=", 6)) { + char cmd_str[64] = {0}; + sprintf(cmd_str, "AT+NAME=EC_%s\r\n", (cAtStr + 6)); + printf("ADDR:%s\r\n", cAtStr + 6); + console_send_atcmd(cmd_str, strlen(cmd_str));//get mac addr + memset(cmd_str, 0, sizeof(cmd_str)); + sprintf(cmd_str, "AT+LENAME=EC_%s\r\n", (cAtStr + 6)); + console_send_atcmd(cmd_str, strlen(cmd_str));//get mac addr + g_cp_bt_mac_ready = true; + memcpy(g_cp_bt_mac, (cAtStr + 6), 12); + } else if (0 == strncmp(cAtStr, "+VER", 4)) { + char* cmd = "AT+ADDR\r\n"; + console_send_atcmd(cmd, strlen(cmd));//get mac addr + } else if (0 == strncmp(cAtStr, "+NAME=", 6)) { + char cmd_str[64] = {0}; + sprintf(cmd_str, "AT+LEADDR\r\n"); + console_send_atcmd(cmd_str, strlen(cmd_str));//get LE addr + } else if (0 == strncmp(cAtStr, "+LEADDR=", 6)) { + char hexMacAddr[6] = {0}; + char m_tmp_buf[64] = {0}; + string2hex(&cAtStr[8], 12, hexMacAddr, sizeof(hexMacAddr)); + sprintf(m_tmp_buf, "AT+ADVDATA=%s\r\n", hexMacAddr); + console_send_atcmd(m_tmp_buf, 19); + } else if (0 == strncmp(cAtStr, "+GATTSENT=", 10)) { + return; + } else if (0 == strncmp(cAtStr, "+IAPSTAT=3", 10)) { + carplay_start(); + } +} + +int iap_data_write(unsigned char *data, int len) +{ + uint8_t *at_str = NULL, *at_str_ptr = NULL; + uint8_t *at_prefix = "AT+IAPSEND="; + int prefix_len = strlen((char *)at_prefix); + int cmd_len = (len * 2 + prefix_len + 2); + + at_str = (uint8_t *)pvPortMalloc(cmd_len + 1); + memset(at_str, 0, cmd_len + 1); + if (NULL == at_str) + return -1; + at_str_ptr = at_str; + sprintf((char*)at_str_ptr, "%s", (char*)at_prefix); + at_str_ptr += prefix_len; + hex2str(data, len, (char *)at_str_ptr); + at_str_ptr += (len * 2); + *at_str_ptr++ = '\r'; + *at_str_ptr++ = '\n'; + console_send_atcmd((char *)at_str, cmd_len); + vPortFree(at_str); + return len; +} + + +static void cp_wifi_event_handler( WIFIEvent_t * xEvent ) +{ + WIFIEventType_t xEventType = xEvent->xEventType; + + wps_connect_done = 0; + + if (0) { + } else if (eWiFiEventConnected == xEventType) {// meter is sta + printf("\r\n The meter is connected to ap \r\n"); + } else if (eWiFiEventDisconnected == xEventType) {// meter is sta + printf("\r\n The meter is disconnected from ap \r\n"); + } else if (eWiFiEventAPStationConnected == xEventType) {// meter is ap + printf("\r\n The meter in AP is connected by sta %s \r\n", xEvent->xInfo.xAPStationConnected.ucMac); + } else if (eWiFiEventAPStationDisconnected == xEventType) {// meter is ap + printf("\r\n The sta %s is disconnected from the meter \r\n", xEvent->xInfo.xAPStationDisconnected.ucMac); + } +} + +static BaseType_t cp_wifi_init() +{ + int status; + WIFI_Context_init(); + WIFI_RegisterEvent(eWiFiEventMax, cp_wifi_event_handler); + for (;;) { + status = mmcsd_wait_sdio_ready((int32_t)portMAX_DELAY); + if (status == MMCSD_HOST_PLUGED) { + printf("detect sdio device\r\n"); + break; + } + } + return 0; +} + +static void bt_set_support_carplay() +{ + char cmd_str[64] = {0}; + + sprintf(cmd_str, "AT+PROFILE=33962\r\n"); + console_send_atcmd(cmd_str, strlen(cmd_str)); +} + +int carlink_cp_bt_wifi_init() +{ + carlink_ey_video_init(); + cp_wifi_init(); + console_register_cb(NULL, cp_bt_callback); + fsc_bt_main(); + bt_set_support_carplay(); + cp_start_wlan(); + printf("bt wlan init is ok\r\n"); + return 0; +} + + diff --git a/app/carlink/EC-orig/src/carlink_ec.c b/app/carlink/EC-orig/src/carlink_ec.c index 860fb67..878af5c 100644 --- a/app/carlink/EC-orig/src/carlink_ec.c +++ b/app/carlink/EC-orig/src/carlink_ec.c @@ -632,7 +632,7 @@ int32_t ec_ble_write(void * data, uint32_t len); int32_t ec_ble_read(void * data, uint32_t len); int32_t ec_ble_open(); void ec_ble_close(); -extern char strQrText[100]; +extern char strQrText[200]; void* initECTiny(void* param) { char uuid[32] = {0}; diff --git a/app/carlink/EC/include/ECTiny.h b/app/carlink/EC/include/ECTiny.h index 5f5bf84..3d1a065 100644 --- a/app/carlink/EC/include/ECTiny.h +++ b/app/carlink/EC/include/ECTiny.h @@ -3,288 +3,259 @@ #include "ECTypes.h" -#define ECSDK_VERSION "1.0.10" +#define ECSDK_VERSION "1.0.13.1" typedef struct { - + /** + * @brief 互联连接状态回调函数 + * @param status 互联连接状态 + * @param type 互联连接类型 + * @note 此函数是非常重要的回调函数。它会返回整个互联的状态。 + * 有部分互联功能接口,比如:EC_startMirror()/EC_enableDownloadPhoneAppHud()/EC_enableDownloadPhoneAppHud() 等, + * 都需要 status为 EC_CONNECT_STATUS_CONNECT_SUCCEED 时,调用才能生效。 + * 因为这些接口都是在互联成功之后(ECTiny与手机app建立了通讯),才能发指令给手机app,对应功能才能开启。 + */ void (*onECConnectStatus)(ECConnectedStatus status, ECConnectedType type); - void (*onMirrorStatus)(ECMirrorStatus status); /** - * @brief Called when EasyConnected status changed. - * - * @param status The changed EasyConnected message. + * @brief 投屏状态 + * @param status 互联投屏状态 + */ + void (*onMirrorStatus)(ECMirrorStatus status); + + /** + * @brief 互联状态变更通知 + * @param status 变更的状态 */ void (*onECStatusMessage)(ECStatusMessage status); /** - * @brief Called when the phone app sends down HUD information. - * - * @param data HUD information. + * @brief 手机下发HUD信息时回调 + * @param data HUD信息 */ void (*onPhoneAppHUD)(const ECNavigationHudInfo *data); /** - * @brief Called when the phone app sends down HUD Road Junction Picture. + * @brief 手机下发道路引导图时回调 * @param data */ void (*onPhoneAppHUDRoadJunctionPicture)(const ECHudRoadJunctionPictureInfo* data); - /* - * @brief Called when phone app tell the music info. - * - * @param data The information of music. - */ + /** + * @brief 手机音乐信息变化时回调 + * @param data + */ void (*onPhoneAppMusicInfo)(const ECAppMusicInfo *data); /** - * @brief Called when the phone app sends down some information. - * - * @param data Buffer of app information. - * - * @param length Buffer length. - * - * @note data is json string, the fields includes os, osVersion and ip. - * Called when ECSDK::openTransport succeed. + * @brief 手机下发app信息时回调 + * @param data app信息 + * @param length app信息长度 + * @note data 是json字符串, 包括手机类型、系统版本、ip地址等。 + * ECTiny 与 手机app建立通讯后会回调此函数 */ void (*onPhoneAppInfo)(const void *data, uint32_t length); /** - * @brief Called when ECSDK wants car to do call operations(dial or hang up) via Bluetooth. - * - * @param type Operation type. - * - * @param name The person's name of corresponding number. - * - * @param number Phone numbers. - * - * @note Phone app is not able to dial or hang up automatically due to the latest system access limitation, - * however, car is able to do it via Bluetooth. Therefore, ECSDK moves the call operations - * to car, which can dial or hang up when this method is called. + * @brief 需要拨打或者挂断蓝牙电话时回调 + * @param type 操作类型 + * @param name 电话拨打的姓名 + * @param number 电话号码 + * @note 受限于Android/iOS系统的权限,在车机上点击互联投屏的过来的拨打电话,ECTiny无法完成电话的拨打和接听操作,因此需要依赖于车机系统的蓝牙模块完成。 + * 车机的投屏界面上点击拨打蓝牙电话时,此回调函数会把拨打的用户姓名和电话号码传到车机上,由车机蓝牙模块完成电话的拨打 + * 1.需要车机端作为蓝牙免提设备(Hand-Free-Device)。 + * 2.亿连的蓝牙电话功能,需要在车机和手机的HFP保持连接后,才可以正常启用。 */ void (*onCallAction)(ECCallType type, const char *name, const char *number); /** - * @brief Called when bulk data is received. - * + * @brief 接收手机端发送的数据块 * @param data Buffer of bulk data. - * * @param length Buffer length. - * */ void (*onBulkDataReceived)(const void *data, uint32_t length); - /** - * @brief onRealMirrorSizeChanged - * @param realWidth - * @param realHeight - * - * \note The actual size of the projection screen does not equal the size of the video stream in some cases. - * The surrounding area is filled with black. This message calls back the actual size of the projection screen + * @brief 投屏状态变更 + * @param ECVideoInfo 视屏参数 + * @note 投屏的实际宽高、横竖屏切换时回调此函数 */ void (*onMirrorInfoChanged)(const ECVideoInfo *info); /** - * @brief Called when the license authorization failed. After this interface was called, - * all connections would be forced closed. - * - * @param errCode Error code. - * - * @param errMsg Error message. + * @brief 鉴权失败时回调此函数。ECTiny功能全部不可用 + * @param errCode 主要用于亿连后台进行排查的错误码,无需关心具体值。 + * @param errMsg 错误信息。 + * @note 此回调函数需要处理,当出现激活失败时给与提示。 + * 该回调一般出现在互联建立过程中,出现时ECTiny会在内部进行释放动作。 + * ECTiny使用者需要保证合法的激活校验流程,之后重新初始化ECSDK方可使用。 */ void (*onLicenseAuthFail)(int32_t errCode, const char *errMsg); /** - * @brief Called when the license authorization succeed. - * - * @param code success code. The code can gain specific meaning by ECAuthSuccessCode. - * - * @param msg success information. - * - * @param msg the description information. - * + * @brief 鉴权成时回调此函数 + * @param code 正常错误码,无需关心具体值。 + * @param msg 正常激活log信息。 + * @note 该接口回调一般出现在互联建立过程中,在首次进行激活(手机IME号备案激活)时,回调会包含剩余数量等信息,SDK使用者可根据具体的使用场景进行相关展示。 */ void (*onLicenseAuthSuccess)(int32_t code, const char *msg); /** - * @brief Called when registered command was triggered by VR. - * - * @param carCmd The triggered command. - * - * @note Voice control can be implemented with this method by VR. - * - * @see ECSDK::registerCarCmds + * @brief 当注册的控车指令被vr激活时回调 + * @param carCmd 触发的控车指令 + * @see EC_registerCarCmds() */ void (*onCarCmdNotified)(const ECCarCmd *carCmd); /** - * @brief Called when phone app request the HU to start input. - * - * @param info relevant parameters about the input. + * @brief 监听手机端文字输入 + * @param info 当前需要输入的文字信息,包括输入类型(文字、数字、电话号码等),最大输入长度,默认的文字,最大行数,以及Enter键默认的显示效果及动作。 + * @note 监听手机端输入法的开始输入状态,并传递此次输入文字的相关信息。 */ void (*onInputStart)(const ECInputInfo *info); /** - * @brief Called when phone app request the HU to cancel input. + * @note 监听手机端输入法的结束或者取消的状态,此时车机端键盘也需要取消。 */ void (*onInputCancel)(); /** - * @brief Called when phone app tell the selection of input. + * @brief 监听手机端输入光标位置、选择状态信息 + * @param start 光标开始的位置 + * @param stop 光标结束的位置 + * @note 监听手机端输入文字的选择状态,光标状态,车机端并做状态展示。仅对安卓手机有效,苹果手机互联无此回调。 */ void (*onInputSelection)(int32_t start, int32_t stop); /** - * @brief Called when phone app tell the text of input. + * @brief 同步当前手机端的文字信息到车机 + * @param text 当前手机端输入的文字信息。 + * @note 如在手机端也对输入框内的文字进行输入,需要同步至车机端,保持车机端和手机端的状态同步。 */ void (*onInputText)(const char *text); /** - * @brief Called when phone app send the text of VR or TTS. + * @brief 对识别内容进行展示 + * @param info 手机端语音引擎识别后的文字内容信息。 */ void (*onVRTextReceived)(const ECVRTextInfo *info); /** - * @brief Called when phone app tell the page list. - * - * @param pages Array of the struct ECPageInfo. - * - * @param length The length of the array. + * @brief 获取快捷方式列表信息 + * @param pages 返回快捷方式的数组,参考 ECTypes.h 的 ECPageInfo 定义,主要包含图标的编号、名称、icon的唯一标识信息; + * @param length pages数组长度; + * @note ECPageInfo::page 字段标识了每一个快捷方式的唯一标识,通过该标识,可以实现两个主要的功能: + * 1. 通过page编号,可以通过调用 ECSDK::queryPageIcon 获取快捷方式的图标资源。 + * 2. 通过page编号,可以通过调用 ECSDK::openAppPage 实现快捷打开对应指定手机APP页面 */ void (*onPageListReceived)(const ECPageInfo *pages, int32_t length); /** - * @brief Called when phone app tell the icons. - * - * @param icons Array of the struct ECIconInfo. - * - * @param length The length of the array. + * @brief 手机app回调图标信息 + * @param icons 返回快捷方式图标资源的数组,参考 ECTypes.h 的 ECIconInfo 定义,主要包含icon的编号、icon的格式、icon图像数据、icon的数据长度; + * @param length icons的数组长度。 */ void (*onPageIconReceived)(const ECIconInfo *icons, int32_t length); /** - * @brief Called when phone app tell weather. - * - * @param data Buffer of weather information. - * - * @param length Buffer length. - * - * @note data pointed to a json string buffer. + * @brief 回调天气信息 + * @param data 天气信息字符串 + * @param length 字符串长度 + * @note data 是一个固定格式的json字符串 */ void (*onWeatherReceived)(const char *data, int32_t length); /** - * @brief Called when phone app tell vr tips. - * - * @param data Buffer of tips information. - * - * @param length Buffer length. - * - * @note data pointed to a json string buffer. + * @brief 请求VR提醒文字 + * @param data VR文字 + * @param length data长度 + * @note data是一个json字符串 + * 在使用车机端本地语音助手时,一般需要有一些常驻提示类的使用帮助,这些文字主要通过手机端传输至车机端,由车机端系统完成展示。 */ void (*onVRTipsReceived)(const char *data, int32_t length); /** - * @brief Called when the app requests networking - * - * @param clientInfo Mobile phone related information - * - * @note + * @brief 手机app发送到车机的请求组网 + * @param clientInfo 手机app的相关信息 + * @note 此回调用于BLE组网 */ void (*onRequestBuildNet)(const ECBTClientInfo *clientInfo); /** - * @brief Called when canceling networking - * - * @note + * @brief 手机app取消组网时回调 + * @note 此回调用于BLE组网 */ void (*onRequestBuildNetCancel)(); /** - * @brief Called when networking is completed - * - * @note + * @brief 手机app组网完成时回调 + * @note 此回调用于BLE组网 */ - void (*onPhoneBuildNetFinish)(); + void (*onPhoneBuildNetFinish)(const char* ip); /** - * @brief Called when app sends AP information - * - * @param netDeviceInfo AP information - * - * @note + * @brief 手机app通知车机,手机创建的ap信息 + * @param netDeviceInfo AP信息 + * @note 此回调用于BLE组网 */ void (*onPhoneAPInfo)(const ECBTNetInfo* netDeviceInfo); /** - * @brief Called when mobile phone has a notification message. - * @param notification + * @brief 收到手机消息通知时回调 + * @param notification 消息通知 + * @note 允许下发手机消息通知功能开启后,当收到短信、微信等消息时,此函数会回调消息到车机 + * @see EC_requestPhoneNotification() */ void (*onPhoneNotification)(const ECPhoneNotification* notification); /** - * @brief Called when the phone app sends down HUD lane guidance Picture. - * @param notification + * @brief HUD道路引导图 + * @param notification 引导图信息 + * @note 下发HUD导航功能开启后,导航时,有道路引导图时,此函数会回调 + * @see EC_enableDownloadPhoneAppHud() */ void (*onPhoneAppHUDLaneGuidancePicture)(const ECHudLaneGuidancePictureInfo * data); /** - * @brief Called when checkOTAUpdate was called, it will tell the result of checkOTAUpdate. - * - * @param downloadableSoftwares It pointer to a array of ECOTAUpdateSoftware, which is downloadable software. - * - * @param downloadableLength The length of the downloadable array, if downloadableLength < 0, means check occur error, downloadableLength is error value of ECOTAUpdateErrorCode. - * - * @param downloadedSoftwares It pointer to a array of ECOTAUpdateSoftware, which is downloaded software. - * - * @param downloadedLength The length of the downloaded array. + * @brief 检测更新函数 EC_checkOTAUpdate()调用后, 此回调函数返回结果 + * @param downloadableSoftwares 可下载的软件包数组 + * @param downloadableLength 可下载的软件包数组大小, 如果 downloadableLength < 0 标识出现错误, 错误码参考:ECOTAUpdateErrorCode. + * @param downloadedSoftwares 已下载的软件包数组 + * @param downloadedLength 已下载的软件包数组大小 */ void (*onOTAUpdateCheckResult)(const ECOTAUpdateSoftware* downloadableSoftwares, const int32_t downloadableLength, const ECOTAUpdateSoftware* downloadedSoftwares, const uint32_t downloadedLength); /** - * @brief Called when remote downloadable software has been downloaded to phone. - * - * @param downloadableSoftwares It pointer to a array of ECOTAUpdateSoftware, which has been in phone, can be downloaded from phone to HU. - * - * @param downloadableLength The length of the downloadable array. + * @brief 有软件包请求下载手机时回调 + * @param downloadableSoftwares 可下载的软件包数组 + * @param downloadableLength 可下载软件包数组大小 + * @note 软件包已存在手机,请求下载到车机 */ void (*onOTAUpdateRequestDownload)(const ECOTAUpdateSoftware* downloadableSoftwares, const uint32_t downloadableLength); /** - * @brief Called when startOTAUpdate is called, it will notify the progress of downloading. - * - * @param downloadingSoftwareId The id of the downloading software. - * - * @param progress The progress of the downloading software,which is a percentage. - * - * @param softwareLeftTime The left time of the downloading software. - * - * @param otaLeftTime The left time of all the specified software by startOTAUpdate. + * @brief EC_startOTAUpdate()调用之后, 此回调函数会回调下载进度 + * @param downloadingSoftwareId 下载的软件ID + * @param progress 下载的进度 + * @param softwareLeftTime 剩余下载时间 + * @param otaLeftTime OTA剩余时间 */ void (*onOTAUpdateProgress)(const char* downloadingSoftwareId, float progress, uint32_t softwareLeftTime, uint32_t otaLeftTime); /** - * @brief Called when startOTAUpdate is called, it will notify software is downloaded. - * - * @param downloadedSoftwareId The id of the downloaded software. - * - * @param md5Path The md5 file path. - * - * @param packagePath The software path. - * - * @param iconPath The icon path. - * - * @param leftSoftwareNum The amount of software remaining to be downloaded. + * @brief EC_startOTAUpdate()调用之后, 下载完成时回调此函数 + * @param downloadedSoftwareId 下载的软件ID + * @param md5Path md5文件路径 + * @param packagePath 升级包路径 + * @param iconPath 图标路径 + * @param leftSoftwareNum 剩余下载数量 */ void (*onOTAUpdateCompleted)(const char* downloadedSoftwareId, const char* md5Path, const char* packagePath, const char* iconPath, uint32_t leftSoftwareNum); /** - * @brief Called when checkOTAUpdate or startOTAUpdate failed. - * - * @param errCode error code, see ECOTAUpdateErrorCode. - * - * @param softwarId the id of software. + * @brief EC_checkOTAUpdate() 或者 EC_startOTAUpdate() 调用过程出错回调此函数 + * @param errCode 错误码, 参考:ECOTAUpdateErrorCode. + * @param softwarId 软件id */ void (*onOTAUpdateError)(int32_t errCode, const char* softwareId); @@ -350,67 +321,502 @@ ECConfigHandle EC_createECConfig(); void EC_destroyECConfig(ECConfigHandle config); void EC_setBaseConfig(ECConfigHandle config,const char *uuid, const char *version,const char *writableDir); void EC_setCommonConfig(ECConfigHandle config, const char *cfgName, const char *value); +/** + * @brief 设置 ECTiny 连接的app版本 + * @param type 0:国内版; 1:海外版 + */ +void EC_setLinkPhoneApp(ECConfigHandle config,int32_t type); void EC_setCommonConfig1(ECConfigHandle config, const char *cfgName, int32_t value); +// This function must be called after the EC_start() function. +int32_t EC_resetECConfig(const char* config); +/** + * @brief ECTiny 初始化函数 + * @param config 项目配置 + * @param listener 回调接口 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 此接口为互联必调用的接口。 + * 1.除了调用 EC_setBaseConfig() 设置基本的运行配置之外,config 一般不需要额外配置。 + * 2.listener 的生命周期大于 ECTiny 生命周期。即 listener 在 EC_initialize() 调用前就需要初始化,EC_release()之后才可以释放。 + */ int32_t EC_initialize(ECConfigHandle config, IECCallBack *listener); -int32_t EC_release(); -int32_t EC_setLogInfo(const ECLogLevel level,const ECLogOutputType type,const char *logDirectory, int32_t module); -const char* EC_getVersion(); -int32_t EC_getVersionCode(); -int32_t EC_start(); -int32_t EC_stop(); -int32_t EC_bindAccessFile(IECAccessFile *handle); -int32_t EC_bindUSBDevice(ECTransportType type, IECAccessDevice *dev); -int32_t EC_bindWIFIDevice(ECTransportType type, const char *ip); -int32_t EC_unbindDevice(ECTransportType type); -int32_t EC_bindHidDevice(IECHidAccessDev* dev); -int32_t EC_unBindHidDevice(); -int32_t EC_bindBTDevice( IECAccessDevice* ioHandle); -int32_t EC_unBindBTDevice(); -int32_t EC_setMirrorConfig(const ECMirrorConfig *mirrorCfg); -int32_t EC_setVideoPlayer(IECVideoPlayer* video); -int32_t EC_setAudioPlayer(IECAudioPlayer* audio); -int32_t EC_setAudioRecorder(IECAudioRecorder* audioRecorde); -int32_t EC_notifyWifiStateChanged(ECWifiStateAction action, const ECNetWorkInfo* netInfo); -int32_t EC_setRequestBuildNetRly(const char *phoneID, const ECBTRequestBuildNetRly *rly); -int32_t EC_setNetInterfaceInfo(const ECNetInterfaceInfo *info,const int32_t num); -int32_t EC_startMirror(); -void EC_stopMirror(); -int32_t EC_pauseMirror(); -int32_t EC_resumeMirror(); -int32_t EC_sendTouchEvent(const ECTouchEventData *touch, ECTouchEventType type); -int32_t EC_sendBtnEvent(int32_t btnCode, int32_t type); -int32_t EC_stopPhoneNavigation(); -int32_t EC_stopPhoneVR(); -int32_t EC_uploadNightModeStatus(uint32_t isNightModeOn); -int32_t EC_uploadDrivingStatus(ECDrivingStatus status); -int32_t EC_enableDownloadPhoneAppAudio(uint32_t supportType, uint32_t autoChangeToBT); -void EC_disableDownloadPhoneAppAudio(); -int32_t EC_enableDownloadPhoneAppHud(uint32_t supportFunction); -void EC_disableDownloadPhoneAppHud(); -int32_t EC_setConnectedBTAddress(const char *carBtMac, const char *phoneBtMac); -int32_t EC_sendCarBluetooth(const char *name, const char *adddress, const char *pin); -int32_t EC_openAppPage(int32_t page); -int32_t EC_queryGPS(uint32_t* status, ECGPSInfo* gps); -int32_t EC_queryTime(uint64_t *gmtTime, uint64_t *localTime, char *timeZone, uint32_t len, char* dateTime, uint32_t dateTimeLen); -int32_t EC_sendCarStatus(ECCarStatusType carStatus, ECCarStatusValue value); -int32_t EC_registerCarCmds(const ECCarCmd *carCmds, uint32_t length); -int32_t EC_playCarTTS(const char *text, uint32_t level); -int32_t EC_registerSimilarSoundingWords(const char *data, uint32_t length); -int32_t EC_sendInputText(const char* text); -int32_t EC_sendInputAction(int32_t actionId, int32_t keyCode); -int32_t EC_sendInputSelection(int32_t start, int32_t stop); -int32_t EC_queryPageList(); -int32_t EC_queryPageIcon(int32_t* pages, int32_t length); -int32_t EC_queryWeather(); -int32_t EC_queryVRTips(); -const char* EC_generateQRCodeUrl(ECQRInfo* info); -int32_t EC_requestPhoneNotification(int32_t enable); +/** + * @brief ECTiny 释放函数 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 此函数调用后,后面声明的函数调用都会失效。 + * 没有互联时,ECTiny线程处于block或者waiting状态,占用系统资源不多,所以ECTiny的一般使用场景不需要调用此函数。 + */ +int32_t EC_release(); + +/** + * @brief 设置ECTiny日志 + * @param level 日志级别。调试时设置成:EC_LOG_LEVEL_ALL,生产时设置成:EC_LOG_LEVEL_ERROR或者其他高级别 + * @param type 日志输出类型,设置成 EC_LOG_OUT_STD标准输出。其余类型暂不支持。 + * @param logDirectory 日志保存位置,暂不支持 + * @param module 日志模块,通常设置成:EC_LOG_MODULE_SDK | EC_LOG_MODULE_APP + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 此接口为互联必调用的接口。 + */ +int32_t EC_setLogInfo(const ECLogLevel level,const ECLogOutputType type,const char *logDirectory, int32_t module); + +/** + * @return 获取 ECTiny 版本号 + */ +const char* EC_getVersion(); + +/** + * @return 获取 ECTiny 升级版本号 + */ +int32_t EC_getVersionCode(); + +/** + * @brief 开启互联服务 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 此接口为互联必调用的接口。 + */ +int32_t EC_start(); + +/** + * @brief 停止互联服务 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 没有投屏的情况下, ECTiny线程出于阻塞状态,占用的系统资源很少。 + * 一般使用场景,调用 EC_start() 之后,不需要调用 EC_stop()。 + */ +int32_t EC_stop(); + +/** + * @brief 绑定文件读写设备 + * @param handle 文件操作接口 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 对于某些 RTOS 系统,没有标准的文件操作接口,因此需要实现此接口,把基本文件操作的接口传给 ECTiny。 + * ECTiny会使用此接口读写license和OTA。 + */ +int32_t EC_bindAccessFile(IECAccessFile *handle); + +/** + * @brief 绑定usb设备 + * @param type 互联类型 + * @param dev usb设备操作接口 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 绑定usb设备读写操作,用于实现usb互联。 + * @see EC_unbindDevice() + */ +int32_t EC_bindUSBDevice(ECTransportType type, IECAccessDevice *dev); + +/** + * @brief 绑定wifi互联ip + * @param type 互联类型 + * @param ip 对端ip地址 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 此函数调用之后, ECTiny会直接连接ip,进行互联。 + * @see EC_unbindDevice() + */ +int32_t EC_bindWIFIDevice(ECTransportType type, const char *ip); + +/** + * @brief 释放绑定的设备 + * @param type 互联类型 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 此函数与 EC_bindUSBDevice(),EC_bindWIFIDevice(),有绑定与解绑定关系。 + */ +int32_t EC_unbindDevice(ECTransportType type); + +/** + * @brief 绑定HID设备 + * @param dev HID设备 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @see EC_unBindHidDevice() + */ +int32_t EC_bindHidDevice(IECHidAccessDev* dev); + +/** + * @brief 解除HID设备绑定 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @see EC_bindHidDevice() + */ +int32_t EC_unBindHidDevice(); + +/** + * @brief 绑定蓝牙ble设备操作接口 + * @param ioHandle 蓝牙ble设备操作接口 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 此接口用于BLE组网方式的互联。 + * @see EC_unBindBTDevice() + */ +int32_t EC_bindBTDevice( IECAccessDevice* ioHandle); + +/** + * @brief 蓝牙ble设备解绑定 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @see EC_bindBTDevice() + */ +int32_t EC_unBindBTDevice(); + +/** + * @brief 设置投屏参数 + * @param mirrorCfg 投屏参数 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 此接口为互联必执行的接口。 + */ +int32_t EC_setMirrorConfig(const ECMirrorConfig *mirrorCfg); + +/** + * @brief 设置解码显示设备 + * @param video 解码显示器 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 解码显示器 IECVideoPlayer 通过此接口注册给 ECTiny之后,由 ECTiny主动调用解码器的开始和停止。 + */ +int32_t EC_setVideoPlayer(IECVideoPlayer* video); + +/** + * @brief 设置音频播放器 + * @param audio 音频播放器 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 声音数据走usb或者wifi时才需要设置此接口。一般项目声音都是走蓝牙a2dp,不需要设置此接口。 + */ +int32_t EC_setAudioPlayer(IECAudioPlayer* audio); + +/** + * @brief 设置录音设备 + * @param audioRecorde 录音设备 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 需要手机app回声降噪的项目才需要设置此接口。 + */ +int32_t EC_setAudioRecorder(IECAudioRecorder* audioRecorde); + +/** + * @brief 仪表wifi状态通知接口 + * @param action 仪表wifi模式:ap/sta。 目前此值不做要求,填写此枚举任意值即可 + * @param netInfo 网络状态。ECNetWorkInfo::state 必须填写,其余字段不需要填。 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 仪表/车机wifi发生变化时,通过此接口通知给 ECTiny。wifi连接,此接口必调用 + */ +int32_t EC_notifyWifiStateChanged(ECWifiStateAction action, const ECNetWorkInfo* netInfo); + +/** + * @brief 请求组网接口 + * @param phoneID 手机id + * @param rly 组网信息 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 只有BLE组网的连接方式,才用到此接口。 + */ +int32_t EC_setRequestBuildNetRly(const char *phoneID, const ECBTRequestBuildNetRly *rly); + +/** + * @brief 仪表ip地址上报给手机 + * @param info 仪表网络信息 + * @param num 仪表网络信息数量 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 只有BLE组网的连接方式,才用到此接口。 + */ +int32_t EC_setNetInterfaceInfo(const ECNetInterfaceInfo *info,const int32_t num); + +/** + * @brief 开始投屏 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 此接口为互联必执行的接口。 + * 此接口调用后,手机app会把 H264 数据发送给 ECTiny。 ECTiny会自动调用 IECVideoPlayer 解码器解码显示。 + * onECConnectStatus 回调函数,status==EC_CONNECT_STATUS_CONNECT_SUCCEED 时才可以调用此接口,否则无效。 + * @see EC_stopMirror() + */ +int32_t EC_startMirror(); + +/** + * @brief 停止投屏 + * @note 此接口为互联必执行的接口。 + * @see EC_startMirror() + */ +void EC_stopMirror(); + +/** + * @brief 暂停/开启 投屏 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 目前不调用。调用 EC_startMirror()/EC_stopMirror() + */ +int32_t EC_pauseMirror(); +int32_t EC_resumeMirror(); + +/** + * @brief 发送触控消息 + * @param touch 触控数据 + * @param type 触控类型 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 发送仪表/车机屏幕的触控消息给手机app,互联程序会映射到手机的坐标,让手机app做出响应。 + */ +int32_t EC_sendTouchEvent(const ECTouchEventData *touch, ECTouchEventType type); + +/** + * @brief 发送按键消息 + * @param btnCode 按键键值,取值于:ECBtnCode + * @param type 按键类型,取值与:ECBtnEventType + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 发送按键消息给手机app,让手机作出响应。 + */ +int32_t EC_sendBtnEvent(int32_t btnCode, int32_t type); + +/** + * @brief 结束手机导航 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + */ +int32_t EC_stopPhoneNavigation(); + +/** + * @brief 结束手机vr语音 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + */ +int32_t EC_stopPhoneVR(); + +/** + * @brief 上传汽车的夜间模式信息到手机 + * @param isNightModeOn 1:夜间模式; 0: 非夜间模式 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 手机app的显示模式设置为自动时,此接口才能让手机app响应 + */ +int32_t EC_uploadNightModeStatus(uint32_t isNightModeOn); + +/** + * @brief 上传汽车的驾驶信息到手机 + * @param status 驾驶状态 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + */ +int32_t EC_uploadDrivingStatus(ECDrivingStatus status); + +/** + * @brief 允许手机下发声音数据到仪表/车机 + * @param supportType 下载的声音类型,取值于 ECAudioType 类型,可以通过或运算下载多种声音 + * @param autoChangeToBT 是否启用蓝牙优先的策略,当蓝牙连接后,声音自动走蓝牙通道。 + * 也可通过该接口控制手机端蓝牙连接提示框的弹出,当该参数设置为false后,手机端不再弹出连接蓝牙提示框。 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 只有在连接层成功建立后,接口调用才能成功。参考 onECConnectStatus() + * 该接口调用之后,手机app才会下传相应声音,停止音频下传接口为EC_disableDownloadPhoneAppAudio() + */ +int32_t EC_enableDownloadPhoneAppAudio(uint32_t supportType, uint32_t autoChangeToBT); + +/** + * @brief 停止手机下发声音数据 + */ +void EC_disableDownloadPhoneAppAudio(); + +/** + * @brief 允许手机下发HUD导航信息 + * @param supportFunction hud导航功能,取值于 ECAPPHUDSupportFunction 类型,可以通过或运算开启多种hud功能 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 只有在连接层成功建立后,接口调用才能成功。参考 onECConnectStatus() + * 此接口调用一次即可生效 + */ +int32_t EC_enableDownloadPhoneAppHud(uint32_t supportFunction); + +/** + * @brief 停止手机下发HUD导航信息 + */ +void EC_disableDownloadPhoneAppHud(); + +/** + * @brief 设置连接的蓝牙 + * @param carBtMac 车机自己的蓝牙地址 + * @param phoneBtMac 车机连接的蓝牙Mac地址 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + * @note 此接口的目的是用于对比手机和车机两者连接的蓝牙是不是对方。受限于手机系统限制,无法取得手机的蓝牙物理地址,目前此接口功能已经失效。 + */ +int32_t EC_setConnectedBTAddress(const char *carBtMac, const char *phoneBtMac); + +/** + * @brief 发送车机的蓝牙信息给手机 + * @param name 蓝牙名称 + * @param adddress 蓝牙地址 + * @param pin 蓝牙pin码 + * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 + */ +int32_t EC_sendCarBluetooth(const char *name, const char *adddress, const char *pin); + +/** + * @brief 打开手机界面 + * @param page 快速访问手机APP的相关界面或功能,如导航、音乐、对讲等,具体取值参考:ECAppPage + * @return EC_OK 为成功,其余值为失败。 + * @note 该接口主要用于如下场景,譬如车机端系统桌面集成快捷按钮,可直达互联的指定页面。 + */ +int32_t EC_openAppPage(int32_t page); + +/** + * @brief 查询GPS信息 + * @param status 当前的请求结果是否有效,0:无效;其余值有效 + * @param gps GPS信息 + * @return EC_OK 为成功,其余值为失败。 + * @note 该接口主要用于车机需要使用到手机端GPS的场景,请求网络当前位置。 + */ +int32_t EC_queryGPS(uint32_t* status, ECGPSInfo* gps); + +/** + * @brief 查询手机时间 + * @param gmtTime 返回GMT(UTC)时间,单位毫秒。 + * @param localTime 返回当前时区的时间,单位毫秒 + * @param timeZone 返回当前的时区的字符串。 + * @param len 当前时区字符串的长度 + * @param dateTime 返回手机app当前时间字符串 + * @param dateTimeLen 手机app当前时间字符串长度 + * @return EC_OK 为成功,其余值为失败。 + * @note 由于GMT时间涉及到系统函数和时区的计算,建议直接使用后两个参数获取当前时间字符串,然后解析字符串获取到时间 + */ +int32_t EC_queryTime(uint64_t *gmtTime, uint64_t *localTime, char *timeZone, uint32_t len, char* dateTime, uint32_t dateTimeLen); + +/** + * @brief 同步车机状态到手机 + * @param carStatus 车机状态类型 + * @param value 部分status需要携带状态值 + * @return EC_OK 为成功,其余值为失败。 + * @note 部分场景下,需要将车机的部分状态信息通知到手机APP,手机APP需要根据状态做互联的相关逻辑处理。 + * 如手机APP可根据行车状态,在不同的地区做不同的使用限制。该接口主要用于行车模式功能等功能。 + */ +int32_t EC_sendCarStatus(ECCarStatusType carStatus, ECCarStatusValue value); + +/** + * @brief 注册控车指令 + * @param carCmds 控车指令 + * .type : 指令类型,是一个全局指令或是一个和页面绑定的指令,见枚举 ECCarCmdEFFECTType 。 + * .id : 指令id,每个需要识别的指令,都有一个唯一的标识。 + * .cmd : 期望语音识别的指令,当时一个全局指令时,可以是正则表达式;如"(打开|开启)空调",等价于"打开空调" ,"开启空调";而当是一个和页面绑定的指令词,不支持正则表达式,仅支持明确的指令,如"放大地图"。 + * .vrText : 当前成功匹配的语义,仅用于当 IECCallback::onCarCmdNotified 回调时,可根据匹配的内容处理相关的动作。 + * .pauseMusic : 该参数仅用于 ECSDK::registerCarCmds ,告知手机如果触发语音识别时,是否需要暂停当前正在播放的音乐。 + * .responser : 语音指令执行的结果是由车机端播报,还是由手机端播报。0 车机端播报,1,手机端播报。 + * .thresholdLevel : 可选项,默认值为0,由手机端指定默认的门限值, 范围参考值 1~9999,识别门限值,值越大识别率越低,误唤醒率越低,开发者在使用语音识别功能时,可在项目中调试设置合适的值。该参数仅在 type= EC_CAR_CMD_TYPE_EFFECTIVE_PAGE 生效; + * @param length 注册的指令列表的长度。 + * @return EC_OK 为成功,其余值为失败。 + * @note 当发起语音识别后,通过手机端的VR引擎识别后,会转化后具体的指令,通过回调接口 IECCallback::onCarCmdNotified 响应,须在此进行相关处理。 + */ +int32_t EC_registerCarCmds(const ECCarCmd *carCmds, uint32_t length); + +/** + * @brief 播放指定的文字 + * @param text 文字信息 + * @param level 优先级,0~10,优先级越高,被播放的优先级也越高。 + * @return EC_OK 为成功,其余值为失败。 + * @note 与手机的通讯建立成功后,把需要播报的文字传输至手机APP。 + * 如果车机端配置了 ECSDK::enableDownloadPhoneAppAudio 通过车机端播放手机APP音频,此时音频将以TTS类型,通过USB/wifi传输车机端。 + */ +int32_t EC_playCarTTS(const char *text, uint32_t level); + +/** + * @brief 注册近似指令 + * @param data 需要注册的近音词组,数据格式为JSON格式字符串 + * { + * words: + * [ + * ["词1", ..., "词m"], ///< 数据类型为string数组,近音词集合,数组中的第一个词为显示词。 + * ... + * ["词a", ..., "词n"] ///< 数据类型为string数组,近音词集合,数组中的第一个词为显示词。 + * ] + * } + * @param length 注册的指令Json字符串的长度。 + * @return EC_OK 为成功,其余值为失败。 + * @note 该接口主要是对 EC_registerCarCmds() 接口的补充,常见使用场景提高语音控车指令的准确度,如“上身车窗”、“上升车窗”可以正确的被识别为同一个含义。 + */ +int32_t EC_registerSimilarSoundingWords(const char *data, uint32_t length); + +/** + * @brief 发送给手机端当前已输入的文字 + * @param text 当前输入的车机端文字 + * @return EC_OK 为成功,其余值为失败。 + * @note 此函数用于车机键盘输入功能 + */ +int32_t EC_sendInputText(const char* text); + +/** + * @brief 发送给手机端键盘按键事件 + * @param actionId 当前输入的动作 + * @param keyCode 键值 + * @return EC_OK 为成功,其余值为失败。 + * @note 如车机端输入法点击Enter键,此时需把事件发送给手机端。所有keycode及ActionId对安卓手机都有效; + * 苹果手机仅响应actionid=0 keycode=4,苹果手机处理为隐藏手机端输入法,并把输入状态置为inActive状态。 + * 此函数用于车机键盘输入功能 + */ +int32_t EC_sendInputAction(int32_t actionId, int32_t keyCode); + +/** + * @brief 发送给手机端当前光标位置及选中状态 + * @param start 光标开始的位置。 + * @param stop 光标结束的位置。 + * @return EC_OK 为成功,其余值为失败。 + * @note 如果车机端的光标产生变化,需把对应状态发送至手机端同步。仅对安卓手机有效,苹果手机互联无此回调。 + * 此函数用于车机键盘输入功能 + */ +int32_t EC_sendInputSelection(int32_t start, int32_t stop); + +/** + * @brief 获取快捷方式列表信息 + * @return EC_OK 为成功,其余值为失败。 + * @note ECTiny与手机app传输建立之后。通过 IECCallback::onPageListReceived 回调接口完快捷方式列表信息的接收。 + */ +int32_t EC_queryPageList(); + +/** + * @brief 获取快捷方式图标资源 + * @param pages 待请求的page编号的数组,通过 EC_queryPageList 获取。 + * @param length page编号的数组长度。 + * @return EC_OK 为成功,其余值为失败。 + * @note ECTiny与手机app传输建立之后。通过 IECCallback::onPageIconReceived 回调接口完快捷方式图标资源的的接收。 + * 为了避免重复的请求,占用带宽资源,以及做到车机端的快捷方式快速显示;车机端系统需要做好缓存策略,对icon的资源信息做到增量更新: + * 通过每次互联后 EC_queryPageList 获取最新的列表信息,然后比对车机端缓存的列表信息,仅对增量的资源进行请求更新; + */ +int32_t EC_queryPageIcon(int32_t* pages, int32_t length); + +/** + * @brief 查询天气 + * @return EC_OK 为成功,其余值为失败。 + * @note 查询结果通过 IECCallback::onWeatherReceived 回调函数返回 + */ +int32_t EC_queryWeather(); + +/** + * @brief 车机端语音提醒轮播 + * @return EC_OK 为成功,其余值为失败。 + * @note 在使用车机端本地语音助手时,一般需要有一些常驻提示类的使用帮助,这些文字主要通过手机端传输至车机端,由车机端系统完成展示。 + */ +int32_t EC_queryVRTips(); + +/** + * @brief 生成二维码url + * @param info 二维码信息 + * @return EC_OK 为成功,其余值为失败。 + */ +const char* EC_generateQRCodeUrl(ECQRInfo* info); + +/** + * @brief 允许手机下发手机消息 + * @param enable 0:禁止; 1:允许 + * @return EC_OK 为成功,其余值为失败。 + */ +int32_t EC_requestPhoneNotification(uint32_t enable); + +/** + * @brief 检测OTA升级 + * @param cfg ota配置 + * @param language 语言 + * @param mode ota升级模式 + * @return EC_OK 为成功,其余值为失败。 + */ int32_t EC_checkOTAUpdate(const ECOTAConfig* cfg, const ECLanguage language, const ECOTAUpdateCheckMode mode); + +/** + * @brief 开始OTA升级 + * @param softwareIds 需要升级的软件id + * @param softwareNum 需要升级的软件id数量 + * @return EC_OK 为成功,其余值为失败。 + */ int32_t EC_startOTAUpdate(const char** softwareIds, const int32_t softwareNum); + +/** + * @brief 停止OTA升级 + */ void EC_stopOTAUpdate(); +/** + * @brief 开启iperf服务端 + * @param ip + * @param port + * @return + * @note 简单实现的iperf功能。车机/仪表进行iperf测试时,建议使用标准iperf + */ int32_t EC_startIperfTcpServer(const char* ip, int port); void EC_stopIperfTcpServer(); #endif diff --git a/app/carlink/EC/include/ECTypes.h b/app/carlink/EC/include/ECTypes.h index f3e8d6d..35aa208 100644 --- a/app/carlink/EC/include/ECTypes.h +++ b/app/carlink/EC/include/ECTypes.h @@ -194,6 +194,18 @@ enum ECProjectFlavor }; typedef enum ECProjectFlavor ECProjectFlavor; +/** + * @enum ECAuthCheckMode + * + */ +enum ECAuthCheckMode { + EC_AUTH_CHECK_DEFAULT = 0, ///< default check auth on phone + EC_AUTH_CHECK_ON_CAR_NETWORK = 1, ///< check auth on car network + EC_AUTH_CHECK_SCAN_CODE_TO_ACTIVATE_FOR_SUDING = 2, ///< scan the code to activate the certificate for suding + EC_AUTH_CHECK_SCAN_CODE_TO_ACTIVATE = 4, ///< scan the code to activate the certificate +}; +typedef enum ECAuthCheckMode ECAuthCheckMode; + /** * @struct ECAuthentication * @@ -205,7 +217,7 @@ struct ECAuthentication char pwd[1024]; ///< the specific password for authentication powered by Carbit. char versionName[1024]; ///< the version name of EasyConn. uint32_t versionCode; ///< the version code of EasyConn. - uint32_t autoAuthViaCar; ///< specify whether make automatic authentication via car's network. + uint32_t authCheckMode; ///< the value of auth check model refer to ECAuthCheckMode. ECProjectFlavor flavor; ///< specify the HU Project market for sale,SDK will carry a flavor by default.see enum ECProjectFlavor in ECTypes.h char reserve[256]; ///< reserve }; @@ -373,11 +385,22 @@ struct ECOptions ECMirrorMode mirrorMode; ///< tell the app of connected phone which mirror mode would be used. uint32_t bluetoothPolicy; ///< the policy of A2DP message phone sent to the car. uint32_t disableShowCallInfo; ///< true:Don't show call info + uint32_t disablePageInRVMap; ///< Block display of some page uint32_t socketTimeoutPeriod; ///< socket timeout period in seconds char reserve[256]; ///< reserve }; typedef struct ECOptions ECOptions; +/** + * @enum ECDisablePageInRVMap + * + */ +enum ECDisablePageInRVMap { + EC_DISABLE_PAGEINRVMAP_CALLPHONE = 0x0001, ///< Block call display + EC_DISABLE_PAGEINRVMAP_MUSIC = 0x0002, ///< Block music display + EC_DISABLE_PAGEINRVMAP_MESSAGE = 0x0004, ///< Block message display +}; + /** * @enum ECTransportType * diff --git a/app/carlink/EC/lib/ECTiny.a b/app/carlink/EC/lib/ECTiny.a index 4c5c09a..f237748 100644 Binary files a/app/carlink/EC/lib/ECTiny.a and b/app/carlink/EC/lib/ECTiny.a differ diff --git a/app/carlink/EC/src/__carlink_ec.c b/app/carlink/EC/src/__carlink_ec.c new file mode 100644 index 0000000..b0cc94f --- /dev/null +++ b/app/carlink/EC/src/__carlink_ec.c @@ -0,0 +1,1332 @@ +#include "carlink_ec.h" +#include "os_adapt.h" +#include +#include +#include "FreeRTOS_IP.h" +#include "FreeRTOS_IP_Private.h" +#include "FreeRTOS_Sockets.h" +#include "FreeRTOS_DHCP.h" +#include "FreeRTOS_DHCP_Server.h" +#include +#include +#include +#include +#include +#include +#include +#include "board.h" +#include "timer.h" +#include "iot_wifi.h" +#include "mmcsd_core.h" +#include "carlink_video.h" +#include "carlink_utils.h" +#include "console.h" +#include "fsc_bt.h" +#include "sfud.h" + +//#define CARLINK_EC 1 +#if CARLINK_EC +//------ ECTiny code begin ------ +#define USE_ECTINY_CODE /*测试 ECTiny 代码 */ + +#ifdef USE_ECTINY_CODE +#ifdef __cplusplus +extern "C" { +#endif + +#include "ECTiny.h" +#include "ECTypes.h" + +#if USE_LWIP +#include "ethernet.h" +#include "tcpip.h" +#include "lwip/apps/lwiperf.h" +static struct netif gnetif[4]; +extern err_t dhcp_server_start(struct netif *netif, ip4_addr_t *start, ip4_addr_t *end); + +extern err_t wlan_ethernetif_init(struct netif *netif); +#define lwip_ipv4_addr(addr) ((addr[0]) | (addr[1] << 8) | (addr[2] << 16) | (addr[3] << 24)) + +#endif + +#ifdef __cplusplus +}; +#endif + +#define AP_NO_PASSWD 0 + +#define printf_func printf + +#define FLASH_PRIV_TYPE_BYTE 0x1000 +#define EC_FLASH_OFFSET 0X38000 + + +#define EC_EVENT_BT_CONNECT 0 +#define EC_EVENT_BT_DISCONNECT 1 +#define EC_EVENT_BT_DATA 2 +#define EC_EVENT_CLIENT_DHCP_READY 3 +#define EC_EVENT_BUILD_NET_OK 4 +#define EC_EVENT_WIFI_DISCONNECT 5 +#define EC_EVENT_WIFI_CONNECT 6 + +struct ec_event +{ + int type; + union { + int len; + void* data; + uint8_t para[32]; + }u; +}; + +static TaskHandle_t ec_network_task = NULL; +static TaskHandle_t ec_ap_task = NULL; +static TaskHandle_t ec_sta_task = NULL; +static SemaphoreHandle_t ec_sta_sem = NULL; +static bool g_wifi_sta_inited = false; +static bool mInited = false; +static bool g_bt_mac_ready = false; +static char g_bt_mac[13] = {0}; +static ECConfigHandle mECTinyCfg = NULL; +static IECCallBack* mECTinyCallback = NULL; +static IECVideoPlayer* mECTinyVideoPlayer = NULL; + +static const uint8_t ucIPAddress[4] = {192, 168, 13, 1}; +static const uint8_t ucNetMask[4] = {255, 255, 255, 0}; +static const uint8_t ucGatewayAddress[4] = {0, 0, 0, 0}; +#if !USE_LWIP +static const uint8_t ucDNSServerAddress[4] = {8, 8, 8, 8}; +static const uint8_t ucMACAddress[6] = {0x30, 0x4a, 0x26, 0x78, 0xfd, 0x12}; +#endif +static uint8_t ap_ssid[64] = {"ap63011"}; +static uint8_t ap_passwd[16] = {"88888888"}; +//static int g_dhcp_ready = 0; +static char g_ip_str[32] = {0}; +static uint8_t gphone_type = 0; +static ring_buffer_t ble_ring_data; +static QueueHandle_t ec_event_queue = NULL; +static IECAccessDevice bleDev; +static IECAccessFile accessFile; +ECBTNetInfo gNetDeviceInfo = {0}; +static ECQRInfo qr_info; +extern int wps_connect_done; + + +//extern uint8_t gDayNight; +static void ec_reset_wifi_ap_info(const char *btmac); + + +pthread_mutex_t bufLocker = { \ + .xIsInitialized = pdFALSE, \ + .xMutex = { { 0 } }, \ + .xTaskOwner = NULL, \ + .xAttr = { .iType = 0 } \ + }; + +void onECConnectStatus(ECConnectedStatus status, ECConnectedType type) +{ + printf("\r\nite onECConnectStatus:status=%d,type=%d", status, type); + if (status == EC_CONNECT_STATUS_CONNECT_SUCCEED) + { + //EC_uploadNightModeStatus(gDayNight); + EC_startMirror(); + + //EC_startIperfTcpServer("192.168.43.103",11150); + } +} + +void onMirrorStatus(ECMirrorStatus status) +{ + printf("\r\nonMirrorStatus:status=%d\r\n", status); +} + +void onECStatusMessage(ECStatusMessage status) +{ + printf("\r\nITE onECStatusMessage:status=%d\r\n", status); +} + +void onPhoneAppHUD(const ECNavigationHudInfo *data) +{ + printf("\r\nECNavigationHudInfo\r\n"); +} + +void onPhoneAppMusicInfo(const ECAppMusicInfo *data) +{ + printf("\r\nonPhoneAppMusicInfo\r\n"); +} + +void onPhoneAppInfo(const void *data, uint32_t length) +{ + printf("\r\nonPhoneAppInfo\r\n"); +} + +void onCallAction(ECCallType type, const char *name, const char *number) +{ + printf("\r\nonCallAction\r\n"); +} + +void onBulkDataReceived(const void *data, uint32_t length) +{ + printf("onBulkDataReceived\r\n"); +} + +void onMirrorInfoChanged(const ECVideoInfo *info) +{ + printf("\r\nonMirrorInfoChanged\r\n"); +} + +void onLicenseAuthFail(int32_t errCode, const char *errMsg) +{ + printf("\r\nonLicenseAuthFail\r\n"); +} + +void onLicenseAuthSuccess(int32_t code, const char *msg) +{ + printf("\r\nonLicenseAuthSuccess\r\n"); +} + +void onCarCmdNotified(const ECCarCmd *carCmd) +{ + printf("\r\nonCarCmdNotified\r\n"); +} + +void onInputStart(const ECInputInfo *info) +{ + printf("\r\nonInputStart\r\n"); +} + +void onInputCancel() +{ + printf("\r\nonInputCancel\r\n"); +} + +void onInputSelection(int32_t start, int32_t stop) +{ + printf("\r\nonInputSelection\r\n"); +} + +void onInputText(const char *text) +{ + printf("\r\nonInputText\r\n"); +} + +void onVRTextReceived(const ECVRTextInfo *info) +{ + printf("\r\nonVRTextReceived\r\n"); +} + +void onPageListReceived(const ECPageInfo *pages, int32_t length) +{ + printf("\r\nonPageListReceived\r\n"); +} + +void onPageIconReceived(const ECIconInfo *icons, int32_t length) +{ + printf("\r\nonPageIconReceived\r\n"); +} + +void onWeatherReceived(const char *data, int32_t length) +{ + printf("\r\nonWeatherReceived\r\n"); + +} + +void onVRTipsReceived(const char *data, int32_t length) +{ + printf("\r\nonVRTipsReceived\r\n"); +} + +void start_ap_thd(void* param) { + int channel = 36; +#ifdef AP_USE_AUTO_CHANNEL + int autoChannel = 0; + uint8_t channelNum = sizeof(channel_set)/sizeof(channel_set[0]); + autoChannel = wext_get_auto_chl("wlan0",channel_set, channelNum); + if (autoChannel >= channel_set[0] && autoChannel <= channel_set[channelNum-1]) + { + channel = autoChannel; + } + printf("start_ap_thd channel:%d, autoChannel:%d\n", channel, autoChannel); +#endif +#if !AP_NO_PASSWD + int ret = start_ap(channel, (const char *)ap_ssid, (const char *)ap_passwd, 1); +#else + int ret = start_ap(channel, (const char *)ap_ssid, "", 0); +#endif + printf(" start_ap_thd_ret=%d\r\n",ret); + + vTaskDelete(NULL); +} + +void start_sta_thd(void* param) +{ + xSemaphoreTake(ec_sta_sem, portMAX_DELAY ); + printf("------ start_sta_thd ssid=[%s],pwd=[%s] ------\r\n",gNetDeviceInfo.ssid, gNetDeviceInfo.pwd); + if (!g_wifi_sta_inited) { + printf("start_sta_thd init\r\n"); + g_wifi_sta_inited = true; + wifi_initialize(eWiFiModeStation);// load wifi driver + xSemaphoreGive(ec_sta_sem); + } else { + char ssid[32] = {0}; + char pwd[16] = {0}; + int ret = -1; + strcpy(ssid, gNetDeviceInfo.ssid); + strcpy(pwd, gNetDeviceInfo.pwd); + printf("start_sta_thd start\r\n"); + xSemaphoreGive(ec_sta_sem); + ret = start_sta(ssid, pwd, 1); + if (ret != 0) { + printf("start sta failed\r\n"); + xSemaphoreTake(ec_sta_sem, portMAX_DELAY ); + memset(&gNetDeviceInfo, 0, sizeof(gNetDeviceInfo)); + xSemaphoreGive(ec_sta_sem); + } + } + + vTaskDelete(NULL); +} + +void onRequestBuildNet(const ECBTClientInfo *clientInfo) +{ + printf("onRequestBuildNet-----------------------\r\n"); + printf("TRACE[%s][%d]:",__func__ ,__LINE__); + ECBTRequestBuildNetRly rpy; + memset((void *)&rpy.netDeviceInfo, 0, sizeof(rpy.netDeviceInfo)); + printf("packageName %s\r\n", clientInfo->packageName); + printf("phoneName %s\r\n", clientInfo->phoneName); + printf("phoneID %s\r\n", clientInfo->phoneID); + printf("phoneType %d\r\n", clientInfo->phoneType); + printf("version %d\r\n", clientInfo->version); + printf("TRACE[%s][%d]:",__func__ ,__LINE__); + if (clientInfo->phoneType == 0) {// android + rpy.status = EC_BT_REQUEST_BUILD_NET_USE_PHONE_AP; + gphone_type = 0; + + printf("TRACE[%s][%d]:",__func__ ,__LINE__); + EC_setRequestBuildNetRly(clientInfo->phoneID, &rpy); + printf("TRACE[%s][%d]:",__func__ ,__LINE__); + + printf("TRACE[%s][%d]:",__func__ ,__LINE__); + xSemaphoreTake(ec_sta_sem, portMAX_DELAY ); + g_wifi_sta_inited = false; + memset(&gNetDeviceInfo, 0, sizeof(gNetDeviceInfo)); + xSemaphoreGive(ec_sta_sem); + xTaskCreate(start_sta_thd, "ecThread", 2048 *4, NULL, configMAX_PRIORITIES / 4, &ec_sta_task); + printf("TRACE[%s][%d]:",__func__ ,__LINE__); + + } else if (clientInfo->phoneType == 1) {//iphone + printf("------ onRequestBuildNet begin\r\n"); + gphone_type = 1; + rpy.status = EC_BT_REQUEST_BUILD_NET_NEED_PHONE_BUILD; +#if !AP_NO_PASSWD + strcpy(rpy.netDeviceInfo.ssid, (char *)ap_ssid); + strcpy(rpy.netDeviceInfo.pwd, (char *)ap_passwd); + strcpy(rpy.netDeviceInfo.auth, "WAP2"); +#else + strcpy(rpy.netDeviceInfo.ssid, (char *)ap_ssid); + //strcpy(rpy.netDeviceInfo.pwd, (char *)ap_passwd); + //strcpy(rpy.netDeviceInfo.auth, ""); +#endif + + printf("TRACE[%s][%d]:",__func__ ,__LINE__); + EC_setRequestBuildNetRly(clientInfo->phoneID, &rpy); + printf("TRACE[%s][%d]:",__func__ ,__LINE__); + xTaskCreate(start_ap_thd, "ecThread", 2048 *4, NULL, configMAX_PRIORITIES / 4, &ec_ap_task); + + printf("------ onRequestBuildNet end\r\n"); + } +} + + +void onRequestBuildNetCancel() +{ +} + + +void onPhoneBuildNetFinish(char const *str) +{ + struct ec_event ev = {0}; + ev.type = EC_EVENT_BUILD_NET_OK; + + if (-1 != ev.type && NULL != ec_event_queue) { + xQueueSend(ec_event_queue, &ev, 0); + } +} + +void onPhoneAPInfo(const ECBTNetInfo* netDeviceInfo) +{ + printf("------ onPhoneAPInfo ------\r\n"); + printf("onPhoneAPInfo ssid=[%s]\r\n",netDeviceInfo->ssid); + printf("onPhoneAPInfo pwd=[%s]\r\n",netDeviceInfo->pwd); + printf("onPhoneAPInfo auth=[%s]\r\n",netDeviceInfo->auth); + printf("onPhoneAPInfo mac=[%s]\r\n",netDeviceInfo->mac); + printf("onPhoneAPInfo name=[%s]\r\n",netDeviceInfo->name); + printf("onPhoneAPInfo action=[%u]\r\n",netDeviceInfo->action); + printf("------ onPhoneAPInfo ------\r\n"); + + xSemaphoreTake(ec_sta_sem, portMAX_DELAY ); + if (!memcmp(netDeviceInfo->ssid, gNetDeviceInfo.ssid, strlen(netDeviceInfo->ssid) + 1) && + !memcmp(netDeviceInfo->pwd, gNetDeviceInfo.pwd, strlen(netDeviceInfo->pwd) + 1)) { + xSemaphoreGive(ec_sta_sem); + printf("recv same ssid info \r\n"); + return; + } + + memset(&gNetDeviceInfo,0,sizeof(gNetDeviceInfo)); + strcpy(gNetDeviceInfo.ssid,netDeviceInfo->ssid); + strcpy(gNetDeviceInfo.pwd,netDeviceInfo->pwd); + xSemaphoreGive(ec_sta_sem); + +// static bool bRunOnce = true; +// if(bRunOnce) { + //start_sta(gNetDeviceInfo.ssid, gNetDeviceInfo.pwd, 1); + xTaskCreate(start_sta_thd, "ecThread", 2048 *4, NULL, configMAX_PRIORITIES / 4, NULL); +// bRunOnce = false; +// } +} + + +IECCallBack * registerECCallback() +{ + IECCallBack * callBack = (IECCallBack*)malloc(sizeof(IECCallBack)); + memset(callBack, 0, sizeof(IECCallBack)); + callBack->onECConnectStatus = onECConnectStatus; + callBack->onMirrorStatus = onMirrorStatus; + callBack->onECStatusMessage = onECStatusMessage; + callBack->onPhoneAppHUD = onPhoneAppHUD; + callBack->onPhoneAppInfo = onPhoneAppInfo; + callBack->onPhoneAppMusicInfo = onPhoneAppMusicInfo; + callBack->onCallAction = onCallAction; + callBack->onBulkDataReceived = onBulkDataReceived; + callBack->onMirrorInfoChanged = onMirrorInfoChanged; + callBack->onLicenseAuthFail = onLicenseAuthFail; + callBack->onLicenseAuthSuccess = onLicenseAuthSuccess; + callBack->onCarCmdNotified = onCarCmdNotified; + callBack->onInputStart = onInputStart; + callBack->onInputCancel = onInputCancel; + callBack->onInputSelection = onInputSelection; + callBack->onInputText = onInputText; + callBack->onVRTextReceived = onVRTextReceived; + callBack->onPageListReceived = onPageListReceived; + callBack->onPageIconReceived = onPageIconReceived; + callBack->onWeatherReceived = onWeatherReceived; + callBack->onVRTipsReceived = onVRTipsReceived; + callBack->onRequestBuildNet = onRequestBuildNet; + callBack->onRequestBuildNetCancel = onRequestBuildNetCancel; + callBack->onPhoneBuildNetFinish = onPhoneBuildNetFinish; + callBack->onPhoneAPInfo = onPhoneAPInfo; + + return callBack; +} +void unregisterECCallback(IECCallBack * callBack) +{ + if (callBack) + { + free(callBack); + callBack = NULL; + } +} + +//static uint32_t gts = 0; +// video player begin +void vp_start(int32_t width, int32_t height) +{ + printf("\r\nstart VideoPlayer,width=%d,height=%d\r\n", width, height); + + h264_dec_ctx_init(); + //gts = get_timer(0); + set_carlink_display_state(1); +} + +void vp_stop() +{ + //video_frame_s* frame = NULL; + printf("\r\nstop VideoPlayer\r\n"); + + set_carlink_display_state(0); +} + +void vp_play(const void *data, uint32_t read_len) +{ + //printf("\r\nplay VideoPlayer len = %d ts:%d ms\r\n", read_len, (get_timer(0) -gts) / 1000); + //gts = get_timer(0); + video_frame_s* frame = NULL; + +get_retry: + frame = get_h264_frame_buf(); + if (NULL == frame) { + //printf("h264 frame is empty\r\n"); + vTaskDelay(pdMS_TO_TICKS(10)); + goto get_retry; + //continue; + } + + memcpy(frame->cur, data, read_len); + frame->len = read_len; + + notify_h264_frame_ready(&frame); +} + +IECVideoPlayer * registerVideoPlayer() +{ + IECVideoPlayer* videoPlayer = (IECVideoPlayer*)malloc(sizeof(IECVideoPlayer)); + videoPlayer->start = vp_start; + videoPlayer->stop = vp_stop; + videoPlayer->play = vp_play; + + return videoPlayer; +} + +void unregisterVideoPlayer(IECVideoPlayer* player) +{ + if (player) + { + player->stop(); + + free(player); + player = NULL; + } +} + +// Ôö¼ÓÒÚÁªµÄÊý¾Ý¶Áд½Ó¿Ú +uint32_t ec_access_size(const char* name) +{ + printf_func("TRACE[%s][%d]:name=%s\r\n",__func__ ,__LINE__,name); + + int32_t ret = 0; + char num[5] = {0}; + sfud_flash *sflash = sfud_get_device(0); + if( SFUD_SUCCESS == sfud_read(sflash, EC_FLASH_OFFSET, 4, (uint8_t *)num) ) + { + ret = atoi(num); + if (ret >= FLASH_PRIV_TYPE_BYTE) + { + printf_func("TRACE[%s][%d]:ec_access_size sfud_read error,clear name:%s ret:%d\r\n",__func__ ,__LINE__,name,ret); + ret = 0; + } + } + else + { + ret = 0; + } + + printf_func("TRACE[%s][%d]:name=[%s],ret=%d\r\n",__func__ ,__LINE__,name,ret); + return ret; +} + +static int32_t ec_access_read(const char* name,void *data, uint32_t length, uint32_t offset) +{ + printf_func("TRACE[%s][%d]1:len=%d\r\n", + __func__ ,__LINE__,length); + + int32_t ret = 0; + char num[5] = {0}; + uint8_t* readData = malloc(FLASH_PRIV_TYPE_BYTE); + memset(readData,0,sizeof(FLASH_PRIV_TYPE_BYTE)); + sfud_flash *sflash = sfud_get_device(0); + if( SFUD_SUCCESS == sfud_read(sflash, EC_FLASH_OFFSET, FLASH_PRIV_TYPE_BYTE, readData) ) + { + memcpy(num,readData,4); + ret = atoi(num); + if(ret == length) + { + memcpy(data,readData+4,length); + } + else + { + ret = 0; + } + } + + printf_func("TRACE[%s][%d]2:data=[%s],ret=%d\r\n", + __func__ ,__LINE__,(char*)data,ret); + + free(readData); + + return ret; +} + +static int32_t ec_access_write(const char* name,void *data, uint32_t length, uint32_t offset) +{ + printf_func("TRACE[%s][%d]1:data=[%s],len=%d\r\n", + __func__ ,__LINE__,(char*)data,length); + + int32_t ret = 0; + char* writeData = malloc(length+4); + sprintf(writeData,"%04d%s",length, (char*)data); + sfud_flash *sflash = sfud_get_device(0); + sfud_erase(sflash, EC_FLASH_OFFSET, FLASH_PRIV_TYPE_BYTE); + if( SFUD_SUCCESS == sfud_erase_write(sflash, EC_FLASH_OFFSET, length+4, (void*)writeData) ) + { + ret = length; + } + + free(writeData); + printf_func("TRACE[%s][%d]2:ret=%d\r\n", + __func__ ,__LINE__,ret); + return ret; +} + +static void ec_access_clear(const char* name) +{ + sfud_flash *sflash = sfud_get_device(0); + sfud_erase(sflash, EC_FLASH_OFFSET, FLASH_PRIV_TYPE_BYTE); + printf_func("TRACE[%s][%d]1:name=[%s]\r\n", + __func__ ,__LINE__,name); +} + +void ec_wifi_event_handler( WIFIEvent_t * xEvent ) +{ + WIFIEventType_t xEventType = xEvent->xEventType; + + wps_connect_done = 0; + + if (0) { + } else if (eWiFiEventConnected == xEventType) {// meter is sta + printf("\r\n The meter is connected to ap \r\n"); + struct ec_event ev = {0}; + ev.type = EC_EVENT_WIFI_CONNECT; + + if (-1 != ev.type && NULL != ec_event_queue) { + xQueueSend(ec_event_queue, &ev, 0); + } + } else if (eWiFiEventDisconnected == xEventType) {// meter is sta + printf("\r\n The meter is disconnected from ap \r\n"); + struct ec_event ev = {0}; + ev.type = EC_EVENT_WIFI_DISCONNECT; + + if (-1 != ev.type && NULL != ec_event_queue) { + xQueueSend(ec_event_queue, &ev, 0); + } + } else if (eWiFiEventAPStationConnected == xEventType) {// meter is ap + printf("\r\n The meter in AP is connected by sta %s \r\n", xEvent->xInfo.xAPStationConnected.ucMac); + } else if (eWiFiEventAPStationDisconnected == xEventType) {// meter is ap + printf("\r\n The sta %s is disconnected from the meter \r\n", xEvent->xInfo.xAPStationDisconnected.ucMac); + } +} + +#if ( ipconfigUSE_DHCP_HOOK != 0 ) +eDHCPCallbackAnswer_t xApplicationDHCPHook( eDHCPCallbackPhase_t eDHCPPhase, + uint32_t ulIPAddress ) +{ + eDHCPCallbackAnswer_t eReturn; + struct ec_event ev = {0}; + + sprintf(g_ip_str, "%d.%d.%d.%d\r\n", (ulIPAddress >> 0) & 0xFF, + (ulIPAddress >> 8) & 0xFF, (ulIPAddress >> 16) & 0xFF, (ulIPAddress >> 24) & 0xFF); + printf("\r\n eDHCPPhase:%d ulIPAddress:%s state:%d \r\n", eDHCPPhase, g_ip_str, getDhcpClientState()); + if (getDhcpClientState() == 0) + return eDHCPStopNoChanges; + + switch( eDHCPPhase ) + { + case eDHCPPhaseFinished: + //g_dhcp_ready = 1; + ev.type = EC_EVENT_CLIENT_DHCP_READY; + + if (-1 != ev.type && NULL != ec_event_queue) { + xQueueSend(ec_event_queue, &ev, 0); + } + eReturn = eDHCPContinue; + break; + case eDHCPPhasePreDiscover : + eReturn = eDHCPContinue; + break; + + case eDHCPPhasePreRequest : + eReturn = eDHCPContinue; + break; + case 0xff: + WIFI_Off(); + start_ap_thd(NULL); + default : + eReturn = eDHCPContinue; + break; + } + + return eReturn; +} +#endif +int32_t ec_ble_write(void * data, uint32_t len); +int32_t ec_ble_read(void * data, uint32_t len); +int32_t ec_ble_open(); +void ec_ble_close(); +#if defined(AWTK) +extern char strQrText[200]; +extern char UI_uuid[32]; +#else +char strQrText[200]; +char key_value; +#endif +void* initECTiny(void* param) +{ + char uuid[32] = {0}; + if (mInited) + { + printf("\r\n------ ECTiny has inited ------\r\n"); + } + else + { + printf("\r\n-------- Sample begin----------\r\n"); + + printf("\r\n1.inti ECTiny config\r\n"); + mECTinyCfg = EC_createECConfig(); + + while(!g_bt_mac_ready) { + vTaskDelay(pdMS_TO_TICKS(10)); + } + { + char ap_prefix[5] = {0}; + memcpy(ap_prefix, g_bt_mac + 8, 4); + ec_reset_wifi_ap_info(ap_prefix); + printf("ap_ssid:%s\r\n", ap_ssid); + } + sprintf(uuid, "CARBIT%s", g_bt_mac); + printf("carbit uuid :%s\r\n", uuid); + strcpy(UI_uuid,uuid); + EC_setBaseConfig(mECTinyCfg, uuid, "V0.0.1", "B:/"); //"CARBIT00000001" + + printf("\r\n2.register ECTiny callback functions\r\n"); + mECTinyCallback = registerECCallback(); + + printf("\r\n3.register ECTiny Video player\r\n"); + mECTinyVideoPlayer = registerVideoPlayer(); + + printf("\r\n4.set Mirror config\r\n"); + ECMirrorConfig mirrorCfg; + memset(&mirrorCfg, 0, sizeof(ECMirrorConfig)); + + //mirrorCfg.width = 1280; + //mirrorCfg.height = 480; + mirrorCfg.width = get_carlink_video_width(); + mirrorCfg.height = get_carlink_video_height(); + mirrorCfg.height = ((mirrorCfg.height + 0xf) & (~0xf)); + + mirrorCfg.touchMode = 2; + mirrorCfg.type = EC_VIDEO_TYPE_H264; + mirrorCfg.quality = 4 * 1024 * 1024; + mirrorCfg.capScreenMode = 0x08; + + printf("\r\n5.init ECTiny\r\n"); + + accessFile.size = ec_access_size; + accessFile.read = ec_access_read; + accessFile.write = ec_access_write; + accessFile.clear = ec_access_clear; + EC_bindAccessFile(&accessFile); + + //EC_bindAccessFile(&license2File); + EC_initialize(mECTinyCfg, mECTinyCallback); + + printf("\r\n6.set log info\r\n"); + EC_setLogInfo(EC_LOG_LEVEL_INFO, EC_LOG_OUT_STD, NULL, EC_LOG_MODULE_SDK | EC_LOG_MODULE_APP); + + printf("\r\n7.set Mirror config\r\n"); + EC_setMirrorConfig(&mirrorCfg); + EC_setVideoPlayer(mECTinyVideoPlayer); + + printf("\r\n8.start EC work!\r\n"); + EC_start(); + + printf("\r\n9.bindBtDevice!\r\n"); + + //sleep(1); + //EC_bindWIFIDevice(EC_TRANSPORT_ANDROID_WIFI, "192.168.43.1"); + //EC_bindWIFIDevice(EC_TRANSPORT_IOS_WIFI_APP, "192.168.13.20"); + +// ECQRInfo info; +// memset(&info,0, sizeof(ECQRInfo)); +// strcpy(info.ssid,"QJ501"); +// strcpy(info.pwd,"88888888"); +// strcpy(info.auth,"WPA"); +// info.action = EC_QR_ACTION_WIFI_AP_MODE_ACCESS_INTERNET; +// +// EC_generateQRCodeUrl(&info); + + mInited = true; + +// while (1) { +// sleep(20); +// } + } + + + printf("------ initECTiny end ------\n"); + if (1) { + /*ECQRInfo qr_info; + char ap_prefix[32] = {0}; + memset(&qr_info, 0, sizeof(ECQRInfo)); + qr_info.action = EC_QR_ACTION_WIFI_P2P_MODE | EC_QR_ACTION_WIFI_AP_MODE_CUSTOMIZED; + memcpy(ap_prefix, g_bt_mac + 8, 4); + sprintf(qr_info.name, "ark630hv100_p2p_%s", ap_prefix); + sprintf(qr_info.ssid, "ark630hv100_%s", ap_prefix); + sprintf(qr_info.pwd, "12345678"); + sprintf(qr_info.auth, "WPA-PSK");*/ + const char *UrlData = EC_generateQRCodeUrl(&qr_info); + printf("++++++++++++++++++++++UrlData:%s+++++++++++++++++++++++++++\n", UrlData); + strcpy(strQrText, UrlData); + } + return NULL; +} +#endif + +//------ ECTiny code end ------ + + +void* thdPingPhone(void* param) +{ + int ret = 0; + int count = 0; + uint32_t IPAddress = (20 << 24) | (13 << 16) | (168 << 8) | (192 << 0); + while(true) { + ret = FreeRTOS_SendPingRequest(IPAddress, 8, 1000); + printf("[TRACE][%s][%d]:count=%d,ping ret=%d\n",__FUNCTION__,__LINE__,count++,ret); + sleep(2); + } +} + +#if 0 +void testThread() +{ + pthread_t tid; + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_create(&tid, &attr, initECTiny, NULL); + pthread_attr_destroy(&attr); +} +#else +int mmcsd_wait_sdio_ready(int32_t timeout); +static void ec_start_wlan(); +static int carlink_ec_network_init() +{ + BaseType_t ret = -1; +#if !USE_LWIP +#else + +#endif + return (int)ret; +} + +#if USE_LWIP +#include "dhcp.h" +static int lwip_tcpip_init_done_flag = 0; +static void tcpip_init_done(void *arg) +{ + (void)arg; + lwip_tcpip_init_done_flag = 1; +} + +void lwiperf_report_cb_impl(void *arg, enum lwiperf_report_type report_type, + const ip_addr_t* local_addr, u16_t local_port, const ip_addr_t* remote_addr, u16_t remote_port, + u32_t bytes_transferred, u32_t ms_duration, u32_t bandwidth_kbitpsec) +{ + (void)arg; + + printf("lwiperf_report_cb_impl bytes:%d %d ms \r\n", bytes_transferred, ms_duration); +} + +struct netif *get_lwip_net_interface() +{ + return &gnetif[0]; +} + + +#endif + +void vIPerfInstall( void ); +static void ec_start_wlan() +{ +#if USE_LWIP + const char *customer = "ark630hv100"; + char ap_prefix[5] = {0}; + //char dev_name[32] = {0}; + //char ssid[32] = {0}; + + ip4_addr_t ip_addr; + ip4_addr_t netmask; + ip4_addr_t gw; + ip4_addr_t dhcp_addr_start; + ip4_addr_t dhcp_addr_end; + + while(!g_bt_mac_ready) { + vTaskDelay(pdMS_TO_TICKS(10)); + } + memcpy(ap_prefix, g_bt_mac + 8, 4); + //sprintf(dev_name, "ark630hv100_p2p_%s", ap_prefix); + //sprintf(ssid, "ark630hv100_%s", ap_prefix); + + memset(&qr_info, 0, sizeof(ECQRInfo)); + qr_info.action = EC_QR_ACTION_WIFI_P2P_MODE | EC_QR_ACTION_WIFI_AP_MODE_CUSTOMIZED; + memcpy(ap_prefix, g_bt_mac + 8, 4); + sprintf(qr_info.name, "DIRECT-%s_p2p_%s", customer, ap_prefix); + sprintf(qr_info.ssid, "DIRECT-%s_%s", customer, ap_prefix); + sprintf(qr_info.pwd, "12345678"); + sprintf(qr_info.auth, "WPA-PSK"); + printf("dev_name:%s ssid:%s\r\n", qr_info.name, qr_info.ssid); + + start_p2p(qr_info.name, qr_info.ssid, qr_info.pwd); + //start_sta("Cym-ipod", "CYm-8875x", 1); + + ip_addr.addr = lwip_ipv4_addr(ucIPAddress); + netmask.addr = lwip_ipv4_addr(ucNetMask); + gw.addr = lwip_ipv4_addr(ucGatewayAddress); + tcpip_init(tcpip_init_done, NULL); + netif_add(&gnetif[0], +#if LWIP_IPV4 + &ip_addr, &netmask, &gw, +#endif + NULL, wlan_ethernetif_init, tcpip_input); + lwip_tcpip_init_done_flag = 1; + netif_set_default(&gnetif[0]); +#if 1 + uint8_t addr_start[4] = {192, 168, 13, 20}; + uint8_t addr_end[4] = {192, 168, 13, 30}; + dhcp_addr_start.addr = lwip_ipv4_addr(addr_start); + dhcp_addr_end.addr = lwip_ipv4_addr(addr_end); + dhcp_server_start(&gnetif[0], &dhcp_addr_start, &dhcp_addr_end); +#else + dhcpd_start("wi"); +#endif + //start_p2p(qr_info.name, qr_info.ssid, qr_info.pwd); + netif_set_up(&gnetif[0]); + + //dhcp_start(&gnetif[0]); + + lwiperf_start_tcp_server_default(lwiperf_report_cb_impl, NULL); +#else + char ap_prefix[5] = {0}; + while(!g_bt_mac_ready) { + vTaskDelay(pdMS_TO_TICKS(10)); + } + memcpy(ap_prefix, g_bt_mac + 8, 4); + memset(&qr_info, 0, sizeof(ECQRInfo)); + qr_info.action = EC_QR_ACTION_WIFI_P2P_MODE | EC_QR_ACTION_WIFI_AP_MODE_CUSTOMIZED; + memcpy(ap_prefix, g_bt_mac + 8, 4); + sprintf(qr_info.name, "DIRECT-ark630hv100_p2p_%s", ap_prefix); + sprintf(qr_info.ssid, "DIRECT-ark630hv100_%s", ap_prefix); + sprintf(qr_info.pwd, "12345678"); + sprintf(qr_info.auth, "WPA-PSK"); + printf("dev_name:%s ssid:%s\r\n", qr_info.name, qr_info.ssid); + + BaseType_t ret = FreeRTOS_IPInit(ucIPAddress, ucNetMask, ucGatewayAddress,ucDNSServerAddress, ucMACAddress); + + //start_ap(36, qr_info.ssid, qr_info.pwd, 1); + //start_p2p(qr_info.name, qr_info.ssid, qr_info.pwd); + vIPerfInstall(); +#endif +} + +#if USE_LWIP +static void dump_ip_addr(const char *msg, const ip_addr_t *server_addr) +{ + printf("%s %d.%d.%d.%d \r\n", msg, + ip4_addr1_16(ip_2_ip4(server_addr)), ip4_addr2_16(ip_2_ip4(server_addr)), ip4_addr3_16(ip_2_ip4(server_addr)), ip4_addr4_16(ip_2_ip4(server_addr))); +} + + +static void dhcp_client_status_callback(struct netif *netif, int status, const ip_addr_t *server_addr) +{ + if (&gnetif[0] == netif) { + dump_ip_addr("dhcp server ip :", (const ip_addr_t *)server_addr); + dump_ip_addr("dhcp client ip :", (const ip_addr_t *)&netif->ip_addr); + dump_ip_addr("dhcp client netmask:", (const ip_addr_t *)&netif->netmask); + dump_ip_addr("dhcp client gw :", (const ip_addr_t *)&netif->gw); + } +} + +int start_sta_ext(const char* ssid, const char* passwd, char need_passwd) +{ + int ret = -1; + ip4_addr_t ip_addr; + ip4_addr_t netmask; + ip4_addr_t gw; + + ret = start_sta(ssid, passwd, need_passwd); + if (ret != 0) { + printf("start wifi sta failed\r\n"); + return ret; + } + + if (lwip_tcpip_init_done_flag) { + netif_remove(&gnetif[0]); + netif_add(&gnetif[0], +#if LWIP_IPV4 + &ip_addr, &netmask, &gw, +#endif + NULL, wlan_ethernetif_init, tcpip_input); + netif_set_default(&gnetif[0]); + dhcp_regisger_status_callback(dhcp_client_status_callback); + netif_set_up(&gnetif[0]); + dhcp_start(&gnetif[0]); + } + + return ret; +} + +int __restart_p2p(const char *dev_name, const char *ssid, const char *passwd) +{ + int ret = -1; + ip4_addr_t ip_addr; + ip4_addr_t netmask; + ip4_addr_t gw; + + ip_addr.addr = lwip_ipv4_addr(ucIPAddress); + netmask.addr = lwip_ipv4_addr(ucNetMask); + gw.addr = lwip_ipv4_addr(ucGatewayAddress); + + ret = start_p2p(dev_name, ssid, passwd); + if (ret != 0) { + printf("restart wifi p2p failed\r\n"); + return ret; + } + if (!lwip_tcpip_init_done_flag) { + printf("lwip tcpip is not inited\r\n"); + return ret; + } + + dhcp_stop(&gnetif[0]); + netif_remove(&gnetif[0]); + + netif_add(&gnetif[0], +#if LWIP_IPV4 + &ip_addr, &netmask, &gw, +#endif + NULL, wlan_ethernetif_init, tcpip_input); + + netif_set_up(&gnetif[0]); + ret = 0; + return ret; +} + +int restart_p2p() +{ + if (!g_bt_mac_ready) { + return -1; + } + return __restart_p2p(qr_info.name, qr_info.ssid, qr_info.pwd); +} +#endif + +static void ec_reset_wifi_ap_info(const char *btmac) +{ + memset(ap_ssid, 0, sizeof(ap_ssid)); + sprintf((char *)ap_ssid, "AP630_%s", btmac); +} + +static void ec_bt_callback(char * cAtStr) +{ + char* cmd_para = NULL; + //printf("\r\nfsc_bt_callback_ec %s\r\n", cAtStr); + static struct ec_event ev = {0}; + static char m_tmp_buf[64]; + memset((void*)&ev, 0, sizeof(ev)); + ev.type = -1; + + if (0) { + } else if (0 == strncmp(cAtStr, "+GATTDATA=", 10)) { + //printf("fsc_bt_callback_ec=[%s]\r\n", cAtStr); + char ble_buf[256] = {0}; + + pthread_mutex_lock(&bufLocker); + int data_str_len = (strlen(cAtStr) - 10), data_len; + + ev.type = EC_EVENT_BT_DATA; + cmd_para = cAtStr + 10; + data_len = data_str_len / 2; + while (ring_buffer_get_bytes_free(&ble_ring_data) < data_len) { + pthread_mutex_unlock(&bufLocker); + vTaskDelay(pdMS_TO_TICKS(10)); + pthread_mutex_lock(&bufLocker); + } + string2hex(cmd_para, data_str_len, ble_buf, data_len); + ring_buffer_write(&ble_ring_data, (uint8_t *)ble_buf, data_len); + pthread_mutex_unlock(&bufLocker); + + } else if (0 == strncmp(cAtStr, "+GATTSTAT=1",11)) { + ev.type = EC_EVENT_BT_DISCONNECT; + // btEvent = EC_EVENT_BT_DISCONNECT; + printf("TRACE[%s][%d]:EC_EVENT_BT_DISCONNECT\r\n",__func__ ,__LINE__); + } else if (0 == strncmp(cAtStr, "+GATTSTAT=3",11)) { + printf("TRACE[%s][%d]:EC_EVENT_BT_CONNECT\r\n",__func__ ,__LINE__); + ev.type = EC_EVENT_BT_CONNECT; + } else if (0 == strncmp(cAtStr, "+ADDR=", 6)) { + char cmd_str[64] = {0}; + sprintf(cmd_str, "AT+NAME=EC_%s\r\n", (cAtStr + 6)); + //ec_reset_wifi_ap_info(cAtStr + 6); + printf("ADDR:%s\r\n", cAtStr + 6); + console_send_atcmd(cmd_str, strlen(cmd_str));//get mac addr + memset(cmd_str, 0, sizeof(cmd_str)); + sprintf(cmd_str, "AT+LENAME=EC_%s\r\n", (cAtStr + 6)); + console_send_atcmd(cmd_str, strlen(cmd_str));//get mac addr + g_bt_mac_ready = true; + memcpy(g_bt_mac, (cAtStr + 6), 12); + } else if (0 == strncmp(cAtStr, "+VER", 4)) { + char* cmd = "AT+ADDR\r\n"; + console_send_atcmd(cmd, strlen(cmd));//get mac addr + } else if (0 == strncmp(cAtStr, "+NAME=", 6)) { + char cmd_str[64] = {0}; + sprintf(cmd_str, "AT+LEADDR\r\n"); + console_send_atcmd(cmd_str, strlen(cmd_str));//get LE addr + } else if (0 == strncmp(cAtStr, "+LEADDR=", 6)) { + char hexMacAddr[6] = {0}; + memset(m_tmp_buf, 0, sizeof(m_tmp_buf)); + string2hex(&cAtStr[8], 12, hexMacAddr, sizeof(hexMacAddr)); + //memcpy(addr, &cAtStr[8], 12); + sprintf(m_tmp_buf, "AT+ADVDATA=%s\r\n", hexMacAddr); + console_send_atcmd(m_tmp_buf, 19); + } + else if (0 == strncmp(cAtStr, "+GATTSENT=", 10)) { + + return; + } + + if (-1 != ev.type && NULL != ec_event_queue) { + xQueueSend(ec_event_queue, &ev, 0); + } +} + +int32_t ec_ble_read(void * data, uint32_t len) +{ + pthread_mutex_lock(&bufLocker); + int data_len = 0; + + data_len = ring_buffer_get_bytes_used(&ble_ring_data); + + if (data_len > len) { + data_len = len; + } + if (data_len > 0) { + ring_buffer_read(&ble_ring_data, (uint8_t*)data, data_len); + pthread_mutex_unlock(&bufLocker); + return data_len; + } + pthread_mutex_unlock(&bufLocker); + return 0; +} + +static int ble_write(unsigned char *data, int len) +{ + uint8_t *at_str = NULL, *at_str_ptr = NULL; + uint8_t *at_prefix = "AT+GATTSEND="; + int prefix_len = strlen((char *)at_prefix); + int cmd_len = (len * 2 + prefix_len + 2); + + at_str = (uint8_t *)pvPortMalloc(cmd_len+1); + memset(at_str,0,cmd_len+1); + if (NULL == at_str) + return -1; + at_str_ptr = at_str; + sprintf((char*)at_str_ptr, "%s", (char*)at_prefix); + at_str_ptr += prefix_len; + hex2str(data, len, (char *)at_str_ptr); + at_str_ptr += (len * 2); + *at_str_ptr++ = '\r'; + *at_str_ptr++ = '\n'; + console_send_atcmd((char *)at_str, cmd_len); + vPortFree(at_str); + return len; +} + +int32_t ec_ble_write(void *data, uint32_t len) +{ + int send = 0; + int offset = 0; + do + { + // 把data每次按10个字节发送。ble_write 中组合之后长度变成34. 10 * 2 + 12 + 2 + send = (len - offset) > 10 ? 10 : (len - offset); + offset += ble_write((unsigned char *)data + offset, send); + //usleep(2000*1000); + } while (offset < len); + + return offset; +} + +int32_t ec_ble_open() +{ + return 0; +} + +void ec_ble_close() +{ + +} + +static BaseType_t wifi_init() +{ + int status; + WIFI_Context_init(); + WIFI_RegisterEvent(eWiFiEventMax, ec_wifi_event_handler); + for (;;) { + status = mmcsd_wait_sdio_ready((int32_t)portMAX_DELAY); + if (status == MMCSD_HOST_PLUGED) { + printf("detect sdio device\r\n"); + break; + } + } + return 0; +} + +static void setNetInterfaceInfo() +{ + struct ECNetInterfaceInfo info; + uint32_t ulIPAddress = 0, netMask = 0; + + memset(&info, 0, sizeof(info)); + strcpy(info.name, "wlan0"); + if (gphone_type == 1) + ulIPAddress = (ucIPAddress[0]) | (ucIPAddress[1] << 8) | (ucIPAddress[2] << 16) | (ucIPAddress[3] << 24); + else + ulIPAddress = FreeRTOS_GetIPAddress(); + sprintf(info.ip, "%d.%d.%d.%d", (ulIPAddress >> 0) & 0xFF, + (ulIPAddress >> 8) & 0xFF, (ulIPAddress >> 16) & 0xFF, (ulIPAddress >> 24) & 0xFF); + if (gphone_type == 1) + netMask = (ucNetMask[0]) | (ucNetMask[1] << 8) | (ucNetMask[2] << 16) | (ucNetMask[3] << 24); + else + netMask = FreeRTOS_GetNetmask(); + sprintf(info.mask, "%d.%d.%d.%d", (netMask >> 0) & 0xFF, + (netMask >> 8) & 0xFF, (netMask >> 16) & 0xFF, (netMask >> 24) & 0xFF); + EC_setNetInterfaceInfo(&info, 1); +} + +static void taskECTinyWrapper(void* param) +{ + struct ec_event ev; + int android_ap_connect_flag = 0; + int apple_connect_flag = 0; + + while(1) { + if (xQueueReceive(ec_event_queue, &ev, portMAX_DELAY) != pdPASS) { + printf("%s xQueueReceive err!\r\n", __func__); + continue; + } + + //printf("TRACE[%s][%d]:ec_event_queue,get event:%d\r\n", __func__, __LINE__, ev.type); + + switch (ev.type) { + case -1: { + continue; + } + case EC_EVENT_BT_CONNECT: { + printf("TRACE[%s][%d]:EC_bindBTDevice_1\r\n",__func__ ,__LINE__); + bleDev.open = ec_ble_open; + bleDev.close = ec_ble_close; + bleDev.read = ec_ble_read; + bleDev.write = ec_ble_write; + EC_bindBTDevice(&bleDev); + printf("TRACE[%s][%d]:EC_bindBTDevice_2\r\n",__func__ ,__LINE__); + + break; + } + case EC_EVENT_BT_DISCONNECT: { + break; + } + case EC_EVENT_BT_DATA: { + + break; + } + // wifi is station, dhcp ready + case EC_EVENT_CLIENT_DHCP_READY: { + if (gphone_type == 1) { + if(apple_connect_flag == 1) { + printf("TRACE[%s][%d]:dhpc has been ready\r\n",__func__ ,__LINE__); + break; + } + apple_connect_flag = 1; + } + ECNetWorkInfo netInfo = {0}; + netInfo.state = EC_WIFI_STATE_CONNECTED; + EC_notifyWifiStateChanged(EC_WIFI_STATE_CHANGED_ACTION, &netInfo); + setNetInterfaceInfo(); + printf("TRACE[%s][%d]:EC_EVENT_CLIENT_DHCP_READY\r\n",__func__ ,__LINE__); + + break; + } + case EC_EVENT_BUILD_NET_OK: { + if (gphone_type == 1) + { + ECNetWorkInfo netInfo = {0}; + netInfo.state = EC_WIFI_STATE_CONNECTED; + EC_notifyWifiStateChanged(EC_WIFI_STATE_CHANGED_ACTION, &netInfo); + apple_connect_flag = 0; + } + + setNetInterfaceInfo(); + printf("TRACE[%s][%d]:EC_EVENT_BUILD_NET_OK--------------\r\n", __func__, __LINE__); + break; + } + case EC_EVENT_WIFI_DISCONNECT: + { + if (android_ap_connect_flag == 1) { + ECNetWorkInfo netInfo = {0}; + netInfo.state = EC_WIFI_STATE_DISCONNECTED; + EC_notifyWifiStateChanged(EC_WIFI_STATE_CHANGED_ACTION, &netInfo); + printf("TRACE[%s][%d]:EC_EVENT_WIFI_DISCONNECT--------------\r\n", __func__, __LINE__); + } + android_ap_connect_flag = 0; + break; + } + case EC_EVENT_WIFI_CONNECT: + { + android_ap_connect_flag = 1; + printf("TRACE[%s][%d]:EC_EVENT_WIFI_CONNECT--------------\r\n", __func__, __LINE__); + break; + } + default: + printf("TRACE[%s][%d]:error event:%d\r\n", __func__, __LINE__, ev.type); + } + } + + vTaskDelete(NULL); +} + +void testThread() +{ + wifi_init(); + ring_buffer_init(&ble_ring_data, 256); + ec_event_queue = xQueueCreate(1, sizeof(struct ec_event)); + if (ec_sta_sem == NULL) + ec_sta_sem = xSemaphoreCreateMutex(); + carlink_ec_network_init(); + console_register_cb(NULL, ec_bt_callback); + xTaskCreate(taskECTinyWrapper, "ecThread", 2048 *4, NULL, configMAX_PRIORITIES / 4, &ec_network_task); + fsc_bt_main();printf("%s:%d\r\n", __func__, __LINE__); + ec_start_wlan(); + initECTiny(NULL); +} +#endif + +static void taskInitCarlink(void* param) +{ + testThread(); + vTaskDelete(NULL); +} + +int carlink_ec_init(int argc,char ** argv) +{ + printf("------ TestECTiny begin ------\n"); + carlink_ey_video_init(); +#if 0 + testThread(); +#else + /* 启动线程初始化: + * 1. initECTiny初始化延时过长,导致开机动画和UI显示切换之间存在黑屏时间,因此在线程中初始化 + * 2. wifi模块未贴或异常时,wifi_init函数无法返回,导致UI无法正常显示。 + */ + xTaskCreate(taskInitCarlink, "initThread", 2048 *4, NULL, configMAX_PRIORITIES / 4, NULL); +#endif + printf("------ TestECTiny end ------\n"); + + return 0; +} +#else +int carlink_ec_init(int argc,char ** argv) +{ + (void)argc; + (void)argv; + return 0; +} +#endif + diff --git a/app/carlink/EC/src/carlink_ec.c b/app/carlink/EC/src/carlink_ec.c index d4fccdb..a742699 100644 --- a/app/carlink/EC/src/carlink_ec.c +++ b/app/carlink/EC/src/carlink_ec.c @@ -2,127 +2,53 @@ #include "os_adapt.h" #include #include -#include "FreeRTOS_IP.h" -#include "FreeRTOS_IP_Private.h" -#include "FreeRTOS_Sockets.h" -#include "FreeRTOS_DHCP.h" -#include "FreeRTOS_DHCP_Server.h" -#include #include #include #include -#include #include #include #include "board.h" #include "timer.h" -#include "iot_wifi.h" -#include "mmcsd_core.h" -#include "carlink_video.h" -#include "carlink_utils.h" -#include "console.h" -#include "fsc_bt.h" #include "sfud.h" +#include "carlink_common.h" +#include "carlink_video.h" -//#define CARLINK_EC 1 #if CARLINK_EC -//------ ECTiny code begin ------ -#define USE_ECTINY_CODE /*测试 ECTiny 代码 */ - -#ifdef USE_ECTINY_CODE -#ifdef __cplusplus -extern "C" { -#endif - #include "ECTiny.h" #include "ECTypes.h" -#if USE_LWIP -#include "ethernet.h" -#include "tcpip.h" -#include "lwip/apps/lwiperf.h" -static struct netif gnetif[4]; -extern err_t dhcp_server_start(struct netif *netif, ip4_addr_t *start, ip4_addr_t *end); - -extern err_t wlan_ethernetif_init(struct netif *netif); -#define lwip_ipv4_addr(addr) ((addr[0]) | (addr[1] << 8) | (addr[2] << 16) | (addr[3] << 24)) - -#endif - -#ifdef __cplusplus -}; -#endif - -#define AP_NO_PASSWD 0 +#define ENABLE_EC_DASHCAM 0 #define printf_func printf -#define FLASH_PRIV_TYPE_BYTE 0x1000 -#define EC_FLASH_OFFSET 0X38000 +#define FLASH_PRIV_TYPE_BYTE 0x1000 +#define EC_FLASH_OFFSET 0X38000 -#define EC_EVENT_BT_CONNECT 0 -#define EC_EVENT_BT_DISCONNECT 1 -#define EC_EVENT_BT_DATA 2 -#define EC_EVENT_CLIENT_DHCP_READY 3 -#define EC_EVENT_BUILD_NET_OK 4 -#define EC_EVENT_WIFI_DISCONNECT 5 -#define EC_EVENT_WIFI_CONNECT 6 - -struct ec_event -{ - int type; - union { - int len; - void* data; - uint8_t para[32]; - }u; -}; - -static TaskHandle_t ec_network_task = NULL; -static TaskHandle_t ec_ap_task = NULL; -static TaskHandle_t ec_sta_task = NULL; -static SemaphoreHandle_t ec_sta_sem = NULL; -static bool g_wifi_sta_inited = false; static bool mInited = false; -static bool g_bt_mac_ready = false; -static char g_bt_mac[13] = {0}; static ECConfigHandle mECTinyCfg = NULL; static IECCallBack* mECTinyCallback = NULL; static IECVideoPlayer* mECTinyVideoPlayer = NULL; - -static const uint8_t ucIPAddress[4] = {192, 168, 13, 1}; -static const uint8_t ucNetMask[4] = {255, 255, 255, 0}; -static const uint8_t ucGatewayAddress[4] = {0, 0, 0, 0}; -#if !USE_LWIP -static const uint8_t ucDNSServerAddress[4] = {8, 8, 8, 8}; -static const uint8_t ucMACAddress[6] = {0x30, 0x4a, 0x26, 0x78, 0xfd, 0x12}; -#endif -static uint8_t ap_ssid[64] = {"ap63011"}; -static uint8_t ap_passwd[16] = {"88888888"}; -//static int g_dhcp_ready = 0; -static char g_ip_str[32] = {0}; -static uint8_t gphone_type = 0; -static ring_buffer_t ble_ring_data; -static QueueHandle_t ec_event_queue = NULL; -static IECAccessDevice bleDev; static IECAccessFile accessFile; -ECBTNetInfo gNetDeviceInfo = {0}; static ECQRInfo qr_info; extern int wps_connect_done; +static bool g_ec_disable = false; + +#if ENABLE_EC_DASHCAM +int start_http_camera(); +void stop_http_camera(); +#endif -//extern uint8_t gDayNight; -static void ec_reset_wifi_ap_info(const char *btmac); +static void ec_notify_event(struct carlink_event *ev, enum CARLINK_EVENT_TYPE type, bool disable_filter) +{ + ev->link_type = CARLINK_ECLINK_WIRELESS; + ev->disable_filter = disable_filter; + ev->type = type; + carlink_notify_event(ev); +} -pthread_mutex_t bufLocker = { \ - .xIsInitialized = pdFALSE, \ - .xMutex = { { 0 } }, \ - .xTaskOwner = NULL, \ - .xAttr = { .iType = 0 } \ - }; - void onECConnectStatus(ECConnectedStatus status, ECConnectedType type) { printf("\r\nite onECConnectStatus:status=%d,type=%d", status, type); @@ -138,6 +64,11 @@ void onECConnectStatus(ECConnectedStatus status, ECConnectedType type) void onMirrorStatus(ECMirrorStatus status) { printf("\r\nonMirrorStatus:status=%d\r\n", status); + +#if ENABLE_EC_DASHCAM + if (status == EC_MIRROR_STATUS_MIRROR_STARTED) + start_http_camera(); +#endif } void onECStatusMessage(ECStatusMessage status) @@ -236,57 +167,6 @@ void onVRTipsReceived(const char *data, int32_t length) printf("\r\nonVRTipsReceived\r\n"); } -void start_ap_thd(void* param) { - int channel = 36; -#ifdef AP_USE_AUTO_CHANNEL - int autoChannel = 0; - uint8_t channelNum = sizeof(channel_set)/sizeof(channel_set[0]); - autoChannel = wext_get_auto_chl("wlan0",channel_set, channelNum); - if (autoChannel >= channel_set[0] && autoChannel <= channel_set[channelNum-1]) - { - channel = autoChannel; - } - printf("start_ap_thd channel:%d, autoChannel:%d\n", channel, autoChannel); -#endif -#if !AP_NO_PASSWD - int ret = start_ap(channel, (const char *)ap_ssid, (const char *)ap_passwd, 1); -#else - int ret = start_ap(channel, (const char *)ap_ssid, "", 0); -#endif - printf(" start_ap_thd_ret=%d\r\n",ret); - - vTaskDelete(NULL); -} - -void start_sta_thd(void* param) -{ - xSemaphoreTake(ec_sta_sem, portMAX_DELAY ); - printf("------ start_sta_thd ssid=[%s],pwd=[%s] ------\r\n",gNetDeviceInfo.ssid, gNetDeviceInfo.pwd); - if (!g_wifi_sta_inited) { - printf("start_sta_thd init\r\n"); - g_wifi_sta_inited = true; - wifi_initialize(eWiFiModeStation);// load wifi driver - xSemaphoreGive(ec_sta_sem); - } else { - char ssid[32] = {0}; - char pwd[16] = {0}; - int ret = -1; - strcpy(ssid, gNetDeviceInfo.ssid); - strcpy(pwd, gNetDeviceInfo.pwd); - printf("start_sta_thd start\r\n"); - xSemaphoreGive(ec_sta_sem); - ret = start_sta(ssid, pwd, 1); - if (ret != 0) { - printf("start sta failed\r\n"); - xSemaphoreTake(ec_sta_sem, portMAX_DELAY ); - memset(&gNetDeviceInfo, 0, sizeof(gNetDeviceInfo)); - xSemaphoreGive(ec_sta_sem); - } - } - - vTaskDelete(NULL); -} - void onRequestBuildNet(const ECBTClientInfo *clientInfo) { printf("onRequestBuildNet-----------------------\r\n"); @@ -299,43 +179,6 @@ void onRequestBuildNet(const ECBTClientInfo *clientInfo) printf("phoneType %d\r\n", clientInfo->phoneType); printf("version %d\r\n", clientInfo->version); printf("TRACE[%s][%d]:",__func__ ,__LINE__); - if (clientInfo->phoneType == 0) {// android - rpy.status = EC_BT_REQUEST_BUILD_NET_USE_PHONE_AP; - gphone_type = 0; - - printf("TRACE[%s][%d]:",__func__ ,__LINE__); - EC_setRequestBuildNetRly(clientInfo->phoneID, &rpy); - printf("TRACE[%s][%d]:",__func__ ,__LINE__); - - printf("TRACE[%s][%d]:",__func__ ,__LINE__); - xSemaphoreTake(ec_sta_sem, portMAX_DELAY ); - g_wifi_sta_inited = false; - memset(&gNetDeviceInfo, 0, sizeof(gNetDeviceInfo)); - xSemaphoreGive(ec_sta_sem); - xTaskCreate(start_sta_thd, "ecThread", 2048 *4, NULL, configMAX_PRIORITIES / 4, &ec_sta_task); - printf("TRACE[%s][%d]:",__func__ ,__LINE__); - - } else if (clientInfo->phoneType == 1) {//iphone - printf("------ onRequestBuildNet begin\r\n"); - gphone_type = 1; - rpy.status = EC_BT_REQUEST_BUILD_NET_NEED_PHONE_BUILD; -#if !AP_NO_PASSWD - strcpy(rpy.netDeviceInfo.ssid, (char *)ap_ssid); - strcpy(rpy.netDeviceInfo.pwd, (char *)ap_passwd); - strcpy(rpy.netDeviceInfo.auth, "WAP2"); -#else - strcpy(rpy.netDeviceInfo.ssid, (char *)ap_ssid); - //strcpy(rpy.netDeviceInfo.pwd, (char *)ap_passwd); - //strcpy(rpy.netDeviceInfo.auth, ""); -#endif - - printf("TRACE[%s][%d]:",__func__ ,__LINE__); - EC_setRequestBuildNetRly(clientInfo->phoneID, &rpy); - printf("TRACE[%s][%d]:",__func__ ,__LINE__); - xTaskCreate(start_ap_thd, "ecThread", 2048 *4, NULL, configMAX_PRIORITIES / 4, &ec_ap_task); - - printf("------ onRequestBuildNet end\r\n"); - } } @@ -344,14 +187,9 @@ void onRequestBuildNetCancel() } -void onPhoneBuildNetFinish() +void onPhoneBuildNetFinish(char const *str) { - struct ec_event ev = {0}; - ev.type = EC_EVENT_BUILD_NET_OK; - if (-1 != ev.type && NULL != ec_event_queue) { - xQueueSend(ec_event_queue, &ev, 0); - } } void onPhoneAPInfo(const ECBTNetInfo* netDeviceInfo) @@ -364,26 +202,6 @@ void onPhoneAPInfo(const ECBTNetInfo* netDeviceInfo) printf("onPhoneAPInfo name=[%s]\r\n",netDeviceInfo->name); printf("onPhoneAPInfo action=[%u]\r\n",netDeviceInfo->action); printf("------ onPhoneAPInfo ------\r\n"); - - xSemaphoreTake(ec_sta_sem, portMAX_DELAY ); - if (!memcmp(netDeviceInfo->ssid, gNetDeviceInfo.ssid, strlen(netDeviceInfo->ssid) + 1) && - !memcmp(netDeviceInfo->pwd, gNetDeviceInfo.pwd, strlen(netDeviceInfo->pwd) + 1)) { - xSemaphoreGive(ec_sta_sem); - printf("recv same ssid info \r\n"); - return; - } - - memset(&gNetDeviceInfo,0,sizeof(gNetDeviceInfo)); - strcpy(gNetDeviceInfo.ssid,netDeviceInfo->ssid); - strcpy(gNetDeviceInfo.pwd,netDeviceInfo->pwd); - xSemaphoreGive(ec_sta_sem); - -// static bool bRunOnce = true; -// if(bRunOnce) { - //start_sta(gNetDeviceInfo.ssid, gNetDeviceInfo.pwd, 1); - xTaskCreate(start_sta_thd, "ecThread", 2048 *4, NULL, configMAX_PRIORITIES / 4, NULL); -// bRunOnce = false; -// } } @@ -489,7 +307,6 @@ void unregisterVideoPlayer(IECVideoPlayer* player) } } -// Ôö¼ÓÒÚÁªµÄÊý¾Ý¶Áд½Ó¿Ú uint32_t ec_access_size(const char* name) { printf_func("TRACE[%s][%d]:name=%s\r\n",__func__ ,__LINE__,name); @@ -576,84 +393,58 @@ static void ec_access_clear(const char* name) __func__ ,__LINE__,name); } -void ec_wifi_event_handler( WIFIEvent_t * xEvent ) +static void onEventEC(void* ctx, const struct carlink_event *ev) { - WIFIEventType_t xEventType = xEvent->xEventType; + enum CARLINK_EVENT_TYPE type; + + if (NULL == ev) + return; + if (ev->link_type != CARLINK_ECLINK_WIRELESS && !ev->disable_filter)// skip not ec event + return; - wps_connect_done = 0; + type = ev->type; - if (0) { - } else if (eWiFiEventConnected == xEventType) {// meter is sta - printf("\r\n The meter is connected to ap \r\n"); - struct ec_event ev = {0}; - ev.type = EC_EVENT_WIFI_CONNECT; - - if (-1 != ev.type && NULL != ec_event_queue) { - xQueueSend(ec_event_queue, &ev, 0); - } - } else if (eWiFiEventDisconnected == xEventType) {// meter is sta - printf("\r\n The meter is disconnected from ap \r\n"); - struct ec_event ev = {0}; - ev.type = EC_EVENT_WIFI_DISCONNECT; - - if (-1 != ev.type && NULL != ec_event_queue) { - xQueueSend(ec_event_queue, &ev, 0); - } - } else if (eWiFiEventAPStationConnected == xEventType) {// meter is ap - printf("\r\n The meter in AP is connected by sta %s \r\n", xEvent->xInfo.xAPStationConnected.ucMac); - } else if (eWiFiEventAPStationDisconnected == xEventType) {// meter is ap - printf("\r\n The sta %s is disconnected from the meter \r\n", xEvent->xInfo.xAPStationDisconnected.ucMac); + switch (type) { + case -1: { + break; } -} - -#if ( ipconfigUSE_DHCP_HOOK != 0 ) -eDHCPCallbackAnswer_t xApplicationDHCPHook( eDHCPCallbackPhase_t eDHCPPhase, - uint32_t ulIPAddress ) -{ - eDHCPCallbackAnswer_t eReturn; - struct ec_event ev = {0}; - - sprintf(g_ip_str, "%d.%d.%d.%d\r\n", (ulIPAddress >> 0) & 0xFF, - (ulIPAddress >> 8) & 0xFF, (ulIPAddress >> 16) & 0xFF, (ulIPAddress >> 24) & 0xFF); - printf("\r\n eDHCPPhase:%d ulIPAddress:%s state:%d \r\n", eDHCPPhase, g_ip_str, getDhcpClientState()); - if (getDhcpClientState() == 0) - return eDHCPStopNoChanges; - - switch( eDHCPPhase ) - { - case eDHCPPhaseFinished: - //g_dhcp_ready = 1; - ev.type = EC_EVENT_CLIENT_DHCP_READY; - - if (-1 != ev.type && NULL != ec_event_queue) { - xQueueSend(ec_event_queue, &ev, 0); - } - eReturn = eDHCPContinue; - break; - case eDHCPPhasePreDiscover : - eReturn = eDHCPContinue; - break; - - case eDHCPPhasePreRequest : - eReturn = eDHCPContinue; - break; - case 0xff: - WIFI_Off(); - start_ap_thd(NULL); - default : - eReturn = eDHCPContinue; + case CARLINK_EVENT_INIT_DONE: + break; + case CARLINK_EVENT_BT_CONNECT: { + break; + } + case CARLINK_EVENT_BT_AA_RFCOMM_READY: { + break; + } + case CARLINK_EVENT_BT_DISCONNECT: { + break; + } + case CARLINK_EVENT_WIFI_CONNECT: { + break; + } + case CARLINK_EVENT_MSG_SESSION_CONNECT: { + break; + } + case CARLINK_EVENT_MSG_SESSION_STOP: { + break; + } + + default: break; } - - return eReturn; } -#endif -int32_t ec_ble_write(void * data, uint32_t len); -int32_t ec_ble_read(void * data, uint32_t len); -int32_t ec_ble_open(); -void ec_ble_close(); + +static void ec_ble_data_read(void* ctx, const void* buf, int len) +{ + (void)ctx; + (void)buf; + (void)len; +} + + #if defined(AWTK) extern char strQrText[100]; +extern char UI_uuid[32]; #else char strQrText[100]; char key_value; @@ -661,52 +452,58 @@ char key_value; void* initECTiny(void* param) { char uuid[32] = {0}; + const char *bt_mac = carlink_get_bt_mac(); + + if (NULL == bt_mac) { + printf("\r\n------ bt not ready ------\r\n"); + return NULL; + } + if (mInited) { printf("\r\n------ ECTiny has inited ------\r\n"); + return NULL; } - else - { - printf("\r\n-------- Sample begin----------\r\n"); - printf("\r\n1.inti ECTiny config\r\n"); - mECTinyCfg = EC_createECConfig(); + printf("\r\n-------- Sample begin----------\r\n"); - while(!g_bt_mac_ready) { - vTaskDelay(pdMS_TO_TICKS(10)); - } - { - char ap_prefix[5] = {0}; - memcpy(ap_prefix, g_bt_mac + 8, 4); - ec_reset_wifi_ap_info(ap_prefix); - printf("ap_ssid:%s\r\n", ap_ssid); - } - sprintf(uuid, "CARBIT%s", g_bt_mac); - printf("carbit uuid :%s\r\n", uuid); - EC_setBaseConfig(mECTinyCfg, uuid, "V0.0.1", "B:/"); //"CARBIT00000001" + printf("\r\n1.inti ECTiny config\r\n"); + mECTinyCfg = EC_createECConfig(); - printf("\r\n2.register ECTiny callback functions\r\n"); - mECTinyCallback = registerECCallback(); + memset(&qr_info, 0, sizeof(ECQRInfo)); + qr_info.action = EC_QR_ACTION_WIFI_P2P_MODE | EC_QR_ACTION_WIFI_AP_MODE_CUSTOMIZED; + sprintf(qr_info.name, "%s", carlink_get_wifi_p2p_name()); + sprintf(qr_info.ssid, "%s", carlink_get_wifi_ssid()); + sprintf(qr_info.pwd, "%s", carlink_get_wifi_passwd()); + sprintf(qr_info.auth, "WPA-PSK"); - printf("\r\n3.register ECTiny Video player\r\n"); - mECTinyVideoPlayer = registerVideoPlayer(); + sprintf(uuid, "CARBIT%s", bt_mac); + printf("carbit uuid :%s\r\n", uuid); + strcpy(UI_uuid,uuid); + EC_setBaseConfig(mECTinyCfg, uuid, "V0.0.1", "B:/"); //"CARBIT00000001" - printf("\r\n4.set Mirror config\r\n"); - ECMirrorConfig mirrorCfg; - memset(&mirrorCfg, 0, sizeof(ECMirrorConfig)); + printf("\r\n2.register ECTiny callback functions\r\n"); + mECTinyCallback = registerECCallback(); - //mirrorCfg.width = 1280; - //mirrorCfg.height = 480; - mirrorCfg.width = get_carlink_video_width(); - mirrorCfg.height = get_carlink_video_height(); - mirrorCfg.height = ((mirrorCfg.height + 0xf) & (~0xf)); + printf("\r\n3.register ECTiny Video player\r\n"); + mECTinyVideoPlayer = registerVideoPlayer(); - mirrorCfg.touchMode = 2; - mirrorCfg.type = EC_VIDEO_TYPE_H264; - mirrorCfg.quality = 4 * 1024 * 1024; - mirrorCfg.capScreenMode = 0x08; + printf("\r\n4.set Mirror config\r\n"); + ECMirrorConfig mirrorCfg; + memset(&mirrorCfg, 0, sizeof(ECMirrorConfig)); - printf("\r\n5.init ECTiny\r\n"); + //mirrorCfg.width = 1280; + //mirrorCfg.height = 480; + mirrorCfg.width = get_carlink_video_width(); + mirrorCfg.height = get_carlink_video_height(); + mirrorCfg.height = ((mirrorCfg.height + 0xf) & (~0xf)); + + mirrorCfg.touchMode = 2; + mirrorCfg.type = EC_VIDEO_TYPE_H264; + mirrorCfg.quality = 4 * 1024 * 1024; + mirrorCfg.capScreenMode = 0x08; + + printf("\r\n5.init ECTiny\r\n"); accessFile.size = ec_access_size; accessFile.read = ec_access_read; @@ -714,587 +511,42 @@ void* initECTiny(void* param) accessFile.clear = ec_access_clear; EC_bindAccessFile(&accessFile); - //EC_bindAccessFile(&license2File); - EC_initialize(mECTinyCfg, mECTinyCallback); + //EC_bindAccessFile(&license2File); + EC_initialize(mECTinyCfg, mECTinyCallback); - printf("\r\n6.set log info\r\n"); - EC_setLogInfo(EC_LOG_LEVEL_INFO, EC_LOG_OUT_STD, NULL, EC_LOG_MODULE_SDK | EC_LOG_MODULE_APP); + printf("\r\n6.set log info\r\n"); + EC_setLogInfo(EC_LOG_LEVEL_ERROR, EC_LOG_OUT_STD, NULL, EC_LOG_MODULE_SDK | EC_LOG_MODULE_APP); - printf("\r\n7.set Mirror config\r\n"); - EC_setMirrorConfig(&mirrorCfg); - EC_setVideoPlayer(mECTinyVideoPlayer); + printf("\r\n7.set Mirror config\r\n"); + EC_setMirrorConfig(&mirrorCfg); + EC_setVideoPlayer(mECTinyVideoPlayer); - printf("\r\n8.start EC work!\r\n"); - EC_start(); + printf("\r\n8.start EC work!\r\n"); - printf("\r\n9.bindBtDevice!\r\n"); + if (!g_ec_disable) + EC_start(); - //sleep(1); - //EC_bindWIFIDevice(EC_TRANSPORT_ANDROID_WIFI, "192.168.43.1"); - //EC_bindWIFIDevice(EC_TRANSPORT_IOS_WIFI_APP, "192.168.13.20"); - -// ECQRInfo info; -// memset(&info,0, sizeof(ECQRInfo)); -// strcpy(info.ssid,"QJ501"); -// strcpy(info.pwd,"88888888"); -// strcpy(info.auth,"WPA"); -// info.action = EC_QR_ACTION_WIFI_AP_MODE_ACCESS_INTERNET; -// -// EC_generateQRCodeUrl(&info); - - mInited = true; - -// while (1) { -// sleep(20); -// } - } + printf("\r\n9.bindBtDevice!\r\n"); printf("------ initECTiny end ------\n"); - if (1) { - /*ECQRInfo qr_info; - char ap_prefix[32] = {0}; - memset(&qr_info, 0, sizeof(ECQRInfo)); - qr_info.action = EC_QR_ACTION_WIFI_P2P_MODE | EC_QR_ACTION_WIFI_AP_MODE_CUSTOMIZED; - memcpy(ap_prefix, g_bt_mac + 8, 4); - sprintf(qr_info.name, "ark630hv100_p2p_%s", ap_prefix); - sprintf(qr_info.ssid, "ark630hv100_%s", ap_prefix); - sprintf(qr_info.pwd, "12345678"); - sprintf(qr_info.auth, "WPA-PSK");*/ - const char *UrlData = EC_generateQRCodeUrl(&qr_info); - printf("++++++++++++++++++++++UrlData:%s+++++++++++++++++++++++++++\n", UrlData); - strcpy(strQrText, UrlData); - } + const char *UrlData = EC_generateQRCodeUrl(&qr_info); + printf("++++++++++++++++++++++UrlData:%s+++++++++++++++++++++++++++\n", UrlData); + strcpy(strQrText, UrlData); + return NULL; } -#endif - -//------ ECTiny code end ------ - - -void* thdPingPhone(void* param) -{ - int ret = 0; - int count = 0; - uint32_t IPAddress = (20 << 24) | (13 << 16) | (168 << 8) | (192 << 0); - while(true) { - ret = FreeRTOS_SendPingRequest(IPAddress, 8, 1000); - printf("[TRACE][%s][%d]:count=%d,ping ret=%d\n",__FUNCTION__,__LINE__,count++,ret); - sleep(2); - } -} - -#if 0 -void testThread() -{ - pthread_t tid; - pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - pthread_create(&tid, &attr, initECTiny, NULL); - pthread_attr_destroy(&attr); -} -#else -int mmcsd_wait_sdio_ready(int32_t timeout); -static void ec_start_wlan(); -static int carlink_ec_network_init() -{ - BaseType_t ret = -1; -#if !USE_LWIP -#else - -#endif - return (int)ret; -} - -#if USE_LWIP -#include "dhcp.h" -static int lwip_tcpip_init_done_flag = 0; -static void tcpip_init_done(void *arg) -{ - (void)arg; - lwip_tcpip_init_done_flag = 1; -} - -void lwiperf_report_cb_impl(void *arg, enum lwiperf_report_type report_type, - const ip_addr_t* local_addr, u16_t local_port, const ip_addr_t* remote_addr, u16_t remote_port, - u32_t bytes_transferred, u32_t ms_duration, u32_t bandwidth_kbitpsec) -{ - (void)arg; - - printf("lwiperf_report_cb_impl bytes:%d %d ms \r\n", bytes_transferred, ms_duration); -} - -struct netif *get_lwip_net_interface() -{ - return &gnetif[0]; -} - - -#endif - -void vIPerfInstall( void ); -static void ec_start_wlan() -{ -#if USE_LWIP - const char *customer = "ark630hv100"; - char ap_prefix[5] = {0}; - //char dev_name[32] = {0}; - //char ssid[32] = {0}; - - ip4_addr_t ip_addr; - ip4_addr_t netmask; - ip4_addr_t gw; - ip4_addr_t dhcp_addr_start; - ip4_addr_t dhcp_addr_end; - - while(!g_bt_mac_ready) { - vTaskDelay(pdMS_TO_TICKS(10)); - } - memcpy(ap_prefix, g_bt_mac + 8, 4); - //sprintf(dev_name, "ark630hv100_p2p_%s", ap_prefix); - //sprintf(ssid, "ark630hv100_%s", ap_prefix); - - memset(&qr_info, 0, sizeof(ECQRInfo)); - qr_info.action = EC_QR_ACTION_WIFI_P2P_MODE | EC_QR_ACTION_WIFI_AP_MODE_CUSTOMIZED; - memcpy(ap_prefix, g_bt_mac + 8, 4); - sprintf(qr_info.name, "DIRECT-%s_p2p_%s", customer, ap_prefix); - sprintf(qr_info.ssid, "DIRECT-%s_%s", customer, ap_prefix); - sprintf(qr_info.pwd, "12345678"); - sprintf(qr_info.auth, "WPA-PSK"); - printf("dev_name:%s ssid:%s\r\n", qr_info.name, qr_info.ssid); - - start_p2p(qr_info.name, qr_info.ssid, qr_info.pwd); - //start_sta("Cym-ipod", "CYm-8875x", 1); - - ip_addr.addr = lwip_ipv4_addr(ucIPAddress); - netmask.addr = lwip_ipv4_addr(ucNetMask); - gw.addr = lwip_ipv4_addr(ucGatewayAddress); - tcpip_init(tcpip_init_done, NULL); - netif_add(&gnetif[0], -#if LWIP_IPV4 - &ip_addr, &netmask, &gw, -#endif - NULL, wlan_ethernetif_init, tcpip_input); - lwip_tcpip_init_done_flag = 1; - netif_set_default(&gnetif[0]); -#if 1 - uint8_t addr_start[4] = {192, 168, 13, 20}; - uint8_t addr_end[4] = {192, 168, 13, 30}; - dhcp_addr_start.addr = lwip_ipv4_addr(addr_start); - dhcp_addr_end.addr = lwip_ipv4_addr(addr_end); - dhcp_server_start(&gnetif[0], &dhcp_addr_start, &dhcp_addr_end); -#else - dhcpd_start("wi"); -#endif - //start_p2p(qr_info.name, qr_info.ssid, qr_info.pwd); - netif_set_up(&gnetif[0]); - - //dhcp_start(&gnetif[0]); - - lwiperf_start_tcp_server_default(lwiperf_report_cb_impl, NULL); -#else - char ap_prefix[5] = {0}; - while(!g_bt_mac_ready) { - vTaskDelay(pdMS_TO_TICKS(10)); - } - memcpy(ap_prefix, g_bt_mac + 8, 4); - memset(&qr_info, 0, sizeof(ECQRInfo)); - qr_info.action = EC_QR_ACTION_WIFI_P2P_MODE | EC_QR_ACTION_WIFI_AP_MODE_CUSTOMIZED; - memcpy(ap_prefix, g_bt_mac + 8, 4); - sprintf(qr_info.name, "DIRECT-ark630hv100_p2p_%s", ap_prefix); - sprintf(qr_info.ssid, "DIRECT-ark630hv100_%s", ap_prefix); - sprintf(qr_info.pwd, "12345678"); - sprintf(qr_info.auth, "WPA-PSK"); - printf("dev_name:%s ssid:%s\r\n", qr_info.name, qr_info.ssid); - - BaseType_t ret = FreeRTOS_IPInit(ucIPAddress, ucNetMask, ucGatewayAddress,ucDNSServerAddress, ucMACAddress); - - //start_ap(36, qr_info.ssid, qr_info.pwd, 1); - //start_p2p(qr_info.name, qr_info.ssid, qr_info.pwd); - vIPerfInstall(); -#endif -} - -#if USE_LWIP -static void dump_ip_addr(const char *msg, const ip_addr_t *server_addr) -{ - printf("%s %d.%d.%d.%d \r\n", msg, - ip4_addr1_16(ip_2_ip4(server_addr)), ip4_addr2_16(ip_2_ip4(server_addr)), ip4_addr3_16(ip_2_ip4(server_addr)), ip4_addr4_16(ip_2_ip4(server_addr))); -} - - -static void dhcp_client_status_callback(struct netif *netif, int status, const ip_addr_t *server_addr) -{ - if (&gnetif[0] == netif) { - dump_ip_addr("dhcp server ip :", (const ip_addr_t *)server_addr); - dump_ip_addr("dhcp client ip :", (const ip_addr_t *)&netif->ip_addr); - dump_ip_addr("dhcp client netmask:", (const ip_addr_t *)&netif->netmask); - dump_ip_addr("dhcp client gw :", (const ip_addr_t *)&netif->gw); - } -} - -int start_sta_ext(const char* ssid, const char* passwd, char need_passwd) -{ - int ret = -1; - ip4_addr_t ip_addr; - ip4_addr_t netmask; - ip4_addr_t gw; - - ret = start_sta(ssid, passwd, need_passwd); - if (ret != 0) { - printf("start wifi sta failed\r\n"); - return ret; - } - - if (lwip_tcpip_init_done_flag) { - netif_remove(&gnetif[0]); - netif_add(&gnetif[0], -#if LWIP_IPV4 - &ip_addr, &netmask, &gw, -#endif - NULL, wlan_ethernetif_init, tcpip_input); - netif_set_default(&gnetif[0]); - dhcp_regisger_status_callback(dhcp_client_status_callback); - netif_set_up(&gnetif[0]); - dhcp_start(&gnetif[0]); - } - - return ret; -} - -int __restart_p2p(const char *dev_name, const char *ssid, const char *passwd) -{ - int ret = -1; - ip4_addr_t ip_addr; - ip4_addr_t netmask; - ip4_addr_t gw; - - ip_addr.addr = lwip_ipv4_addr(ucIPAddress); - netmask.addr = lwip_ipv4_addr(ucNetMask); - gw.addr = lwip_ipv4_addr(ucGatewayAddress); - - ret = start_p2p(dev_name, ssid, passwd); - if (ret != 0) { - printf("restart wifi p2p failed\r\n"); - return ret; - } - if (!lwip_tcpip_init_done_flag) { - printf("lwip tcpip is not inited\r\n"); - return ret; - } - - dhcp_stop(&gnetif[0]); - netif_remove(&gnetif[0]); - - netif_add(&gnetif[0], -#if LWIP_IPV4 - &ip_addr, &netmask, &gw, -#endif - NULL, wlan_ethernetif_init, tcpip_input); - - netif_set_up(&gnetif[0]); - ret = 0; - return ret; -} - -int restart_p2p() -{ - if (!g_bt_mac_ready) { - return -1; - } - return __restart_p2p(qr_info.name, qr_info.ssid, qr_info.pwd); -} -#endif - -static void ec_reset_wifi_ap_info(const char *btmac) -{ - memset(ap_ssid, 0, sizeof(ap_ssid)); - sprintf((char *)ap_ssid, "AP630_%s", btmac); -} - -static void ec_bt_callback(char * cAtStr) -{ - char* cmd_para = NULL; - //printf("\r\nfsc_bt_callback_ec %s\r\n", cAtStr); - static struct ec_event ev = {0}; - static char m_tmp_buf[64]; - memset((void*)&ev, 0, sizeof(ev)); - ev.type = -1; - - if (0) { - } else if (0 == strncmp(cAtStr, "+GATTDATA=", 10)) { - //printf("fsc_bt_callback_ec=[%s]\r\n", cAtStr); - char ble_buf[256] = {0}; - - pthread_mutex_lock(&bufLocker); - int data_str_len = (strlen(cAtStr) - 10), data_len; - - ev.type = EC_EVENT_BT_DATA; - cmd_para = cAtStr + 10; - data_len = data_str_len / 2; - while (ring_buffer_get_bytes_free(&ble_ring_data) < data_len) { - pthread_mutex_unlock(&bufLocker); - vTaskDelay(pdMS_TO_TICKS(10)); - pthread_mutex_lock(&bufLocker); - } - string2hex(cmd_para, data_str_len, ble_buf, data_len); - ring_buffer_write(&ble_ring_data, (uint8_t *)ble_buf, data_len); - pthread_mutex_unlock(&bufLocker); - - } else if (0 == strncmp(cAtStr, "+GATTSTAT=1",11)) { - ev.type = EC_EVENT_BT_DISCONNECT; - // btEvent = EC_EVENT_BT_DISCONNECT; - printf("TRACE[%s][%d]:EC_EVENT_BT_DISCONNECT\r\n",__func__ ,__LINE__); - } else if (0 == strncmp(cAtStr, "+GATTSTAT=3",11)) { - printf("TRACE[%s][%d]:EC_EVENT_BT_CONNECT\r\n",__func__ ,__LINE__); - ev.type = EC_EVENT_BT_CONNECT; - } else if (0 == strncmp(cAtStr, "+ADDR=", 6)) { - char cmd_str[64] = {0}; - sprintf(cmd_str, "AT+NAME=EC_%s\r\n", (cAtStr + 6)); - //ec_reset_wifi_ap_info(cAtStr + 6); - printf("ADDR:%s\r\n", cAtStr + 6); - console_send_atcmd(cmd_str, strlen(cmd_str));//get mac addr - memset(cmd_str, 0, sizeof(cmd_str)); - sprintf(cmd_str, "AT+LENAME=EC_%s\r\n", (cAtStr + 6)); - console_send_atcmd(cmd_str, strlen(cmd_str));//get mac addr - g_bt_mac_ready = true; - memcpy(g_bt_mac, (cAtStr + 6), 12); - } else if (0 == strncmp(cAtStr, "+VER", 4)) { - char* cmd = "AT+ADDR\r\n"; - console_send_atcmd(cmd, strlen(cmd));//get mac addr - } else if (0 == strncmp(cAtStr, "+NAME=", 6)) { - char cmd_str[64] = {0}; - sprintf(cmd_str, "AT+LEADDR\r\n"); - console_send_atcmd(cmd_str, strlen(cmd_str));//get LE addr - } else if (0 == strncmp(cAtStr, "+LEADDR=", 6)) { - char hexMacAddr[6] = {0}; - memset(m_tmp_buf, 0, sizeof(m_tmp_buf)); - string2hex(&cAtStr[8], 12, hexMacAddr, sizeof(hexMacAddr)); - //memcpy(addr, &cAtStr[8], 12); - sprintf(m_tmp_buf, "AT+ADVDATA=%s\r\n", hexMacAddr); - console_send_atcmd(m_tmp_buf, 19); - } - else if (0 == strncmp(cAtStr, "+GATTSENT=", 10)) { - - return; - } - - if (-1 != ev.type && NULL != ec_event_queue) { - xQueueSend(ec_event_queue, &ev, 0); - } -} - -int32_t ec_ble_read(void * data, uint32_t len) -{ - pthread_mutex_lock(&bufLocker); - int data_len = 0; - - data_len = ring_buffer_get_bytes_used(&ble_ring_data); - - if (data_len > len) { - data_len = len; - } - if (data_len > 0) { - ring_buffer_read(&ble_ring_data, (uint8_t*)data, data_len); - pthread_mutex_unlock(&bufLocker); - return data_len; - } - pthread_mutex_unlock(&bufLocker); - return 0; -} - -static int ble_write(unsigned char *data, int len) -{ - uint8_t *at_str = NULL, *at_str_ptr = NULL; - uint8_t *at_prefix = "AT+GATTSEND="; - int prefix_len = strlen((char *)at_prefix); - int cmd_len = (len * 2 + prefix_len + 2); - - at_str = (uint8_t *)pvPortMalloc(cmd_len+1); - memset(at_str,0,cmd_len+1); - if (NULL == at_str) - return -1; - at_str_ptr = at_str; - sprintf((char*)at_str_ptr, "%s", (char*)at_prefix); - at_str_ptr += prefix_len; - hex2str(data, len, (char *)at_str_ptr); - at_str_ptr += (len * 2); - *at_str_ptr++ = '\r'; - *at_str_ptr++ = '\n'; - console_send_atcmd((char *)at_str, cmd_len); - vPortFree(at_str); - return len; -} - -int32_t ec_ble_write(void *data, uint32_t len) -{ - int send = 0; - int offset = 0; - do - { - // 把data每次按10个字节发送。ble_write 中组合之后长度变成34. 10 * 2 + 12 + 2 - send = (len - offset) > 10 ? 10 : (len - offset); - offset += ble_write((unsigned char *)data + offset, send); - //usleep(2000*1000); - } while (offset < len); - - return offset; -} - -int32_t ec_ble_open() -{ - return 0; -} - -void ec_ble_close() -{ - -} - -static BaseType_t wifi_init() -{ - int status; - WIFI_Context_init(); - WIFI_RegisterEvent(eWiFiEventMax, ec_wifi_event_handler); - for (;;) { - status = mmcsd_wait_sdio_ready((int32_t)portMAX_DELAY); - if (status == MMCSD_HOST_PLUGED) { - printf("detect sdio device\r\n"); - break; - } - } - return 0; -} - -static void setNetInterfaceInfo() -{ - struct ECNetInterfaceInfo info; - uint32_t ulIPAddress = 0, netMask = 0; - - memset(&info, 0, sizeof(info)); - strcpy(info.name, "wlan0"); - if (gphone_type == 1) - ulIPAddress = (ucIPAddress[0]) | (ucIPAddress[1] << 8) | (ucIPAddress[2] << 16) | (ucIPAddress[3] << 24); - else - ulIPAddress = FreeRTOS_GetIPAddress(); - sprintf(info.ip, "%d.%d.%d.%d", (ulIPAddress >> 0) & 0xFF, - (ulIPAddress >> 8) & 0xFF, (ulIPAddress >> 16) & 0xFF, (ulIPAddress >> 24) & 0xFF); - if (gphone_type == 1) - netMask = (ucNetMask[0]) | (ucNetMask[1] << 8) | (ucNetMask[2] << 16) | (ucNetMask[3] << 24); - else - netMask = FreeRTOS_GetNetmask(); - sprintf(info.mask, "%d.%d.%d.%d", (netMask >> 0) & 0xFF, - (netMask >> 8) & 0xFF, (netMask >> 16) & 0xFF, (netMask >> 24) & 0xFF); - EC_setNetInterfaceInfo(&info, 1); -} - -static void taskECTinyWrapper(void* param) -{ - struct ec_event ev; - int android_ap_connect_flag = 0; - int apple_connect_flag = 0; - - while(1) { - if (xQueueReceive(ec_event_queue, &ev, portMAX_DELAY) != pdPASS) { - printf("%s xQueueReceive err!\r\n", __func__); - continue; - } - - //printf("TRACE[%s][%d]:ec_event_queue,get event:%d\r\n", __func__, __LINE__, ev.type); - - switch (ev.type) { - case -1: { - continue; - } - case EC_EVENT_BT_CONNECT: { - printf("TRACE[%s][%d]:EC_bindBTDevice_1\r\n",__func__ ,__LINE__); - bleDev.open = ec_ble_open; - bleDev.close = ec_ble_close; - bleDev.read = ec_ble_read; - bleDev.write = ec_ble_write; - EC_bindBTDevice(&bleDev); - printf("TRACE[%s][%d]:EC_bindBTDevice_2\r\n",__func__ ,__LINE__); - - break; - } - case EC_EVENT_BT_DISCONNECT: { - break; - } - case EC_EVENT_BT_DATA: { - - break; - } - // wifi is station, dhcp ready - case EC_EVENT_CLIENT_DHCP_READY: { - if (gphone_type == 1) { - if(apple_connect_flag == 1) { - printf("TRACE[%s][%d]:dhpc has been ready\r\n",__func__ ,__LINE__); - break; - } - apple_connect_flag = 1; - } - ECNetWorkInfo netInfo = {0}; - netInfo.state = EC_WIFI_STATE_CONNECTED; - EC_notifyWifiStateChanged(EC_WIFI_STATE_CHANGED_ACTION, &netInfo); - setNetInterfaceInfo(); - printf("TRACE[%s][%d]:EC_EVENT_CLIENT_DHCP_READY\r\n",__func__ ,__LINE__); - - break; - } - case EC_EVENT_BUILD_NET_OK: { - if (gphone_type == 1) - { - ECNetWorkInfo netInfo = {0}; - netInfo.state = EC_WIFI_STATE_CONNECTED; - EC_notifyWifiStateChanged(EC_WIFI_STATE_CHANGED_ACTION, &netInfo); - apple_connect_flag = 0; - } - - setNetInterfaceInfo(); - printf("TRACE[%s][%d]:EC_EVENT_BUILD_NET_OK--------------\r\n", __func__, __LINE__); - break; - } - case EC_EVENT_WIFI_DISCONNECT: - { - if (android_ap_connect_flag == 1) { - ECNetWorkInfo netInfo = {0}; - netInfo.state = EC_WIFI_STATE_DISCONNECTED; - EC_notifyWifiStateChanged(EC_WIFI_STATE_CHANGED_ACTION, &netInfo); - printf("TRACE[%s][%d]:EC_EVENT_WIFI_DISCONNECT--------------\r\n", __func__, __LINE__); - } - android_ap_connect_flag = 0; - break; - } - case EC_EVENT_WIFI_CONNECT: - { - android_ap_connect_flag = 1; - printf("TRACE[%s][%d]:EC_EVENT_WIFI_CONNECT--------------\r\n", __func__, __LINE__); - break; - } - default: - printf("TRACE[%s][%d]:error event:%d\r\n", __func__, __LINE__, ev.type); - } - } - - vTaskDelete(NULL); -} void testThread() { - wifi_init(); - ring_buffer_init(&ble_ring_data, 256); - ec_event_queue = xQueueCreate(1, sizeof(struct ec_event)); - if (ec_sta_sem == NULL) - ec_sta_sem = xSemaphoreCreateMutex(); - carlink_ec_network_init(); - console_register_cb(NULL, ec_bt_callback); - xTaskCreate(taskECTinyWrapper, "ecThread", 2048 *4, NULL, configMAX_PRIORITIES / 4, &ec_network_task); - fsc_bt_main();printf("%s:%d\r\n", __func__, __LINE__); - ec_start_wlan(); + int ret = carlink_common_init(); + ret = carlink_bt_wifi_init(); + struct ICalinkEventCallbacks carlinkEventCB = {0}; + carlinkEventCB.onEvent = onEventEC; + carlinkEventCB.rfcomm_data_read = ec_ble_data_read; + carlink_register_event_callbacks(&carlinkEventCB); initECTiny(NULL); } -#endif static void taskInitCarlink(void* param) { @@ -1306,19 +558,35 @@ int carlink_ec_init(int argc,char ** argv) { printf("------ TestECTiny begin ------\n"); carlink_ey_video_init(); -#if 0 - testThread(); -#else + /* 启动线程初始化: * 1. initECTiny初始化延时过长,导致开机动画和UI显示切换之间存在黑屏时间,因此在线程中初始化 * 2. wifi模块未贴或异常时,wifi_init函数无法返回,导致UI无法正常显示。 */ xTaskCreate(taskInitCarlink, "initThread", 2048 *4, NULL, configMAX_PRIORITIES / 4, NULL); -#endif printf("------ TestECTiny end ------\n"); return 0; } + +void carlink_ec_enable(int enable) +{ + if (enable) { + if (g_ec_disable) { + if (mInited) + EC_start(); + } + g_ec_disable = false; + } else { + if (!g_ec_disable) { + if (mInited) + EC_stop(); + } + g_ec_disable = true; + } +} + + #else int carlink_ec_init(int argc,char ** argv) { @@ -1326,5 +594,11 @@ int carlink_ec_init(int argc,char ** argv) (void)argv; return 0; } + +void carlink_ec_enable(int enable) +{ + (void)enable; +} + #endif diff --git a/app/carlink/EC/src/carlink_ec.h b/app/carlink/EC/src/carlink_ec.h index 2dfb636..dd982e1 100644 --- a/app/carlink/EC/src/carlink_ec.h +++ b/app/carlink/EC/src/carlink_ec.h @@ -2,5 +2,7 @@ #define _CARLINK_EC_H_ int carlink_ec_init(int argc,char ** argv); +void carlink_ec_enable(int enable); + #endif diff --git a/app/carlink/common/carlink_bt_wifi.c b/app/carlink/common/carlink_bt_wifi.c index 4355843..b19d6c2 100644 --- a/app/carlink/common/carlink_bt_wifi.c +++ b/app/carlink/common/carlink_bt_wifi.c @@ -29,9 +29,12 @@ #include "wifi_conf.h" #include "carlink_common.h" +#define DEV_NAME_PREFIX "AP630_CARLINK" + static char g_cp_bt_mac[13] = {0}; static bool g_cp_bt_mac_ready = false; +static uint8_t carlink_p2p_name[64] = {0}; static uint8_t carlink_ap_ssid[64] = {"ap63011"}; static uint8_t carlink_ap_passwd[16] = {"88888888"}; static uint8_t carlink_wifi_mac[32] = {0}; @@ -65,6 +68,17 @@ extern err_t dhcp_server_start(struct netif *netif, ip4_addr_t *start, ip4_addr_ extern err_t wlan_ethernetif_init(struct netif *netif); #define lwip_ipv4_addr(addr) ((addr[0]) | (addr[1] << 8) | (addr[2] << 16) | (addr[3] << 24)) +const char *carlink_get_bt_mac() +{ + if (!g_cp_bt_mac_ready) + return NULL; + return (const char *)g_cp_bt_mac; +} + +const char *carlink_get_wifi_p2p_name() +{ + return (const char *)carlink_p2p_name; +} const char *carlink_get_wifi_ssid() { @@ -74,7 +88,7 @@ const char *carlink_get_wifi_ssid() const char *carlink_get_wifi_mac() { - wifi_get_mac_address(carlink_wifi_mac); + wifi_get_mac_address((char *)carlink_wifi_mac); return (const char *)carlink_wifi_mac; } @@ -173,7 +187,11 @@ static void carlink_start_wlan() } memcpy(ap_prefix, g_cp_bt_mac + 8, 4); carlink_reset_wifi_ap_info(ap_prefix); - start_ap(36, (const char *)carlink_ap_ssid, (const char *)carlink_ap_passwd, 1); +#if (CARLINK_EC) + start_p2p((const char *)carlink_p2p_name, (const char *)carlink_ap_ssid, (const char *)carlink_ap_passwd); +#else + start_ap(36, (const char *)carlink_ap_ssid, (const char *)carlink_ap_passwd, 1); +#endif ip_addr.addr = lwip_ipv4_addr(ucIPAddress); netmask.addr = lwip_ipv4_addr(ucNetMask); @@ -194,18 +212,113 @@ static void carlink_start_wlan() dhcp_server_start(&gnetif[0], &dhcp_addr_start, &dhcp_addr_end); - netif_set_up(&gnetif[0]); + //netif_set_up(&gnetif[0]); lwiperf_start_tcp_server_default(carlink_lwiperf_report_cb_impl, NULL); lwip_tcpip_init_done_flag = 1; carlink_carplay_add_vendor_ie(); } +void cp_wlan_start(void){ + netif_set_up(&gnetif[0]); +} + +static void dump_ip_addr(const char *msg, const ip_addr_t *server_addr) +{ + printf("%s %d.%d.%d.%d \r\n", msg, + ip4_addr1_16(ip_2_ip4(server_addr)), ip4_addr2_16(ip_2_ip4(server_addr)), ip4_addr3_16(ip_2_ip4(server_addr)), ip4_addr4_16(ip_2_ip4(server_addr))); +} + + +static void dhcp_client_status_callback(struct netif *netif, int status, const ip_addr_t *server_addr) +{ + if (&gnetif[0] == netif) { + dump_ip_addr("dhcp server ip :", (const ip_addr_t *)server_addr); + dump_ip_addr("dhcp client ip :", (const ip_addr_t *)&netif->ip_addr); + dump_ip_addr("dhcp client netmask:", (const ip_addr_t *)&netif->netmask); + dump_ip_addr("dhcp client gw :", (const ip_addr_t *)&netif->gw); + } +} + +int start_sta_ext(const char* ssid, const char* passwd, char need_passwd) +{ + int ret = -1; + ip4_addr_t ip_addr; + ip4_addr_t netmask; + ip4_addr_t gw; + + ret = start_sta(ssid, passwd, need_passwd); + if (ret != 0) { + printf("start wifi sta failed\r\n"); + return ret; + } + + if (lwip_tcpip_init_done_flag) { + netif_remove(&gnetif[0]); + netif_add(&gnetif[0], +#if LWIP_IPV4 + &ip_addr, &netmask, &gw, +#endif + NULL, wlan_ethernetif_init, tcpip_input); + netif_set_default(&gnetif[0]); + dhcp_regisger_status_callback(dhcp_client_status_callback); + netif_set_up(&gnetif[0]); + dhcp_start(&gnetif[0]); + } + + return ret; +} + +int __restart_p2p(const char *dev_name, const char *ssid, const char *passwd) +{ + int ret = -1; + ip4_addr_t ip_addr; + ip4_addr_t netmask; + ip4_addr_t gw; + + ip_addr.addr = lwip_ipv4_addr(ucIPAddress); + netmask.addr = lwip_ipv4_addr(ucNetMask); + gw.addr = lwip_ipv4_addr(ucGatewayAddress); + + ret = start_p2p(dev_name, ssid, passwd); + if (ret != 0) { + printf("restart wifi p2p failed\r\n"); + return ret; + } + if (!lwip_tcpip_init_done_flag) { + printf("lwip tcpip is not inited\r\n"); + return ret; + } + + dhcp_stop(&gnetif[0]); + netif_remove(&gnetif[0]); + + netif_add(&gnetif[0], +#if LWIP_IPV4 + &ip_addr, &netmask, &gw, +#endif + NULL, wlan_ethernetif_init, tcpip_input); + + netif_set_up(&gnetif[0]); + ret = 0; + return ret; +} + +int restart_p2p() +{ + if (!g_cp_bt_mac_ready) { + printf("bt is not ready at %s", __func__); + return -1; + } + return __restart_p2p((const char *)carlink_p2p_name, (const char *)carlink_ap_ssid, (const char *)carlink_ap_passwd); +} static void carlink_reset_wifi_ap_info(const char *prefex) { if (prefex) { memset(carlink_ap_ssid, 0, sizeof(carlink_ap_ssid)); - sprintf((char *)carlink_ap_ssid, "AP630_CARLINK_%s", prefex); + sprintf((char *)carlink_ap_ssid, "%s_%s", DEV_NAME_PREFIX, prefex); + memset(carlink_p2p_name, 0, sizeof(carlink_p2p_name)); + sprintf((char *)carlink_p2p_name, "DIRECT-%s_p2p_%s", DEV_NAME_PREFIX, prefex);//do not delete "DIRECT-" !!! } } @@ -256,11 +369,11 @@ static void carlink_bt_callback(char * cAtStr) carlink_notify_event(&ev); } else if (0 == strncmp(cAtStr, "+ADDR=", 6)) { char cmd_str[64] = {0}; - sprintf(cmd_str, "AT+NAME=AP630_CARLINK_%s\r\n", (cAtStr + 6 + 8)); + sprintf(cmd_str, "AT+NAME=%s_%s\r\n", DEV_NAME_PREFIX, (cAtStr + 6 + 8)); printf("ADDR:%s\r\n", cAtStr + 6); console_send_atcmd(cmd_str, strlen(cmd_str));//get mac addr memset(cmd_str, 0, sizeof(cmd_str)); - sprintf(cmd_str, "AT+LENAME=AP630_CARLINK_%s\r\n", (cAtStr + 6 + 8)); + sprintf(cmd_str, "AT+LENAME=%s_%s\r\n", DEV_NAME_PREFIX, (cAtStr + 6 + 8)); console_send_atcmd(cmd_str, strlen(cmd_str));//get mac addr memcpy(g_cp_bt_mac, (cAtStr + 6), 12); carlink_carplay_ie_replace_bt_mac(cAtStr + 6, 12); @@ -396,7 +509,7 @@ static void carlink_wifi_event_handler( WIFIEvent_t * xEvent ) char *mac = NULL; if (xEvent) { - mac = xEvent->xInfo.xAPStationConnected.ucMac; + mac = (char *)xEvent->xInfo.xAPStationConnected.ucMac; sprintf(mac_str, "%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); } @@ -414,6 +527,40 @@ static void carlink_wifi_event_handler( WIFIEvent_t * xEvent ) } } +#if ( ipconfigUSE_DHCP_HOOK != 0 ) +eDHCPCallbackAnswer_t xApplicationDHCPHook( eDHCPCallbackPhase_t eDHCPPhase, + uint32_t ulIPAddress ) +{ + eDHCPCallbackAnswer_t eReturn; + char g_ip_str[32] = {0}; + + sprintf(g_ip_str, "%d.%d.%d.%d\r\n", (ulIPAddress >> 0) & 0xFF, + (ulIPAddress >> 8) & 0xFF, (ulIPAddress >> 16) & 0xFF, (ulIPAddress >> 24) & 0xFF); + printf("\r\n eDHCPPhase:%d ulIPAddress:%s state:%d \r\n", eDHCPPhase, g_ip_str, getDhcpClientState()); + if (getDhcpClientState() == 0) + return eDHCPStopNoChanges; + + switch( eDHCPPhase ) + { + case eDHCPPhaseFinished: + eReturn = eDHCPContinue; + break; + case eDHCPPhasePreDiscover : + eReturn = eDHCPContinue; + break; + + case eDHCPPhasePreRequest : + eReturn = eDHCPContinue; + break; + default : + eReturn = eDHCPContinue; + break; + } + + return eReturn; +} +#endif + static BaseType_t carlink_wifi_init() { int status; diff --git a/app/carlink/common/carlink_common.c b/app/carlink/common/carlink_common.c index 459ec52..5ef93e5 100644 --- a/app/carlink/common/carlink_common.c +++ b/app/carlink/common/carlink_common.c @@ -25,6 +25,7 @@ static pthread_mutex_t carlink_com_locker = .xAttr = { .iType = 0 } }; +void pthread_key_system_init(); void carlink_rfcomm_data_read_hook(void* buf, int len) { @@ -41,7 +42,7 @@ void carlink_rfcomm_data_read_hook(void* buf, int len) void carlink_notify_event(struct carlink_event *ev) { - if (-1 != ev->type && NULL != carlink_event_queue) { + if (CARLINK_EVENT_NONE != ev->type && NULL != carlink_event_queue) { xQueueSend(carlink_event_queue, ev, 0); } } diff --git a/app/carlink/common/carlink_common.h b/app/carlink/common/carlink_common.h index 9f1b4e0..9f0dc80 100644 --- a/app/carlink/common/carlink_common.h +++ b/app/carlink/common/carlink_common.h @@ -16,13 +16,14 @@ typedef enum CARLINK_ANDROID_AUTO = 5, CARLINK_ECLINK = 0x06, CARLINK_CARPLAY_WIRELESS, - CARLINK_AUTO_WIRELESS + CARLINK_AUTO_WIRELESS, + CARLINK_ECLINK_WIRELESS, }CARLink_TYPE; #define CARLINK_VIDEO_WIDTH 800 -#define CARLINK_VIDEO_HEIGHT 480 +#define CARLINK_VIDEO_HEIGHT 380 @@ -72,6 +73,8 @@ int carlink_wlan_tcp_ip_is_ready(); void carlink_bt_open(); void carlink_bt_close(); void carlink_restart_bt_wifi(); +const char *carlink_get_bt_mac(); +const char *carlink_get_wifi_p2p_name(); const char *carlink_get_wifi_ssid(); const char *carlink_get_wifi_passwd(); const char *carlink_get_wifi_mac(); diff --git a/app/carlink/common/carlink_video.c b/app/carlink/common/carlink_video.c index 3350aa0..541479a 100644 --- a/app/carlink/common/carlink_video.c +++ b/app/carlink/common/carlink_video.c @@ -25,6 +25,15 @@ static int g_disp_x = 0, g_disp_y = 0, g_disp_width = LCD_WIDTH, g_disp_height = static int g_video_width = LCD_WIDTH, g_video_height = LCD_HEIGHT, g_video_fps = 30; static int g_hide_carlink_flag = 0; +static int g_active_video_x = 0, g_active_video_y = 0; + +void set_carlink_active_video_info(int x, int y)//for android auto +{ + g_active_video_x = x; + g_active_video_y = y; +} + + void set_carlink_video_info(int w, int h, int fps) { g_video_width = w; @@ -145,7 +154,7 @@ void set_h264_frame_free(video_frame_s* frame) } xSemaphoreGive(frame_list_mutex); } - +uint8_t map_flag = 0; static void h264_decode_proc(void *pvParameters) { MFCHandle *handle = NULL; @@ -197,6 +206,11 @@ static void h264_decode_proc(void *pvParameters) } if (g_hide_carlink_flag == 0) { + if(map_flag) + map_flag = 0; + printf("Exit navigation =========\r\n "); + Set_sys_wifi(0); + //printf("start carplay or andrord auto .\r\n"); ark_lcd_osd_enable(LCD_VIDEO_LAYER, 0); ark_lcd_osd_enable(LCD_UI_LAYER, 1); } @@ -236,15 +250,16 @@ static void h264_decode_proc(void *pvParameters) //continue; for(i = 0; i < outBuf.num; i++) { + int active_offset = 0; align_width = outBuf.frameWidth; align_height = outBuf.frameHeight; if(!(align_width && align_height)) continue; - - yaddr = outBuf.buffer[i].yBusAddress; - uaddr = yaddr + align_width * align_height; - vaddr = yaddr + align_width * align_height * 5/4; + active_offset = g_active_video_y * align_width; + yaddr = outBuf.buffer[i].yBusAddress + active_offset + g_active_video_x; + uaddr = outBuf.buffer[i].yBusAddress + align_width * align_height + active_offset / 2 + g_active_video_x; + vaddr = 0;//yaddr + align_width * align_height * 5/4; if (carlink_lcd_take == 0) { carlink_lcd_take = 1; @@ -295,6 +310,8 @@ static void h264_decode_proc(void *pvParameters) info.y = g_disp_y; info.width = g_disp_width; info.height = g_disp_height; + if (g_active_video_x != 0) + info.stride = outBuf.frameWidth; if (info.format == LCD_OSD_FORAMT_YUV420) ark_lcd_set_osd_yuv420_mode(LCD_VIDEO_LAYER, LCD_OSD_Y_UV420); @@ -306,7 +323,8 @@ static void h264_decode_proc(void *pvParameters) ark_lcd_set_osd_info_atomic(LCD_VIDEO_LAYER, &info); ark_lcd_osd_enable(LCD_VIDEO_LAYER, 1); ark_lcd_set_osd_sync(LCD_VIDEO_LAYER); - ark_lcd_osd_enable(LCD_UI_LAYER, 0); + Set_sys_wifi(1); + // ark_lcd_osd_enable(LCD_UI_LAYER, 0); ark_lcd_set_osd_sync(LCD_UI_LAYER); vVideoDisplayBufRender(dstaddr); if (outBuf.num > 1) {// for apple h264 @@ -317,6 +335,13 @@ static void h264_decode_proc(void *pvParameters) if (delta_ts > 0) vTaskDelay(pdMS_TO_TICKS(delta_ts)); } + if(!map_flag){ + // printf("###############################################.\r\n"); + request_UI("maps:"); + map_flag = 1; + // printf("###############################################.\r\n"); + } + } } //printf("all use:%d ms dec:%ld ms all ts:%ld ms\r\n", (get_timer(0) - ts) / 1000, dec_ts, (get_timer(0) - all_ts) / 1000); diff --git a/app/carlink/common/carlink_video.h b/app/carlink/common/carlink_video.h index 09ed4b17..8415935 100644 --- a/app/carlink/common/carlink_video.h +++ b/app/carlink/common/carlink_video.h @@ -29,7 +29,7 @@ int get_carlink_video_fps(void); void set_carlink_video_info(int w, int h, int fps);//set h264 video stream info from phone void set_carlink_display_info(int x, int y, int w, int h);//set carlink show area in lcd void set_carlink_display_state(int on); // on: 1.display carlink; 0. display native ui - +void set_carlink_active_video_info(int x, int y);//for android auto #define WRITE_BE32(ptr, val) \ do { \ diff --git a/app/main_awtk.c b/app/main_awtk.c index dbff13f..9e8c60d 100644 --- a/app/main_awtk.c +++ b/app/main_awtk.c @@ -580,6 +580,33 @@ static void usb_read_thread(void *para) status = usb_wait_stor_dev_pluged(portMAX_DELAY); if (status == USB_DEV_PLUGED) { printf("usb dev inserted.\n"); + FF_FILE *fp = ff_fopen("/usb/update.bin", "rb"); + if (fp) { + UpFileHeader header; + SysInfo *sysinfo = GetSysInfo(); + if (ff_fread(&header, 1, sizeof(header), fp) == sizeof(header)) { + if (header.magic != MKTAG('U', 'P', 'D', 'F')) { + printf("Wrong update file, don't update.\n"); + } else { + if (header.checksum != sysinfo->app_checksum) { + printf("found different update file(0x%x-0x%x), update...\n", + header.checksum, sysinfo->app_checksum); + sysinfo->update_media_type = UPDATE_MEDIA_USB; + sysinfo->update_status = UPDATE_STATUS_START; + SaveSysInfo(); + hub_usb_dev_reset(); + vTaskDelay(500); + wdt_cpu_reboot(); + } else { + printf("the update file version is same, don't update.\n"); + } + } + }; + ff_fclose(fp); + } else { + printf("open update.bin fail.\n"); + } + /*printf("usb dev inserted.\n"); #ifdef OTA_UPDATE_SUPPORT FF_FILE *fp = ff_fopen("/usb/update.bin", "rb"); if (fp) { @@ -635,7 +662,7 @@ static void usb_read_thread(void *para) } else { printf("open update.bin fail.\n"); } -#endif +#endif*/ } else if (status == USB_DEV_UNPLUGED) { printf("usb removed.\n"); } @@ -710,7 +737,7 @@ void awtk_thread(void *data) /* can demo */ - //can_demo(); + can_demo(); /* read sd card demo */ #ifdef SDMMC_SUPPORT @@ -785,13 +812,15 @@ void awtk_thread(void *data) extern int gui_app_start(int lcd_w, int lcd_h); gui_app_start (OSD_WIDTH, OSD_HEIGHT); #endif - + // float cell = 0; + // static float cell_value = 0; + // static uint8_t cell_count = 0; while(1) { + #ifdef TASK_STATUS_MONITOR static uint32_t idletick = 0; uint8_t CPU_RunInfo[1024]; - if (xTaskGetTickCount() - idletick > configTICK_RATE_HZ * 10) { memset(CPU_RunInfo,0,1024); vTaskList((char *)&CPU_RunInfo); //获取任务运行时间信息 @@ -807,6 +836,25 @@ void awtk_thread(void *data) idletick = xTaskGetTickCount(); } #endif + + /*if ((xTaskGetTickCount() - idletick > configTICK_RATE_HZ*3) && (Get_sys_power_on_self_test() == 100)) { + adc_light = adc_get_channel_value(ADC_CH_AUX2);//光感 + adc_voltage = adc_get_channel_value(ADC_CH_AUX3);//电压 + // DEBUG_PRINT("adc_light = %d ,adc_voltage = %d . ",adc_light,adc_voltage); + idletick = xTaskGetTickCount(); + cell = adc_voltage_calculation(); + // DEBUG_PRINT("cell %lf .\r\n",cell); + // cell_value += cell; + // cell_count++; + // if(cell_count>=8){ + // cell_value = cell_value/cell_count; + // Set_sys_voltage(cell_value); + // cell_value = 0; + // cell_count = 0; + // } + Set_sys_voltage(cell); + + }*/ vTaskDelay(pdMS_TO_TICKS(10)); /*Just to let the system breath*/ } } diff --git a/app/moto/protocol/Bt_Interaction_protocol.c b/app/moto/protocol/Bt_Interaction_protocol.c new file mode 100644 index 0000000..2989b31 --- /dev/null +++ b/app/moto/protocol/Bt_Interaction_protocol.c @@ -0,0 +1,162 @@ +#include "awtk.h" +#include "conversation_protocol.h" + +#include +#include +#include +#include "chip.h" +#include "board.h" +#include "serial.h" +#include "sysinfo.h" +#include "user_data.h" +#include "data_port.h" +#include "universal.h" + + +#define MAX_ENTRIES 100 // 假设最大条目数为100 + +// 定义电话本条目结构体 +typedef struct { + char name[50]; + char phone[20]; +} PhoneBookEntry; + +PhoneBookEntry phoneBook[MAX_ENTRIES]; // 存储电话本信息的数组 +int numEntries = 0; // 当前电话本条目数量 + +void Phone_book_analysis(void){ + /*int numEntries = 0; // 当前电话本条目数量 + + // 模拟收到的电话本信息字符串 + char data[] = "+PBDATA=1JACK12345678911"; + + // 解析字符串并提取姓名和电话号码 + char *token = strtok(data, ""); // 使用作为分隔符 + if (token != NULL) { + token = strtok(NULL, ""); // 跳过第一个分隔符 + if (token != NULL) { + strcpy(phoneBook[numEntries].name, token); + token = strtok(NULL, ""); + if (token != NULL) { + strcpy(phoneBook[numEntries].phone, token); + numEntries++; + printf("Phone book entry stored successfully.\n"); + } + } + }*/ + + // 打印存储的电话本信息 + for (int i = 0; i < numEntries; i++) { + printf("Entry %d: Name - %s, Phone - %s\n", i+1, phoneBook[i].name, phoneBook[i].phone); + } + +} + +void Call_analysis(){ + +} + +void parseBtATCommand(char* cAtCmd,int cATLen) { + uint8_t str[64]; + static uint8_t flag = 0; + uint8_t j=0; + uint32_t num = 0; + + printf(">>"); + for(uint16_t i =0;i 8 && !memcmp(cAtCmd,"+A2DPDEV",8))//蓝牙连接设备信息 远端设备信息 蓝牙连接 + { + Set_sys_bt_connect_state(1); + }else if(strlen(cAtCmd) > 8 && !memcmp(cAtCmd,"+A2DPDEV",8)){ + + }else if(strlen(cAtCmd) > 9 && !memcmp(cAtCmd,"+A2DPLOST",9)){//远距离断开 设备丢失 + + }else if(strlen(cAtCmd) > 12 && !memcmp(cAtCmd,"+AVRCPSTAT=1",12)){//AVRCP状态 1是配对状态 蓝牙断开 + Set_sys_bt_connect_state(0); + }else if(strlen(cAtCmd) > 6 && !memcmp(cAtCmd,"+PBCNT",6)){//电话本数量 + num = atoi(cAtCmd + 7); //从数字的起始位置开始转换为整数 + printf("Extracted number from command: %d\n", num); + }else if(strlen(cAtCmd) > 7 && !memcmp(cAtCmd,"+PBDATA",7)){//电话号码 + printf("----------------------------\r\n"); + // 解析字符串并提取姓名和电话号码 + // char *token = strtok(cAtCmd, ""); // 使用作为分隔符 + /*char *token = strtok(cAtCmd, 0x3F); // 使用作为分隔符 + printf("token1 > %s .\r\n",token); + if (token != NULL) { + // token = strtok(NULL, ""); // 跳过第一个分隔符 + token = strtok(NULL, 0x3F); // 跳过第一个分隔符 + printf("token2 > %s .\r\n",token); + if (token != NULL) { + strcpy(phoneBook[numEntries].name, token); + printf("token3 > %s .\r\n",token); + // token = strtok(NULL, ""); + token = strtok(NULL, 0x3F); // 跳过第一个分隔符 + if (token != NULL) { + strcpy(phoneBook[numEntries].phone, token); + printf("token4 > %s .\r\n",token); + numEntries++; + printf("Phone book entry stored successfully.\n"); + } + } + }*/ + printf(">>"); + for(uint16_t i =0;i%s.\r\n",start4); + + strncpy(start2, (cAtCmd + len2), len2);//number + printf("start2 >%s.\r\n",start2); + strncpy(start, (cAtCmd + 10), len2-len1);//name + printf("start >%s, start2 >%s .\r\n",start,start2); + + + // char *start = cAtCmd + 10; + // char *start2; + // strncpy(start2, start, len1); + // char *start3 = start + len1; + + // // char *end = strchr(start, 0x3F); + // // char *end2 = strchr(end, 0x3F); + // printf("start >%s, end >%s, end2 >%s .\r\n",start,start2,start3); + + + + + // if (end) { + // *end = '\0'; + // strncpy(call_num, start, 19); + // call_num[19] = '\0'; // 确保字符串以null结尾 + // printf("call_num > %s .\r\n",call_num); + // } + // if (end2) { + // *end2 = '\0'; + // strncpy(call_name, end, 19); + // call_name[19] = '\0'; // 确保字符串以null结尾 + // printf("call_name > %s .\r\n",call_name); + // } + + + } +} diff --git a/app/moto/protocol/Bt_Interaction_protocol.h b/app/moto/protocol/Bt_Interaction_protocol.h new file mode 100644 index 0000000..5d505b4 --- /dev/null +++ b/app/moto/protocol/Bt_Interaction_protocol.h @@ -0,0 +1,6 @@ +#ifndef BT_INTERACTION_PROTOCOL_H +#define BT_INTERACTION_PROTOCOL_H + + + +#endif diff --git a/app/moto/protocol/can_protocol.c b/app/moto/protocol/can_protocol.c index 7878799..cf189b5 100644 --- a/app/moto/protocol/can_protocol.c +++ b/app/moto/protocol/can_protocol.c @@ -1,2 +1,69 @@ #include "awtk.h" #include "can_protocol.h" + +uint8_t tcs_twinkle = 0; +uint8_t tcs_switch = 0; + +//37B +void tcsworking_event_handing(int *buf){ + uint8_t data = 0; + *(buf++); + *(buf++); + data = *(buf++); + tcs_twinkle = getBitValue(data,7);//tcs闪烁控制指令 为1闪烁 +} + +//12B +void tcsswitch_event_handing(int *buf){ + uint8_t data = 0; + uint8_t tcs_data = 0; + data = *(buf++); + tcs_data = getBit2Value(data,0);//tcs开关信号 + if(tcs_data<=1) + tcs_switch = tcs_data; +} +//101 +void speed_event_handing(int *buf){ + uint16_t eng_temp = 0; + uint16_t data = 0; + double buf_value = 0; + *(buf++); + *(buf++); + *(buf++); + *(buf++); + + data = *(buf++) &0xFF; + data = (*(buf++)&0xFF) | data<<8; + + buf_value = data; //值为60-120 + if(buf_value>5280) + buf_value = 255; + else if(buf_value>2730) + buf_value = ((buf_value*0.1)-273); + else + buf_value = 0; + eng_temp = (int)buf_value; + Set_sys_can_temp(eng_temp); +} + +//0xA5 +void abs_dtc_event_handing(int *buf){ + char dtc[5] = {0}; + dtc[4] = *(buf++)&0xFF; + dtc[3] = *(buf++)&0xFF; + dtc[2] = *(buf++)&0xFF; + dtc[1] = *(buf++)&0xFF; + dtc[0] = *(buf++)&0xFF; + Get_can_abs_dtc(dtc); +} + +//0x402 +void ecu_dtc_event_handing2(int *buf){ + char dtc[5] = {0}; + dtc[4] = *(buf++)&0xFF; + dtc[3] = *(buf++)&0xFF; + dtc[2] = *(buf++)&0xFF; + dtc[1] = *(buf++)&0xFF; + dtc[0] = *(buf++)&0xFF; + Get_can_abs_dtc(dtc); +} \ No newline at end of file diff --git a/app/moto/protocol/gpio_protocol.c b/app/moto/protocol/gpio_protocol.c index 2e30ac9..a5fe11b 100644 --- a/app/moto/protocol/gpio_protocol.c +++ b/app/moto/protocol/gpio_protocol.c @@ -70,29 +70,31 @@ void vbat_led_off(void){ void light_gpio_init(void){ - // //灯光使能 - // gpio_direction_output(GPIO_LIGHT, TRUE); + //灯光使能 + gpio_direction_output(47, TRUE); //R_LED gpio_direction_output(GPIO_LIGHT_R_LED, TRUE); //YG_LED gpio_direction_output(GPIO_LIGHT_YG_LED, TRUE); - //ABS_LED - gpio_direction_output(GPIO_LIGHT_ABS, TRUE); //OIL_LED gpio_direction_output(GPIO_LIGHT_OIL, TRUE); //L_LED gpio_direction_output(GPIO_LIGHT_L_LED, TRUE); //N_LED gpio_direction_output(GPIO_LIGHT_N_LED, TRUE); - //ENG_LED - gpio_direction_output(GPIO_LIGHT_ENG_LED, TRUE); + // #if (MOTO_WARE_HOSE == MOTO_ICMX_A580A) + // //ABS_LED + // gpio_direction_output(GPIO_LIGHT_ABS, TRUE); + // //ENG_LED + // gpio_direction_output(GPIO_LIGHT_ENG_LED, TRUE); + // #endif //VBAT_LED gpio_direction_output(GPIO_LIGHT_VBAT_LED, TRUE); gpio_direction_input(GPIO_LIGHT_SET); gpio_direction_input(GPIO_LIGHT_MODE); - gpio_timer(); + gpio_timer();//按键 //左右灯光 } @@ -101,16 +103,18 @@ void light_off(void){ gpio_direction_output(GPIO_LIGHT_R_LED, FALSE); //YG_LED gpio_direction_output(GPIO_LIGHT_YG_LED, FALSE); - //ABS_LED - gpio_direction_output(GPIO_LIGHT_ABS, FALSE); //OIL_LED gpio_direction_output(GPIO_LIGHT_OIL, FALSE); //L_LED gpio_direction_output(GPIO_LIGHT_L_LED, FALSE); //N_LED gpio_direction_output(GPIO_LIGHT_N_LED, FALSE); - //ENG_LED - gpio_direction_output(GPIO_LIGHT_ENG_LED, FALSE); + // #if (MOTO_WARE_HOSE == MOTO_ICMX_A580A) + // //ABS_LED + // gpio_direction_output(GPIO_LIGHT_ABS, FALSE); + // //ENG_LED + // gpio_direction_output(GPIO_LIGHT_ENG_LED, FALSE); + // #endif //VBAT_LED gpio_direction_output(GPIO_LIGHT_VBAT_LED, FALSE); diff --git a/app/moto/protocol/gpio_protocol.h b/app/moto/protocol/gpio_protocol.h index 4bb03b2..a519e1b 100644 --- a/app/moto/protocol/gpio_protocol.h +++ b/app/moto/protocol/gpio_protocol.h @@ -3,7 +3,7 @@ #include "tkc/types_def.h" -#define GPIO_LIGHT 47 + #define GPIO_LIGHT_R_LED_FLAG 11 #define GPIO_LIGHT_L_LED_FLAG 10 diff --git a/app/moto/protocol/key_protocol.c b/app/moto/protocol/key_protocol.c index 8b2b430..2ccca75 100644 --- a/app/moto/protocol/key_protocol.c +++ b/app/moto/protocol/key_protocol.c @@ -10,9 +10,10 @@ KEY_DAT gs_keyDat[KEY_NUMBERS]={0}; bool key_readKeyPin(uint8_t keyx) { bool status; - if(keyx==0) status = gpio_get_value(GPIO_LIGHT_MODE); - else if(keyx==1) status = gpio_get_value(GPIO_LIGHT_SET); - return status; + if(keyx==0) status = gpio_get_value(GPIO_LIGHT_SET); + else if(keyx==1) status = gpio_get_value(GPIO_LIGHT_MODE); + // return (!status);//低有效 + return (status);//高有效 } void key_Scan(void) @@ -28,6 +29,9 @@ void key_Scan(void) } } +extern uint8_t map_flag; +static int step_about = 0; +static int step = 0; void check_key(void) { @@ -44,7 +48,7 @@ void check_key(void) gs_keyDat[1].flag_Reset=1; gs_keyDat[0].keyCnt=0; gs_keyDat[1].keyCnt=0; - // printf("set mode key \r\n"); + // printf("two long key ---------------------\r\n"); Key_Distinction(KEY_SHORT_ON,LV_KEY_OTHER1); } else if(gs_keyDat[i].keyCnt==KEY_LONGPRESS_COUNTER) @@ -55,14 +59,14 @@ void check_key(void) { gs_keyDat[i].flag_Reset=1; gs_keyDat[i].keyCnt=0; - // printf("set key long key\r\n"); + // printf("LV_KEY_OPTION key long key\r\n"); Key_Distinction(KEY_LONG_ON,LV_KEY_OPTION); } if(i==1 && gs_keyDat[0].flag_Pressed==KEY_OFF) { gs_keyDat[i].flag_Reset=1; gs_keyDat[i].keyCnt=0; - // printf("mode key long key\r\n"); + // printf("LV_KEY_SELECT key long key\r\n"); Key_Distinction(KEY_LONG_ON,LV_KEY_SELECT); } @@ -76,13 +80,37 @@ void check_key(void) { if(i==0 && gs_keyDat[1].flag_Pressed==KEY_OFF) { - // printf("set key short key\r\n"); - Key_Distinction(KEY_SHORT_ON,LV_KEY_OPTION); + // printf("LV_KEY_OPTION-------------------------.\r\n"); + // if(map_flag){ + // // KnobUpdate(0,0,0,0,0,1); + // request_UI("maps:"); + // }else + // if(Get_sys_wifi()){ + // printf("option DOWN .\r\n"); + // android_auto_send_key_event(20,1); + // android_auto_send_key_event(20,0); + // // android_auto_send_knob_event(19,1); + // // android_auto_send_knob_event(19,0); + // }else + Key_Distinction(KEY_SHORT_ON,LV_KEY_OPTION); } else if(i==1 && gs_keyDat[0].flag_Pressed==KEY_OFF) { - // printf("mode key short key\r\n"); - Key_Distinction(KEY_SHORT_ON,LV_KEY_SELECT); + // printf("LV_KEY_SELECT-------------------------.\r\n"); + // if(map_flag){ + // // KnobUpdate(0,0,0,0,0,-1); + // request_UI("maps:"); + // }else + // if(Get_sys_wifi()){ + // printf("select ENTER .\r\n"); + // android_auto_send_key_event(66,1); + // android_auto_send_key_event(66,0); + // // android_auto_send_key_event(20,1); + // // android_auto_send_key_event(20,0); + // // android_auto_send_knob_event(20,1); + // // android_auto_send_knob_event(20,0); + // }else + Key_Distinction(KEY_SHORT_ON,LV_KEY_SELECT); } } gs_keyDat[i].keyCnt=0; @@ -143,7 +171,7 @@ static void gpio_handler(void *param) int gpio_timer(void){ // printf("gpio_timer .\r\n"); if (xTaskCreate(gpio_handler, "gpio_handler", configMINIMAL_STACK_SIZE, NULL, - configMAX_PRIORITIES / 3, NULL) != pdPASS) { + configMAX_PRIORITIES - 5, NULL) != pdPASS) { printf("create uart rx demo task fail.\n"); return -1; } diff --git a/app/moto/protocol/ota_protocol.c b/app/moto/protocol/ota_protocol.c new file mode 100644 index 0000000..da3238d --- /dev/null +++ b/app/moto/protocol/ota_protocol.c @@ -0,0 +1,539 @@ + +#include +#include +#include + +#include "FreeRTOS.h" +#include "chip.h" +#include "board.h" +#include "serial.h" +#include "sysinfo.h" +#include "conversation_protocol.h" + +#include "sfud.h" + +#include "ota_update.h" +#include "updatefile.h" +#include "romfile.h" +#include "animation.h" +#include "ff_stdio.h" + +#include "awtk.h" +#include "ota_protocol.h" + + +int flash_copy_demo(void); + +#if DEVICE_TYPE_SELECT != EMMC_FLASH +#include "ff_sfdisk.h" +#endif + +typedef enum { + UART_FRAME_START, + UART_FRAME_FILEINFO, + UART_FRAME_FILEXFER, + UART_FRAME_FINISH, +} eUartFrameType; + +typedef enum { + UUP_STATE_IDLE, + UUP_STATE_START, + UUP_STATE_GET_FILEINFO, + UUP_STATE_FILE_TFR, + UUP_STATE_END, +} eUartUpdateState; + +#define UUP_ACK_OK 1 +#define UUP_ACK_FAIL 0 + +#define UUP_MAX_FILE_SIZE 0x1000000 +#define UUP_RX_FRAME_NUM 16 +#define UUP_MAX_LOADER_SIZE STEPLDR_MAX_SIZE//0x10000 + +static int uup_status = UUP_STATE_IDLE; +static int uup_file_type = 0; +static int uup_file_size = 0; +static int uup_packet_num = 0; +static int uup_rev_packet = 0; +static int uup_rev_len = 0; +static char uup_filename[32]; +static FF_FILE *uup_file = NULL; + +#define UUP_PACKET_SIZE 128 +#define UUP_MAX_FRAME_LEN (UUP_PACKET_SIZE + 16) +#define UUP_PACKET_A27_SIZE 4096 +#define UUP_MAX_FRAME_A27_LEN (UUP_PACKET_A27_SIZE + 16) +#define UUP_RX_FRAME_NUM 16 +#define BYTESPERPAGE 256 +#define PAGESPERSECTORS 16 +#define UUP_BUF_SIZE (BYTESPERPAGE * PAGESPERSECTORS) + +#define IMAGE_RW_SIZE 0x10000 +#define NEW_APPLDR_CHECKSUM_OFFSET 0x14 + +#define AMT630_BIN_OFFSET 0x41000 +#define BOOTANIM_BIN_OFFSET 0x741000 +#define ROM_BIN_OFFSET 0xb41000 +#define NEW_APPFOOSET 0x17F0000 +#define AMT630_BIN_MAX_SIZE 0x700000 + +/* +#define AMT630_BIN_OFFSET 0x41000 +#define BOOTANIM_BIN_OFFSET 0x501000//0x341000 +#define ROM_BIN_OFFSET 0x801000 +#define NEW_APPFOOSET 0xb01000 +#define AMT630_BIN_MAX_SIZE 0x4c0000 +*/ + +static uint32_t uup_app_offset; +static uint32_t uup_burn_offset; +static unsigned char uup_buf[4096]; +static unsigned int uup_buf_len = 0; +static unsigned int checksum = 0,calc_checksum = 0xffffffff; + +static void uup_send_ack(UartPort_t *uap, int type, int ret) +{ + /*unsigned char buf[7] = {0x55, 0x80, 0xc5, 0x02, 0x00, 0x00, 0x00}; + int i; + buf[4] = type; + buf[5] = ret; + for (i = 1; i < 6; i++) + buf[6] ^= buf[i]; + iUartWrite(uap, buf, 7, pdMS_TO_TICKS(100));*/ + unsigned char buf[8] = {0x55, 0x80, 0xc5, 0x02, 0x00, 0x00, 0x00, 0x00}; + int i; + + buf[5] = type; + buf[6] = ret; + if(ret == 0){ + Set_sys_power_on_self_test(100); + Set_sys_return_demo(2); + Set_sys_plan(0); + Set_sys_pace(0); + } + for (i = 1; i < 7; i++) + buf[7] ^= buf[i]; + // printf("630->uart:"); + // for(uint8_t j=0;j<8;j++){ + // printf("%02x ",buf[j]); + // } + // printf("\n"); + + iUartWrite(uap, buf, 8, pdMS_TO_TICKS(100)); +} + +void uup_ota_update(UartPort_t *uap, uint8_t *framebuf, size_t len) +{ + int frametype = framebuf[0]; + uint8_t *buf = framebuf + 1; + unsigned int framelen; + unsigned int packetnum; + sfud_flash *sflash = sfud_get_device(0); + SysInfo *sysinfo = GetSysInfo(); + //printf("uup_ota_update frametype =%d \n",frametype); + switch (frametype) { + case UART_FRAME_START: + printf("UART3_Modification_Type .\n"); + UART3_Modification_Type(); + vTaskDelay(10); + printf("start sfud erase flash .\n"); + //擦除flash + uup_app_offset = NEW_APPFOOSET; + uup_burn_offset = uup_app_offset; + //uup_send_ack(uap, frametype, UUP_ACK_OK); + //Set_sys_power_on_self_test(150); + printf("erase add %X , size %X .\r\n",uup_app_offset,AMT630_BIN_MAX_SIZE); + if(sfud_erase(sflash, uup_app_offset, AMT630_BIN_MAX_SIZE)==SFUD_SUCCESS){ + vTaskDelay(100); + printf("UART3_Type_regression .\n"); + UART3_Type_regression(); + vTaskDelay(100); + printf("UART_FRAME_START sfud erase ok.\n"); + uup_send_ack(uap, frametype, UUP_ACK_OK); + }else{ + vTaskDelay(100); + printf("UART3_Type_regression .\n"); + UART3_Type_regression(); + vTaskDelay(100); + printf("UART_FRAME_START sfud erase fail.\n"); + uup_send_ack(uap, frametype, UUP_ACK_FAIL); + + } + uup_status = UUP_STATE_START; + break; + case UART_FRAME_FILEINFO: + if (uup_status != UUP_STATE_START && uup_status != UUP_STATE_GET_FILEINFO) { + uup_send_ack(uap, frametype, UUP_ACK_FAIL); + break; + } + uup_file_type = buf[0]; + if (uup_file_type > UPFILE_TYPE_LNCHEMMC) { + printf("Rev wrong file type %d.\n", uup_file_type); + uup_send_ack(uap, frametype, UUP_ACK_FAIL); + break; + } + uup_packet_num = (buf[1] << 16) | (buf[2] << 8) | buf[3]; + uup_file_size = 128 * uup_packet_num; + if (uup_file_size > AMT630_BIN_MAX_SIZE) { + printf("Rev wrong file size.\n"); + printf("uup_file_size = 0x%x ,uup_packet_num = 0x%x .\n",uup_file_size,uup_packet_num); + uup_send_ack(uap, frametype, UUP_ACK_FAIL); + break; + } + printf("uup_file_size = 0x%x .\n",uup_file_size); + uup_packet_num = uup_packet_num/32; + + Set_sys_plan(uup_packet_num); + + uup_rev_packet = 0; + uup_send_ack(uap, frametype, UUP_ACK_OK); + uup_status = UUP_STATE_GET_FILEINFO; + calc_checksum = 0xffffffff; + break; + case UART_FRAME_FILEXFER: + if (uup_status != UUP_STATE_GET_FILEINFO && uup_status != UUP_STATE_FILE_TFR) { + uup_send_ack(uap, frametype, UUP_ACK_FAIL); + break; + } + + packetnum = buf[0]; + if ((uup_rev_packet & 0xff) != packetnum) { + printf("Wrong packet number.\n"); + //printf("buf 0 - 4 : 0x%x ,0x%x ,0x%x ,0x%x ,0x%x \n",buf[0],buf[1],buf[2],buf[3],buf[4],buf[5]); + //printf("packetnum = 0x%x,uup_rev_packet = 0x%x \n",packetnum,uup_rev_packet); + uup_send_ack(uap, frametype, UUP_ACK_FAIL); + break; + } + //printf("uup_rev_packet==0 ---------TURE\n"); + //printf("uup_rev_packet %d.\n", uup_rev_packet); + if (uup_rev_packet==0) { //第一条数据保存其crc校验码 + /*if (uup_file_type == UPFILE_TYPE_WHOLE) { + UpFileHeader *header = (UpFileHeader*)&buf[1]; + if (header->magic != MKTAG('U', 'P', 'D', 'F')) { + printf("Wrong whole file magic.\n"); + uup_send_ack(uap, frametype, UUP_ACK_FAIL); + break; + } + checksum = header->checksum; + sysinfo->app_size = header->files[0].size; + printf("sysinfo->appsize = 0x%x", sysinfo->app_size); + }else if (uup_file_type == UPFILE_TYPE_RESOURCE) { + RomHeader *header = (RomHeader *)&buf[1]; + if (header->magic != MKTAG('R', 'O', 'M', 'A')) { + printf("Wrong resource file magic.\n"); + uup_send_ack(uap, frametype, UUP_ACK_FAIL); + break; + } + checksum = header->checksum; + } else if (uup_file_type == UPFILE_TYPE_ANIMATION) { + BANIHEADER *header = (BANIHEADER *)&buf[1]; + if (header->magic != MKTAG('B', 'A', 'N', 'I')) { + printf("Wrong animation file magic.\n"); + uup_send_ack(uap, frametype, UUP_ACK_FAIL); + break; + } + checksum = header->checksum; + } else */ + if (uup_file_type == UPFILE_TYPE_APP) {//代码文件 + unsigned int magic = buf[1] | (buf[2] << 8) | (buf[3] << 16) | (buf[4] << 24); + if (magic != UPFILE_APP_MAGIC) { + printf("Wrong app file magic.\n"); + uup_send_ack(uap, frametype, UUP_ACK_FAIL); + break; + } + unsigned char *tmp = buf + 1 + NEW_APPLDR_CHECKSUM_OFFSET; + checksum = tmp[0] | (tmp[1] <<8) | (tmp[2] << 16) | (tmp[3] << 24); + }else if (uup_file_type == UPFILE_TYPE_ANIMATION) {//动画文件 + BANIHEADER *header = (BANIHEADER *)&buf[1]; + if (header->magic != MKTAG('B', 'A', 'N', 'I')) { + printf("Wrong animation file magic.\n"); + uup_send_ack(uap, frametype, UUP_ACK_FAIL); + break; + } + checksum = header->checksum; + }else if (uup_file_type == UPFILE_TYPE_RESOURCE) {//资源文件 + RomHeader *header = (RomHeader *)&buf[1]; + if (header->magic != MKTAG('R', 'O', 'M', 'A')) { + printf("Wrong resource file magic.\n"); + uup_send_ack(uap, frametype, UUP_ACK_FAIL); + break; + } + checksum = header->checksum; + } + printf(" file_type = %d ,No1.checksum = 0x%x\n",uup_file_type,checksum); + } + framelen = len - 2; + //printf("framelen = %d ,uup_packet_num =%d ,uup_rev_packet = %d \n",framelen,uup_packet_num,uup_rev_packet); + /* only last frame size is less than UUP_PACKET_SIZE */ + if (framelen > UUP_PACKET_A27_SIZE || + (framelen < UUP_PACKET_A27_SIZE && uup_rev_packet != uup_packet_num)) { //UUP_PACKET_A27_SIZE + printf("Wrong packet len.\n"); + printf("uup_rev_packet = %d, uup_packet_num = %d \n",uup_rev_packet,uup_packet_num); + uup_send_ack(uap, frametype, UUP_ACK_FAIL); + break; + } + memcpy(uup_buf + uup_buf_len, buf+1, framelen); + uup_buf_len += framelen; + uup_rev_packet++; + //uup_send_ack(uap, frametype, UUP_ACK_OK); + if (uup_buf_len == UUP_BUF_SIZE) { + printf("uup_rev_packet = %d , save_data.\n",uup_rev_packet); + uup_send_ack(uap, frametype, UUP_ACK_OK); + Set_sys_pace(uup_rev_packet); + //printf("addr=0x%x,size=%x\n",uup_burn_offset,framelen); + //sfud_erase_write(sflash, uup_burn_offset, UUP_BUF_SIZE, uup_buf); + sfud_write(sflash, uup_burn_offset, UUP_BUF_SIZE, uup_buf); + if (uup_rev_packet == 1){//UUP_BUF_SIZE/UUP_PACKET_SIZE) { + //printf("enter1 uup_rev_packet = %d \n",uup_rev_packet); + /*if (uup_file_type == UPFILE_TYPE_WHOLE) { + UpFileHeader *pheader = (UpFileHeader *)uup_buf; + pheader->checksum = 0; + } else if (uup_file_type == UPFILE_TYPE_RESOURCE) { + RomHeader *pheader = (RomHeader *)uup_buf; + pheader->checksum = 0; + } else if (uup_file_type == UPFILE_TYPE_ANIMATION) { + BANIHEADER *pheader = (BANIHEADER *)uup_buf; + pheader->checksum = 0; + } else if (uup_file_type == UPFILE_TYPE_APP) {*/ + if (uup_file_type == UPFILE_TYPE_APP) {//代码文件 + unsigned int *tmp = (unsigned int *)(uup_buf + NEW_APPLDR_CHECKSUM_OFFSET); + *tmp = 0; + }else if (uup_file_type == UPFILE_TYPE_ANIMATION) {//动画文件 + BANIHEADER *pheader = (BANIHEADER *)uup_buf; + pheader->checksum = 0; + }else if (uup_file_type == UPFILE_TYPE_RESOURCE) {//资源文件 + RomHeader *pheader = (RomHeader *)uup_buf; + pheader->checksum = 0; + } + //} + } + calc_checksum = xcrc32(uup_buf, UUP_BUF_SIZE, calc_checksum);//计算校验和 + uup_buf_len =0; + uup_burn_offset += UUP_BUF_SIZE; + }else if (uup_buf_len > UUP_BUF_SIZE) { + printf("loader file is too large.\n"); + uup_send_ack(uap, frametype, UUP_ACK_FAIL); + break; + } + /*memcpy(&uup_sysinfo, &buf[2], sizeof(SysInfo)); + sfud_erase_write(sflash, uup_burn_offset, framelen, &buf[1]);//128字节写一次 + uup_burn_offset += framelen;*/ + uup_status = UUP_STATE_FILE_TFR; + break; + case UART_FRAME_FINISH: + if (uup_status != UUP_STATE_FILE_TFR && uup_status != UART_FRAME_FINISH) { + uup_send_ack(uap, frametype, UUP_ACK_FAIL); + break; + } + if (!buf[0]) { + printf("update end with error!\n"); + uup_send_ack(uap, frametype, UUP_ACK_FAIL); + uup_status = UUP_STATE_END; + break; + } + framelen = len - 2; + //printf("finish calc_checksum =%x\n",calc_checksum); + if(uup_buf_len){//若最后一包数据不为0 则存数据并且继续计算校验和 + //sfud_erase_write(sflash, uup_burn_offset, uup_buf_len, uup_buf); + sfud_write(sflash, uup_burn_offset, uup_buf_len, uup_buf); + //若数据为32 即首次的4k 那么将其置为0 + if (uup_rev_packet <= 1){//< UUP_BUF_SIZE / UUP_PACKET_SIZE) { + printf("enter2 uup_rev_packet = %d \n",uup_rev_packet); + /*if (uup_file_type == UPFILE_TYPE_WHOLE) { + UpFileHeader *pheader = (UpFileHeader *)uup_buf; + pheader->checksum = 0; + } else if (uup_file_type == UPFILE_TYPE_RESOURCE) { + RomHeader *pheader = (RomHeader *)uup_buf; + pheader->checksum = 0; + } else if (uup_file_type == UPFILE_TYPE_ANIMATION) { + BANIHEADER *pheader = (BANIHEADER *)uup_buf; + pheader->checksum = 0; + } else if (uup_file_type == UPFILE_TYPE_APP) {*/ + if (uup_file_type == UPFILE_TYPE_APP) { + unsigned int *checksum = (unsigned int *)(uup_buf + NEW_APPLDR_CHECKSUM_OFFSET); + *checksum = 0; + }else if (uup_file_type == UPFILE_TYPE_ANIMATION) { + BANIHEADER *pheader = (BANIHEADER *)uup_buf; + pheader->checksum = 0; + }else if (uup_file_type == UPFILE_TYPE_RESOURCE) { + RomHeader *pheader = (RomHeader *)uup_buf; + pheader->checksum = 0; + } + } + printf("enter2 uup_buf_len =%d calc_checksum================0x%x\n",uup_buf_len,calc_checksum); + calc_checksum = xcrc32(uup_buf, uup_buf_len, calc_checksum); + Set_sys_pace(0); + Set_sys_upgrade(1); + } + + /*if (calc_checksum != checksum) { + printf("checksum error ! ! ! .\r\n"); + }else{ + printf("checksum ok .\r\n"); + }*/ + + if (calc_checksum != checksum) { + printf("calc_checksum = 0x%02x,checksum = 0x%02x.\n",calc_checksum,checksum); + printf("whole crc check after burn fail!\n"); + uup_send_ack(uap, frametype, UUP_ACK_FAIL); + uup_rev_packet = 0; + checksum = 0; + calc_checksum = 0xffffffff; + uup_buf_len = 0; + framelen = 0; + break; + } else { + uup_send_ack(uap, frametype, UUP_ACK_OK); + vTaskDelay(1000); + UART3_Modification_Type(); + printf("uap close .\r\n"); + printf("test amt630h update ok!\n"); + sysinfo->image_offset=0x40000; + sysinfo->reserved[9] = uup_file_type; + sysinfo->upgrade_flag=uup_buf_len; + sysinfo->upgrade_appsize=uup_file_size; + SaveSysInfo(); + vTaskDelay(500); + printf("TaskDelay 500ms SaveSysInfo .\n"); + flash_copy_demo(); + wdt_cpu_reboot(); + } + uup_rev_packet = 0; + checksum = 0; + calc_checksum = 0xffffffff; + uup_buf_len = 0; + framelen = 0; + uup_status = UUP_STATE_END; + break; + } + +} + + + +int flash_copy_demo(void) +{ + uint32_t calchecksum,appchecksum,imageoff,new_appoffset,new_appsize; + int i; + uint8_t *buf; + sfud_flash *sflash = sfud_get_device(0); + + printf("enter copy flash .\n"); + + new_appsize=uup_file_size; //根据串口升级的协议获取 + new_appoffset = NEW_APPFOOSET; //升级的程序可以固定写在这个地址,预留3M + if(uup_file_type == UPFILE_TYPE_APP){ + imageoff = AMT630_BIN_OFFSET; //固定的 运行区固定地址 + }else if(uup_file_type == UPFILE_TYPE_ANIMATION){ + imageoff = BOOTANIM_BIN_OFFSET; //固定的 运行区固定地址 + }else if(uup_file_type == UPFILE_TYPE_RESOURCE){ + imageoff = ROM_BIN_OFFSET; + } + //imageoff = AMT630_BIN_OFFSET; //固定的 运行区固定地址 + printf("copy flash init ok.\n"); + + Set_sys_plan((new_appsize/IMAGE_RW_SIZE)+1); + printf("new_appsize = %x ,start flash copy .\n",new_appsize); + + // sfud_qspi_fast_read_enable(sfud_get_device(0), 1); + // printf("sfud_qspi_fast_read_enable ok.\n"); + buf = pvPortMalloc(IMAGE_RW_SIZE); + if (!buf) { + printf("%s %d malloc %d bytes fail.\n", __FUNCTION__, __LINE__, IMAGE_RW_SIZE); + return -1; + } + printf("start copy flash ok.\n"); + for(i=0;ichecksum; + pheader->checksum = 0; + }else if (uup_file_type == UPFILE_TYPE_RESOURCE) {//资源文件 + RomHeader *pheader = (RomHeader *)buf; + appchecksum = pheader->checksum; + pheader->checksum = 0; + } + printf("file_type = %d. %X\r\n",uup_file_type,appchecksum); + calchecksum = xcrc32(buf, IMAGE_RW_SIZE, 0xffffffff); + printf("i=0 calchecksum = 0x%X.\n",calchecksum); + } + else + { + calchecksum = xcrc32(buf, IMAGE_RW_SIZE, calchecksum); + printf("i=%d ,r_add = 0x%X ,w_add = 0x%X , calchecksum = 0x%X.\n",i,new_appoffset+IMAGE_RW_SIZE*i,imageoff+IMAGE_RW_SIZE*i,calchecksum); + } + } + + + + if(new_appsize%IMAGE_RW_SIZE) + { + uint32_t red_add,wri_add,size,count; + int k; + count = (new_appsize%IMAGE_RW_SIZE )/0x1000; + red_add = new_appoffset+new_appsize- new_appsize%IMAGE_RW_SIZE; + wri_add = imageoff+new_appsize- new_appsize%IMAGE_RW_SIZE; + size = 0x1000; + printf("count = %d .\n",count); + for(k=0;kapp_size = new_appsize; + sysinfo->image_offset=0x40000; + sysinfo->upgrade_flag = 0; + sysinfo->upgrade_appsize =0; + sysinfo->reserved[9] = 0; + SaveSysInfo(); + vTaskDelay(500); + wdt_cpu_reboot(); + return 0; + } + else + { + SysInfo *sysinfo = GetSysInfo(); + sysinfo->image_offset=0x40000; + sysinfo->upgrade_flag = 0; + sysinfo->upgrade_appsize =0; + sysinfo->reserved[9] = 0; + SaveSysInfo(); + vTaskDelay(500); + printf("crc32 ERROR\r\n"); + return -1; + } + +} diff --git a/app/moto/protocol/ota_protocol.h b/app/moto/protocol/ota_protocol.h new file mode 100644 index 0000000..a7fa187 --- /dev/null +++ b/app/moto/protocol/ota_protocol.h @@ -0,0 +1,6 @@ +#ifndef OTA_PROTOCOL_H +#define OTA_PROTOCOL_H + +#include "tkc/types_def.h" + +#endif diff --git a/app/moto/protocol/tire_pressure_protocol.c b/app/moto/protocol/tire_pressure_protocol.c index d59b43d..1827756 100644 --- a/app/moto/protocol/tire_pressure_protocol.c +++ b/app/moto/protocol/tire_pressure_protocol.c @@ -79,7 +79,8 @@ void pressure_buffer_event_handing(Pressure_t pressure,char buffer[],uint8_t typ pressure.temp = data; if(data>=70 && data<128){ pressure.temp_state = 1; - } + }else + pressure.temp_state = 0; //DEBUG_PRINT("%x, ",data); //P sum = 0; diff --git a/app/moto/protocol/user_protocol.c b/app/moto/protocol/user_protocol.c index 189065d..2e2eb35 100644 --- a/app/moto/protocol/user_protocol.c +++ b/app/moto/protocol/user_protocol.c @@ -11,7 +11,7 @@ #include "moto_adc.h" -// uint8_t save_data = 0; +uint8_t save_data = 0; #define ADC_VPLTAGE_MIN 1666 #define ADC_VPLTAGE_MAX 2486 @@ -20,7 +20,7 @@ int adc_light = 0; int adc_voltage = 0; extern uint32_t fml_stamp_to_time(uint32_t timep , uint32_t time[]); -extern uint16_t light_buffer[]; +extern uint8_t light_buffer[]; extern double cell_buffer[]; extern uint8_t data_storage; extern uint32_t tire_front_time; @@ -54,10 +54,10 @@ double adc_voltage_calculation(void){ value = 16.5; else value = (adc_voltage - ADC_VPLTAGE_MIN) * (16.5 - 11.0) / (ADC_VPLTAGE_MAX - ADC_VPLTAGE_MIN) + 11.0; - printf("adc_voltage = %d value = %lf.\r\n",adc_voltage,value); + // printf("adc_voltage = %d value = %lf.\r\n",adc_voltage,value); return value; } -extern uint8_t device_flag; + //MOTO通讯 设备信息+时间戳解析协议 void device_data_analysis(uint8_t *buf){ DEBUG_PRINT("enter device_data_analysis .\r\n"); @@ -77,8 +77,7 @@ void device_data_analysis(uint8_t *buf){ // DEBUG_PRINT("0x47 -- %02x .\n",data); if(data!=0x47) return; - if(!device_flag) - device_flag = 1; + //设备相关信息 data = *(buf++);//0x01 // DEBUG_PRINT("0x01 -- %02x .\n",data); @@ -199,7 +198,7 @@ void device_data_analysis(uint8_t *buf){ Set_device_ability(data); } - +int test_light = 0; //MOTO通讯协议 void data_analysis(uint8_t *buf){ uint32_t data; @@ -211,7 +210,8 @@ void data_analysis(uint8_t *buf){ uint8_t light = 0; double cell = 0; uint8_t sys_state = 0; - uint8_t save_data = 0; + save_data = 0; + if(Get_sys_power_on_self_test()==100) sys_state=1; @@ -279,11 +279,14 @@ void data_analysis(uint8_t *buf){ save_data = getBitValue(data,7); if(sys_state){ - // right_led_switch(getBitValue(data,0)); - // left_led_switch(getBitValue(data,1)); + right_led_switch(getBitValue(data,0)); + left_led_switch(getBitValue(data,1)); yg_led_switch(getBitValue(data,2)); - // abs_led_switch(getBitValue(data,4)); - // eng_led_switch(getBitValue(data,6)); + #if (MOTO_WARE_HOSE == MOTO_ICMX_A580A) + abs_led_switch(getBitValue(data,4)); + eng_led_switch(getBitValue(data,6)); + #endif + } //档位 @@ -343,7 +346,7 @@ void data_analysis(uint8_t *buf){ } if(save_data){ - DEBUG_PRINT("save_data.\r\n"); + // DEBUG_PRINT("save_data.\r\n"); // printf("light = %d .\r\n",light); Set_sys_gas(oil); Set_sys_temp(temp); @@ -364,8 +367,11 @@ void data_analysis(uint8_t *buf){ //adc采样光感计算 int light_num = (adc_light/10); - if(light_num>=100) - light_num = 100; + test_light = light_num; + if(light_num>=200) + light_num = 200; + if(Get_sys_power_on_self_test()<100) + light_num = 10; light_buffer[data_storage] =light_num; data_storage++; if(data_storage>=SAVE_DATA_SIZE){//满足存储大小 计算均值 diff --git a/app/moto/protocol/user_protocol.h b/app/moto/protocol/user_protocol.h index 2afce05..441a8c4 100644 --- a/app/moto/protocol/user_protocol.h +++ b/app/moto/protocol/user_protocol.h @@ -3,4 +3,14 @@ #include "tkc/types_def.h" +// 封装的函数,根据位位置获取对应的值 +uint8_t getBitValue(uint8_t count, int bitPosition); +// 封装的函数,获取2个bit组合成的值 +uint8_t getBit2Value(uint8_t count, int bitPosition); +// 封装的函数,获取3个bit组合成的值 +uint8_t getBit3Value(uint8_t count, int bitPosition); +// 封装的函数,获取4个bit组合成的值 +uint8_t getBit4Value(uint8_t count, int bitPosition); + + #endif diff --git a/lib/awtk/awtk-examples/.gitignore b/lib/awtk/awtk-examples/.gitignore new file mode 100644 index 0000000..10f5670 --- /dev/null +++ b/lib/awtk/awtk-examples/.gitignore @@ -0,0 +1,21 @@ +__docs__ +__images__ +bin/ +*.o +*.a +*.so +*.swp +*.pdb +*.ilk +*.idb +*.obj +*.lib +*.exp +*.doc +*.docx +*.vsd +.sconsign.dblite +.vscode +build_web.py +Moto_A58/res/assets/ +Moto_QH105/ \ No newline at end of file diff --git a/lib/awtk/awtk-examples/Moto_A58-0901.zip b/lib/awtk/awtk-examples/Moto_A58-0901.zip new file mode 100644 index 0000000..7699370 Binary files /dev/null and b/lib/awtk/awtk-examples/Moto_A58-0901.zip differ diff --git a/lib/awtk/awtk-examples/Moto_A58/.sconsign.dblite b/lib/awtk/awtk-examples/Moto_A58/.sconsign.dblite index e3a92ca..b50bf60 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/.sconsign.dblite and b/lib/awtk/awtk-examples/Moto_A58/.sconsign.dblite differ diff --git a/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/.clang-format b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/.clang-format new file mode 100644 index 0000000..dec56b8 --- /dev/null +++ b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/.clang-format @@ -0,0 +1,115 @@ +--- +Language: Cpp +# BasedOnStyle: Google +AccessModifierOffset: -1 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Left +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: false +AllowShortIfStatementsOnASingleLine: true +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: true +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Attach +BreakBeforeInheritanceComma: false +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeColon +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 100 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IncludeCategories: + - Regex: '^' + Priority: 2 + - Regex: '^<.*\.h>' + Priority: 1 + - Regex: '^<.*' + Priority: 2 + - Regex: '.*' + Priority: 3 +IncludeIsMainRegex: '([-_](test|unittest))?$' +IndentCaseLabels: true +IndentPPDirectives: None +IndentWidth: 2 +IndentWrappedFunctionNames: false +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: false +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 600 +PenaltyBreakFirstLessLess: 100 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Left +RawStringFormats: + - Language: TextProto + BasedOnStyle: google +ReflowComments: false +SortIncludes: false +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Auto +TabWidth: 2 +UseTab: Never +... + diff --git a/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/.gitignore b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/.gitignore new file mode 100644 index 0000000..66bce9e --- /dev/null +++ b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/.gitignore @@ -0,0 +1,34 @@ +*.o +*.a +*.so +*.swp +*.pdb +*.ilk +*.idb +*.obj +*.exe +*.os +*.pyc +/bin +/lib +.sconsign.dblite +lua/demo1 +lua/lftk_run +tags +bin/demo1* +bin/demo_animator* +bin/demo_thread* +bin/demotr* +bin/demovg* +bin/fontgen* +bin/preview_ui* +bin/resgen* +bin/runLua* +bin/runTest* +bin/strgen* +bin/image* +bin/hello* +.vscode +.vs +*.os +res diff --git a/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/.remote_aw_plugin b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/.remote_aw_plugin new file mode 100644 index 0000000..e69de29 diff --git a/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/LICENSE b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/LICENSE new file mode 100644 index 0000000..8000a6f --- /dev/null +++ b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/LICENSE @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random + Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/README.md b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/README.md new file mode 100644 index 0000000..37c1bd1 --- /dev/null +++ b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/README.md @@ -0,0 +1,143 @@ +# awtk-widget-qr + +qr 控件。用于显示二维码控件。 + +![](docs/images/ui.jpg) + +* 本项目使用 [libqrencode](https://github.com/fukuchi/libqrencode) 生成二维码。 + +* 本项目使用 [awtk-widget-generator](https://github.com/zlgopen/awtk-widget-generator) 生成代码框架。 + +## 准备 + +1. 获取 awtk 并编译 + +``` +git clone https://github.com/zlgopen/awtk.git +cd awtk; scons; cd - +``` + +2. 获取 awtk-widget-qr 并编译 +``` +git clone https://github.com/zlgopen/awtk-widget-qr.git +cd awtk-widget-qr; scons +``` + +## 运行 + +1. 生成示例代码的资源 + +``` +python scripts/update_res.py all +``` +> 也可以使用 Designer 打开项目,之后点击 “打包” 按钮进行生成; +> 如果资源发生修改,则需要重新生成资源。 + +如果 PIL 没有安装,执行上述脚本可能会出现如下错误: +```cmd +Traceback (most recent call last): +... +ModuleNotFoundError: No module named 'PIL' +``` +请用 pip 安装: +```cmd +pip install Pillow +``` + +2. 编译 + +* 编译PC版本 + +``` +scons +``` + +* 编译LINUX FB版本 + +``` +scons LINUX_FB=true +``` + +> 完整编译选项请参考[编译选项](https://github.com/zlgopen/awtk-widget-generator/blob/master/docs/build_options.md) + + +3. 运行 + +``` +./bin/demo +``` + +## 如何使用二维码控件 + +### 设置需要转成二维码的字符串 + +qr 控件 `value` 属性内容就是转成二维码的字符串内容。 + +在界面描述文件设置: + +```xml + + + +``` + +或在代码中设置: + +```c +widget_t* win = window_open("main"); +widget_t* qr = widget_lookup(win, "qr", TRUE); +qr_set_value(qr, "https://github.com/zlgopen/awtk"); +``` + +按照上述例子设置完成后,用手机扫该二维码就会打开[ https://github.com/zlgopen/awtk ](https://github.com/zlgopen/awtk)网址。 + +### 设置二维码中的颜色与图片 + +添加图片资源到项目中: + +![](./design/default/images/x1/message.png) + +在样式文件中设置 qr 控件样式在对应状态设置 `fg_color` ,`bg_color`,`bg_image` 属性: + +```xml + + + +``` + +从上述例子得到的效果为: + +正常状态: + +![](./docs/images/normal_style.png) + +被扫描状态: + +![](./docs/images/scanned_style.png) + +**注意**:图片大小不可以大于二维码的 `45%` ,否则图片将会被裁剪: + +图片资源: + +![](./design/default/images/x3/message.png) + +得到的二维码: + +![](./docs/images/clip_image.png) + +qr 控件的属性名及作用如下表所示: + +| 属性名 | 作用 | +| ------ | ---------------------- | +| value | 要转换为二维码的字符串 | + +## 文档 + +[完善自定义控件](https://github.com/zlgopen/awtk-widget-generator/blob/master/docs/improve_generated_widget.md) diff --git a/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/SConstruct b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/SConstruct new file mode 100644 index 0000000..7efd06b --- /dev/null +++ b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/SConstruct @@ -0,0 +1,8 @@ +import os +import scripts.app_helper as app + +helper = app.Helper(ARGUMENTS) +helper.set_dll_def('src/qr.def').set_libs(['qr']).call(DefaultEnvironment) + +SConscriptFiles = ['src/SConscript'] +SConscript(SConscriptFiles) diff --git a/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/design/default/fonts/default.ttf b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/design/default/fonts/default.ttf new file mode 100644 index 0000000..866d3ba Binary files /dev/null and b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/design/default/fonts/default.ttf differ diff --git a/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/design/default/images/x1/message.png b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/design/default/images/x1/message.png new file mode 100644 index 0000000..70793c3 Binary files /dev/null and b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/design/default/images/x1/message.png differ diff --git a/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/design/default/images/x2/message.png b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/design/default/images/x2/message.png new file mode 100644 index 0000000..7f828bc Binary files /dev/null and b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/design/default/images/x2/message.png differ diff --git a/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/design/default/images/x3/message.png b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/design/default/images/x3/message.png new file mode 100644 index 0000000..192be1f Binary files /dev/null and b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/design/default/images/x3/message.png differ diff --git a/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/design/default/styles/default.xml b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/design/default/styles/default.xml new file mode 100644 index 0000000..114eb99 --- /dev/null +++ b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/design/default/styles/default.xml @@ -0,0 +1,459 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/design/default/styles/main.xml b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/design/default/styles/main.xml new file mode 100644 index 0000000..97ef347 --- /dev/null +++ b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/design/default/styles/main.xml @@ -0,0 +1,6 @@ + + + diff --git a/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/design/default/ui/main.xml b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/design/default/ui/main.xml new file mode 100644 index 0000000..d9948a8 --- /dev/null +++ b/lib/awtk/awtk-examples/Moto_A58/3rd/awtk-widget-qr/design/default/ui/main.xml @@ -0,0 +1,4 @@ + + + - diff --git a/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview1.bin b/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview1.bin index 7353c66..0ef8c6d 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview1.bin and b/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview1.bin differ diff --git a/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview1.xml b/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview1.xml index 40de7cd..9aabb99 100644 --- a/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview1.xml +++ b/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview1.xml @@ -4,20 +4,25 @@ - - - + \ No newline at end of file diff --git a/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview2.bin b/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview2.bin index bb5b0c0..48b285b 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview2.bin and b/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview2.bin differ diff --git a/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview2.xml b/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview2.xml index c9ac164..1b14cf9 100644 --- a/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview2.xml +++ b/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview2.xml @@ -1,23 +1,29 @@ - \ No newline at end of file diff --git a/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview3.bin b/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview3.bin index fdc26f4..baead25 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview3.bin and b/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview3.bin differ diff --git a/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview3.xml b/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview3.xml index bd713a9..df3ee9e 100644 --- a/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview3.xml +++ b/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview3.xml @@ -1,13 +1,13 @@ - - - diff --git a/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview4.bin b/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview4.bin index d456bee..39297a6 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview4.bin and b/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview4.bin differ diff --git a/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview4.xml b/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview4.xml index 9eb22e5..7e649f2 100644 --- a/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview4.xml +++ b/lib/awtk/awtk-examples/Moto_A58/design/default/ui/settingview4.xml @@ -1,7 +1,7 @@ - \ No newline at end of file diff --git a/lib/awtk/awtk-examples/Moto_A58/design_dll/number_label.dll b/lib/awtk/awtk-examples/Moto_A58/design_dll/number_label.dll index dd3d0d6..7504bed 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/design_dll/number_label.dll and b/lib/awtk/awtk-examples/Moto_A58/design_dll/number_label.dll differ diff --git a/lib/awtk/awtk-examples/Moto_A58/design_dll/qr.dll b/lib/awtk/awtk-examples/Moto_A58/design_dll/qr.dll new file mode 100644 index 0000000..3c076c7 Binary files /dev/null and b/lib/awtk/awtk-examples/Moto_A58/design_dll/qr.dll differ diff --git a/lib/awtk/awtk-examples/Moto_A58/manifest.json b/lib/awtk/awtk-examples/Moto_A58/manifest.json index ad48324..eed5cf4 100644 --- a/lib/awtk/awtk-examples/Moto_A58/manifest.json +++ b/lib/awtk/awtk-examples/Moto_A58/manifest.json @@ -1 +1 @@ -{"uri":"project://383b8640-4b1b-11ef-8e8b-5da0ffbe4848","resources":{"design\\default\\fonts\\A27_SYHT_CT.ttf":{"md5":"511cdf2466984f6684a72b98f05debfd"},"design\\default\\fonts\\Arial_MT_Black.ttf":{"md5":"d01aa1b985e0be9fb183a6af6aa80ac3"},"design\\default\\fonts\\default.ttf":{"md5":"4ef27a910b2372755d003837c6c2c00f"},"design\\default\\fonts\\QH_LABEL.ttf":{"md5":"4c4e0da52229ca6117545021661814fb"},"design\\default\\fonts\\QH_SJ.ttf":{"md5":"2f859ae506250f150d8789a956fd9cd1"},"design\\default\\fonts\\QH_SPEED.ttf":{"md5":"0d8a3ce17f471070c381538c34190731"},"design\\default\\fonts\\Serpentine_MediumOblique.ttf":{"md5":"c1095d7f8031ae1ce19a0eea6769edd7"},"design\\default\\images\\xx\\beam_wide_icon.png":{"md5":"02723015986a4f3149b6924df5d82250"},"design\\default\\images\\xx\\btn_next_bk.png":{"md5":"c839fb6591ceb2b0ff4eab19d256b194"},"design\\default\\images\\xx\\btn_next_wt.png":{"md5":"a4dd1ac55a4c2fd2b83010996022532f"},"design\\default\\images\\xx\\btn_select_bg_bk.png":{"md5":"768ceacab9828fb7a45a72f0dfce0895"},"design\\default\\images\\xx\\btn_select_bg_wt.png":{"md5":"6445ee30bc6e858a88bcdf9b6ff08f33"},"design\\default\\images\\xx\\demo_bk.png":{"md5":"a684b85011048a0624ef0e9e1f71377e"},"design\\default\\images\\xx\\demo_wt.png":{"md5":"05cf615d9d956e7a004f760213cab178"},"design\\default\\images\\xx\\front_learing.png":{"md5":"9db0371a319b92be5e8ed3db2364e857"},"design\\default\\images\\xx\\front_normal.png":{"md5":"7385bdc8a34a36af1a2161a9ef5d68ab"},"design\\default\\images\\xx\\front_not_learned.png":{"md5":"ceb53052268109286e6c60048ae5cdd3"},"design\\default\\images\\xx\\fuel_bar_01.png":{"md5":"712e5701cead9293b6f78feda1235320"},"design\\default\\images\\xx\\fuel_bar_02.png":{"md5":"8550f1b5a5cf6caf0e652b91a8d599cb"},"design\\default\\images\\xx\\fuel_bar_03.png":{"md5":"bf5e44bf4a041c8a26333995936ac19c"},"design\\default\\images\\xx\\fuel_bar_04.png":{"md5":"a5b71e5d0f1d645b3c5c030a0d2c5c60"},"design\\default\\images\\xx\\fuel_bar_05.png":{"md5":"d9e634012e1195e92b9de89ce89a82eb"},"design\\default\\images\\xx\\fuel_bar_06.png":{"md5":"d7773bbd8b0e406648a69ffffa928ff6"},"design\\default\\images\\xx\\fuel_bg.png":{"md5":"c4bed120953cc291a2fc30383db30a01"},"design\\default\\images\\xx\\fuel_icon.png":{"md5":"2b60ccd8401f0b6bb5d2d2906e93f0fe"},"design\\default\\images\\xx\\fuel_warn_icon.png":{"md5":"26767b9b37a8e339731343f6f1fbc8c7"},"design\\default\\images\\xx\\func_bt_icon.png":{"md5":"c4b06de55c8dc66a54ca9526f4efc25a"},"design\\default\\images\\xx\\func_call_answer_icon.png":{"md5":"442bac4b88538789ce7d5a47536f48f8"},"design\\default\\images\\xx\\light_bar.png":{"md5":"47ee6c52d7112ee44b278180ed0d787e"},"design\\default\\images\\xx\\light_bg.png":{"md5":"2437eef409ec3cbc4fe4ead7e2ae7e7d"},"design\\default\\images\\xx\\list_information_bk.png":{"md5":"38300a0c329965752d5017d3194a0d26"},"design\\default\\images\\xx\\list_information_select_bk.png":{"md5":"c90e725434ed199f394400bb6340e0c8"},"design\\default\\images\\xx\\list_information_select_wt.png":{"md5":"803a535e4b3c4870e292406a18fed626"},"design\\default\\images\\xx\\list_information_wt.png":{"md5":"67676ee0f1406d7a03a8bc93686a2192"},"design\\default\\images\\xx\\list_light_bk.png":{"md5":"9af6e4179dae13c69e51cea470d27a7a"},"design\\default\\images\\xx\\list_light_select_bk.png":{"md5":"3eb008447e3aa40b19c8c579df54ed31"},"design\\default\\images\\xx\\list_light_select_wt.png":{"md5":"e6b8ac1e78cc70d779030e76bc6e5edd"},"design\\default\\images\\xx\\list_light_wt.png":{"md5":"fb7f12705a88dde2db87f0d53c1da98c"},"design\\default\\images\\xx\\list_set_bk.png":{"md5":"c43f0d4ac97c15e1376d0cbd05168af3"},"design\\default\\images\\xx\\list_set_select_bk.png":{"md5":"bb3bed1d06ff003630e815f060cd5585"},"design\\default\\images\\xx\\list_set_select_wt.png":{"md5":"c39c058e26c9bd628988ebe91a302663"},"design\\default\\images\\xx\\list_set_wt.png":{"md5":"c506c1a7bf89b7f4ed296be648a50ba1"},"design\\default\\images\\xx\\list_theme_bk.png":{"md5":"5009dde85e7d0de1bd7d68185ac6ca84"},"design\\default\\images\\xx\\list_theme_select_bk.png":{"md5":"3b49b74cc205105ee3343df028d251e2"},"design\\default\\images\\xx\\list_theme_select_wt.png":{"md5":"f28598d77b31def4322380e123dd4ec7"},"design\\default\\images\\xx\\list_theme_wt.png":{"md5":"a76c3c7029b4d398d0d36bae366e19da"},"design\\default\\images\\xx\\list_top_bg_bk.png":{"md5":"7a0ecbf190f56c0d8da53128499ca54f"},"design\\default\\images\\xx\\list_top_bg_wt.png":{"md5":"25b6e790e8ce642a91ccc9edf57a3016"},"design\\default\\images\\xx\\main_bg.png":{"md5":"81db82f799fd0e3312092f7f0f49c361"},"design\\default\\images\\xx\\Moto.png":{"md5":"fa113f87921c3910a9361765655c7bea"},"design\\default\\images\\xx\\MOTO_wt.png":{"md5":"950fdc478269860e1bb4baa58483b547"},"design\\default\\images\\xx\\odo_index.png":{"md5":"29ad59b17f39844877663b861137fbfd"},"design\\default\\images\\xx\\rear_learing.png":{"md5":"f72fe09fdf5d2fe1f3f99c037a3387f8"},"design\\default\\images\\xx\\rear_normal.png":{"md5":"530b93a9c139598fcbab9d9e705b72dd"},"design\\default\\images\\xx\\rear_not_learned.png":{"md5":"58b3f9ef58e12ffef1d068494555d0cf"},"design\\default\\images\\xx\\rpm_bg.png":{"md5":"33139d52ae6c95f3e866ae0bf0186ddc"},"design\\default\\images\\xx\\rpm_bg_01.png":{"md5":"bb25b80fdbfe616270a1bd020481f78b"},"design\\default\\images\\xx\\rpm_pointer.png":{"md5":"daa9cec09274913978c6364621c547d5"},"design\\default\\images\\xx\\temp_bar_01.png":{"md5":"6c13de39ab3f6e13e3b77bdc4a185162"},"design\\default\\images\\xx\\temp_bar_02.png":{"md5":"ffd2e651c64e57cd15183b57d99e8d73"},"design\\default\\images\\xx\\temp_bar_03.png":{"md5":"e25110e20d5927580850d1342cc5b61d"},"design\\default\\images\\xx\\temp_bar_04.png":{"md5":"74b9e6ed184e3e148455c166c8b0f459"},"design\\default\\images\\xx\\temp_bar_05.png":{"md5":"281abd08fffe542d448bc641dc6e95f3"},"design\\default\\images\\xx\\temp_bar_06.png":{"md5":"d7773bbd8b0e406648a69ffffa928ff6"},"design\\default\\images\\xx\\temp_icon.png":{"md5":"9bc43e033fd5936fa4438deef44be9c9"},"design\\default\\images\\xx\\temp_warn_icon.png":{"md5":"7553c3fd094899dc05f2106665b66dc5"},"design\\default\\images\\xx\\time_select.png":{"md5":"80f4606b0277e9bf73e74bda940e532c"},"design\\default\\images\\xx\\trip_index.png":{"md5":"4c12d0a9a0f7879559e60b8f038b4ae9"},"design\\default\\images\\xx\\warn_abs_icon.png":{"md5":"b1577cef3a98eed3c3a37a7eed2fff32"},"design\\default\\images\\xx\\warn_engine_icon.png":{"md5":"f2e9b97376b18a6e9d84a27945047836"},"design\\default\\images\\xx\\warn_tcs_icon.png":{"md5":"929d57ebb1fd2db7af1669c0e98f62a0"},"design\\default\\images\\xx\\warn_tire_icon.png":{"md5":"4fc61a993e951c015055e7f4772af01b"},"design\\default\\strings\\strings.xml":{"md5":"772568980dde4e1d490f594d2c0b08a9"},"design\\default\\styles\\default.xml":{"md5":"85082107424d6266c7202478b9c7a7d8"},"design\\default\\styles\\settingview2.xml":{"md5":"d41d8cd98f00b204e9800998ecf8427e"},"design\\default\\ui\\A58_home_page.xml":{"md5":"dec9fc6e118788836922c7e083fc196d"},"design\\default\\ui\\call.xml":{"md5":"0892b33fa0de072719bb9f31410c9a98"},"design\\default\\ui\\new.xml":{"md5":"1672448cea9b27ee13aafcab3359a2cc"},"design\\default\\ui\\prompt.xml":{"md5":"33da2a4201553201a3deee277dc73da2"},"design\\default\\ui\\settingview1.xml":{"md5":"10d32dba20a95bac178826f333c46ee1"},"design\\default\\ui\\settingview2.xml":{"md5":"9f0098d30c324452aa4fd3bccac92cb5"},"design\\default\\ui\\settingview3.xml":{"md5":"22781c39dc2f4e08c5fadd8212eeb18e"},"design\\default\\ui\\settingview4.xml":{"md5":"0d6caf8d0bd0febe216e3775822431f2"},"design\\default\\ui\\set_list.xml":{"md5":"1760597b4932b3227e57a934e58040e9"},"design\\default\\ui\\set_mile.xml":{"md5":"735e875679f928555cb9f41bac624e34"},"design\\default\\ui\\set_time.xml":{"md5":"d3fb6b117711be54dd4d13d17ee8f40d"},"design\\default\\ui\\set_tire_pressure.xml":{"md5":"6f175d85118777864b28144de93c4a8a"}},"config":{"loadFrom":"any","const":"resource_data"}} \ No newline at end of file +{"uri":"project://2466e1f0-7ba4-11ef-85ef-b916cf49d078","resources":{"design\\default\\fonts\\A27_SYHT_CT.ttf":{"md5":"9406356f67725baa8b23780d938c5d76"},"design\\default\\fonts\\Arial_MT_Black.ttf":{"md5":"d01aa1b985e0be9fb183a6af6aa80ac3"},"design\\default\\fonts\\default.ttf":{"md5":"4ef27a910b2372755d003837c6c2c00f"},"design\\default\\fonts\\Serpentine_MediumOblique.ttf":{"md5":"c1095d7f8031ae1ce19a0eea6769edd7"},"design\\default\\images\\xx\\beam_wide_icon.png":{"md5":"02723015986a4f3149b6924df5d82250"},"design\\default\\images\\xx\\btn_next_bk.png":{"md5":"c839fb6591ceb2b0ff4eab19d256b194"},"design\\default\\images\\xx\\btn_next_wt.png":{"md5":"a4dd1ac55a4c2fd2b83010996022532f"},"design\\default\\images\\xx\\btn_select_bg_bk.png":{"md5":"768ceacab9828fb7a45a72f0dfce0895"},"design\\default\\images\\xx\\btn_select_bg_wt.png":{"md5":"6445ee30bc6e858a88bcdf9b6ff08f33"},"design\\default\\images\\xx\\call_bg.png":{"md5":"66eaf5c82d15f5476ed84f3d6d85de07"},"design\\default\\images\\xx\\call_bg2.png":{"md5":"0ffff6186011a608dde15e40e5762189"},"design\\default\\images\\xx\\demo2_bg_bk.png":{"md5":"402ae4abec3078911fbfb253a1df922b"},"design\\default\\images\\xx\\demo2_bg_wt.png":{"md5":"3bd6680ccca3ec9cbbe417146dc07dcd"},"design\\default\\images\\xx\\demo2_fuel_bar_00.png":{"md5":"5ccf2bff6bc18edcb5998dbbcdffa76c"},"design\\default\\images\\xx\\demo2_fuel_bar_01.png":{"md5":"239cd7afb0ca318c8908ee70ad7570a3"},"design\\default\\images\\xx\\demo2_fuel_bar_02.png":{"md5":"b43323b57ae2e3ab6e6a9a9c1d40fda1"},"design\\default\\images\\xx\\demo2_fuel_bar_03.png":{"md5":"8d75d524c1d2a79acea38649fd4f6843"},"design\\default\\images\\xx\\demo2_fuel_bar_04.png":{"md5":"7a7e2736d9e9e123065283b079b744b7"},"design\\default\\images\\xx\\demo2_fuel_bar_05.png":{"md5":"c399c153f35655da6807c1572da99d13"},"design\\default\\images\\xx\\demo2_fuel_bar_bk_00.png":{"md5":"73fc3bb7ead44698e781f0e9daf3ae86"},"design\\default\\images\\xx\\demo2_fuel_bar_bk_01.png":{"md5":"44db941e798f40dd18a3c37274a5ca42"},"design\\default\\images\\xx\\demo2_fuel_bar_bk_02.png":{"md5":"cf5ad920c1769b1eafe38915b930cbfe"},"design\\default\\images\\xx\\demo2_fuel_bar_bk_03.png":{"md5":"84ca0c3c64b3b34ed7aaf02d01b69830"},"design\\default\\images\\xx\\demo2_fuel_bar_bk_04.png":{"md5":"49d2641ae283f73c1e94577c2c7b1d70"},"design\\default\\images\\xx\\demo2_fuel_bar_bk_05.png":{"md5":"df625e399ef8a54397bfc50d54ca7576"},"design\\default\\images\\xx\\demo2_speed_bk.png":{"md5":"42d203907d3fa940dc2c592ba8f855f0"},"design\\default\\images\\xx\\demo2_speed_wt.png":{"md5":"8baaa80eb301c7fd289b4663ae38ab19"},"design\\default\\images\\xx\\demo_bk.png":{"md5":"7b7df056bd747aa6a08b56747d246301"},"design\\default\\images\\xx\\demo_wt.png":{"md5":"d5f27b6e08631ce7acb17fafb79f76d8"},"design\\default\\images\\xx\\front_learing.png":{"md5":"9db0371a319b92be5e8ed3db2364e857"},"design\\default\\images\\xx\\front_normal.png":{"md5":"7385bdc8a34a36af1a2161a9ef5d68ab"},"design\\default\\images\\xx\\front_not_learned.png":{"md5":"ceb53052268109286e6c60048ae5cdd3"},"design\\default\\images\\xx\\fuel_bar_00.png":{"md5":"eb622b4d06bf97c26cbc167652c46bca"},"design\\default\\images\\xx\\fuel_bar_01.png":{"md5":"83147d130d7dd40dcac760fc4bc6d3a1"},"design\\default\\images\\xx\\fuel_bar_02.png":{"md5":"b0b6a73c6610bf05440062f5c0f354ff"},"design\\default\\images\\xx\\fuel_bar_03.png":{"md5":"800c3e46ff1ef29d761e8d04d1617024"},"design\\default\\images\\xx\\fuel_bar_04.png":{"md5":"95cec455ac99c76a38e2148a7054fdc7"},"design\\default\\images\\xx\\fuel_bar_05.png":{"md5":"e25079e17e866d479591c1eb2e2b971c"},"design\\default\\images\\xx\\fuel_bar_bk_00.png":{"md5":"9d24cee24967370dae7dcf1404a2f0a8"},"design\\default\\images\\xx\\fuel_bar_bk_01.png":{"md5":"73c1d35939e53958be109efc929557d4"},"design\\default\\images\\xx\\fuel_bar_bk_02.png":{"md5":"dba930cbc08e8537e9e483908c19e298"},"design\\default\\images\\xx\\fuel_bar_bk_03.png":{"md5":"c15af94b81af49389f14ab39c495598a"},"design\\default\\images\\xx\\fuel_bar_bk_04.png":{"md5":"464142438c6cc573f121f2d1fbb373ac"},"design\\default\\images\\xx\\fuel_bar_bk_05.png":{"md5":"7cb8f990ae3d9ec57f2e5dc19e277eb6"},"design\\default\\images\\xx\\fuel_icon_bk.png":{"md5":"c482ab072b478e27ca2f1e2f1c22d7ec"},"design\\default\\images\\xx\\fuel_icon_wt.png":{"md5":"2b60ccd8401f0b6bb5d2d2906e93f0fe"},"design\\default\\images\\xx\\fuel_warn_icon.png":{"md5":"26767b9b37a8e339731343f6f1fbc8c7"},"design\\default\\images\\xx\\func_bt_icon.png":{"md5":"c4b06de55c8dc66a54ca9526f4efc25a"},"design\\default\\images\\xx\\func_call_answer_icon.png":{"md5":"f1de66ad3dbf9ca8834104f775fd68b5"},"design\\default\\images\\xx\\light_bar.png":{"md5":"47ee6c52d7112ee44b278180ed0d787e"},"design\\default\\images\\xx\\light_bg.png":{"md5":"2437eef409ec3cbc4fe4ead7e2ae7e7d"},"design\\default\\images\\xx\\list_information_bk.png":{"md5":"38300a0c329965752d5017d3194a0d26"},"design\\default\\images\\xx\\list_information_select_bk.png":{"md5":"c90e725434ed199f394400bb6340e0c8"},"design\\default\\images\\xx\\list_information_select_wt.png":{"md5":"803a535e4b3c4870e292406a18fed626"},"design\\default\\images\\xx\\list_information_wt.png":{"md5":"67676ee0f1406d7a03a8bc93686a2192"},"design\\default\\images\\xx\\list_light_bk.png":{"md5":"9af6e4179dae13c69e51cea470d27a7a"},"design\\default\\images\\xx\\list_light_select_bk.png":{"md5":"3eb008447e3aa40b19c8c579df54ed31"},"design\\default\\images\\xx\\list_light_select_wt.png":{"md5":"e6b8ac1e78cc70d779030e76bc6e5edd"},"design\\default\\images\\xx\\list_light_wt.png":{"md5":"fb7f12705a88dde2db87f0d53c1da98c"},"design\\default\\images\\xx\\list_set_bk.png":{"md5":"c43f0d4ac97c15e1376d0cbd05168af3"},"design\\default\\images\\xx\\list_set_select_bk.png":{"md5":"bb3bed1d06ff003630e815f060cd5585"},"design\\default\\images\\xx\\list_set_select_wt.png":{"md5":"c39c058e26c9bd628988ebe91a302663"},"design\\default\\images\\xx\\list_set_wt.png":{"md5":"c506c1a7bf89b7f4ed296be648a50ba1"},"design\\default\\images\\xx\\list_theme_bk.png":{"md5":"5009dde85e7d0de1bd7d68185ac6ca84"},"design\\default\\images\\xx\\list_theme_select_bk.png":{"md5":"3b49b74cc205105ee3343df028d251e2"},"design\\default\\images\\xx\\list_theme_select_wt.png":{"md5":"f28598d77b31def4322380e123dd4ec7"},"design\\default\\images\\xx\\list_theme_wt.png":{"md5":"a76c3c7029b4d398d0d36bae366e19da"},"design\\default\\images\\xx\\list_top_bg_bk.png":{"md5":"7a0ecbf190f56c0d8da53128499ca54f"},"design\\default\\images\\xx\\list_top_bg_wt.png":{"md5":"25b6e790e8ce642a91ccc9edf57a3016"},"design\\default\\images\\xx\\main_bg_bk.png":{"md5":"31afc46c144026972c650feba3f5845c"},"design\\default\\images\\xx\\main_bg_wt.png":{"md5":"810086ab3061d8e55acf6691f37c1ca4"},"design\\default\\images\\xx\\Moto.png":{"md5":"fa113f87921c3910a9361765655c7bea"},"design\\default\\images\\xx\\MOTO_wt.png":{"md5":"950fdc478269860e1bb4baa58483b547"},"design\\default\\images\\xx\\odo_index.png":{"md5":"29ad59b17f39844877663b861137fbfd"},"design\\default\\images\\xx\\rear_learing.png":{"md5":"f72fe09fdf5d2fe1f3f99c037a3387f8"},"design\\default\\images\\xx\\rear_normal.png":{"md5":"530b93a9c139598fcbab9d9e705b72dd"},"design\\default\\images\\xx\\rear_not_learned.png":{"md5":"58b3f9ef58e12ffef1d068494555d0cf"},"design\\default\\images\\xx\\rpm_bg_bk.png":{"md5":"eb3c97894cd18d8edaec20194e70c81f"},"design\\default\\images\\xx\\rpm_bg_bk_01.png":{"md5":"e49ffcc0373dcef52362e3b8e3f643c4"},"design\\default\\images\\xx\\rpm_bg_wt.png":{"md5":"969ad0952ffe25281a2107f6648f3e93"},"design\\default\\images\\xx\\rpm_bg_wt_01.png":{"md5":"9c40dfd5482ed8afbdc229f7fc50224c"},"design\\default\\images\\xx\\rpm_pointer_bk.png":{"md5":"daa9cec09274913978c6364621c547d5"},"design\\default\\images\\xx\\rpm_pointer_wt.png":{"md5":"e63dd7eb8c231f056545fc18d6b28180"},"design\\default\\images\\xx\\speed_bg.png":{"md5":"1922fa93b4ade1828ce23537da8065ba"},"design\\default\\images\\xx\\temp_bar_00.png":{"md5":"23e3491b0f5a116d57e283ff5dcbd3ea"},"design\\default\\images\\xx\\temp_bar_01.png":{"md5":"66bcc9c6303a4ee51940d7fc983d8190"},"design\\default\\images\\xx\\temp_bar_02.png":{"md5":"778ca9dca38cc783ed9251bd9ed8c955"},"design\\default\\images\\xx\\temp_bar_03.png":{"md5":"cee28e318911af9e8271018378de05cb"},"design\\default\\images\\xx\\temp_bar_04.png":{"md5":"7c79aa657c5755661a8131c54556f6a5"},"design\\default\\images\\xx\\temp_bar_05.png":{"md5":"886e02c52965f120fd0eaaca918cab7e"},"design\\default\\images\\xx\\temp_bar_bk_00.png":{"md5":"58f4d74546bc8f13ef2b476b98825faf"},"design\\default\\images\\xx\\temp_bar_bk_01.png":{"md5":"36a2d33bc77f84c6df6e5579940984b0"},"design\\default\\images\\xx\\temp_bar_bk_02.png":{"md5":"19d8051fe4e02d8ce63020a38908bdba"},"design\\default\\images\\xx\\temp_bar_bk_03.png":{"md5":"b7387d058afd85dea957115b62fec2b4"},"design\\default\\images\\xx\\temp_bar_bk_04.png":{"md5":"85b6f281666ed233ed49bba5f9c808f1"},"design\\default\\images\\xx\\temp_bar_warning.png":{"md5":"e3730bef4fe2fe4cdb65467a9981e8e5"},"design\\default\\images\\xx\\temp_icon_bk.png":{"md5":"90022dcec13b7fc23cb40ca141df9bc9"},"design\\default\\images\\xx\\temp_icon_wt.png":{"md5":"4d585a684eaff6f34a5d1c79084d6a33"},"design\\default\\images\\xx\\temp_warn2_icon.png":{"md5":"bf7bac620188b82642acce44926a79ea"},"design\\default\\images\\xx\\temp_warn_icon.png":{"md5":"19bf4c3d70157f5e599b39740fedd5e0"},"design\\default\\images\\xx\\test.png":{"md5":"d02dd97803e281b5df0767a173d934d2"},"design\\default\\images\\xx\\time_select.png":{"md5":"80f4606b0277e9bf73e74bda940e532c"},"design\\default\\images\\xx\\trip_index.png":{"md5":"4c12d0a9a0f7879559e60b8f038b4ae9"},"design\\default\\images\\xx\\warn_abs_icon.png":{"md5":"b1577cef3a98eed3c3a37a7eed2fff32"},"design\\default\\images\\xx\\warn_engine_icon.png":{"md5":"f2e9b97376b18a6e9d84a27945047836"},"design\\default\\images\\xx\\warn_maint_icon.png":{"md5":"c58eac74d6b7093a457054c6bd7b7c38"},"design\\default\\images\\xx\\warn_tcs_icon.png":{"md5":"761e9d151e97ca5e24163b09597f8d87"},"design\\default\\images\\xx\\warn_tire_icon.png":{"md5":"a5c1d9b91070910eb0fa26402ba4c2aa"},"design\\default\\images\\xx\\warn_tire_icon_bk.png":{"md5":"3b824bbd03149e04ad11d823840c9675"},"design\\default\\images\\xx\\warn_tire_icon_wt.png":{"md5":"d856d3b9c353bac1bcfb405e308940cd"},"design\\default\\strings\\strings.xml":{"md5":"f841d064cd84c5253f5d5aa9fe2c43b1"},"design\\default\\styles\\default.xml":{"md5":"e98808afd96cfad760cca9ef00c15f81"},"design\\default\\styles\\new.xml":{"md5":"d41d8cd98f00b204e9800998ecf8427e"},"design\\default\\styles\\settingview2.xml":{"md5":"d41d8cd98f00b204e9800998ecf8427e"},"design\\default\\ui\\A58_demo2.xml":{"md5":"f01949b58b614dcbf3354550f5ed8c74"},"design\\default\\ui\\A58_home_page.xml":{"md5":"b4907816085bd78dc338b52c15dd2528"},"design\\default\\ui\\call.xml":{"md5":"0892b33fa0de072719bb9f31410c9a98"},"design\\default\\ui\\new.xml":{"md5":"9ebc3b60f6d7bd98316a1ad801c43e08"},"design\\default\\ui\\prompt.xml":{"md5":"33da2a4201553201a3deee277dc73da2"},"design\\default\\ui\\settingview1.xml":{"md5":"4a070c626d94530e86642c88b4e19797"},"design\\default\\ui\\settingview2.xml":{"md5":"d9724dfdeb6e2862a7107bcbf03c8afc"},"design\\default\\ui\\settingview3.xml":{"md5":"d7ce3d8c5496a37c6fba96c5d9f28420"},"design\\default\\ui\\settingview4.xml":{"md5":"f09e65e7e4bf1a1ecb66643efe169092"},"design\\default\\ui\\set_list.xml":{"md5":"0de9d6433292d41b4c2c87984ef02420"},"design\\default\\ui\\set_mile.xml":{"md5":"503a95d211f6b5a0c9f65a35b4b1477d"},"design\\default\\ui\\set_mile_reset.xml":{"md5":"63e989346a126400e9c5995aa7963d2f"},"design\\default\\ui\\set_time.xml":{"md5":"b0cedde0e8f48ff0fa1ff226081e47cf"},"design\\default\\ui\\set_tire_pressure.xml":{"md5":"6a56059a62005b372bd611478042eb90"}},"config":{"loadFrom":"any","const":"resource_data"}} \ No newline at end of file diff --git a/lib/awtk/awtk-examples/Moto_A58/project.json b/lib/awtk/awtk-examples/Moto_A58/project.json index a59b26f..47fb07a 100644 --- a/lib/awtk/awtk-examples/Moto_A58/project.json +++ b/lib/awtk/awtk-examples/Moto_A58/project.json @@ -9,7 +9,8 @@ "appType": "APP_SIMULATOR", "dependencies": { "awtk": ">=2210", - "awtk-widget-number-label": "1.0.1" + "awtk-widget-number-label": "1.0.1", + "awtk-widget-qr": "1.0.1" }, "assets": { "activedTheme": "default", @@ -29,7 +30,7 @@ "fonts": { "default": { "18": "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~!@#$%^&*()-_=+[{]}|;:'\",<.>/?…()—、?〉《〉》,。!·‘’“”:;【】\\ ¥1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ阿啊哎哀唉埃挨癌矮艾爱碍安氨俺岸按案暗昂凹熬傲奥澳八巴叭吧拔把坝爸罢霸白百柏摆败拜班般颁斑搬板版办半伴扮瓣邦帮膀傍棒包胞宝饱保堡报抱豹暴爆卑杯悲碑北贝备背倍被辈奔本崩逼鼻比彼笔币必毕闭辟碧蔽壁避臂边编蝙鞭扁便变遍辨辩标表别宾滨冰兵丙柄饼并病拨波玻剥播脖伯驳泊勃博搏膊薄卜补捕不布步部擦猜才材财裁采彩踩菜蔡参餐残蚕惨灿仓苍舱藏操曹槽草册侧测策层叉插查茶察差拆柴缠产阐颤昌长肠尝偿常厂场畅倡唱抄超巢朝潮吵炒车扯彻撤尘臣沉陈闯衬称趁撑成呈承诚城乘惩程橙吃池驰迟持匙尺齿斥赤翅充冲虫崇抽仇绸愁筹酬丑瞅臭出初除厨础储楚处触川穿传船喘串窗床晨创吹垂锤春纯唇醇词瓷慈辞磁雌此次刺从匆葱聪丛凑粗促催脆翠村存寸措错搭达答打大呆代带待袋逮戴丹单担胆旦但诞弹淡蛋氮当挡党荡刀导岛倒蹈到盗道稻得德的灯登等邓凳瞪低堤滴迪敌笛底抵地弟帝递第颠典点电店垫淀殿雕吊钓调掉爹跌叠蝶丁叮盯钉顶订定丢东冬懂动冻洞都斗抖陡豆督毒读独堵赌杜肚度渡端短段断锻堆队对吨敦蹲盾顿多夺朵躲俄鹅额恶饿鳄恩儿而尔耳二发乏伐罚阀法帆番翻凡烦繁反返犯泛饭范贩方坊芳防妨房肪仿访纺放飞非啡菲肥废沸肺费分纷芬坟粉份奋愤粪丰风枫封疯峰锋蜂冯逢缝凤奉佛否夫肤孵弗伏扶服浮符幅福辐蝠抚府辅腐父付妇负附复赴副傅富赋腹覆该改钙盖溉概干甘杆肝赶敢感刚岗纲缸钢港高搞稿告戈哥胳鸽割歌阁革格葛隔个各给根跟更耕工弓公功攻供宫恭巩拱共贡勾沟钩狗构购够估咕姑孤菇古谷股骨鼓固故顾瓜刮挂拐怪关观官冠馆管贯惯灌罐光广归龟规硅轨鬼柜贵桂滚棍郭锅国果裹过哈孩海害含函寒韩罕喊汉汗旱杭航毫豪好号浩耗呵喝合何和河核荷盒贺褐赫鹤黑嘿痕很狠恨哼恒横衡轰哄红宏洪虹鸿侯喉猴吼后厚候乎呼忽狐胡壶湖葫糊蝴虎互户护花华哗滑化划画话桦怀淮坏欢还环缓幻唤换患荒慌皇黄煌晃灰恢挥辉徽回毁悔汇会绘惠慧昏婚浑魂混活火伙或货获祸惑霍击饥圾机肌鸡积基迹绩激及吉级即极急疾集辑籍几己挤脊计记纪忌技际剂季既济继寂寄加夹佳家嘉甲贾钾价驾架假嫁稼尖坚间肩艰兼监减剪检简碱见件建剑健舰渐践鉴键箭江姜将浆僵疆讲奖蒋匠降交郊娇浇骄胶焦礁角脚搅叫轿较教阶皆接揭街节劫杰洁结捷截竭姐解介戒届界借巾今斤金津筋仅紧锦尽劲近进晋浸禁京经茎惊晶睛精鲸井颈景警净径竞竟敬境静镜纠究九久酒旧救就舅居局菊橘举矩句巨拒具俱剧惧据距聚卷倦决绝觉掘嚼军君均菌俊峻卡开凯慨刊堪砍看康抗炕考烤靠科棵颗壳咳可渴克刻客课肯坑空孔恐控口扣枯哭苦库裤酷夸跨块快宽款狂况矿亏葵愧溃昆困扩括阔垃拉啦喇腊蜡辣来莱赖兰拦栏蓝篮览懒烂滥郎狼廊朗浪捞劳牢老乐勒雷蕾泪类累冷愣厘梨离莉犁璃黎礼李里哩理鲤力历厉立丽利励例隶粒俩连帘怜莲联廉脸练炼恋链良凉梁粮两亮辆量辽疗聊僚了料列劣烈猎裂邻林临淋磷灵玲凌铃陵羚零龄领岭令另溜刘流留硫瘤柳六龙笼隆垄拢楼漏露卢芦炉鲁陆录鹿碌路驴旅铝履律虑率绿氯滤卵乱掠略伦轮论罗萝逻螺裸洛络骆落妈麻马玛码蚂骂吗嘛埋买迈麦卖脉蛮满曼慢漫忙芒盲茫猫毛矛茅茂冒贸帽貌么没枚玫眉梅媒煤霉每美妹门闷们萌盟猛蒙孟梦弥迷谜米泌秘密蜜眠绵棉免勉面苗描秒妙庙灭民敏名明鸣命摸模膜摩磨蘑魔抹末沫陌莫漠墨默谋某母亩牡姆拇木目牧墓幕慕穆拿哪内那纳娜钠乃奶奈耐男南难囊恼脑闹呢嫩能尼泥你拟逆年念娘酿鸟尿捏您宁凝牛扭纽农浓弄奴努怒女暖挪诺哦欧偶爬帕怕拍排牌派攀盘判叛盼庞旁胖抛炮跑泡胚陪培赔佩配喷盆朋棚蓬鹏膨捧碰批披皮疲脾匹屁譬片偏篇骗漂飘瓢票拼贫频品平评凭苹屏瓶萍坡泼颇婆迫破剖扑铺葡蒲朴浦普谱七妻栖戚期欺漆齐其奇歧骑棋旗企岂启起气弃汽契砌器恰千迁牵铅谦签前钱潜浅遣欠枪腔强墙抢悄敲乔桥瞧巧切茄且窃亲侵秦琴禽勤青氢轻倾清情晴顷请庆穷丘秋蚯求球区曲驱屈躯趋取娶去趣圈全权泉拳犬劝券缺却雀确鹊裙群然燃染嚷壤让饶扰绕惹热人仁忍认任扔仍日绒荣容溶熔融柔肉如儒乳辱入软锐瑞润若弱撒洒萨塞赛三伞散桑嗓丧扫嫂色森僧杀沙纱刹砂傻啥晒山杉衫珊闪陕扇善伤商赏上尚梢烧稍少绍哨舌蛇舍设社射涉摄申伸身深神审婶肾甚渗慎升生声牲胜绳省圣盛剩尸失师诗施狮湿十什石时识实拾蚀食史使始驶士氏世市示式事侍势视试饰室是适逝释收手守首寿受兽售授瘦书抒叔枢殊疏舒输蔬熟暑署属鼠薯术束述树竖数刷耍衰摔甩帅双霜爽谁水税睡顺瞬说丝司私思斯撕死四寺似饲松耸宋送颂搜艘苏俗诉肃素速宿塑酸蒜算虽随髓岁遂碎穗孙损笋缩所索锁他它她塌塔踏胎台抬太态泰贪摊滩坛谈潭坦叹炭探碳汤唐堂塘糖躺趟涛掏逃桃陶淘萄讨套特疼腾藤梯踢啼提题蹄体替天添田甜填挑条跳贴铁厅听廷亭庭停蜓挺艇通同桐铜童统桶筒痛偷头投透突图徒涂途屠土吐兔团推腿退吞托拖脱驼妥拓唾挖哇蛙娃瓦歪外弯湾丸完玩顽挽晚碗万汪亡王网往忘旺望危威微为围违唯惟维伟伪尾纬委萎卫未位味胃谓喂慰魏温文纹闻蚊吻稳问翁窝我沃卧握乌污屋无吴吾五午伍武舞务物误悟雾夕西吸希析息牺悉惜晰稀溪锡熙嘻膝习席袭媳洗喜戏系细隙虾瞎峡狭辖霞下吓夏厦仙先纤掀鲜闲弦贤咸衔嫌显险县现线限宪陷献腺乡相香厢湘箱详祥翔享响想向巷项象像橡削消萧硝销小晓孝效校笑些歇协胁斜谐携鞋写泄泻卸屑械谢蟹心辛欣新信兴星猩刑行形型醒杏姓幸性凶兄匈胸雄熊休修羞朽秀绣袖嗅须虚需徐许序叙畜绪续蓄宣玄悬旋选穴学雪血寻巡询循训讯迅压呀鸦鸭牙芽崖哑雅亚咽烟淹延严言岩沿炎研盐颜衍掩眼演厌宴艳验焰雁燕央扬羊阳杨洋仰养氧痒样腰邀摇遥咬药要耀爷也冶野业叶页夜液一伊衣医依仪夷宜姨移遗疑乙已以矣蚁椅义亿忆艺议亦异役抑译易疫益谊逸意溢毅翼因阴音吟银引饮蚓隐印应英婴鹰迎盈营蝇赢影映硬哟拥永泳勇涌用优忧幽悠尤犹由邮油游友有又右幼诱于予余鱼娱渔愉愚与宇羽雨语玉吁育郁狱浴预域欲喻寓御裕遇愈誉豫元员园原圆袁援缘源远怨院愿曰约月岳钥悦阅跃越云匀允孕运晕韵蕴杂砸灾栽宰载再在咱暂赞脏葬遭糟早枣藻灶皂造噪燥躁则择泽责贼怎曾增赠渣扎眨炸摘宅窄债沾粘展占战站张章涨掌丈仗帐胀账障招找召兆赵照罩遮折哲者这浙针侦珍真诊枕阵振镇震争征挣睁蒸整正证郑政症之支汁芝枝知织肢脂蜘执直值职植殖止只旨址纸指趾至志制治质致智置中忠终钟肿种仲众重州舟周洲轴宙皱骤朱株珠诸猪蛛竹烛逐主煮嘱住助注贮驻柱祝著筑抓爪专砖转赚庄桩装壮状撞追准捉桌着仔兹姿资滋籽子紫字自宗综棕踪总纵走奏租足族阻组祖钻嘴最罪醉尊遵昨左作坐座做蔼隘庵鞍黯肮拗袄懊扒芭疤捌跋靶掰扳拌绊梆绑榜蚌谤磅镑苞褒雹鲍狈悖惫笨绷泵蹦匕鄙庇毙痹弊璧贬匾辫彪憋鳖瘪彬斌缤濒鬓秉禀菠舶渤跛簸哺怖埠簿睬惭沧糙厕蹭茬岔豺掺搀禅馋蝉铲猖敞钞嘲澈忱辰铛澄逞秤痴弛侈耻宠畴稠锄雏橱矗揣囱疮炊捶椿淳蠢戳绰祠赐醋簇窜篡崔摧悴粹搓撮挫瘩歹怠贷耽档叨捣祷悼蹬嘀涤缔蒂掂滇巅碘佃甸玷惦奠刁叼迭谍碟鼎董栋兜蚪逗痘睹妒镀缎兑墩盹囤钝咄哆踱垛堕舵惰跺讹娥峨蛾扼鄂愕遏噩饵贰筏矾妃匪诽吠吩氛焚忿讽敷芙拂俘袱甫斧俯脯咐缚尬丐柑竿尴秆橄赣冈肛杠羔膏糕镐疙搁蛤庚羹埂耿梗蚣躬汞苟垢沽辜雇寡卦褂乖棺逛闺瑰诡癸跪亥骇酣憨涵悍捍焊憾撼翰夯嚎皓禾烘弘弧唬沪猾徊槐宦涣焕痪凰惶蝗簧恍谎幌卉讳诲贿晦秽荤豁讥叽唧缉畸箕稽棘嫉妓祭鲫冀颊奸歼煎拣俭柬茧捡荐贱涧溅槛缰桨酱椒跤蕉侥狡绞饺矫剿缴窖酵秸睫芥诫藉襟谨荆兢靖窘揪灸玖韭臼疚拘驹鞠桔沮炬锯娟捐鹃绢眷诀倔崛爵钧骏竣咖揩楷勘坎慷糠扛亢拷铐坷苛磕蝌垦恳啃吭抠叩寇窟垮挎筷筐旷框眶盔窥魁馈坤捆廓睐婪澜揽缆榄琅榔唠姥涝烙酪垒磊肋擂棱狸漓篱吏沥俐荔栗砾痢雳镰敛粱谅晾寥嘹撩缭瞭咧琳鳞凛吝赁躏拎伶聆菱浏琉馏榴咙胧聋窿娄搂篓陋庐颅卤虏赂禄吕侣屡缕峦抡仑沦啰锣箩骡蟆馒瞒蔓莽锚卯昧媚魅氓朦檬锰咪靡眯觅缅瞄渺藐蔑皿闽悯冥铭谬馍摹茉寞沐募睦暮捺挠瑙呐馁妮匿溺腻捻撵碾聂孽拧狞柠泞钮脓疟虐懦糯殴鸥呕藕趴啪耙徘湃潘畔乓螃刨袍沛砰烹彭澎篷坯劈霹啤僻翩撇聘乒坪魄仆菩圃瀑曝柒凄祈脐崎鳍乞迄泣掐洽钳乾黔谴嵌歉呛跷锹侨憔俏峭窍翘撬怯钦芹擒寝沁卿蜻擎琼囚岖渠痊瘸冉瓤壬刃纫韧戎茸蓉榕冗揉蹂蠕汝褥蕊闰腮叁搔骚臊涩瑟鲨煞霎筛删煽擅赡裳晌捎勺奢赦呻绅沈笙甥矢屎恃拭柿嗜誓梳淑赎蜀曙恕庶墅漱蟀拴栓涮吮烁硕嗽嘶巳伺祀肆讼诵酥粟溯隋祟隧唆梭嗦琐蹋苔汰瘫痰谭檀毯棠膛倘淌烫滔誊剔屉剃涕惕恬舔迢帖彤瞳捅凸秃颓蜕褪屯豚臀驮鸵椭洼袜豌宛婉惋皖腕枉妄偎薇巍帷苇畏尉猬蔚瘟紊嗡涡蜗呜巫诬芜梧蜈侮捂鹉勿戊昔犀熄蟋徙匣侠暇馅羡镶宵潇箫霄嚣淆肖哮啸蝎邪挟懈芯锌薪馨衅腥汹锈戌墟旭恤酗婿絮轩喧癣炫绚渲靴薛勋熏旬驯汛逊殉丫押涯衙讶焉阎蜒檐砚唁谚堰殃秧鸯漾夭吆妖尧肴姚窑谣舀椰腋壹怡贻胰倚屹邑绎姻茵荫殷寅淫瘾莺樱鹦荧莹萤颖佣庸咏踊酉佑迂淤渝隅逾榆舆屿禹芋冤鸳渊猿苑粤耘陨酝哉赃凿蚤澡憎咋喳轧闸乍诈栅榨斋寨毡瞻斩盏崭辗栈绽彰樟杖昭沼肇辙蔗贞斟疹怔狰筝拯吱侄帜挚秩掷窒滞稚衷粥肘帚咒昼拄瞩蛀铸拽撰妆幢椎锥坠缀赘谆卓拙灼茁浊酌啄琢咨姊揍卒佐佘赊", - "text": "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~!@#$%^&*()-_=+[{]}|;:'\",<.>/?…()—、?〉《〉》,。!·‘’“”:;【】\\ ¥1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ阿啊哎哀唉埃挨癌矮艾爱碍安氨俺岸按案暗昂凹熬傲奥澳八巴叭吧拔把坝爸罢霸白百柏摆败拜班般颁斑搬板版办半伴扮瓣邦帮膀傍棒包胞宝饱保堡报抱豹暴爆卑杯悲碑北贝备背倍被辈奔本崩逼鼻比彼笔币必毕闭辟碧蔽壁避臂边编蝙鞭扁便变遍辨辩标表别宾滨冰兵丙柄饼并病拨波玻剥播脖伯驳泊勃博搏膊薄卜补捕不布步部擦猜才材财裁采彩踩菜蔡参餐残蚕惨灿仓苍舱藏操曹槽草册侧测策层叉插查茶察差拆柴缠产阐颤昌长肠尝偿常厂场畅倡唱抄超巢朝潮吵炒车扯彻撤尘臣沉陈闯衬称趁撑成呈承诚城乘惩程橙吃池驰迟持匙尺齿斥赤翅充冲虫崇抽仇绸愁筹酬丑瞅臭出初除厨础储楚处触川穿传船喘串窗床晨创吹垂锤春纯唇醇词瓷慈辞磁雌此次刺从匆葱聪丛凑粗促催脆翠村存寸措错搭达答打大呆代带待袋逮戴丹单担胆旦但诞弹淡蛋氮当挡党荡刀导岛倒蹈到盗道稻得德的灯登等邓凳瞪低堤滴迪敌笛底抵地弟帝递第颠典点电店垫淀殿雕吊钓调掉爹跌叠蝶丁叮盯钉顶订定丢东冬懂动冻洞都斗抖陡豆督毒读独堵赌杜肚度渡端短段断锻堆队对吨敦蹲盾顿多夺朵躲俄鹅额恶饿鳄恩儿而尔耳二发乏伐罚阀法帆番翻凡烦繁反返犯泛饭范贩方坊芳防妨房肪仿访纺放飞非啡菲肥废沸肺费分纷芬坟粉份奋愤粪丰风枫封疯峰锋蜂冯逢缝凤奉佛否夫肤孵弗伏扶服浮符幅福辐蝠抚府辅腐父付妇负附复赴副傅富赋腹覆该改钙盖溉概干甘杆肝赶敢感刚岗纲缸钢港高搞稿告戈哥胳鸽割歌阁革格葛隔个各给根跟更耕工弓公功攻供宫恭巩拱共贡勾沟钩狗构购够估咕姑孤菇古谷股骨鼓固故顾瓜刮挂拐怪关观官冠馆管贯惯灌罐光广归龟规硅轨鬼柜贵桂滚棍郭锅国果裹过哈孩海害含函寒韩罕喊汉汗旱杭航毫豪好号浩耗呵喝合何和河核荷盒贺褐赫鹤黑嘿痕很狠恨哼恒横衡轰哄红宏洪虹鸿侯喉猴吼后厚候乎呼忽狐胡壶湖葫糊蝴虎互户护花华哗滑化划画话桦怀淮坏欢还环缓幻唤换患荒慌皇黄煌晃灰恢挥辉徽回毁悔汇会绘惠慧昏婚浑魂混活火伙或货获祸惑霍击饥圾机肌鸡积基迹绩激及吉级即极急疾集辑籍几己挤脊计记纪忌技际剂季既济继寂寄加夹佳家嘉甲贾钾价驾架假嫁稼尖坚间肩艰兼监减剪检简碱见件建剑健舰渐践鉴键箭江姜将浆僵疆讲奖蒋匠降交郊娇浇骄胶焦礁角脚搅叫轿较教阶皆接揭街节劫杰洁结捷截竭姐解介戒届界借巾今斤金津筋仅紧锦尽劲近进晋浸禁京经茎惊晶睛精鲸井颈景警净径竞竟敬境静镜纠究九久酒旧救就舅居局菊橘举矩句巨拒具俱剧惧据距聚卷倦决绝觉掘嚼军君均菌俊峻卡开凯慨刊堪砍看康抗炕考烤靠科棵颗壳咳可渴克刻客课肯坑空孔恐控口扣枯哭苦库裤酷夸跨块快宽款狂况矿亏葵愧溃昆困扩括阔垃拉啦喇腊蜡辣来莱赖兰拦栏蓝篮览懒烂滥郎狼廊朗浪捞劳牢老乐勒雷蕾泪类累冷愣厘梨离莉犁璃黎礼李里哩理鲤力历厉立丽利励例隶粒俩连帘怜莲联廉脸练炼恋链良凉梁粮两亮辆量辽疗聊僚了料列劣烈猎裂邻林临淋磷灵玲凌铃陵羚零龄领岭令另溜刘流留硫瘤柳六龙笼隆垄拢楼漏露卢芦炉鲁陆录鹿碌路驴旅铝履律虑率绿氯滤卵乱掠略伦轮论罗萝逻螺裸洛络骆落妈麻马玛码蚂骂吗嘛埋买迈麦卖脉蛮满曼慢漫忙芒盲茫猫毛矛茅茂冒贸帽貌么没枚玫眉梅媒煤霉每美妹门闷们萌盟猛蒙孟梦弥迷谜米泌秘密蜜眠绵棉免勉面苗描秒妙庙灭民敏名明鸣命摸模膜摩磨蘑魔抹末沫陌莫漠墨默谋某母亩牡姆拇木目牧墓幕慕穆拿哪内那纳娜钠乃奶奈耐男南难囊恼脑闹呢嫩能尼泥你拟逆年念娘酿鸟尿捏您宁凝牛扭纽农浓弄奴努怒女暖挪诺哦欧偶爬帕怕拍排牌派攀盘判叛盼庞旁胖抛炮跑泡胚陪培赔佩配喷盆朋棚蓬鹏膨捧碰批披皮疲脾匹屁譬片偏篇骗漂飘瓢票拼贫频品平评凭苹屏瓶萍坡泼颇婆迫破剖扑铺葡蒲朴浦普谱七妻栖戚期欺漆齐其奇歧骑棋旗企岂启起气弃汽契砌器恰千迁牵铅谦签前钱潜浅遣欠枪腔强墙抢悄敲乔桥瞧巧切茄且窃亲侵秦琴禽勤青氢轻倾清情晴顷请庆穷丘秋蚯求球区曲驱屈躯趋取娶去趣圈全权泉拳犬劝券缺却雀确鹊裙群然燃染嚷壤让饶扰绕惹热人仁忍认任扔仍日绒荣容溶熔融柔肉如儒乳辱入软锐瑞润若弱撒洒萨塞赛三伞散桑嗓丧扫嫂色森僧杀沙纱刹砂傻啥晒山杉衫珊闪陕扇善伤商赏上尚梢烧稍少绍哨舌蛇舍设社射涉摄申伸身深神审婶肾甚渗慎升生声牲胜绳省圣盛剩尸失师诗施狮湿十什石时识实拾蚀食史使始驶士氏世市示式事侍势视试饰室是适逝释收手守首寿受兽售授瘦书抒叔枢殊疏舒输蔬熟暑署属鼠薯术束述树竖数刷耍衰摔甩帅双霜爽谁水税睡顺瞬说丝司私思斯撕死四寺似饲松耸宋送颂搜艘苏俗诉肃素速宿塑酸蒜算虽随髓岁遂碎穗孙损笋缩所索锁他它她塌塔踏胎台抬太态泰贪摊滩坛谈潭坦叹炭探碳汤唐堂塘糖躺趟涛掏逃桃陶淘萄讨套特疼腾藤梯踢啼提题蹄体替天添田甜填挑条跳贴铁厅听廷亭庭停蜓挺艇通同桐铜童统桶筒痛偷头投透突图徒涂途屠土吐兔团推腿退吞托拖脱驼妥拓唾挖哇蛙娃瓦歪外弯湾丸完玩顽挽晚碗万汪亡王网往忘旺望危威微为围违唯惟维伟伪尾纬委萎卫未位味胃谓喂慰魏温文纹闻蚊吻稳问翁窝我沃卧握乌污屋无吴吾五午伍武舞务物误悟雾夕西吸希析息牺悉惜晰稀溪锡熙嘻膝习席袭媳洗喜戏系细隙虾瞎峡狭辖霞下吓夏厦仙先纤掀鲜闲弦贤咸衔嫌显险县现线限宪陷献腺乡相香厢湘箱详祥翔享响想向巷项象像橡削消萧硝销小晓孝效校笑些歇协胁斜谐携鞋写泄泻卸屑械谢蟹心辛欣新信兴星猩刑行形型醒杏姓幸性凶兄匈胸雄熊休修羞朽秀绣袖嗅须虚需徐许序叙畜绪续蓄宣玄悬旋选穴学雪血寻巡询循训讯迅压呀鸦鸭牙芽崖哑雅亚咽烟淹延严言岩沿炎研盐颜衍掩眼演厌宴艳验焰雁燕央扬羊阳杨洋仰养氧痒样腰邀摇遥咬药要耀爷也冶野业叶页夜液一伊衣医依仪夷宜姨移遗疑乙已以矣蚁椅义亿忆艺议亦异役抑译易疫益谊逸意溢毅翼因阴音吟银引饮蚓隐印应英婴鹰迎盈营蝇赢影映硬哟拥永泳勇涌用优忧幽悠尤犹由邮油游友有又右幼诱于予余鱼娱渔愉愚与宇羽雨语玉吁育郁狱浴预域欲喻寓御裕遇愈誉豫元员园原圆袁援缘源远怨院愿曰约月岳钥悦阅跃越云匀允孕运晕韵蕴杂砸灾栽宰载再在咱暂赞脏葬遭糟早枣藻灶皂造噪燥躁则择泽责贼怎曾增赠渣扎眨炸摘宅窄债沾粘展占战站张章涨掌丈仗帐胀账障招找召兆赵照罩遮折哲者这浙针侦珍真诊枕阵振镇震争征挣睁蒸整正证郑政症之支汁芝枝知织肢脂蜘执直值职植殖止只旨址纸指趾至志制治质致智置中忠终钟肿种仲众重州舟周洲轴宙皱骤朱株珠诸猪蛛竹烛逐主煮嘱住助注贮驻柱祝著筑抓爪专砖转赚庄桩装壮状撞追准捉桌着仔兹姿资滋籽子紫字自宗综棕踪总纵走奏租足族阻组祖钻嘴最罪醉尊遵昨左作坐座做蔼隘庵鞍黯肮拗袄懊扒芭疤捌跋靶掰扳拌绊梆绑榜蚌谤磅镑苞褒雹鲍狈悖惫笨绷泵蹦匕鄙庇毙痹弊璧贬匾辫彪憋鳖瘪彬斌缤濒鬓秉禀菠舶渤跛簸哺怖埠簿睬惭沧糙厕蹭茬岔豺掺搀禅馋蝉铲猖敞钞嘲澈忱辰铛澄逞秤痴弛侈耻宠畴稠锄雏橱矗揣囱疮炊捶椿淳蠢戳绰祠赐醋簇窜篡崔摧悴粹搓撮挫瘩歹怠贷耽档叨捣祷悼蹬嘀涤缔蒂掂滇巅碘佃甸玷惦奠刁叼迭谍碟鼎董栋兜蚪逗痘睹妒镀缎兑墩盹囤钝咄哆踱垛堕舵惰跺讹娥峨蛾扼鄂愕遏噩饵贰筏矾妃匪诽吠吩氛焚忿讽敷芙拂俘袱甫斧俯脯咐缚尬丐柑竿尴秆橄赣冈肛杠羔膏糕镐疙搁蛤庚羹埂耿梗蚣躬汞苟垢沽辜雇寡卦褂乖棺逛闺瑰诡癸跪亥骇酣憨涵悍捍焊憾撼翰夯嚎皓禾烘弘弧唬沪猾徊槐宦涣焕痪凰惶蝗簧恍谎幌卉讳诲贿晦秽荤豁讥叽唧缉畸箕稽棘嫉妓祭鲫冀颊奸歼煎拣俭柬茧捡荐贱涧溅槛缰桨酱椒跤蕉侥狡绞饺矫剿缴窖酵秸睫芥诫藉襟谨荆兢靖窘揪灸玖韭臼疚拘驹鞠桔沮炬锯娟捐鹃绢眷诀倔崛爵钧骏竣咖揩楷勘坎慷糠扛亢拷铐坷苛磕蝌垦恳啃吭抠叩寇窟垮挎筷筐旷框眶盔窥魁馈坤捆廓睐婪澜揽缆榄琅榔唠姥涝烙酪垒磊肋擂棱狸漓篱吏沥俐荔栗砾痢雳镰敛粱谅晾寥嘹撩缭瞭咧琳鳞凛吝赁躏拎伶聆菱浏琉馏榴咙胧聋窿娄搂篓陋庐颅卤虏赂禄吕侣屡缕峦抡仑沦啰锣箩骡蟆馒瞒蔓莽锚卯昧媚魅氓朦檬锰咪靡眯觅缅瞄渺藐蔑皿闽悯冥铭谬馍摹茉寞沐募睦暮捺挠瑙呐馁妮匿溺腻捻撵碾聂孽拧狞柠泞钮脓疟虐懦糯殴鸥呕藕趴啪耙徘湃潘畔乓螃刨袍沛砰烹彭澎篷坯劈霹啤僻翩撇聘乒坪魄仆菩圃瀑曝柒凄祈脐崎鳍乞迄泣掐洽钳乾黔谴嵌歉呛跷锹侨憔俏峭窍翘撬怯钦芹擒寝沁卿蜻擎琼囚岖渠痊瘸冉瓤壬刃纫韧戎茸蓉榕冗揉蹂蠕汝褥蕊闰腮叁搔骚臊涩瑟鲨煞霎筛删煽擅赡裳晌捎勺奢赦呻绅沈笙甥矢屎恃拭柿嗜誓梳淑赎蜀曙恕庶墅漱蟀拴栓涮吮烁硕嗽嘶巳伺祀肆讼诵酥粟溯隋祟隧唆梭嗦琐蹋苔汰瘫痰谭檀毯棠膛倘淌烫滔誊剔屉剃涕惕恬舔迢帖彤瞳捅凸秃颓蜕褪屯豚臀驮鸵椭洼袜豌宛婉惋皖腕枉妄偎薇巍帷苇畏尉猬蔚瘟紊嗡涡蜗呜巫诬芜梧蜈侮捂鹉勿戊昔犀熄蟋徙匣侠暇馅羡镶宵潇箫霄嚣淆肖哮啸蝎邪挟懈芯锌薪馨衅腥汹锈戌墟旭恤酗婿絮轩喧癣炫绚渲靴薛勋熏旬驯汛逊殉丫押涯衙讶焉阎蜒檐砚唁谚堰殃秧鸯漾夭吆妖尧肴姚窑谣舀椰腋壹怡贻胰倚屹邑绎姻茵荫殷寅淫瘾莺樱鹦荧莹萤颖佣庸咏踊酉佑迂淤渝隅逾榆舆屿禹芋冤鸳渊猿苑粤耘陨酝哉赃凿蚤澡憎咋喳轧闸乍诈栅榨斋寨毡瞻斩盏崭辗栈绽彰樟杖昭沼肇辙蔗贞斟疹怔狰筝拯吱侄帜挚秩掷窒滞稚衷粥肘帚咒昼拄瞩蛀铸拽撰妆幢椎锥坠缀赘谆卓拙灼茁浊酌啄琢咨姊揍卒佐佘赊℃", + "text": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~设置主题切换亮度调节蓝牙其他车辆信息返回时间自适应开启关闭英公制当前历史故障码语言单位选择背景中文动白天黑夜请扫下载亿联骑行手机热点,使用连接名称互搜索需按任意键或二维控件测试胎压学习未传感器丢失升级拷贝过程勿断电准备完善通话模式光钟保养里是否清除确认定解锁您的智能找到并进入菜功已项在附近可汽一旦成相后系统此界面会弹出对就以始了。“”轮防误触长重新漏气高温℃…()—、?〉《》!·‘’:;【】¥1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ阿啊哎哀唉埃挨癌矮艾爱碍安氨俺岸案暗昂凹熬傲奥澳八巴叭吧拔把坝爸罢霸百柏摆败拜班般颁斑搬板版办半伴扮瓣邦帮膀傍棒包胞宝饱堡报抱豹暴爆卑杯悲碑北倍被辈奔本崩逼鼻比彼笔币必毕辟碧蔽壁避臂边编蝙鞭扁便变遍辨辩标表别宾滨冰兵丙柄饼病拨波玻剥播脖伯驳泊勃博搏膊薄卜补捕不布步部擦猜才材财裁采彩踩蔡参餐残蚕惨灿仓苍舱藏操曹槽草册侧策层叉插查茶察差拆柴缠产阐颤昌肠尝偿常厂场畅倡唱抄超巢朝潮吵炒扯彻撤尘臣沉陈闯衬趁撑呈承诚城乘惩橙吃池驰迟持匙尺齿斥赤翅充冲虫崇抽仇绸愁筹酬丑瞅臭初厨础储楚处川穿船喘串窗床晨创吹垂锤春纯唇醇词瓷慈辞磁雌次刺从匆葱聪丛凑粗促催脆翠村存寸措错搭达答打大呆代带待袋逮戴丹担胆但诞淡蛋氮挡党荡刀导岛倒蹈盗道稻得德灯登等邓凳瞪低堤滴迪敌笛底抵地弟帝递第颠典店垫淀殿雕吊钓掉爹跌叠蝶丁叮盯钉顶订东冬懂冻洞都斗抖陡豆督毒读独堵赌杜肚渡端短段锻堆队吨敦蹲盾顿多夺朵躲俄鹅额恶饿鳄恩儿而尔耳发乏伐罚阀法帆番翻凡烦繁反犯泛饭范贩方坊芳妨房肪仿访纺放飞非啡菲肥废沸肺费分纷芬坟粉份奋愤粪丰风枫封疯峰锋蜂冯逢缝凤奉佛夫肤孵弗伏扶服浮符幅福辐蝠抚府辅腐父付妇负复赴副傅富赋腹覆该改钙盖溉概干甘杆肝赶敢刚岗纲缸钢港搞稿告戈哥胳鸽割歌阁革格葛隔个各给根跟更耕工弓攻供宫恭巩拱共贡勾沟钩狗构购够估咕姑孤菇古谷股骨鼓固顾瓜刮挂拐怪观官冠馆管贯惯灌罐广归龟规硅轨鬼柜贵桂滚棍郭锅国果裹哈孩海害含函寒韩罕喊汉汗旱杭航毫豪好号浩耗呵喝合何和河核荷盒贺褐赫鹤嘿痕很狠恨哼恒横衡轰哄红宏洪虹鸿侯喉猴吼厚候乎呼忽狐胡壶湖葫糊蝴虎户护花华哗滑化划画桦怀淮坏欢还环缓幻唤患荒慌皇黄煌晃灰恢挥辉徽毁悔汇绘惠慧昏婚浑魂混活火伙货获祸惑霍击饥圾肌鸡积基迹绩激及吉即极急疾集辑籍几己挤脊计记纪忌技际剂季既济继寂寄加夹佳家嘉甲贾钾价驾架假嫁稼尖坚肩艰兼监减剪检简碱见建剑健舰渐践鉴箭江姜将浆僵疆讲奖蒋匠降交郊娇浇骄胶焦礁角脚搅叫轿较教阶皆揭街劫杰洁结捷截竭姐介戒届借巾今斤金津筋仅紧锦尽劲晋浸禁京经茎惊晶睛精鲸井颈警净径竞竟敬境静镜纠究九久酒旧救舅居局菊橘举矩句巨拒具俱剧惧据距聚卷倦决绝觉掘嚼军君均菌俊峻卡凯慨刊堪砍看康抗炕考烤靠科棵颗壳咳渴克刻客课肯坑空孔恐口扣枯哭苦库裤酷夸跨块快宽款狂况矿亏葵愧溃昆困扩括阔垃拉啦喇腊蜡辣来莱赖兰拦栏篮览懒烂滥郎狼廊朗浪捞劳牢老乐勒雷蕾泪类累冷愣厘梨离莉犁璃黎礼李哩理鲤力厉立丽利励例隶粒俩帘怜莲廉脸练炼恋链良凉梁粮两量辽疗聊僚料列劣烈猎裂邻林临淋磷灵玲凌铃陵羚零龄领岭令另溜刘流留硫瘤柳六龙笼隆垄拢楼露卢芦炉鲁陆录鹿碌路驴旅铝履律虑率绿氯滤卵乱掠略伦论罗萝逻螺裸洛络骆落妈麻马玛蚂骂吗嘛埋买迈麦卖脉蛮满曼慢漫忙芒盲茫猫毛矛茅茂冒贸帽貌么没枚玫眉梅媒煤霉每美妹门闷们萌盟猛蒙孟梦弥迷谜米泌秘密蜜眠绵棉免勉苗描秒妙庙灭民敏明鸣命摸膜摩磨蘑魔抹末沫陌莫漠墨默谋某母亩牡姆拇木目牧墓幕慕穆拿哪内那纳娜钠乃奶奈耐男南难囊恼脑闹呢嫩尼泥你拟逆年念娘酿鸟尿捏宁凝牛扭纽农浓弄奴努怒女暖挪诺哦欧偶爬帕怕拍排牌派攀盘判叛盼庞旁胖抛炮跑泡胚陪培赔佩配喷盆朋棚蓬鹏膨捧碰批披皮疲脾匹屁譬片偏篇骗漂飘瓢票拼贫频品平评凭苹屏瓶萍坡泼颇婆迫破剖扑铺葡蒲朴浦普谱七妻栖戚期欺漆齐奇歧棋旗企岂起弃契砌恰千迁牵铅谦签钱潜浅遣欠枪腔强墙抢悄敲乔桥瞧巧茄且窃亲侵秦琴禽勤青氢轻倾情晴顷庆穷丘秋蚯求球区曲驱屈躯趋取娶去趣圈全权泉拳犬劝券缺却雀鹊裙群然燃染嚷壤让饶扰绕惹人仁忍扔仍日绒荣容溶熔融柔肉如儒乳辱软锐瑞润若弱撒洒萨塞赛三伞散桑嗓丧嫂色森僧杀沙纱刹砂傻啥晒山杉衫珊闪陕扇伤商赏上尚梢烧稍少绍哨舌蛇舍社射涉摄申伸身深神审婶肾甚渗慎生声牲胜绳省圣盛剩尸师诗施狮湿十什石识实拾蚀食驶士氏世市示事侍势视饰室逝释收守首寿受兽售授瘦书抒叔枢殊疏舒输蔬熟暑署属鼠薯术束述树竖数刷耍衰摔甩帅双霜爽谁水税睡顺瞬说丝司私思斯撕死四寺似饲松耸宋送颂艘苏俗诉肃素速宿塑酸蒜算虽随髓岁遂碎穗孙损笋缩所它她塌塔踏台抬太态泰贪摊滩坛谈潭坦叹炭探碳汤唐堂塘糖躺趟涛掏逃桃陶淘萄讨套特疼腾藤梯踢啼提蹄体替添田甜填挑条跳贴铁厅听廷亭庭停蜓挺艇同桐铜童桶筒痛偷头投透突图徒涂途屠土吐兔团推腿退吞托拖脱驼妥拓唾挖哇蛙娃瓦歪外弯湾丸玩顽挽晚碗万汪亡王网往忘旺望危威微为围违唯惟伟伪尾纬委萎卫味胃谓喂慰魏纹闻蚊吻稳问翁窝我沃卧握乌污屋无吴吾五午伍武舞务物悟雾夕西吸希析牺悉惜晰稀溪锡熙嘻膝席袭媳洗喜戏细隙虾瞎峡狭辖霞吓夏厦仙先纤掀鲜闲弦贤咸衔嫌显险县现线限宪陷献腺乡香厢湘箱详祥翔享响想向巷象像橡削消萧硝销小晓孝效校笑些歇协胁斜谐携鞋写泄泻卸屑械谢蟹心辛欣兴星猩刑形型醒杏姓幸性凶兄匈胸雄熊休修羞朽秀绣袖嗅须虚徐许序叙畜绪续蓄宣玄悬旋穴雪血寻巡询循训讯迅呀鸦鸭芽崖哑雅亚咽烟淹延严岩沿炎研盐颜衍掩眼演厌宴艳验焰雁燕央扬羊阳杨洋仰氧痒样腰邀摇遥咬药要耀爷也冶野业叶页液伊衣医依仪夷宜姨移遗疑乙矣蚁椅义忆艺议亦异役抑译易疫益谊逸溢毅翼因阴音吟银引饮蚓隐印婴鹰迎盈营蝇赢影映硬哟拥永泳勇涌优忧幽悠尤犹由邮油游友有又右幼诱于予余鱼娱渔愉愚与宇羽雨玉吁育郁狱浴预域欲喻寓御裕遇愈誉豫元员园原圆袁援缘源远怨院愿曰约月岳钥悦阅跃越云匀允孕运晕韵蕴杂砸灾栽宰再咱暂赞脏葬遭糟早枣藻灶皂造噪燥躁则泽责贼怎曾增赠渣扎眨炸摘宅窄债沾粘展占战站张章涨掌丈仗帐胀账招召兆赵照罩遮折哲者这浙针侦珍真诊枕阵振镇震争征挣睁蒸整正证郑政症之支汁芝枝知织肢脂蜘执直值职植殖止只旨址纸指趾至志治质致忠终肿种仲众州舟周洲轴宙皱骤朱株珠诸猪蛛竹烛逐煮嘱住助注贮驻柱祝著筑抓爪专砖转赚庄桩装壮状撞追捉桌着仔兹姿资滋籽子紫字宗综棕踪总纵走奏租足族阻组祖钻嘴最罪醉尊遵昨左作坐座做蔼隘庵鞍黯肮拗袄懊扒芭疤捌跋靶掰扳拌绊梆绑榜蚌谤磅镑苞褒雹鲍狈悖惫笨绷泵蹦匕鄙庇毙痹弊璧贬匾辫彪憋鳖瘪彬斌缤濒鬓秉禀菠舶渤跛簸哺怖埠簿睬惭沧糙厕蹭茬岔豺掺搀禅馋蝉铲猖敞钞嘲澈忱辰铛澄逞秤痴弛侈耻宠畴稠锄雏橱矗揣囱疮炊捶椿淳蠢戳绰祠赐醋簇窜篡崔摧悴粹搓撮挫瘩歹怠贷耽档叨捣祷悼蹬嘀涤缔蒂掂滇巅碘佃甸玷惦奠刁叼迭谍碟鼎董栋兜蚪逗痘睹妒镀缎兑墩盹囤钝咄哆踱垛堕舵惰跺讹娥峨蛾扼鄂愕遏噩饵贰筏矾妃匪诽吠吩氛焚忿讽敷芙拂俘袱甫斧俯脯咐缚尬丐柑竿尴秆橄赣冈肛杠羔膏糕镐疙搁蛤庚羹埂耿梗蚣躬汞苟垢沽辜雇寡卦褂乖棺逛闺瑰诡癸跪亥骇酣憨涵悍捍焊憾撼翰夯嚎皓禾烘弘弧唬沪猾徊槐宦涣焕痪凰惶蝗簧恍谎幌卉讳诲贿晦秽荤豁讥叽唧缉畸箕稽棘嫉妓祭鲫冀颊奸歼煎拣俭柬茧捡荐贱涧溅槛缰桨酱椒跤蕉侥狡绞饺矫剿缴窖酵秸睫芥诫藉襟谨荆兢靖窘揪灸玖韭臼疚拘驹鞠桔沮炬锯娟捐鹃绢眷诀倔崛爵钧骏竣咖揩楷勘坎慷糠扛亢铐坷苛磕蝌垦恳啃吭抠叩寇窟垮挎筷筐旷框眶盔窥魁馈坤捆廓睐婪澜揽缆榄琅榔唠姥涝烙酪垒磊肋擂棱狸漓篱吏沥俐荔栗砾痢雳镰敛粱谅晾寥嘹撩缭瞭咧琳鳞凛吝赁躏拎伶聆菱浏琉馏榴咙胧聋窿娄搂篓陋庐颅卤虏赂禄吕侣屡缕峦抡仑沦啰锣箩骡蟆馒瞒蔓莽锚卯昧媚魅氓朦檬锰咪靡眯觅缅瞄渺藐蔑皿闽悯冥铭谬馍摹茉寞沐募睦暮捺挠瑙呐馁妮匿溺腻捻撵碾聂孽拧狞柠泞钮脓疟虐懦糯殴鸥呕藕趴啪耙徘湃潘畔乓螃刨袍沛砰烹彭澎篷坯劈霹啤僻翩撇聘乒坪魄仆菩圃瀑曝柒凄祈脐崎鳍乞迄泣掐洽钳乾黔谴嵌歉呛跷锹侨憔俏峭窍翘撬怯钦芹擒寝沁卿蜻擎琼囚岖渠痊瘸冉瓤壬刃纫韧戎茸蓉榕冗揉蹂蠕汝褥蕊闰腮叁搔骚臊涩瑟鲨煞霎筛删煽擅赡裳晌捎勺奢赦呻绅沈笙甥矢屎恃拭柿嗜誓梳淑赎蜀曙恕庶墅漱蟀拴栓涮吮烁硕嗽嘶巳伺祀肆讼诵酥粟溯隋祟隧唆梭嗦琐蹋苔汰瘫痰谭檀毯棠膛倘淌烫滔誊剔屉剃涕惕恬舔迢帖彤瞳捅凸秃颓蜕褪屯豚臀驮鸵椭洼袜豌宛婉惋皖腕枉妄偎薇巍帷苇畏尉猬蔚瘟紊嗡涡蜗呜巫诬芜梧蜈侮捂鹉戊昔犀熄蟋徙匣侠暇馅羡镶宵潇箫霄嚣淆肖哮啸蝎邪挟懈芯锌薪馨衅腥汹锈戌墟旭恤酗婿絮轩喧癣炫绚渲靴薛勋熏旬驯汛逊殉丫押涯衙讶焉阎蜒檐砚唁谚堰殃秧鸯漾夭吆妖尧肴姚窑谣舀椰腋壹怡贻胰倚屹邑绎姻茵荫殷寅淫瘾莺樱鹦荧莹萤颖佣庸咏踊酉佑迂淤渝隅逾榆舆屿禹芋冤鸳渊猿苑粤耘陨酝哉赃凿蚤澡憎咋喳轧闸乍诈栅榨斋寨毡瞻斩盏崭辗栈绽彰樟杖昭沼肇辙蔗贞斟疹怔狰筝拯吱侄帜挚秩掷窒滞稚衷粥肘帚咒昼拄瞩蛀铸拽撰妆幢椎锥坠缀赘谆卓拙灼茁浊酌啄琢咨姊揍卒佐佘赊;", "bpp": "8bits" }, "Arial_MT_Black": { @@ -39,27 +40,12 @@ }, "A27_SYHT_CT": { "18": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", - "text": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~设置主题切换亮度调节蓝牙其他车辆信息返回时间自适应开启关闭英公制当前历史故障码语言单位选择背景中英文动白天黑夜请扫下载亿联骑行手机热点,使用扫连接名称互搜索需按任意键或二维码控件测试胎压学习未传感器丢失习中升级拷贝过程请勿断电!准备完善通话模式光钟保养里", - "bpp": "8bits" - }, - "QH_SJ": { - "18": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", - "text": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", - "bpp": "8bits" - }, - "QH_SPEED": { - "18": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", - "text": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", - "bpp": "8bits" - }, - "QH_LABEL": { - "18": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", - "text": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", + "text": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~设置主题切换亮度调节蓝牙其他车辆信息返回时间自适应开启关闭英公制当前历史故障码语言单位选择背景中英文动白天黑夜请扫下载亿联骑行手机热点,使用扫连接名称互搜索需按任意键或二维码控件测试胎压学习未传感器丢失习中升级拷贝过程请勿断电!准备完善通话模式光钟保养里是否清除?确认定零", "bpp": "8bits" }, "Serpentine_MediumOblique": { "18": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", - "text": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~通话中", + "text": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~通话中℃", "bpp": "8bits" } }, diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/__assets_default.inc b/lib/awtk/awtk-examples/Moto_A58/res/assets/__assets_default.inc index ee628f4..c064ac5 100644 --- a/lib/awtk/awtk-examples/Moto_A58/res/assets/__assets_default.inc +++ b/lib/awtk/awtk-examples/Moto_A58/res/assets/__assets_default.inc @@ -1,6 +1,7 @@ #include "awtk.h" #include "base/assets_manager.h" #ifndef WITH_FS_RES +#include "default/inc/ui/A58_demo2.data" #include "default/inc/ui/A58_home_page.data" #include "default/inc/ui/call.data" #include "default/inc/ui/new.data" @@ -11,6 +12,7 @@ #include "default/inc/ui/settingview4.data" #include "default/inc/ui/set_list.data" #include "default/inc/ui/set_mile.data" +#include "default/inc/ui/set_mile_reset.data" #include "default/inc/ui/set_time.data" #include "default/inc/ui/set_tire_pressure.data" #include "default/inc/strings/en_US.data" @@ -22,19 +24,43 @@ #include "default/inc/images/btn_next_wt.res" #include "default/inc/images/btn_select_bg_bk.res" #include "default/inc/images/btn_select_bg_wt.res" +#include "default/inc/images/call_bg.res" +#include "default/inc/images/call_bg2.res" +#include "default/inc/images/demo2_bg_bk.res" +#include "default/inc/images/demo2_bg_wt.res" +#include "default/inc/images/demo2_fuel_bar_00.res" +#include "default/inc/images/demo2_fuel_bar_01.res" +#include "default/inc/images/demo2_fuel_bar_02.res" +#include "default/inc/images/demo2_fuel_bar_03.res" +#include "default/inc/images/demo2_fuel_bar_04.res" +#include "default/inc/images/demo2_fuel_bar_05.res" +#include "default/inc/images/demo2_fuel_bar_bk_00.res" +#include "default/inc/images/demo2_fuel_bar_bk_01.res" +#include "default/inc/images/demo2_fuel_bar_bk_02.res" +#include "default/inc/images/demo2_fuel_bar_bk_03.res" +#include "default/inc/images/demo2_fuel_bar_bk_04.res" +#include "default/inc/images/demo2_fuel_bar_bk_05.res" +#include "default/inc/images/demo2_speed_bk.res" +#include "default/inc/images/demo2_speed_wt.res" #include "default/inc/images/demo_bk.res" #include "default/inc/images/demo_wt.res" #include "default/inc/images/front_learing.res" #include "default/inc/images/front_normal.res" #include "default/inc/images/front_not_learned.res" +#include "default/inc/images/fuel_bar_00.res" #include "default/inc/images/fuel_bar_01.res" #include "default/inc/images/fuel_bar_02.res" #include "default/inc/images/fuel_bar_03.res" #include "default/inc/images/fuel_bar_04.res" #include "default/inc/images/fuel_bar_05.res" -#include "default/inc/images/fuel_bar_06.res" -#include "default/inc/images/fuel_bg.res" -#include "default/inc/images/fuel_icon.res" +#include "default/inc/images/fuel_bar_bk_00.res" +#include "default/inc/images/fuel_bar_bk_01.res" +#include "default/inc/images/fuel_bar_bk_02.res" +#include "default/inc/images/fuel_bar_bk_03.res" +#include "default/inc/images/fuel_bar_bk_04.res" +#include "default/inc/images/fuel_bar_bk_05.res" +#include "default/inc/images/fuel_icon_bk.res" +#include "default/inc/images/fuel_icon_wt.res" #include "default/inc/images/fuel_warn_icon.res" #include "default/inc/images/func_bt_icon.res" #include "default/inc/images/func_call_answer_icon.res" @@ -58,30 +84,47 @@ #include "default/inc/images/list_theme_wt.res" #include "default/inc/images/list_top_bg_bk.res" #include "default/inc/images/list_top_bg_wt.res" -#include "default/inc/images/main_bg.res" +#include "default/inc/images/main_bg_bk.res" +#include "default/inc/images/main_bg_wt.res" #include "default/inc/images/Moto.res" #include "default/inc/images/MOTO_wt.res" #include "default/inc/images/odo_index.res" #include "default/inc/images/rear_learing.res" #include "default/inc/images/rear_normal.res" #include "default/inc/images/rear_not_learned.res" -#include "default/inc/images/rpm_bg.res" -#include "default/inc/images/rpm_bg_01.res" -#include "default/inc/images/rpm_pointer.res" +#include "default/inc/images/rpm_bg_bk.res" +#include "default/inc/images/rpm_bg_bk_01.res" +#include "default/inc/images/rpm_bg_wt.res" +#include "default/inc/images/rpm_bg_wt_01.res" +#include "default/inc/images/rpm_pointer_bk.res" +#include "default/inc/images/rpm_pointer_wt.res" +#include "default/inc/images/speed_bg.res" +#include "default/inc/images/temp_bar_00.res" #include "default/inc/images/temp_bar_01.res" #include "default/inc/images/temp_bar_02.res" #include "default/inc/images/temp_bar_03.res" #include "default/inc/images/temp_bar_04.res" #include "default/inc/images/temp_bar_05.res" -#include "default/inc/images/temp_bar_06.res" -#include "default/inc/images/temp_icon.res" +#include "default/inc/images/temp_bar_bk_00.res" +#include "default/inc/images/temp_bar_bk_01.res" +#include "default/inc/images/temp_bar_bk_02.res" +#include "default/inc/images/temp_bar_bk_03.res" +#include "default/inc/images/temp_bar_bk_04.res" +#include "default/inc/images/temp_bar_warning.res" +#include "default/inc/images/temp_icon_bk.res" +#include "default/inc/images/temp_icon_wt.res" +#include "default/inc/images/temp_warn2_icon.res" #include "default/inc/images/temp_warn_icon.res" +#include "default/inc/images/test.res" #include "default/inc/images/time_select.res" #include "default/inc/images/trip_index.res" #include "default/inc/images/warn_abs_icon.res" #include "default/inc/images/warn_engine_icon.res" +#include "default/inc/images/warn_maint_icon.res" #include "default/inc/images/warn_tcs_icon.res" #include "default/inc/images/warn_tire_icon.res" +#include "default/inc/images/warn_tire_icon_bk.res" +#include "default/inc/images/warn_tire_icon_wt.res" #else #endif /*WITH_STB_IMAGE*/ #ifdef WITH_VGCANVAS @@ -90,9 +133,6 @@ #include "default/inc/fonts/A27_SYHT_CT.res" #include "default/inc/fonts/Arial_MT_Black.res" #include "default/inc/fonts/default.res" -#include "default/inc/fonts/QH_LABEL.res" -#include "default/inc/fonts/QH_SJ.res" -#include "default/inc/fonts/QH_SPEED.res" #include "default/inc/fonts/Serpentine_MediumOblique.res" #else /*WITH_TRUETYPE_FONT*/ #endif /*WITH_TRUETYPE_FONT*/ @@ -104,6 +144,7 @@ ret_t assets_init_default(void) { #ifdef WITH_FS_RES assets_manager_preload(am, ASSET_TYPE_STYLE, "default"); #else + assets_manager_add(am, ui_A58_demo2); assets_manager_add(am, ui_A58_home_page); assets_manager_add(am, ui_call); assets_manager_add(am, ui_new); @@ -114,6 +155,7 @@ ret_t assets_init_default(void) { assets_manager_add(am, ui_settingview4); assets_manager_add(am, ui_set_list); assets_manager_add(am, ui_set_mile); + assets_manager_add(am, ui_set_mile_reset); assets_manager_add(am, ui_set_time); assets_manager_add(am, ui_set_tire_pressure); assets_manager_add(am, strings_en_US); @@ -124,19 +166,43 @@ ret_t assets_init_default(void) { assets_manager_add(am, image_btn_next_wt); assets_manager_add(am, image_btn_select_bg_bk); assets_manager_add(am, image_btn_select_bg_wt); + assets_manager_add(am, image_call_bg); + assets_manager_add(am, image_call_bg2); + assets_manager_add(am, image_demo2_bg_bk); + assets_manager_add(am, image_demo2_bg_wt); + assets_manager_add(am, image_demo2_fuel_bar_00); + assets_manager_add(am, image_demo2_fuel_bar_01); + assets_manager_add(am, image_demo2_fuel_bar_02); + assets_manager_add(am, image_demo2_fuel_bar_03); + assets_manager_add(am, image_demo2_fuel_bar_04); + assets_manager_add(am, image_demo2_fuel_bar_05); + assets_manager_add(am, image_demo2_fuel_bar_bk_00); + assets_manager_add(am, image_demo2_fuel_bar_bk_01); + assets_manager_add(am, image_demo2_fuel_bar_bk_02); + assets_manager_add(am, image_demo2_fuel_bar_bk_03); + assets_manager_add(am, image_demo2_fuel_bar_bk_04); + assets_manager_add(am, image_demo2_fuel_bar_bk_05); + assets_manager_add(am, image_demo2_speed_bk); + assets_manager_add(am, image_demo2_speed_wt); assets_manager_add(am, image_demo_bk); assets_manager_add(am, image_demo_wt); assets_manager_add(am, image_front_learing); assets_manager_add(am, image_front_normal); assets_manager_add(am, image_front_not_learned); + assets_manager_add(am, image_fuel_bar_00); assets_manager_add(am, image_fuel_bar_01); assets_manager_add(am, image_fuel_bar_02); assets_manager_add(am, image_fuel_bar_03); assets_manager_add(am, image_fuel_bar_04); assets_manager_add(am, image_fuel_bar_05); - assets_manager_add(am, image_fuel_bar_06); - assets_manager_add(am, image_fuel_bg); - assets_manager_add(am, image_fuel_icon); + assets_manager_add(am, image_fuel_bar_bk_00); + assets_manager_add(am, image_fuel_bar_bk_01); + assets_manager_add(am, image_fuel_bar_bk_02); + assets_manager_add(am, image_fuel_bar_bk_03); + assets_manager_add(am, image_fuel_bar_bk_04); + assets_manager_add(am, image_fuel_bar_bk_05); + assets_manager_add(am, image_fuel_icon_bk); + assets_manager_add(am, image_fuel_icon_wt); assets_manager_add(am, image_fuel_warn_icon); assets_manager_add(am, image_func_bt_icon); assets_manager_add(am, image_func_call_answer_icon); @@ -160,39 +226,53 @@ ret_t assets_init_default(void) { assets_manager_add(am, image_list_theme_wt); assets_manager_add(am, image_list_top_bg_bk); assets_manager_add(am, image_list_top_bg_wt); - assets_manager_add(am, image_main_bg); + assets_manager_add(am, image_main_bg_bk); + assets_manager_add(am, image_main_bg_wt); assets_manager_add(am, image_Moto); assets_manager_add(am, image_MOTO_wt); assets_manager_add(am, image_odo_index); assets_manager_add(am, image_rear_learing); assets_manager_add(am, image_rear_normal); assets_manager_add(am, image_rear_not_learned); - assets_manager_add(am, image_rpm_bg); - assets_manager_add(am, image_rpm_bg_01); - assets_manager_add(am, image_rpm_pointer); + assets_manager_add(am, image_rpm_bg_bk); + assets_manager_add(am, image_rpm_bg_bk_01); + assets_manager_add(am, image_rpm_bg_wt); + assets_manager_add(am, image_rpm_bg_wt_01); + assets_manager_add(am, image_rpm_pointer_bk); + assets_manager_add(am, image_rpm_pointer_wt); + assets_manager_add(am, image_speed_bg); + assets_manager_add(am, image_temp_bar_00); assets_manager_add(am, image_temp_bar_01); assets_manager_add(am, image_temp_bar_02); assets_manager_add(am, image_temp_bar_03); assets_manager_add(am, image_temp_bar_04); assets_manager_add(am, image_temp_bar_05); - assets_manager_add(am, image_temp_bar_06); - assets_manager_add(am, image_temp_icon); + assets_manager_add(am, image_temp_bar_bk_00); + assets_manager_add(am, image_temp_bar_bk_01); + assets_manager_add(am, image_temp_bar_bk_02); + assets_manager_add(am, image_temp_bar_bk_03); + assets_manager_add(am, image_temp_bar_bk_04); + assets_manager_add(am, image_temp_bar_warning); + assets_manager_add(am, image_temp_icon_bk); + assets_manager_add(am, image_temp_icon_wt); + assets_manager_add(am, image_temp_warn2_icon); assets_manager_add(am, image_temp_warn_icon); + assets_manager_add(am, image_test); assets_manager_add(am, image_time_select); assets_manager_add(am, image_trip_index); assets_manager_add(am, image_warn_abs_icon); assets_manager_add(am, image_warn_engine_icon); + assets_manager_add(am, image_warn_maint_icon); assets_manager_add(am, image_warn_tcs_icon); assets_manager_add(am, image_warn_tire_icon); + assets_manager_add(am, image_warn_tire_icon_bk); + assets_manager_add(am, image_warn_tire_icon_wt); #ifdef WITH_VGCANVAS #endif /*WITH_VGCANVAS*/ #ifdef WITH_TRUETYPE_FONT assets_manager_add(am, font_A27_SYHT_CT); assets_manager_add(am, font_Arial_MT_Black); assets_manager_add(am, font_default); - assets_manager_add(am, font_QH_LABEL); - assets_manager_add(am, font_QH_SJ); - assets_manager_add(am, font_QH_SPEED); assets_manager_add(am, font_Serpentine_MediumOblique); #else /*WITH_TRUETYPE_FONT*/ #endif /*WITH_TRUETYPE_FONT*/ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/fonts/A27_SYHT_CT.ttf b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/fonts/A27_SYHT_CT.ttf index 14cc320..071ef50 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/fonts/A27_SYHT_CT.ttf and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/fonts/A27_SYHT_CT.ttf differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/demo_bk.png b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/demo_bk.png index 541fd8d..36bf21c 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/demo_bk.png and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/demo_bk.png differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/demo_wt.png b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/demo_wt.png index 7548b6e..487d562 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/demo_wt.png and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/demo_wt.png differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/fuel_bar_01.png b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/fuel_bar_01.png index 1adbf37..a501b00 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/fuel_bar_01.png and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/fuel_bar_01.png differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/fuel_bar_02.png b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/fuel_bar_02.png index 99fdb00..c892942 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/fuel_bar_02.png and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/fuel_bar_02.png differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/fuel_bar_03.png b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/fuel_bar_03.png index 0cb5472..fa55ce7 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/fuel_bar_03.png and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/fuel_bar_03.png differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/fuel_bar_04.png b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/fuel_bar_04.png index aa248e1..1e753ec 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/fuel_bar_04.png and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/fuel_bar_04.png differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/fuel_bar_05.png b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/fuel_bar_05.png index 5785996..51e7e54 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/fuel_bar_05.png and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/fuel_bar_05.png differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/func_call_answer_icon.png b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/func_call_answer_icon.png index c2a3a69..dde044a 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/func_call_answer_icon.png and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/func_call_answer_icon.png differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_bar_01.png b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_bar_01.png index a6d7492..3ee963c 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_bar_01.png and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_bar_01.png differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_bar_02.png b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_bar_02.png index c22b341..4b7a0d0 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_bar_02.png and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_bar_02.png differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_bar_03.png b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_bar_03.png index d45c490..d165e29 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_bar_03.png and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_bar_03.png differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_bar_04.png b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_bar_04.png index a315e10..cc4d052 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_bar_04.png and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_bar_04.png differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_bar_05.png b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_bar_05.png index 24b27ab..9cd872b 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_bar_05.png and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_bar_05.png differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_warn_icon.png b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_warn_icon.png index 59487ec..eae1e00 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_warn_icon.png and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/temp_warn_icon.png differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/warn_tcs_icon.png b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/warn_tcs_icon.png index a24081e..c4c35bf 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/warn_tcs_icon.png and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/warn_tcs_icon.png differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/warn_tire_icon.png b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/warn_tire_icon.png index 3049fc4..ac7ac83 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/warn_tire_icon.png and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/images/xx/warn_tire_icon.png differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/strings/en_US.bin b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/strings/en_US.bin index 4f8b520..4ab1b5c 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/strings/en_US.bin and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/strings/en_US.bin differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/strings/zh_CN.bin b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/strings/zh_CN.bin index 2aec64e..8124331 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/strings/zh_CN.bin and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/strings/zh_CN.bin differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/styles/default.bin b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/styles/default.bin index 5e031c0..1fb15ce 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/styles/default.bin and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/styles/default.bin differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/A58_home_page.bin b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/A58_home_page.bin index 82612a3..177b58e 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/A58_home_page.bin and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/A58_home_page.bin differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/new.bin b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/new.bin index 3823130..767d72d 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/new.bin and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/new.bin differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/set_list.bin b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/set_list.bin index 8496591..4f271a2 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/set_list.bin and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/set_list.bin differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/set_mile.bin b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/set_mile.bin index 31358a6..e527756 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/set_mile.bin and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/set_mile.bin differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/set_time.bin b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/set_time.bin index 82e3720..d85c005 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/set_time.bin and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/set_time.bin differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/set_tire_pressure.bin b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/set_tire_pressure.bin index 14792d9..9d38dc3 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/set_tire_pressure.bin and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/set_tire_pressure.bin differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/settingview1.bin b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/settingview1.bin index 7353c66..0ef8c6d 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/settingview1.bin and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/settingview1.bin differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/settingview2.bin b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/settingview2.bin index bb5b0c0..48b285b 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/settingview2.bin and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/settingview2.bin differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/settingview3.bin b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/settingview3.bin index fdc26f4..baead25 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/settingview3.bin and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/settingview3.bin differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/settingview4.bin b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/settingview4.bin index d456bee..39297a6 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/settingview4.bin and b/lib/awtk/awtk-examples/Moto_A58/res/assets/default/raw/ui/settingview4.bin differ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/assets_default.inc b/lib/awtk/awtk-examples/Moto_A58/res/assets_default.inc index cd98396..6c13db6 100644 --- a/lib/awtk/awtk-examples/Moto_A58/res/assets_default.inc +++ b/lib/awtk/awtk-examples/Moto_A58/res/assets_default.inc @@ -1,6 +1,7 @@ #include "awtk.h" #include "base/assets_manager.h" #ifndef WITH_FS_RES +#include "assets/default/inc/ui/A58_demo2.data" #include "assets/default/inc/ui/A58_home_page.data" #include "assets/default/inc/ui/call.data" #include "assets/default/inc/ui/new.data" @@ -11,6 +12,7 @@ #include "assets/default/inc/ui/settingview4.data" #include "assets/default/inc/ui/set_list.data" #include "assets/default/inc/ui/set_mile.data" +#include "assets/default/inc/ui/set_mile_reset.data" #include "assets/default/inc/ui/set_time.data" #include "assets/default/inc/ui/set_tire_pressure.data" #include "assets/default/inc/strings/en_US.data" @@ -22,19 +24,43 @@ #include "assets/default/inc/images/btn_next_wt.res" #include "assets/default/inc/images/btn_select_bg_bk.res" #include "assets/default/inc/images/btn_select_bg_wt.res" +#include "assets/default/inc/images/call_bg.res" +#include "assets/default/inc/images/call_bg2.res" +#include "assets/default/inc/images/demo2_bg_bk.res" +#include "assets/default/inc/images/demo2_bg_wt.res" +#include "assets/default/inc/images/demo2_fuel_bar_00.res" +#include "assets/default/inc/images/demo2_fuel_bar_01.res" +#include "assets/default/inc/images/demo2_fuel_bar_02.res" +#include "assets/default/inc/images/demo2_fuel_bar_03.res" +#include "assets/default/inc/images/demo2_fuel_bar_04.res" +#include "assets/default/inc/images/demo2_fuel_bar_05.res" +#include "assets/default/inc/images/demo2_fuel_bar_bk_00.res" +#include "assets/default/inc/images/demo2_fuel_bar_bk_01.res" +#include "assets/default/inc/images/demo2_fuel_bar_bk_02.res" +#include "assets/default/inc/images/demo2_fuel_bar_bk_03.res" +#include "assets/default/inc/images/demo2_fuel_bar_bk_04.res" +#include "assets/default/inc/images/demo2_fuel_bar_bk_05.res" +#include "assets/default/inc/images/demo2_speed_bk.res" +#include "assets/default/inc/images/demo2_speed_wt.res" #include "assets/default/inc/images/demo_bk.res" #include "assets/default/inc/images/demo_wt.res" #include "assets/default/inc/images/front_learing.res" #include "assets/default/inc/images/front_normal.res" #include "assets/default/inc/images/front_not_learned.res" +#include "assets/default/inc/images/fuel_bar_00.res" #include "assets/default/inc/images/fuel_bar_01.res" #include "assets/default/inc/images/fuel_bar_02.res" #include "assets/default/inc/images/fuel_bar_03.res" #include "assets/default/inc/images/fuel_bar_04.res" #include "assets/default/inc/images/fuel_bar_05.res" -#include "assets/default/inc/images/fuel_bar_06.res" -#include "assets/default/inc/images/fuel_bg.res" -#include "assets/default/inc/images/fuel_icon.res" +#include "assets/default/inc/images/fuel_bar_bk_00.res" +#include "assets/default/inc/images/fuel_bar_bk_01.res" +#include "assets/default/inc/images/fuel_bar_bk_02.res" +#include "assets/default/inc/images/fuel_bar_bk_03.res" +#include "assets/default/inc/images/fuel_bar_bk_04.res" +#include "assets/default/inc/images/fuel_bar_bk_05.res" +#include "assets/default/inc/images/fuel_icon_bk.res" +#include "assets/default/inc/images/fuel_icon_wt.res" #include "assets/default/inc/images/fuel_warn_icon.res" #include "assets/default/inc/images/func_bt_icon.res" #include "assets/default/inc/images/func_call_answer_icon.res" @@ -58,30 +84,47 @@ #include "assets/default/inc/images/list_theme_wt.res" #include "assets/default/inc/images/list_top_bg_bk.res" #include "assets/default/inc/images/list_top_bg_wt.res" -#include "assets/default/inc/images/main_bg.res" +#include "assets/default/inc/images/main_bg_bk.res" +#include "assets/default/inc/images/main_bg_wt.res" #include "assets/default/inc/images/Moto.res" #include "assets/default/inc/images/MOTO_wt.res" #include "assets/default/inc/images/odo_index.res" #include "assets/default/inc/images/rear_learing.res" #include "assets/default/inc/images/rear_normal.res" #include "assets/default/inc/images/rear_not_learned.res" -#include "assets/default/inc/images/rpm_bg.res" -#include "assets/default/inc/images/rpm_bg_01.res" -#include "assets/default/inc/images/rpm_pointer.res" +#include "assets/default/inc/images/rpm_bg_bk.res" +#include "assets/default/inc/images/rpm_bg_bk_01.res" +#include "assets/default/inc/images/rpm_bg_wt.res" +#include "assets/default/inc/images/rpm_bg_wt_01.res" +#include "assets/default/inc/images/rpm_pointer_bk.res" +#include "assets/default/inc/images/rpm_pointer_wt.res" +#include "assets/default/inc/images/speed_bg.res" +#include "assets/default/inc/images/temp_bar_00.res" #include "assets/default/inc/images/temp_bar_01.res" #include "assets/default/inc/images/temp_bar_02.res" #include "assets/default/inc/images/temp_bar_03.res" #include "assets/default/inc/images/temp_bar_04.res" #include "assets/default/inc/images/temp_bar_05.res" -#include "assets/default/inc/images/temp_bar_06.res" -#include "assets/default/inc/images/temp_icon.res" +#include "assets/default/inc/images/temp_bar_bk_00.res" +#include "assets/default/inc/images/temp_bar_bk_01.res" +#include "assets/default/inc/images/temp_bar_bk_02.res" +#include "assets/default/inc/images/temp_bar_bk_03.res" +#include "assets/default/inc/images/temp_bar_bk_04.res" +#include "assets/default/inc/images/temp_bar_warning.res" +#include "assets/default/inc/images/temp_icon_bk.res" +#include "assets/default/inc/images/temp_icon_wt.res" +#include "assets/default/inc/images/temp_warn2_icon.res" #include "assets/default/inc/images/temp_warn_icon.res" +#include "assets/default/inc/images/test.res" #include "assets/default/inc/images/time_select.res" #include "assets/default/inc/images/trip_index.res" #include "assets/default/inc/images/warn_abs_icon.res" #include "assets/default/inc/images/warn_engine_icon.res" +#include "assets/default/inc/images/warn_maint_icon.res" #include "assets/default/inc/images/warn_tcs_icon.res" #include "assets/default/inc/images/warn_tire_icon.res" +#include "assets/default/inc/images/warn_tire_icon_bk.res" +#include "assets/default/inc/images/warn_tire_icon_wt.res" #else #endif /*WITH_STB_IMAGE*/ #ifdef WITH_VGCANVAS @@ -90,9 +133,6 @@ #include "assets/default/inc/fonts/A27_SYHT_CT.res" #include "assets/default/inc/fonts/Arial_MT_Black.res" #include "assets/default/inc/fonts/default.res" -#include "assets/default/inc/fonts/QH_LABEL.res" -#include "assets/default/inc/fonts/QH_SJ.res" -#include "assets/default/inc/fonts/QH_SPEED.res" #include "assets/default/inc/fonts/Serpentine_MediumOblique.res" #else /*WITH_TRUETYPE_FONT*/ #endif /*WITH_TRUETYPE_FONT*/ @@ -105,6 +145,7 @@ ret_t assets_init(void) { #ifdef WITH_FS_RES assets_manager_preload(am, ASSET_TYPE_STYLE, "default"); #else + assets_manager_add(am, ui_A58_demo2); assets_manager_add(am, ui_A58_home_page); assets_manager_add(am, ui_call); assets_manager_add(am, ui_new); @@ -115,6 +156,7 @@ ret_t assets_init(void) { assets_manager_add(am, ui_settingview4); assets_manager_add(am, ui_set_list); assets_manager_add(am, ui_set_mile); + assets_manager_add(am, ui_set_mile_reset); assets_manager_add(am, ui_set_time); assets_manager_add(am, ui_set_tire_pressure); assets_manager_add(am, strings_en_US); @@ -125,19 +167,43 @@ ret_t assets_init(void) { assets_manager_add(am, image_btn_next_wt); assets_manager_add(am, image_btn_select_bg_bk); assets_manager_add(am, image_btn_select_bg_wt); + assets_manager_add(am, image_call_bg); + assets_manager_add(am, image_call_bg2); + assets_manager_add(am, image_demo2_bg_bk); + assets_manager_add(am, image_demo2_bg_wt); + assets_manager_add(am, image_demo2_fuel_bar_00); + assets_manager_add(am, image_demo2_fuel_bar_01); + assets_manager_add(am, image_demo2_fuel_bar_02); + assets_manager_add(am, image_demo2_fuel_bar_03); + assets_manager_add(am, image_demo2_fuel_bar_04); + assets_manager_add(am, image_demo2_fuel_bar_05); + assets_manager_add(am, image_demo2_fuel_bar_bk_00); + assets_manager_add(am, image_demo2_fuel_bar_bk_01); + assets_manager_add(am, image_demo2_fuel_bar_bk_02); + assets_manager_add(am, image_demo2_fuel_bar_bk_03); + assets_manager_add(am, image_demo2_fuel_bar_bk_04); + assets_manager_add(am, image_demo2_fuel_bar_bk_05); + assets_manager_add(am, image_demo2_speed_bk); + assets_manager_add(am, image_demo2_speed_wt); assets_manager_add(am, image_demo_bk); assets_manager_add(am, image_demo_wt); assets_manager_add(am, image_front_learing); assets_manager_add(am, image_front_normal); assets_manager_add(am, image_front_not_learned); + assets_manager_add(am, image_fuel_bar_00); assets_manager_add(am, image_fuel_bar_01); assets_manager_add(am, image_fuel_bar_02); assets_manager_add(am, image_fuel_bar_03); assets_manager_add(am, image_fuel_bar_04); assets_manager_add(am, image_fuel_bar_05); - assets_manager_add(am, image_fuel_bar_06); - assets_manager_add(am, image_fuel_bg); - assets_manager_add(am, image_fuel_icon); + assets_manager_add(am, image_fuel_bar_bk_00); + assets_manager_add(am, image_fuel_bar_bk_01); + assets_manager_add(am, image_fuel_bar_bk_02); + assets_manager_add(am, image_fuel_bar_bk_03); + assets_manager_add(am, image_fuel_bar_bk_04); + assets_manager_add(am, image_fuel_bar_bk_05); + assets_manager_add(am, image_fuel_icon_bk); + assets_manager_add(am, image_fuel_icon_wt); assets_manager_add(am, image_fuel_warn_icon); assets_manager_add(am, image_func_bt_icon); assets_manager_add(am, image_func_call_answer_icon); @@ -161,39 +227,53 @@ ret_t assets_init(void) { assets_manager_add(am, image_list_theme_wt); assets_manager_add(am, image_list_top_bg_bk); assets_manager_add(am, image_list_top_bg_wt); - assets_manager_add(am, image_main_bg); + assets_manager_add(am, image_main_bg_bk); + assets_manager_add(am, image_main_bg_wt); assets_manager_add(am, image_Moto); assets_manager_add(am, image_MOTO_wt); assets_manager_add(am, image_odo_index); assets_manager_add(am, image_rear_learing); assets_manager_add(am, image_rear_normal); assets_manager_add(am, image_rear_not_learned); - assets_manager_add(am, image_rpm_bg); - assets_manager_add(am, image_rpm_bg_01); - assets_manager_add(am, image_rpm_pointer); + assets_manager_add(am, image_rpm_bg_bk); + assets_manager_add(am, image_rpm_bg_bk_01); + assets_manager_add(am, image_rpm_bg_wt); + assets_manager_add(am, image_rpm_bg_wt_01); + assets_manager_add(am, image_rpm_pointer_bk); + assets_manager_add(am, image_rpm_pointer_wt); + assets_manager_add(am, image_speed_bg); + assets_manager_add(am, image_temp_bar_00); assets_manager_add(am, image_temp_bar_01); assets_manager_add(am, image_temp_bar_02); assets_manager_add(am, image_temp_bar_03); assets_manager_add(am, image_temp_bar_04); assets_manager_add(am, image_temp_bar_05); - assets_manager_add(am, image_temp_bar_06); - assets_manager_add(am, image_temp_icon); + assets_manager_add(am, image_temp_bar_bk_00); + assets_manager_add(am, image_temp_bar_bk_01); + assets_manager_add(am, image_temp_bar_bk_02); + assets_manager_add(am, image_temp_bar_bk_03); + assets_manager_add(am, image_temp_bar_bk_04); + assets_manager_add(am, image_temp_bar_warning); + assets_manager_add(am, image_temp_icon_bk); + assets_manager_add(am, image_temp_icon_wt); + assets_manager_add(am, image_temp_warn2_icon); assets_manager_add(am, image_temp_warn_icon); + assets_manager_add(am, image_test); assets_manager_add(am, image_time_select); assets_manager_add(am, image_trip_index); assets_manager_add(am, image_warn_abs_icon); assets_manager_add(am, image_warn_engine_icon); + assets_manager_add(am, image_warn_maint_icon); assets_manager_add(am, image_warn_tcs_icon); assets_manager_add(am, image_warn_tire_icon); + assets_manager_add(am, image_warn_tire_icon_bk); + assets_manager_add(am, image_warn_tire_icon_wt); #ifdef WITH_VGCANVAS #endif /*WITH_VGCANVAS*/ #ifdef WITH_TRUETYPE_FONT assets_manager_add(am, font_A27_SYHT_CT); assets_manager_add(am, font_Arial_MT_Black); assets_manager_add(am, font_default); - assets_manager_add(am, font_QH_LABEL); - assets_manager_add(am, font_QH_SJ); - assets_manager_add(am, font_QH_SPEED); assets_manager_add(am, font_Serpentine_MediumOblique); #else /*WITH_TRUETYPE_FONT*/ #endif /*WITH_TRUETYPE_FONT*/ diff --git a/lib/awtk/awtk-examples/Moto_A58/res/rom.bin b/lib/awtk/awtk-examples/Moto_A58/res/rom.bin index 55e2ed5..3172a79 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/res/rom.bin and b/lib/awtk/awtk-examples/Moto_A58/res/rom.bin differ diff --git a/lib/awtk/awtk-examples/Moto_A58/src/app_main.obj b/lib/awtk/awtk-examples/Moto_A58/src/app_main.obj index 986b83e..6c478f3 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/src/app_main.obj and b/lib/awtk/awtk-examples/Moto_A58/src/app_main.obj differ diff --git a/lib/awtk/awtk-examples/Moto_A58/src/common/data_communication_send.c b/lib/awtk/awtk-examples/Moto_A58/src/common/data_communication_send.c new file mode 100644 index 0000000..fc54d1a --- /dev/null +++ b/lib/awtk/awtk-examples/Moto_A58/src/common/data_communication_send.c @@ -0,0 +1,204 @@ +#include "awtk.h" +#include "navigator.h" +#include "navigator.h" +#include "data_port.h" +#include "user_data.h" +#include "universal.h" +#include "data_communication_send.h" +#include "moto_config.h" + +unsigned char time_software_request[9] = {0xAA,0x06,0x01,0x04,0,0,0,0,0x0c}; +unsigned char ota_request[8] = {0x7e,0x00,0x05,0x02,0x03,0x01,0x00,0x01}; +unsigned char defect_code_request[9] = {0xAA,0x06,0x04,0x04,0,0,0,0,0x0c}; +unsigned char trip_reset[9] = {0xAA,0x06,0x03,0x04,0,0,0,0,0x07}; +unsigned char time_buffer[13] = {0xAA,0x06,0x02,0x04,0,0,0,0,0,0,0,0}; + + +extern uint32_t tire_front_time; +extern uint32_t tire_rear_time; +extern unsigned char time_buffer[13]; +#ifdef AMT630HV100 +extern void TXCMD_Other_Set(unsigned char time_buffer[],uint8_t len); +#else +void TXCMD_Other_Set(unsigned char time_buffer[],uint8_t len){ + DEBUG_PRINT("TXXMD: "); + for(uint8_t i=0;i<13;i++){ + DEBUG_PRINT("%x ",time_buffer[i]); + } + DEBUG_PRINT("\n"); +} +#endif + + + + + + +//发送询问时间+版本号查询 +void Send_software_version(void){ + DEBUG_PRINT("Send_software_version.\r\n"); + + time_software_request[4] = Get_sys_softwar_host(); + time_software_request[5] = Get_sys_softwar_order(); + + uint8_t count = 0; + for(uint8_t i=0;i<6;i++){ + count += time_software_request[2+i]; + } + time_software_request[8] = count; + + TXCMD_Other_Set(time_software_request,9); +} + + +//发送胎压信息 +void Send_tire_pressure_information(void){ + unsigned char trie_reset[19] = {0xAA,0x10,0x05,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + uint8_t i=0; + if(mac_address_normal(custom_data.front_pressure.mac_address,6)){ + trie_reset[4] = 0x01; + for(i=0;i<6;i++){ + trie_reset[5+i] = custom_data.front_pressure.mac_address[i]; + } + } + if(mac_address_normal(custom_data.rear_pressure.mac_address,6)){ + trie_reset[11] = 0x01; + for(i=0;i<6;i++){ + trie_reset[12+i] = custom_data.rear_pressure.mac_address[i]; + } + } + uint8_t count = 0; + for(uint8_t i=0;i<16;i++){ + count += trie_reset[2+i]; + } + trie_reset[18] = count; + TXCMD_Other_Set(trie_reset,19); +} +//发送OTA升级判断 +void Send_ota_state(uint8_t state){ + ota_request[1] = state; + ota_request[6] = Get_sys_softwar_host(); + ota_request[7] = Get_sys_softwar_order(); + // vTaskDelay(100); + #ifdef AMT630HV100 + vTaskDelay(100); + #else + sleep_ms(100); + #endif + TXCMD_Other_Set(ota_request,8); +} + +//发送当前故障码+历史故障码 有数据更新才会发送 +void Send_defect_code(void){ + + defect_code_request[4] = custom_data.now_defect_code>>8&0xFF; + defect_code_request[5] = custom_data.now_defect_code&0xFF; + defect_code_request[6] = custom_data.his_defect_code>>8&0xFF; + defect_code_request[7] = custom_data.his_defect_code&0xFF; + + uint8_t count = 0; + for(uint8_t i=0;i<6;i++){ + count += defect_code_request[2+i]; + } + defect_code_request[8] = count; + + TXCMD_Other_Set(defect_code_request,9); +} + + +void Send_trip_reset(void){ + DEBUG_PRINT("trip reset .\r\n"); + TXCMD_Other_Set(trip_reset,9); + Set_sys_odo_reset(5); +} + + +void Send_bt_time(void){ + TXCMD_Other_Set(time_buffer,9); + Set_sys_ttrb_time(5); +} + + +void Send_list_set_time(uint32_t sum){ + uint32_t sum1,sum2,sum3,sum4; + uint8_t count=0; + printf("sum1 = %d , %08x.\n",sum,sum); + sum4=sum & 0xFF; + sum3=sum>>8 & 0xFF; + sum2=sum>>16 & 0xFF; + sum1=sum>>24 & 0xFF; + + time_buffer[0] = 0xAA;// + time_buffer[1] = 0x06;//命令长度 + time_buffer[2] = 0x02;//时间指令 + time_buffer[3] = 0x04;//TLV结构 + + time_buffer[4] = sum1; + time_buffer[5] = sum2; + time_buffer[6] = sum3; + time_buffer[7] = sum4; + + count = 0; + for(uint8_t i=0;i<6;i++){ + count += time_buffer[2+i]; + } + time_buffer[8] = count; + + Send_bt_time(); + DEBUG_PRINT("start send time information.\r\n"); + #ifdef AMT630HV100 + vTaskDelay(5); + #else + sleep_ms(5); + #endif + DEBUG_PRINT("send time information ok.\r\n"); +} + +void send_wifi_set_time(int time_buf[]){ + date_time_t dt; + date_time_init(&dt); + uint32_t sum; + uint8_t sum1,sum2,sum3,sum4; + dt.year = time_buf[0]; + dt.month = time_buf[1]; + dt.wday = time_buf[2]; + dt.hour = time_buf[3]; + dt.minute = time_buf[4]; + dt.second = time_buf[5]; + date_time_set(&dt); + + int check_buffer[6]; + check_buffer[0] = dt.year; + check_buffer[1] = dt.month; + check_buffer[2] = dt.day; + check_buffer[3] = dt.hour; + check_buffer[4] = dt.minute; + check_buffer[5] = dt.second; + + sum = fml_time_to_stamp(check_buffer); + #ifdef AMT630HV100 + tire_front_time = sum; + tire_rear_time = sum; + #endif + sum4=sum & 0xFF; + sum3=sum>>8 & 0xFF; + sum2=sum>>16 & 0xFF; + sum1=sum>>24 & 0xFF; + time_buffer[0] = 0xAA;// + time_buffer[1] = 0x06;//命令长度 + time_buffer[2] = 0x02;//时间指令 + time_buffer[3] = 0x04;//TLV结构 + time_buffer[4] = sum1; + time_buffer[5] = sum2; + time_buffer[6] = sum3; + time_buffer[7] = sum4; + + uint8_t count = 0; + for(uint8_t i=0;i<6;i++){ + count += time_buffer[2+i]; + } + time_buffer[8] = count; + + TXCMD_Other_Set(time_buffer,9); + Set_sys_ttrb_time(5); +} diff --git a/lib/awtk/awtk-examples/Moto_A58/src/common/data_communication_send.h b/lib/awtk/awtk-examples/Moto_A58/src/common/data_communication_send.h new file mode 100644 index 0000000..1360eee --- /dev/null +++ b/lib/awtk/awtk-examples/Moto_A58/src/common/data_communication_send.h @@ -0,0 +1,21 @@ +#ifndef DATA_COMMUNICATION_H +#define DATA_COMMUNICATION_H + +#include +#include +#include + +#include "tkc/types_def.h" + +void Send_software_version(void); +void Send_tire_pressure_information(void); +//发送OTA升级判断 +void Send_ota_state(uint8_t state); +//发送当前故障码+历史故障码 有数据更新才会发送 +void Send_defect_code(void); +void Send_trip_reset(void); +void Send_bt_time(void); +void Send_list_set_time(uint32_t sum); +void send_wifi_set_time(int time_buf[]); + +#endif diff --git a/lib/awtk/awtk-examples/Moto_A58/src/common/data_port.c b/lib/awtk/awtk-examples/Moto_A58/src/common/data_port.c index 3f251e3..85aefcb 100644 --- a/lib/awtk/awtk-examples/Moto_A58/src/common/data_port.c +++ b/lib/awtk/awtk-examples/Moto_A58/src/common/data_port.c @@ -4,48 +4,32 @@ #include "user_data.h" #include "main_loop/main_loop_simple.h" #include "../common/universal.h" +#include "common/data_communication_send.h" extern void SaveDataToFlash(SfudData_t user_data); #ifndef WITH_MVVM extern DailyData_t custom_data; extern Device_t device; -#ifndef AWTK_630H +#ifndef AMT630HV100 // uint8_t save_tire_flag = 0; uint8_t bt2_switch_time = 1; uint8_t power_on_flag = 0; uint8_t speed_flag = 0; +uint8_t tcs_twinkle = 0; +uint8_t tcs_switch = 0; +uint8_t can101_flag = 0; +int test_light = 0; SfudData_t sfud_data_saved = {0}; void SaveDataToFlash(SfudData_t user_data){ } void BT2_Switch(int type){ - widget_t* win = window_manager(); - widget_t* widget; - widget = widget_lookup(win, "bt_switch", TRUE); - if(widget == NULL) - return; - const char* language = locale_info()->language; switch(type){ case 0://关闭蓝牙 - if (tk_str_eq(language, "en")) {//英文 - widget_set_text_utf8(widget->parent, "OFF"); - }else{ - widget_set_text_utf8(widget->parent, "关闭"); - } Set_sys_bt_on_off(0); - - widget_set_value(widget,0); break; case 1://开启蓝牙 - if (tk_str_eq(language, "en")) {//英文 - widget_set_text_utf8(widget->parent, "ON"); - }else{ - widget_set_text_utf8(widget->parent, "开启"); - } - widget_set_text_utf8(widget->parent, "开启"); Set_sys_bt_on_off(1); - - widget_set_value(widget,1); break; default: break; @@ -65,6 +49,9 @@ void BT2_init_close(void){ void light_off(void){ } +void cp_wlan_start(void){ +} + void oil_led_off(void){ } @@ -80,14 +67,6 @@ void SaveMileageData(uint32_t trip_data,uint32_t total_data){ void read_mileage(uint32_t trip_data,uint32_t total_data){ } -void TXCMD_Other_Set(unsigned char time_buffer[],uint8_t len){ - DEBUG_PRINT("TXXMD: "); - for(uint8_t i=0;i<13;i++){ - DEBUG_PRINT("%x ",time_buffer[i]); - } - DEBUG_PRINT("\n"); -} - #endif #define KEY_DATA_PRESS 0x01 // 短按 @@ -194,10 +173,10 @@ void Set_sys_theme_state(uint8_t value) { if(value == NULL ){ custom_data.user_data.theme_state = 0; - SaveDataToFlash(custom_data.user_data);//保存数据 + // SaveDataToFlash(custom_data.user_data);//保存数据 }else if(value != custom_data.user_data.theme_state){ custom_data.user_data.theme_state = value; - SaveDataToFlash(custom_data.user_data);//保存数据 + // SaveDataToFlash(custom_data.user_data);//保存数据 } } @@ -227,12 +206,14 @@ uint8_t Get_sys_display_theme(void) { return custom_data.display_theme; } - +uint8_t ui_state_flag = 0; void Set_sys_display_theme(uint8_t value)//光感控制主题 { if(value == NULL ){ custom_data.display_theme = 0; + ui_state_flag = 1; }else if(value != custom_data.display_theme){ + ui_state_flag = 1; custom_data.display_theme = value; } } @@ -258,13 +239,31 @@ void Set_sys_bt_on_off(uint8_t value) } +uint8_t Get_sys_tcs_on_off(void) +{ + return custom_data.user_data.tcs_on_off; +} +void Set_sys_tcs_on_off(uint8_t value) +{ + if(value == NULL ){ + custom_data.user_data.tcs_on_off = 0; + SaveDataToFlash(custom_data.user_data);//保存数据 + }else if(value != custom_data.user_data.tcs_on_off){ + custom_data.user_data.tcs_on_off = value; + SaveDataToFlash(custom_data.user_data);//保存数据 + } + //gpio_direction_output(46,1); + //gpio_direction_output(46,0); + +} + uint8_t Get_sys_bt_connect_state(void) { return custom_data.bt_connect_state; } void Set_sys_bt_connect_state(uint8_t value) { - printf("Get_sys_bt_connect_state = %d .\r\n",value); + // printf("Get_sys_bt_connect_state = %d .\r\n",value); if(value == NULL ){ custom_data.bt_connect_state = 0; }else if(value != custom_data.bt_connect_state){ @@ -281,10 +280,34 @@ uint8_t Get_sys_wifi(void) } void Set_sys_wifi(uint8_t value) { - if(value == NULL ){ - custom_data.wifi_state = 0; - }else if(value != custom_data.wifi_state){ - custom_data.wifi_state = value; + if(value != custom_data.wifi_state){ + if(value == NULL) + custom_data.wifi_state = 0; + else{ + custom_data.wifi_state = value; + // #ifdef AMT630HV100 + #if 0 + + char dataTime[24]; + EC_queryTime(NULL,NULL,NULL,0,dataTime,24); + // printf("..................................................\r\n"); + // printf("dataTime >>%s<< .\r\n",dataTime); + int time_clock; + int year, month, day, hour, minute, second; + sscanf(dataTime, "%d.%d.%d %d:%d:%d", &day, &month, &year, &hour, &minute, &second); + int check_buffer[6]; + check_buffer[0] = year; + check_buffer[1] = month; + check_buffer[2] = day; + check_buffer[3] = hour; + check_buffer[4] = minute; + check_buffer[5] = second; + // printf("now time >%d.%d.%d %d:%d:%d .\r\n",check_buffer[0],check_buffer[1], + // check_buffer[2],check_buffer[3],check_buffer[4],check_buffer[5]); + send_wifi_set_time(check_buffer); + + #endif + } } } @@ -397,11 +420,11 @@ uint16_t Get_sys_veer_velocity(void)//转速 } void Set_sys_veer_velocity(uint16_t value) { - // if(value == NULL ){ - // custom_data.veer_velocity = 0; - // }else if(value != custom_data.veer_velocity){ + if(value == NULL ){ + custom_data.veer_velocity = 0; + }else if(value != custom_data.veer_velocity){ custom_data.veer_velocity = value; - // } + } } uint16_t Get_sys_temp(void)//温度 @@ -517,13 +540,14 @@ uint8_t Get_sys_display_mileage(void) } void Set_sys_display_mileage(uint8_t value){ - if (value == NULL) + + if (value != custom_data.user_data.display_mileage) { - custom_data.user_data.display_mileage = 0; - } - else if (value != custom_data.user_data.display_mileage) - { - custom_data.user_data.display_mileage = value; + if (value == NULL) + custom_data.user_data.display_mileage = 0; + else + custom_data.user_data.display_mileage = value; + SaveDataToFlash(custom_data.user_data);//保存数据 } } @@ -702,23 +726,7 @@ uint32_t Get_sys_his_defect_code(void) return custom_data.his_defect_code; } -extern void TXCMD_Other_Set(unsigned char time_buffer[],uint8_t len); -//发送当前故障码+历史故障码 有数据更新才会发送 -void Send_defect_code(void){ - unsigned char defect_code_request[9] = {0x27,0x06,0x04,0x04,0,0,0,0,0x0c}; - defect_code_request[4] = custom_data.now_defect_code>>8&0xFF; - defect_code_request[5] = custom_data.now_defect_code&0xFF; - defect_code_request[6] = custom_data.his_defect_code>>8&0xFF; - defect_code_request[7] = custom_data.his_defect_code&0xFF; - uint8_t count = 0; - for(uint8_t i=0;i<6;i++){ - count += defect_code_request[2+i]; - } - defect_code_request[8] = count; - - TXCMD_Other_Set(defect_code_request,9); -} //当前故障码 void Set_sys_now_defect_code(uint32_t value) @@ -949,7 +957,7 @@ void Key_Distinction(uint8_t type , int key){ if(Get_sys_power_on_self_test()!=100)//自检时不允许启动按键事件 return; - #if AWTK_630H + #if AMT630HV100 switch(type){ case KEY_DATA_PRESS: main_loop_post_key_event(main_loop(), TRUE, key); @@ -957,6 +965,7 @@ void Key_Distinction(uint8_t type , int key){ Set_sys_return_demo(2); break; case KEY_DATA_LONG_PRESS: + // printf("long key ------------------------------- key = %d .\r\n",key); long_key_event_handling(key);//demo界面长按事件 一个切换单位 一个切换清零小计里程 // Set_sys_return_demo(2); break; @@ -1254,11 +1263,8 @@ uint32_t Get_sys_maintenance_mileage(void) } void Set_sys_maintenance_mileage(uint32_t value) { - if(value == NULL ){ - custom_data.user_data.maintenance_mileage = 0; - }else{ + if(value != custom_data.user_data.maintenance_mileage){ custom_data.user_data.maintenance_mileage = value; - // Set_sys_start_mileage(Get_sys_total_mileage()); custom_data.user_data.mileage_flag = custom_data.user_data.total_mileage; SaveDataToFlash(custom_data.user_data);//保存数据 } @@ -1277,6 +1283,19 @@ void Set_sys_start_mileage(uint32_t value) SaveDataToFlash(custom_data.user_data);//保存数据 } +//保养里程状态 0-1000 1-3000 2-4000 +uint8_t Get_sys_mileage_state(void) +{ + return custom_data.user_data.mile_state; +} +void Set_sys_mileage_state(uint8_t value) +{ + if(value != custom_data.user_data.mile_state){ + custom_data.user_data.mile_state = value; + SaveDataToFlash(custom_data.user_data);//保存数据 + } +} + //胎压相关结构体 Pressure_t Get_sys_front_pressure(void)//前胎压 @@ -1315,30 +1334,6 @@ uint8_t Get_sys_pressure_signal(void) return custom_data.pressure_signal; } -//发送胎压信息 -void Send_tire_pressure_information(void){ - unsigned char trie_reset[19] = {0x27,0x10,0x05,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; - uint8_t i=0; - if(mac_address_normal(custom_data.front_pressure.mac_address,6)){ - trie_reset[4] = 0x01; - for(i=0;i<6;i++){ - trie_reset[5+i] = custom_data.front_pressure.mac_address[i]; - } - } - if(mac_address_normal(custom_data.rear_pressure.mac_address,6)){ - trie_reset[11] = 0x01; - for(i=0;i<6;i++){ - trie_reset[12+i] = custom_data.rear_pressure.mac_address[i]; - } - } - uint8_t count = 0; - for(uint8_t i=0;i<16;i++){ - count += trie_reset[2+i]; - } - trie_reset[18] = count; - - TXCMD_Other_Set(trie_reset,19); -} //开机询问时间标志 ret_t ttrb_mesg(void) @@ -1380,4 +1375,55 @@ ret_t mileage_detection_mesg(void){ } } +/****************************************** can接口 */ +int16_t Get_sys_can_temp(void)//温度 +{ + return custom_data.eng_temp; +} +void Set_sys_can_temp(int16_t value) +{ + if(value == NULL ){ + custom_data.eng_temp = 0; + }else if(value != custom_data.eng_temp){ + custom_data.eng_temp = value; + } +} + + + + +//获取abs故障码 +char *Get_can_abs_dtc(void) +{ + return custom_data.abs_dtc; +} +void Set_can_abs_dtc(char *value) +{ + printf("set now >>>>>>>>>>>> %s ,value =%s.\r\n",custom_data.abs_dtc,value); + if(!compareStrings(custom_data.abs_dtc,value)){ + char uuid[5] = {0}; + strcpy(uuid,value); + // Set_can_abs_his_dtc(value); + strncpy(custom_data.abs_dtc,uuid,5); + // printf("set now >>>>>>>>>>>> %s .\r\n",custom_data.abs_dtc); + + } +} + +//获取abs历史故障码 +char *Get_can_abs_his_dtc(void) +{ + return custom_data.abs_his_dtc; +} +void Set_can_abs_his_dtc(char *value) +{ + if(!compareStrings(custom_data.abs_his_dtc,value)){ + char uuid[5] = {0}; + strcpy(uuid,value); + strncpy(custom_data.abs_his_dtc,uuid,5); + printf("set his >>>>>>>>>>>> %s .\r\n",custom_data.abs_his_dtc); + } +} + + #endif /*WITH_MVVM*/ diff --git a/lib/awtk/awtk-examples/Moto_A58/src/common/data_port.h b/lib/awtk/awtk-examples/Moto_A58/src/common/data_port.h index c78d674..2a8850e 100644 --- a/lib/awtk/awtk-examples/Moto_A58/src/common/data_port.h +++ b/lib/awtk/awtk-examples/Moto_A58/src/common/data_port.h @@ -52,6 +52,10 @@ void Set_sys_warning_brake(uint8_t value); uint8_t Get_sys_warning_maintenance(void); void Set_sys_warning_maintenance(uint8_t value); +uint8_t Get_sys_tcs_on_off(void); +void Set_sys_tcs_on_off(uint8_t value); + + uint8_t Get_sys_display_theme(void); void Set_sys_display_theme(uint8_t value); @@ -214,9 +218,20 @@ uint32_t Get_sys_maintenance_mileage(void); void Set_sys_maintenance_mileage(uint32_t value); uint32_t Get_sys_start_mileage(void); void Set_sys_start_mileage(uint32_t value); +uint8_t Get_sys_mileage_state(void); +void Set_sys_mileage_state(uint8_t value); ret_t mileage_detection_mesg(void); void Send_tire_pressure_information(void); +int16_t Get_sys_can_temp(void); +void Set_sys_can_temp(int16_t value); + +char *Get_can_abs_his_dtc(void); +void Set_can_abs_his_dtc(char *value); + +char *Get_can_abs_dtc(void); +void Set_can_abs_dtc(char *value); + #endif /*DATA_PORT_H*/ diff --git a/lib/awtk/awtk-examples/Moto_A58/src/common/data_port.obj b/lib/awtk/awtk-examples/Moto_A58/src/common/data_port.obj index 42aeba6..fe0eb13 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/src/common/data_port.obj and b/lib/awtk/awtk-examples/Moto_A58/src/common/data_port.obj differ diff --git a/lib/awtk/awtk-examples/Moto_A58/src/common/moto_config.h b/lib/awtk/awtk-examples/Moto_A58/src/common/moto_config.h index 92b8e4c..0a38b43 100644 --- a/lib/awtk/awtk-examples/Moto_A58/src/common/moto_config.h +++ b/lib/awtk/awtk-examples/Moto_A58/src/common/moto_config.h @@ -1,28 +1,39 @@ #ifndef MOTO_CONFIG_H #define MOTO_CONFIG_H -//#define AWTK_630H 1 //控制模拟器和开发板运行 注释掉模拟器可用 打开开发板可用 +//#define AMT630HV100 1 //控制模拟器和开发板运行 注释掉模拟器可用 打开开发板可用 -#define MOTO_ICMX_A590A 1 +#define MOTO_ICMX_A580A 1 +#define MOTO_ICMX_A590A 2 #define MOTO_WARE_HOSE MOTO_ICMX_A590A -#if (MOTO_WARE_HOSE == MOTO_ICMX_A590A) -#define SOFT_WARE_HOST 0 -#define SOFT_WARE_ORDER 2 +#if (MOTO_WARE_HOSE == MOTO_ICMX_A580A) +#define SOFT_WARE_HOST 1 +#define SOFT_WARE_ORDER 7 +#define HARD_WARE "MXC-A58-0A V1.1" +#define HARD_WARE_LABEL "1.1" + +#elif (MOTO_WARE_HOSE == MOTO_ICMX_A590A) +#define SOFT_WARE_HOST 1 +#define SOFT_WARE_ORDER 1 #define HARD_WARE "MXC-A59-0A V1.1" #define HARD_WARE_LABEL "1.1" +#define TP_CARLINK_EC 1 + #else #define SOFT_WARE_HOST 0 #define SOFT_WARE_ORDER 1 -#define HARD_WARE "MXC-A59-0A V1.0" +#define HARD_WARE "MXC-A58-0A V1.0" #define HARD_WARE_LABEL "1.0" #endif + + //胎压功能宏 #define UI_VIEW_TIRE_PRESSURE 1 @@ -36,7 +47,7 @@ #endif // 打印 -#define DEBUG 1 +// #define DEBUG 1 #ifdef DEBUG #define DEBUG_PRINT(fmt, ...) printf(fmt, ##__VA_ARGS__) #else @@ -91,12 +102,6 @@ * 高于116℃(包括)图标闪烁 */ #define UI_TORAL6_GRIDS_TEMP_WARNING 116 -// #define UI_TORAL6_GRIDS_TEMP_0 65 -// #define UI_TORAL6_GRIDS_TEMP_1 70 -// #define UI_TORAL6_GRIDS_TEMP_2 80 -// #define UI_TORAL6_GRIDS_TEMP_3 90 -// #define UI_TORAL6_GRIDS_TEMP_4 100 -// #define UI_TORAL6_GRIDS_TEMP_5 110 #define UI_TORAL6_GRIDS_TEMP_0 60 #define UI_TORAL6_GRIDS_TEMP_1 65 //60-65 1 #define UI_TORAL6_GRIDS_TEMP_2 70 //66-70 2 @@ -105,6 +110,22 @@ #define UI_TORAL6_GRIDS_TEMP_5 100 //91-100 5 #define UI_TORAL6_GRIDS_TEMP_6 110 //101-110 6 +// #define UI_CAN_TORAL6_GRIDS_TEMP_WARNING 114 +// #define UI_CAN_TORAL6_GRIDS_TEMP_0 50//1格 +// #define UI_CAN_TORAL6_GRIDS_TEMP_1 62//2格 +// #define UI_CAN_TORAL6_GRIDS_TEMP_2 80//3格 +// #define UI_CAN_TORAL6_GRIDS_TEMP_3 90//4格 +// #define UI_CAN_TORAL6_GRIDS_TEMP_4 100//5格 +// #define UI_CAN_TORAL6_GRIDS_TEMP_5 117//6格 + +#define UI_CAN_TORAL6_GRIDS_TEMP_WARNING 114 //高温报警后 水温还原点 +#define UI_CAN_TORAL6_GRIDS_TEMP_0 50 //<50 0格 +#define UI_CAN_TORAL6_GRIDS_TEMP_1 62 //<60 1格 +#define UI_CAN_TORAL6_GRIDS_TEMP_2 80 //<80 2格 +#define UI_CAN_TORAL6_GRIDS_TEMP_3 100 //<100 3格 +#define UI_CAN_TORAL6_GRIDS_TEMP_4 117//<117 4格 +#define UI_CAN_TORAL6_GRIDS_TEMP_5 117 //6格 + /**转速限制(客户需求) * 转速保持在15 不需要上下抖动 */ @@ -130,7 +151,7 @@ //转速arc速率 #define ANIMATE_SPEED 50 #define ANIMATE_SPEED_VALUE 100 -#define ANIMATE_SPEED_LITTLE_VALUE 200 +#define ANIMATE_SPEED_LITTLE_VALUE 500 //数组大小 水温 油量 亮度 #define SAVE_DATA_SIZE 10 @@ -201,11 +222,14 @@ #define COLOR_WHITE "0xffffffff"//白色 #define COLOR_RED "0xff0000ff"//红色 #define COLOR_GREEN "0xff00ff00"//绿色 +#define COLOR_YELLOW "0xff10C8FF"//黄色 + #define OUTPUT_COLOR_USER_BLUE str_to_num(COLOR_USER_BLUE) #define OUTPUT_COLOR_BLACK str_to_num(COLOR_BLACK) #define OUTPUT_COLOR_WHITE str_to_num(COLOR_WHITE) #define OUTPUT_COLOR_RED str_to_num(COLOR_RED) #define OUTPUT_COLOR_GREEN str_to_num(COLOR_GREEN) +#define OUTPUT_COLOR_YELLOW str_to_num(COLOR_YELLOW) #define TIME_TO_NUM(num) int(num%5) #define OUTPUT_COLOR(data) str_to_num(data) diff --git a/lib/awtk/awtk-examples/Moto_A58/src/common/navigator.c b/lib/awtk/awtk-examples/Moto_A58/src/common/navigator.c index 0bbb5c2..ab18795 100644 --- a/lib/awtk/awtk-examples/Moto_A58/src/common/navigator.c +++ b/lib/awtk/awtk-examples/Moto_A58/src/common/navigator.c @@ -1,5 +1,7 @@ #include "awtk.h" #include "navigator.h" +extern ret_t A58_demo2_init(widget_t* win, void* ctx); +extern ret_t set_mile_reset_init(widget_t* win, void* ctx); extern ret_t new_init(widget_t* win, void* ctx); extern ret_t A58_home_page_init(widget_t* win, void* ctx); extern ret_t prompt_init(widget_t* win, void* ctx); @@ -11,7 +13,11 @@ extern ret_t set_list_init(widget_t* win, void* ctx); #ifndef WITH_MVVM static ret_t navigator_window_init(const char* name, widget_t* win, void* ctx) { - if (tk_str_eq(name, "new")) { + if (tk_str_eq(name, "A58_demo2")) { + return A58_demo2_init(win, ctx); + } else if (tk_str_eq(name, "set_mile_reset")) { + return set_mile_reset_init(win, ctx); + } else if (tk_str_eq(name, "new")) { return new_init(win, ctx); } else if (tk_str_eq(name, "A58_home_page")) { return A58_home_page_init(win, ctx); diff --git a/lib/awtk/awtk-examples/Moto_A58/src/common/navigator.obj b/lib/awtk/awtk-examples/Moto_A58/src/common/navigator.obj index 72115d3..3315178 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/src/common/navigator.obj and b/lib/awtk/awtk-examples/Moto_A58/src/common/navigator.obj differ diff --git a/lib/awtk/awtk-examples/Moto_A58/src/common/universal.c b/lib/awtk/awtk-examples/Moto_A58/src/common/universal.c index b85bc55..0bc410c 100644 --- a/lib/awtk/awtk-examples/Moto_A58/src/common/universal.c +++ b/lib/awtk/awtk-examples/Moto_A58/src/common/universal.c @@ -10,7 +10,7 @@ char key_value = 0; int can_number =0; double total_mile = 0; double test_data = 0; -uint8_t code_time = 0; +// uint8_t code_time = 0; uint8_t button_flag = 0; extern void light_init(widget_t* win); @@ -18,11 +18,9 @@ extern void bt_init(widget_t* win); extern void theme_list_init(widget_t* win); extern void defect_code_win_init(widget_t* win); -extern void TXCMD_Other_Set(unsigned char time_buffer[],uint8_t len); extern void Set_sys_demo_position(uint8_t value); uint8_t tire_pressure_loading = 0;//胎压界面长按事件标志 -unsigned char trip_reset[9] = {0xAA,0x06,0x03,0x04,0,0,0,0,0x07}; // 时间戳 const uint16_t month_day_table[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; @@ -92,38 +90,21 @@ ret_t on_key_set_list(void* ctx, event_t* e){ key_event_t* evt = key_event_cast(e); // TODO: 在此添加控件事件处理程序代码 if(Get_sys_call_state() == 0){ - if(evt->key == TK_KEY_w){ - #ifndef AWTK_630H + if(evt->key == TK_KEY_q){ + DEBUG_PRINT("update unit .\r\n"); + Set_sys_display_mileage(Get_sys_display_mileage() ? 0 : 1);//切换里程显示 + }else if(evt->key == TK_KEY_w){ + #ifndef AMT630HV100 navigator_replace("set_list"); #else if(Get_sys_velocity() == 0){//有速度的情况下不允许进入设置界面 navigator_replace("set_list"); } #endif - }else if(evt->key == TK_KEY_q){ - // Set_sys_call_state(1); - Set_sys_display_mileage(Get_sys_display_mileage() ? 0 : 1); - #ifndef AWTK_630H - }else if(evt->key == TK_KEY_a){ - Get_sys_unit()==0?Set_sys_unit(1):Set_sys_unit(0); - }else if(evt->key == TK_KEY_b){ - Get_sys_call_state() ==0?Set_sys_call_state(1):Set_sys_call_state(0); - }else if(evt->key == TK_KEY_p){ - custom_data.user_data.gas++; - printf("custom_data.user_data.gas = %d .\r\n",custom_data.user_data.gas); - }else if(evt->key == TK_KEY_o){ - custom_data.user_data.gas--; - printf("custom_data.user_data.gas = %d .\r\n",custom_data.user_data.gas); - }else if(evt->key == TK_KEY_l){ - custom_data.temp++; - printf("custom_data.temp = %d .\r\n",custom_data.temp); - }else if(evt->key == TK_KEY_k){ - custom_data.temp--; - printf("custom_data.temp = %d .\r\n",custom_data.temp); - #endif + } }else{ - #ifndef AWTK_630H + #ifndef AMT630HV100 if(evt->key == TK_KEY_w){//接听 Set_sys_call_state(2); }else if(evt->key == TK_KEY_q){//挂断 @@ -146,41 +127,37 @@ ret_t long_key_event_handling(uint8_t key){ widget_t* win = window_manager(); widget_t* child = window_manager_get_top_main_window(win); widget_t* widget = NULL; - DEBUG_PRINT("long_key > %d .\r\n",key); + // printf("long_key >>>>>>>>>>>>>>>> %d .\r\n",key); if(key == TK_KEY_w){ //设置按键 小计清零 //set - DEBUG_PRINT("w> child->name = %s .\r\n",child->name); - if(strcmp(child->name,"A58_home_page")==0) { - DEBUG_PRINT("trip reset .\r\n"); - TXCMD_Other_Set(trip_reset,9); - Set_sys_odo_reset(5); - }else if(strcmp(child->name,"set_list")==0){ + // printf("w> child->name = %s .\r\n",child->name); + if(strcmp(child->name,"A58_home_page")==0 || strcmp(child->name,"A58_demo2")==0) { + navigator_replace("new");//切换new 投屏界面 + }else if(strcmp(child->name,"setting_list")==0){ + // printf("long set_tire_pressure---------------------.\r\n"); widget = window_manager_get_top_window(win); + // printf("widget->name = %s .\r\n",widget->name); if(widget != NULL &&strcmp(widget->name,"set_tire_pressure")==0){ + // printf("long set_tire_pressure---------------------.\r\n"); child = widget_get_focused_widget(widget);//聚焦对象 uint8_t count = widget_index_of(child); if(count == 0){ - DEBUG_PRINT("1-----------------tire_pressure_loading = %d .\r\n",tire_pressure_loading); + // printf("1-----------------tire_pressure_loading = %d .\r\n",tire_pressure_loading); if(!tire_pressure_loading) tire_pressure_loading = 1; }else if(count ==1){ - DEBUG_PRINT("2-----------------tire_pressure_loading = %d .\r\n",tire_pressure_loading); + // printf("2-----------------tire_pressure_loading = %d .\r\n",tire_pressure_loading); if(!tire_pressure_loading) tire_pressure_loading = 2; - }else{ - Set_sys_return_demo(3); } - }else{ - Set_sys_return_demo(3); } - }else - Set_sys_return_demo(3); + } }else if(key == TK_KEY_q){//mode - DEBUG_PRINT("q> child->name = %s .\r\n",child->name); - if(strcmp(child->name,"A58_home_page")==0) { - DEBUG_PRINT("update unit .\r\n"); - Get_sys_unit()==0?Set_sys_unit(1):Set_sys_unit(0); + // printf("q> child->name = %s .\r\n",child->name); + if(strcmp(child->name,"A58_home_page")==0 || strcmp(child->name,"A58_demo2")==0) { + + Send_trip_reset(); }else{ - #ifdef AWTK_630H + #ifdef AMT630HV100 main_loop_post_key_event(main_loop(), TRUE, TK_KEY_e); main_loop_post_key_event(main_loop(), FALSE, TK_KEY_e); Set_sys_return_demo(2); @@ -195,18 +172,49 @@ ret_t long_key_event_handling(uint8_t key){ void Power_On_Self_Test(void){//自检函数 widget_t* win = window_manager(); widget_t* child = window_manager_get_top_main_window(win); - widget_t* rpm_bar = widget_lookup(win, "rpm_bar", TRUE); - widget_set_animation(rpm_bar, "value(duration=1000,yoyo_times=1,easing=linear,from=0,to=180)"); - widget_t* rpm_pointer = widget_lookup(win, "rpm_pointer", TRUE); - widget_set_animation(rpm_pointer, "value(duration=1000,yoyo_times=1,easing=linear,from=-90,to=90,)"); - + if(child == NULL) + return; + uint8_t theme_Offset = 0; + switch(Get_sys_theme_state()){//theme_state 0黑 1白 2自适应 + case 1: + theme_Offset = 1; + break; + case 2: + if(Get_sys_display_theme()) + theme_Offset = 1; + else + theme_Offset = 0; + break; + default: + theme_Offset = 0; + break; + } + + widget_t* gear = widget_lookup(win, "gear_value", TRUE); - widget_set_animation(gear, "value(duration=1000,yoyo_times=1,easing=linear,from=0,to=6)"); - - widget_t* mile_data = widget_lookup(win, "mile_value", TRUE); - widget_set_animation(mile_data, "value(duration=1000,yoyo_times=1,easing=linear,from=0,to=99999)"); - + widget_t* mile_data = widget_lookup(win, "mile_value", TRUE); widget_t *speed = widget_lookup(win, "speed_value", TRUE); + widget_t *fuel_icon = widget_lookup(win, "fuel_icon", TRUE); + widget_t *temp_icon = widget_lookup(win, "temp_icon", TRUE); + + + if(theme_Offset){ + widget_set_style_color(gear, "text_color", 0xff000000); + }else{ + widget_set_style_color(gear, "text_color", 0xffffffff); + } + widget_use_style(temp_icon, "temp_warn_icon"); + widget_use_style(fuel_icon, "fuel_warn_icon"); + + if(strcmp(child->name,"A58_home_page")==0){ + widget_t* rpm_bar = widget_lookup(win, "rpm_bar", TRUE); + widget_t* rpm_pointer = widget_lookup(win, "rpm_pointer", TRUE); + widget_set_animation(rpm_bar, "value(duration=1000,yoyo_times=1,easing=linear,from=0,to=180)"); + widget_set_animation(rpm_pointer, "value(duration=1000,yoyo_times=1,easing=linear,from=-90,to=90)"); + } + + widget_set_animation(gear, "value(duration=1000,yoyo_times=1,easing=linear,from=0,to=6)"); + widget_set_animation(mile_data, "value(duration=1000,yoyo_times=1,easing=linear,from=0,to=99999)"); widget_set_animation(speed, "value(duration=1000,yoyo_times=1,easing=linear,from=0,to=255)"); } @@ -283,10 +291,10 @@ void Unified_brightness_processing(uint8_t data,uint8_t type){ default: break; } - // printf("duty_ns ============================ %d .\r\n",duty_ns); + if(duty_ns >= 24000) duty_ns = 24000; - #ifdef AWTK_630H + #ifdef AMT630HV100 pwn_update_brightness(duty_ns); #endif @@ -382,8 +390,8 @@ uint32_t fml_stamp_to_time(uint32_t timep , uint32_t time[]){ uint32_t days = 0; uint32_t rem = 0; - //北京时间补偿 - timep = timep + 8*60*60; + // //北京时间补偿 + // timep = timep + 8*60*60; days = (uint32_t)(timep/86400); rem = (uint32_t)(timep%86400); @@ -431,15 +439,76 @@ uint32_t fml_stamp_to_time(uint32_t timep , uint32_t time[]){ void return_theme(void){ widget_t* win = window_manager(); widget_t* child = window_manager_get_top_main_window(win); + // printf("return_theme -------------------------------- .\r\n"); + widget_t* widget = NULL; Set_sys_return_demo(0); - if(child != NULL && strcmp(child->name,"A58_home_page")!=0){ - DEBUG_PRINT("now them ==>> %d ,them_state ==>> %d\r\n",Get_sys_theme(),Get_sys_theme_state()); - navigator_close("set_list"); + if(child == NULL) + return; + if((strcmp(child->name,"new")==0) || (strcmp(child->name,"A58_home_page")==0) || (strcmp(child->name,"A58_demo2")==0)) + return; + + // printf("return>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>child->name = %s .\r\n",child->name); + if(strcmp(child->name,"setting_list")==0){ + navigator_close("setting_list"); + }else if(strcmp(child->name,"set_time")==0){ navigator_close("set_time"); + navigator_close("setting_list"); + }else if(strcmp(child->name,"set_mile")==0){ navigator_close("set_mile"); + navigator_close("setting_list"); + }else if(strcmp(child->name,"set_tire_pressure")==0){ navigator_close("set_tire_pressure"); + navigator_close("setting_list"); + }else if(strcmp(child->name,"select_fault_code")==0){ + navigator_close("select_fault_code"); + navigator_close("setting_list"); + }else if(strcmp(child->name,"set_mile_reset")==0){ + navigator_close("set_mile_reset"); + navigator_close("setting_list"); + }else if(strcmp(child->name,"prompt")==0){ + navigator_close("prompt"); + } + /*if(strcmp(child->name,"setting_list")==0){ + + if(strcmp(widget->name,"set_time")==0){ + printf("close set_time----------------------.\r\n"); + navigator_close("set_time"); + }else if(strcmp(widget->name,"set_mile")==0){ + printf("close set_mile----------------------.\r\n"); + navigator_close("set_mile"); + }else if(strcmp(widget->name,"set_tire_pressure")==0){ + navigator_close("set_tire_pressure"); + }else if(strcmp(widget->name,"select_fault_code")==0){ + navigator_close("select_fault_code"); + }else if(strcmp(widget->name,"set_mile_reset")==0){ + navigator_close("set_mile_reset"); + } + navigator_close("setting_list"); + }*/ + + if(!Get_sys_theme()) navigator_replace("A58_home_page"); - } + else + navigator_replace("A58_demo2"); + +} + +//返回demo界面 +void new_return_theme(void){ + Set_sys_return_demo(0); + navigator_close("new"); + if(!Get_sys_theme()) + navigator_replace("A58_home_page"); + else + navigator_replace("A58_demo2"); +} + +void dh_refresh(void){ + widget_t* win = window_manager(); + widget_t* child = window_manager_get_top_main_window(win); + if(child != NULL && strcmp(child->name,"new")!=0 ) { + navigator_replace("new"); + } } void list_set_btn_init(widget_t* win){ @@ -449,10 +518,11 @@ void list_set_btn_init(widget_t* win){ const char* language = locale_info()->language; widget_t* set_language = widget_lookup(win, "set_language", TRUE); widget_t* set_unit = widget_lookup(win, "set_unit", TRUE); + widget_t* set_mile = widget_lookup(win, "set_mile", TRUE); if (tk_str_eq(language, "en")) {//英文 widget = widget_get_child(set_language,0); - widget_set_text_utf8(widget,"[EN]"); + widget_set_text_utf8(widget,"[英文]"); widget = widget_get_child(set_unit,0); if(Get_sys_unit()==0){ @@ -460,6 +530,20 @@ void list_set_btn_init(widget_t* win){ }else{ widget_set_text_utf8(widget,"[Inch]"); } + + child = widget_lookup(win, "bt_label", TRUE); + if(Get_sys_bt_on_off()==0){ + widget_set_text_utf8(child,"[Close]"); + }else{ + widget_set_text_utf8(child,"[Open]"); + } + + child = widget_lookup(win, "tcs_label", TRUE); + if(Get_sys_tcs_on_off()==0){ + widget_set_text_utf8(child,"[Close]"); + }else{ + widget_set_text_utf8(child,"[Open]"); + } }else{ widget = widget_get_child(set_language,0); widget_set_text_utf8(widget,"[中文]"); @@ -469,23 +553,45 @@ void list_set_btn_init(widget_t* win){ widget_set_text_utf8(widget,"[公制]"); }else{ widget_set_text_utf8(widget,"[英制]"); - } - } + } - child = widget_lookup(win, "bt_switch", TRUE); - if(Get_sys_bt_on_off()==0){ - widget_set_value(child,0); - }else{ - widget_set_value(child,1); - } + child = widget_lookup(win, "bt_label", TRUE); + if(Get_sys_bt_on_off()==0){ + widget_set_text_utf8(child,"[关闭]"); + }else{ + widget_set_text_utf8(child,"[开启]"); + } + + child = widget_lookup(win, "tcs_label", TRUE); + if(Get_sys_tcs_on_off()==0){ + widget_set_text_utf8(child,"[关闭]"); + }else{ + widget_set_text_utf8(child,"[开启]"); + } + } + + if(!Get_sys_warning_maintenance()){ + widget_use_style(set_mile, "btn_switch_disable_bk"); + child = widget_get_child(set_mile,0); + widget_set_opacity(child,100); + } } - +extern uint32_t idletick; void information_win_init(widget_t* win){ widget_t* child =NULL; //widget_t* widget =NULL; char tmpStr[20] = {0}; - uint8_t count = 0 ; + char dtc_str[100] = {0}; + char str[200] = {0}; + uint8_t count = 0; + char* mac_text = Get_device_mac(); + char* abs_dtc = Get_can_abs_dtc(); + char* abs_his_dtc = Get_can_abs_his_dtc(); + widget_t* abs_now = widget_lookup(win, "abs_now", TRUE); + widget_t* abs_his = widget_lookup(win, "abs_his", TRUE); + widget_t* ecu_now = widget_lookup(win, "ecu_now", TRUE); + widget_t* ecu_his = widget_lookup(win, "ecu_his", TRUE); child = widget_lookup(win, "mcu", TRUE); tk_snprintf(tmpStr, sizeof(tmpStr), "%s V%d.%d",Get_device_produce_num(),custom_data.softwar_host,custom_data.softwar_order); @@ -499,24 +605,25 @@ void information_win_init(widget_t* win){ tk_snprintf(tmpStr, sizeof(tmpStr), "%s V%d.%d",Get_device_produce_num(),Get_device_bottom_softwar_host(),Get_device_bottom_softwar_order()); widget_set_text_utf8(child,tmpStr); - if(code_time%128 == 0){ - child = widget_lookup(win, "now_defect_code", TRUE); - count = Get_sys_now_defect_code(); - tk_snprintf(tmpStr, sizeof(tmpStr), "%x",count); - if(count>=1) - widget_set_text_utf8(child,tmpStr); - else - widget_set_text_utf8(child,"--"); + child = widget_lookup(win, "btmac", TRUE); + tk_snprintf(tmpStr, sizeof(tmpStr), "%02X:%02X:%02X:%02X:%02X:%02X",mac_text[0],mac_text[1],mac_text[2],mac_text[3],mac_text[4],mac_text[5]); + widget_set_text_utf8(child,tmpStr); - child = widget_lookup(win, "his_defect_code", TRUE); - count = Get_sys_his_defect_code(); - tk_snprintf(tmpStr, sizeof(tmpStr), "%x",count); - if(count>=1) - widget_set_text_utf8(child,tmpStr); - else - widget_set_text_utf8(child,"--"); + #ifdef AMT630HV100 + if(xTaskGetTickCount() - idletick > configTICK_RATE_HZ * 10){ + tk_snprintf(dtc_str, sizeof(dtc_str), "%s",Get_can_abs_dtc()); + widget_set_text_utf8(abs_now,dtc_str); + + tk_snprintf(str, sizeof(str), "%s",Get_can_abs_his_dtc()); + widget_set_text_utf8(abs_his,str); + idletick = xTaskGetTickCount(); } - code_time ++; + #else + tk_snprintf(tmpStr, sizeof(tmpStr), "%c%c%c%c%c",abs_dtc[0],abs_dtc[1],abs_dtc[2],abs_dtc[3],abs_dtc[4]); + widget_set_text_utf8(abs_now,tmpStr); + tk_snprintf(tmpStr, sizeof(tmpStr), "%c%c%c%c%c",abs_his_dtc[0],abs_his_dtc[1],abs_his_dtc[2],abs_his_dtc[3],abs_his_dtc[4]); + widget_set_text_utf8(abs_his,tmpStr); + #endif } @@ -525,7 +632,7 @@ void theme_win_init(widget_t* win){ widget_t* widget =NULL; //char tmpStr[20] = {0}; uint8_t count = 0 ; - count = Get_sys_theme_state(); + count = Get_sys_theme(); widget_t* theme_view = widget_lookup(win, "theme_view", TRUE); @@ -549,7 +656,6 @@ void light_bar_init(widget_t* win){ void list_theme_button1_init(void){ widget_t* win = window_manager(); - // widget_t* child = window_manager_get_top_main_window(win); widget_t* tab_button1 = widget_lookup(win, "tab_button1", TRUE); if(widget_get_value_int(tab_button1) == 0) @@ -561,11 +667,7 @@ void list_theme_button1_init(void){ } uint8_t count = widget_count_children(set_view);//获取子类个数 - uint8_t theme_Offset = 0; - if(Get_sys_theme_state()) - theme_Offset = RESOURCE_LIST_WHITE; - else - theme_Offset = RESOURCE_LIST_BLACK; + uint8_t theme_Offset = RESOURCE_LIST_WHITE; for(uint8_t i=0;ilanguage; @@ -713,3 +817,20 @@ void newA27_list_win_init(widget_t* child){//list界面刷新函数 } } +//字符串对比 +uint8_t compareStrings(const char* str1, const char* str2) { + while (*str1 && *str2) { + if (*str1 != *str2) { + return 0; // 如果当前字符不相等,返回false + } + str1++; + str2++; + } + + // 如果两个字符串长度不相等,返回false + if (*str1 || *str2) { + return 0; + } + + return 1; // 两个字符串完全相等 +} diff --git a/lib/awtk/awtk-examples/Moto_A58/src/common/universal.h b/lib/awtk/awtk-examples/Moto_A58/src/common/universal.h index abbff66..f66cf5b 100644 --- a/lib/awtk/awtk-examples/Moto_A58/src/common/universal.h +++ b/lib/awtk/awtk-examples/Moto_A58/src/common/universal.h @@ -71,4 +71,6 @@ void list_theme_button1_init(void); void list_theme_button2_init(void); void list_theme_button4_init(void); +uint8_t compareStrings(const char* str1, const char* str2); + #endif \ No newline at end of file diff --git a/lib/awtk/awtk-examples/Moto_A58/src/common/universal.obj b/lib/awtk/awtk-examples/Moto_A58/src/common/universal.obj index 77b810e..f64cc41 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/src/common/universal.obj and b/lib/awtk/awtk-examples/Moto_A58/src/common/universal.obj differ diff --git a/lib/awtk/awtk-examples/Moto_A58/src/common/user_data.c b/lib/awtk/awtk-examples/Moto_A58/src/common/user_data.c index 87a21f8..57d3169 100644 --- a/lib/awtk/awtk-examples/Moto_A58/src/common/user_data.c +++ b/lib/awtk/awtk-examples/Moto_A58/src/common/user_data.c @@ -15,10 +15,11 @@ extern void SaveDataToFlash(SfudData_t user_data); //uint8_t temp_buffer[SAVE_DATA_SIZE]; //uint8_t oil_buffer[SAVE_DATA_SIZE]; -uint16_t light_buffer[SAVE_DATA_SIZE]; +uint8_t light_buffer[SAVE_DATA_SIZE]; double cell_buffer[SAVE_DATA_SIZE]; uint8_t data_storage=0; + Current_fault_code_record_saved_struct* userData_getCurrentFaultRecordSaved(void) { return ¤t_fault_data; @@ -50,18 +51,18 @@ void system_date_init(void){ custom_data.user_data.language = 0; custom_data.user_data.display_unit = 0; - custom_data.user_data.theme = 0; - custom_data.user_data.theme_state = 1;//0为白色 1为黑色 + custom_data.user_data.theme = 1; + custom_data.user_data.theme_state = 0;//0为白色 1为黑色 custom_data.user_data.light_value = 3; //custom_data.user_data.gas = 100; //custom_data.user_data.grade = 0; custom_data.user_data.total_mileage = 0; custom_data.user_data.bt_on_off = 0; custom_data.user_data.trip_unit = 0; - custom_data.user_data.maintenance_mileage = 0; + custom_data.user_data.maintenance_mileage = 1000; custom_data.user_data.mileage_flag = 0; - custom_data.power_on_self_test =0; + // custom_data.power_on_self_test =0; custom_data.wifi_state = 0; custom_data.wireless =0; @@ -83,6 +84,7 @@ void system_date_init(void){ custom_data.voltage =0; if(custom_data.light_perception_value == 0) custom_data.light_perception_value=50; + custom_data.light = 50; custom_data.return_demo = 0; custom_data.bt_data_inheritance = 0; //SaveBtInformation("CARBITDC0D30329E1A"); @@ -110,7 +112,7 @@ void system_date_init(void){ custom_data.call.call_state=0; custom_data.call.call_key_state=0; custom_data.call.time=0; - + custom_data.user_data.tcs_on_off = 1; // extern Device_t device; // device.ability = 0xff; @@ -157,7 +159,7 @@ void copy_tire_pressure_rear(void){ } void system_flash_to_date_event_handling(void){//上电后数据同步 -#ifdef AWTK_630H +#ifdef AMT630HV100 DEBUG_PRINT("**************read flash init***********************\r\n"); DEBUG_PRINT("MXCA27_A => sfud_data_saved :%d-%d-%d-%d-%d %d %d ,",sfud_data_saved.language, sfud_data_saved.display_unit,sfud_data_saved.theme,sfud_data_saved.theme_state, @@ -185,11 +187,15 @@ void system_flash_to_date_event_handling(void){//上电后数据同步 custom_data.user_data.light_value = sfud_data_saved.light_value; custom_data.user_data.bt_on_off = sfud_data_saved.bt_on_off; + custom_data.user_data.display_mileage = sfud_data_saved.display_mileage; + custom_data.user_data.tcs_on_off = sfud_data_saved.tcs_on_off; + custom_data.user_data.mile_state = sfud_data_saved.mile_state; + if(sfud_data_saved.maintenance_mileage!=0xFFFFFFFF){ custom_data.user_data.maintenance_mileage = sfud_data_saved.maintenance_mileage; }else{ - custom_data.user_data.maintenance_mileage = 0; + custom_data.user_data.maintenance_mileage = 1000; } if(sfud_data_saved.mileage_flag!=0xFFFFFFFF){ custom_data.user_data.mileage_flag = sfud_data_saved.mileage_flag; @@ -248,6 +254,10 @@ void system_flash_to_date_event_handling(void){//上电后数据同步 sfud_data_saved.maintenance_mileage = custom_data.user_data.maintenance_mileage; sfud_data_saved.mileage_flag = custom_data.user_data.mileage_flag; + sfud_data_saved.display_mileage = custom_data.user_data.display_mileage; + sfud_data_saved.tcs_on_off = custom_data.user_data.tcs_on_off; + sfud_data_saved.mile_state = custom_data.user_data.mile_state; + SaveDataToFlash(custom_data.user_data); } @@ -257,7 +267,7 @@ void system_flash_to_date_event_handling(void){//上电后数据同步 } void BrightnessPowerOnSetting(void){ -#ifdef AWTK_630H +#ifdef AMT630HV100 int buf; ReadDataToFlash(); if(sfud_data_saved.light_value>6 || sfud_data_saved.light_value == 0) @@ -274,6 +284,7 @@ ret_t on_key_set_data(void* ctx, event_t* e){ key_event_t* evt = key_event_cast(e); // TODO: 在此添加控件事件处理程序代码 + #ifndef AMT630HV100 if(evt->key == TK_KEY_z){//灯光开关 custom_data.veer = 1; }else if(evt->key == TK_KEY_x){//远光 @@ -283,16 +294,34 @@ ret_t on_key_set_data(void* ctx, event_t* e){ custom_data.velocity +=1; }else if(evt->key == TK_KEY_v){ custom_data.velocity -=1; - }else if(evt->key == TK_KEY_b){//转速 - custom_data.veer_velocity +=1; - }else if(evt->key == TK_KEY_n){ - custom_data.veer_velocity -=1; - }else if(evt->key == TK_KEY_m){ + }else if(evt->key == TK_KEY_j){//测试主题切换 + if(Get_sys_display_theme()) + Set_sys_display_theme(0); + else + Set_sys_display_theme(1); + }else if(evt->key == TK_KEY_k){//测试通话 + if(Get_sys_call_state()) + Set_sys_call_state(0); + else + Set_sys_call_state(1); + }else if(evt->key == TK_KEY_y){//转速 + custom_data.veer_velocity +=100; + printf("veer_velocity ----------------- %d .\r\n",custom_data.veer_velocity); + }else if(evt->key == TK_KEY_u){ + custom_data.veer_velocity -=100; + printf("veer_velocity ----------------- %d .\r\n",custom_data.veer_velocity); + }else if(evt->key == TK_KEY_o){ custom_data.user_data.gas +=1; custom_data.temp +=1; - }else if(evt->key == TK_KEY_a){ + custom_data.eng_temp +=1; + printf("can temp ----------------- %d .\r\n",custom_data.eng_temp); + printf("gas ----------------- %d .\r\n",custom_data.user_data.gas); + }else if(evt->key == TK_KEY_p){ custom_data.user_data.gas -=1; custom_data.temp -=1; + custom_data.eng_temp -=1; + printf("can temp ----------------- %d .\r\n",custom_data.eng_temp); + printf("gas ----------------- %d .\r\n",custom_data.user_data.gas); }else if(evt->key == TK_KEY_s){ if(custom_data.lamplight == 0) custom_data.lamplight = 1; @@ -306,19 +335,14 @@ ret_t on_key_set_data(void* ctx, event_t* e){ custom_data.user_data.total_mileage +=1; }else if(evt->key == TK_KEY_h){ custom_data.user_data.total_mileage -=1; - }else if(evt->key == TK_KEY_j){ - /*if(custom_data.user_data.bt_state < 2) - custom_data.user_data.bt_state +=1; - else - custom_data.user_data.bt_state =0;*/ - }else if(evt->key == TK_KEY_k){ - if(custom_data.wifi_state !=1) - custom_data.wifi_state =1; - else - custom_data.wifi_state =0; - }else if(evt->key == TK_KEY_l){ - + }else if(evt->key == TK_KEY_a){ + Get_sys_unit()==0?Set_sys_unit(1):Set_sys_unit(0); + }else if(evt->key == TK_KEY_b){ + Get_sys_call_state() ==0?Set_sys_call_state(1):Set_sys_call_state(0); + }else if(evt->key == TK_KEY_m){ + navigator_replace("new");//切换new 投屏界面 } + #endif return RET_OK; } @@ -338,7 +362,7 @@ void Simulating_data_changes(void){ if(n%20==0){ //custom_data.user_data.bt_state =0; custom_data.wireless =0; - custom_data.warning.engine =0; + // custom_data.warning.engine =0; custom_data.warning.machine_oil = 0; custom_data.warning.fan = 0; custom_data.warning.abs = 0; @@ -347,11 +371,11 @@ void Simulating_data_changes(void){ custom_data.veer = 0; custom_data.lamplight = 0; custom_data.user_data.bt_on_off = 0; - custom_data.wifi_state = 0; + // custom_data.wifi_state = 0; custom_data.side_marker = 0; }else if(n%20==10){ custom_data.wireless =1; - custom_data.warning.engine =1; + // custom_data.warning.engine =1; custom_data.warning.machine_oil = 1; custom_data.warning.fan = 1; custom_data.warning.abs = 1; @@ -362,28 +386,28 @@ void Simulating_data_changes(void){ if(n%40==30) custom_data.lamplight = 2; custom_data.user_data.bt_on_off = 1; - custom_data.wifi_state = 1; + // custom_data.wifi_state = 1; custom_data.side_marker = 1; } if((int)(n/100)%2 == 0){ - // custom_data.user_data.gas++; + custom_data.user_data.gas++; custom_data.trip_mileage+=1100; custom_data.user_data.total_mileage+=1000; }else{ - // custom_data.user_data.gas--; + custom_data.user_data.gas--; custom_data.trip_mileage-=1100; custom_data.user_data.total_mileage-=1000; } - // if((int)(n/60)%2 == 0){ - // custom_data.temp++; - // }else{ - // custom_data.temp--; - // } - // custom_data.temp=111; + if((int)(n/60)%2 == 0){ + custom_data.temp++; + }else{ + custom_data.temp--; + } + // custom_data.temp=117; if((int)(n/255)%2 == 0){ custom_data.velocity++; @@ -392,9 +416,9 @@ void Simulating_data_changes(void){ } if((int)(n/160)%2 == 0){ - custom_data.veer_velocity+=100; + custom_data.veer_velocity+=50; }else{ - custom_data.veer_velocity-=100; + custom_data.veer_velocity-=50; } // custom_data.veer_velocity = 1400; diff --git a/lib/awtk/awtk-examples/Moto_A58/src/common/user_data.h b/lib/awtk/awtk-examples/Moto_A58/src/common/user_data.h index e686274..009e5e7 100644 --- a/lib/awtk/awtk-examples/Moto_A58/src/common/user_data.h +++ b/lib/awtk/awtk-examples/Moto_A58/src/common/user_data.h @@ -63,9 +63,9 @@ typedef struct char r_mac_address[9]; // 后胎压物理地址 uint32_t maintenance_mileage; // 保养里程数max uint32_t mileage_flag; // 保养里程设置时的开始里程 - // Pressure_t f_data; - // Pressure_t r_data; - uint8_t display_mileage; // 里程显示类型 + uint8_t display_mileage; // 里程显示类型 + uint8_t tcs_on_off; //tcs开关类型 + uint8_t mile_state; //保养里程状态 } SfudData_t; typedef struct @@ -156,6 +156,10 @@ typedef struct CallData_t call; + int16_t eng_temp; + char abs_dtc[5]; //abs_dtc + char abs_his_dtc[5]; //abs_dtc + } DailyData_t; typedef struct @@ -187,36 +191,5 @@ void Simulating_data_changes(void); void system_flash_to_date_event_handling(void); void power_on_self_data(void); -#if 0 -#define AWTK_630H 1 // 控制模拟器和开发板运行 注释掉模拟器可用 打开开发板可用 -#define SOFT_WARE "MXC-A27-A V0.1" -#define HARD_WARE "MXC-A27-A V4.0" -#define HARD_WARE_LABEL "4.0" - -//胎压温度报警 - -//前 -#define TIRE_PRESSURE_FRONT_UPPER 362 + 146 -#define TIRE_PRESSURE_FRONT_LOWER 268 + 146 -//后 -#define TIRE_PRESSURE_REAR_UPPER 362 + 146 -#define TIRE_PRESSURE_REAR_LOWER 275 + 146 - -extern Current_fault_code_record_saved_struct* userData_getCurrentFaultRecordSaved(void); -extern Historical_fault_code_record_saved_struct* userData_getHistorFaultRecordSaved(void); - -extern daily_data_t custom_data; -daily_data_t* userData_getCustom(void); -void system_date_init(void); -void Simulating_data_changes(void); -void system_flash_to_date_event_handling(void); - -#define DEBUG 1 -#ifdef DEBUG -#define DEBUG_PRINT(fmt, ...) printf(fmt, ##__VA_ARGS__) -#else -#define DEBUG_PRINT(fmt, ...) -#endif -#endif #endif /*USER_DATA_H*/ diff --git a/lib/awtk/awtk-examples/Moto_A58/src/common/user_data.obj b/lib/awtk/awtk-examples/Moto_A58/src/common/user_data.obj index b5abfae..d3c5266 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/src/common/user_data.obj and b/lib/awtk/awtk-examples/Moto_A58/src/common/user_data.obj differ diff --git a/lib/awtk/awtk-examples/Moto_A58/src/pages/A58_demo2.c b/lib/awtk/awtk-examples/Moto_A58/src/pages/A58_demo2.c new file mode 100644 index 0000000..c219672 --- /dev/null +++ b/lib/awtk/awtk-examples/Moto_A58/src/pages/A58_demo2.c @@ -0,0 +1,1062 @@ +#include "awtk.h" +#include "../common/navigator.h" +#include "../common/data_port.h" +#include "../common/universal.h" +#include "../common/moto_config.h" +#include "tkc/object_date_time.h" + +extern char *fuel_resource_icon[3]; +extern char *temp_resource_icon[4]; +extern uint8_t tcs_twinkle; +extern uint8_t tcs_switch; +extern uint8_t speed_flag; +uint8_t refresh_flag = 0; +static char *fuel_resource[7] = { + "demo2_fuel_bar_00", + "demo2_fuel_bar_01", + "demo2_fuel_bar_02", + "demo2_fuel_bar_03", + "demo2_fuel_bar_04", + "demo2_fuel_bar_05", +}; + +static char *fuel_bk_resource[7] = { + "demo2_fuel_bar_bk_00", + "demo2_fuel_bar_bk_01", + "demo2_fuel_bar_bk_02", + "demo2_fuel_bar_bk_03", + "demo2_fuel_bar_bk_04", + "demo2_fuel_bar_bk_05", +}; + + +static void removeNonNumeric(char *str) +{ + int j = 0; + for (int i = 0; str[i] != '\0'; i++) + { + if (isdigit(str[i]) || str[i] == '-') + { + str[j++] = str[i]; + } + else + { + break; // 遇到非数字和"-"字符,结束循环 + } + } + str[j] = '\0'; +} + +typedef struct { + int x; + int y; +}Points_xy; +// static widget_t* canvas_demo; +/*坐标点:start为一侧的坐标,end为另一侧的坐标,value为刻度值*/ +Points_xy point_start[30]={{53,276},{43,248},{45,228},{88,191}, {119,168}, {142,146}, {168,125}, {199,108}, {229,95}, {256,87}, {285,81}, {315,78},{345,75}, + {373,72},{398,70},{425,69},{456,69},{484,68},{510,65},{541,64},{567,61},{594,61},{623,60},{651,60},{679,59},{705,59},{734,58}}; +Points_xy point_end[30]={{111,276},{116,258},{134,239},{155,220},{179,198}, {199,181}, {220,163}, {244,147}, {270,137}, {293,130},{319,124}, {347,118},{370,117}, + {396,112},{418,110},{445,109},{473,108},{499,107},{525,106},{550,105},{575,104},{602,104},{626,103},{655,102},{679,102},{707,101},{737,100}}; +int point_value[30] = {0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200,210,220,230,240,250,260,270,280,290}; + +void speed_refresh_value(canvas_t* c,widget_t* widget,uint16_t test){ + bitmap_t img; + + // static int test = 0; // + // test = test++; + // if (test >= 240) test = 0; //校准一点 + + vgcanvas_t* vg = canvas_get_vgcanvas(c); // 获取到canvas + vgcanvas_save(vg); + vgcanvas_begin_path(vg); + vgcanvas_move_to(vg, point_start[0].x, point_start[0].y); + int i = 0; + /*用坐标点连成一个闭合的区域*/ + for (i = 1; i < 28; i++) { + if (test < point_value[i]) { + Points_xy start; + start.x = point_start[i-1].x + + (point_start[i].x - point_start[i-1].x) * + (test - point_value[i-1]) / 10; + start.y = point_start[i-1].y + + (point_start[i].y - point_start[i-1].y) * + (test - point_value[i-1]) / 10; + vgcanvas_line_to(vg, start.x, start.y); + + Points_xy end; + end.x = point_end[i-1].x + + (point_end[i].x - point_end[i-1].x) * + (test - point_value[i-1]) / 10; + end.y = point_end[i-1].y + + (point_end[i].y - point_end[i-1].y) * + (test - point_value[i-1]) / 10; + vgcanvas_line_to(vg, end.x, end.y); + break; + } else if (test == point_value[i]) { + vgcanvas_line_to(vg, point_start[i].x, point_start[i].y); + vgcanvas_line_to(vg, point_end[i].x, point_end[i].y); + break; + } else { + vgcanvas_line_to(vg, point_start[i].x, point_start[i].y); + } + } + + if (i > 0) { + for (int j = i - 1; j > 0; j--) { + vgcanvas_line_to(vg, point_end[j-1].x, + point_end[j-1].y); + } + vgcanvas_line_to(vg, point_end[0].x, point_end[0].y); + } + + vgcanvas_close_path(vg); + /*调整图片的起始位置*/ + vgcanvas_translate(vg, 45, 61); + /*用颜色填充不规则区域*/ + // vgcanvas_set_fill_color_str(vg,"#FF0000"); + /*用图片填充不规则区域*/ + uint8_t theme_Offset = 0;//0为白色 1为黑色 + switch(Get_sys_theme_state()){//theme_state 0黑 1白 2自适应 + case 1: + theme_Offset = 1; + break; + case 2: + if(Get_sys_display_theme()) + theme_Offset = 1; + else + theme_Offset = 0; + break; + default: + theme_Offset = 0; + break; + } + + if(theme_Offset) + widget_load_image(widget, "demo2_speed_wt", &img); + else + widget_load_image(widget, "demo2_speed_bk", &img); + vgcanvas_paint(vg, FALSE, &img); + vgcanvas_fill(vg); + vgcanvas_restore(vg); +} + +static uint8_t demo2_inited = 0; + +static ret_t on_paint_demo(void* ctx, event_t* e) { + widget_t* widget = WIDGET(ctx); + paint_event_t* evt = (paint_event_t*)e; + canvas_t* speed_canvas = evt->c; + uint16_t value = Get_sys_veer_velocity(); + if(value>13000) + value = 13000; + static int16_t test=0; + static uint8_t data_flag = 0; + if(Get_sys_power_on_self_test() != 100){ + + if(!data_flag) + test+=8; + else{ + if(test){ + test-=8; + } + } + if(test>=260){ + data_flag++; + test = 260; + }else if(test<=0){ + test = 0; + } + + value = test; + }else{ + value = value/50; + } + + speed_refresh_value(speed_canvas,widget,value); + return RET_REPEAT; +} + + + +/** + * @brief 转速刷新 + * + * @param win + * @param value 转速值 r/min + */ +// uint8_t rpm_value1[11]={47,42,37,32,27,21,16,10,5,0}; +uint8_t rpm_value1[11]={58,53,48,43,38,32,27,21,16,10}; +uint8_t rpm_value2[19]={70,67,63,60,57,54,50,46,42,37,34,30,25,21,16,12,7,0}; +static void ui_refresh_rmp(widget_t *win, uint16_t value) +{ + static widget_t *speed1 = NULL; // 转速弧形1 + static widget_t *speed2 = NULL; // 转速弧形2 + if (!demo2_inited) + { + speed1 = widget_lookup(win, "speed1", TRUE); + speed2 = widget_lookup(win, "speed2", TRUE); + } + + if(value>=13000) + value = 13000; + static int16_t _value = 0; + value /= 100; + int16_t diff = (int16_t)_value - (int16_t)value; + uint8_t number = 0; + static uint8_t _number = 0; + if ((value%5 == 0) || diff > 1 || diff < -1 || refresh_flag) + { + if (value >= 14 && value <= 16) + value = 15; + + if(value <=45){ + number = value/5; + if(number>9) + number = 9; + if(_number != number || refresh_flag){ + widget_set_visible(speed1,TRUE); + widget_set_value(speed1,rpm_value1[number]); + widget_set_value(speed2,rpm_value2[0]); + if(number == 9) + widget_set_value(speed2,70); + else + widget_set_value(speed2,71); + _number = number; + } + }else{ + number = (value-45)/5; + if(number>17) + number = 17; + + if(_number != number || refresh_flag){ + widget_set_value(speed1,rpm_value1[9]); + widget_set_visible(speed1,FALSE); + widget_set_value(speed2,rpm_value2[number]); + _number = number; + } + } + _value = value; + } + +} + +/* +uint8_t rpm_value1[10]={47,43,38,33,27,22,16,11,5,0}; +uint8_t rpm_value2[18]={72,69,65,62,58,55,51,47,43,38,34,30,25,21,15,11,6,0}; +static void ui_refresh_rmp(widget_t *win, uint16_t value) +{ + static widget_t *speed1 = NULL; // 转速弧形1 + static widget_t *speed2 = NULL; // 转速弧形2 + if (!demo2_inited) + { + speed1 = widget_lookup(win, "speed1", TRUE); + speed2 = widget_lookup(win, "speed2", TRUE); + } + + if(value>=13000) + value = 13000; + static int16_t _value = 0; + value /= 100; + value = value * 3 / 2; + int16_t diff = (int16_t)_value - (int16_t)value; + uint8_t number = 0; + + if (diff > 2 || diff < -2) + { + if (value >= 14 && value <= 16) + value = 15; + if(value <=45){ + number = value/5; + if(number>9) + number = 9; + // widget_set_value(speed1,rpm_value1[number]); + widget_set_value(speed2,rpm_value2[0]); + }else{ + number = (value-45)/5; + if(number>17) + number = 17; + + // widget_set_value(speed1,rpm_value1[9]); + widget_set_value(speed2,rpm_value2[number]); + } + _value = value; + } +} +*/ +/** + * @brief 档位刷新 + * + * @param win + * @param value 档位 0-N 1-6 7卡档 + * @param theme_Offset 主题变化 + */ +static void ui_refresh_gear(widget_t *win, uint16_t value, uint8_t theme_Offset) +{ + static widget_t *gear = NULL; // 挡位 + if (!demo2_inited) + { + gear = widget_lookup(win, "gear_value", TRUE); + } + char tmpStr[20] = {0}; + if (value == 0) + { + tmpStr[0] = 'N'; + widget_set_style_color(gear, "text_color", 0xff00ff00); + } + else if (value > 6) + { + tmpStr[0] = '-'; + if(theme_Offset) + widget_set_style_color(gear, "text_color", 0xff000000); + else + widget_set_style_color(gear, "text_color", 0xffffffff); + } + else + { + tk_snprintf(tmpStr, sizeof(tmpStr), "%d", value); + if(theme_Offset) + widget_set_style_color(gear, "text_color", 0xff000000); + else + widget_set_style_color(gear, "text_color", 0xffffffff); + } + widget_set_text_utf8(gear, tmpStr); +} + + +/** + * @brief 速度刷新 + * + * @param win + * @param value 速度值 km/h + */ +static void ui_refresh_speed(widget_t *win, uint16_t value) +{ + static widget_t *speed = NULL; // 速度 + static widget_t *speed_unit = NULL; // 速度单位 + if (!demo2_inited) + { + speed = widget_lookup(win, "speed_value", TRUE); + speed_unit = widget_lookup(win, "speed_unit", TRUE); + } + widget_set_text_utf8(speed_unit, "km/h"); + + static uint16_t _value = 0; + int16_t diff = (int16_t)_value - (int16_t)value; + + + if (diff > 3 || diff < -3 || (!value) || refresh_flag) + { + _value = value; + if (Get_sys_unit()) + { + value *= 0.6; + widget_set_text_utf8(speed_unit, "mph"); + } + char tmpStr[20] = {0}; + tk_snprintf(tmpStr, sizeof(tmpStr), "%d", value); + widget_set_value(speed,value); + + } +} + + +/** + * @brief 油量刷新 + * + * @param win + * @param value 油量值 0-100 + */ +extern uint8_t oil_state; +extern uint8_t temp_state; +extern uint8_t can101_flag; +static void ui_refresh_oil(widget_t *win, uint16_t value, uint8_t theme_Offset) +{ + static widget_t *fuel_icon = NULL; // 油量图标 + static widget_t *fuel_bar = NULL; // 油量 + if (!demo2_inited) + { + fuel_icon = widget_lookup(win, "fuel_icon", TRUE); // 油量图标 + fuel_bar = widget_lookup(win, "fuel_bar", TRUE); // 油量 + } + // uint16_t fuel_list[7] = {10, 20, 32, 44, 56, 68, 80}; + uint16_t fuel_list[6] = {UI_TORAL6_GRIDS_OIL_WARNING, UI_TORAL6_GRIDS_OIL_0, UI_TORAL6_GRIDS_OIL_1, UI_TORAL6_GRIDS_OIL_2, + UI_TORAL6_GRIDS_OIL_3, UI_TORAL6_GRIDS_OIL_4}; + + uint8_t index = 0; + for (size_t i = 0; i < 6; i++) + { + if (value <= fuel_list[i]) + { + break; + } + index = i; + } + if(oil_state!=2){ + widget_use_style(fuel_icon, fuel_resource_icon[2]); // 油量图标 + }else{ + widget_use_style(fuel_icon, fuel_resource_icon[0+theme_Offset]); + } + // if(!index){ + if(theme_Offset) + widget_use_style(fuel_bar, fuel_resource[index]); + else + widget_use_style(fuel_bar, fuel_bk_resource[index]); + // }else + // widget_use_style(fuel_bar, fuel_resource[index]); +} + + +/** + * @brief 电压图标刷新 + * + * @param win + * @param value 电压值 + */ +static void ui_refresh_cell(widget_t *win, float value) +{ + // static widget_t *cell = NULL; + // static widget_t *cell_label = NULL; + // char tmpStr[20] = {0}; + // if (!demo2_inited) + // { + // // cell = widget_lookup(win, "warn_batv_icon", TRUE); + // // cell_label = widget_lookup(win, "cell_label", TRUE); + // } + if (value < 11.75 || value >= 14.95) // A58判断范围 小于11.8V 大于15V + { // 变红 + vbat_led_on(); + } + else + { + vbat_led_off(); + } + // tk_snprintf(tmpStr, sizeof(tmpStr), "%.1lf", value); + // widget_set_text_utf8(cell_label, tmpStr); +} + +/** + * @brief 里程刷新 + * + * @param win + * @param odo_value 总计里程(米) + * @param trip_value 小计里程(米) + */ +static void ui_refresh_mileage(widget_t *win, uint32_t odo_value, uint32_t trip_value, uint8_t type) +{ + static widget_t *mile_label = NULL; + static widget_t *mile_data = NULL; + static widget_t *mile_unit = NULL; + + if (!demo2_inited) + { + mile_label = widget_lookup(win, "mile_label", TRUE); // 里程标签 + mile_data = widget_lookup(win, "mile_value", TRUE); // 里程数 + mile_unit = widget_lookup(win, "mile_unit", TRUE); // 里程单位 + } + + uint32_t mile_value = 0; + if (type == 1) + { + mile_value = trip_value; + widget_set_text_utf8(mile_label, "TRIP"); + } + else + { + mile_value = odo_value; + widget_set_text_utf8(mile_label, "ODO"); + } + + float mile = mile_value * 1.0; + widget_set_text_utf8(mile_unit, "km"); + // 速度单位 + if (Get_sys_unit()) + { + mile = mile * 0.6; + widget_set_text_utf8(mile_unit, "mile"); + } + mile /= 1000; + // char tmpStr[20] = {0}; + // 里程数刷新 + // tk_snprintf(tmpStr, sizeof(tmpStr), type == 0 ? "%.0f" : "%.1f", mile); + type == 0 ?number_label_set_format(mile_data,"%d"):number_label_set_format(mile_data,"%.1lf"); + widget_set_value(mile_data, mile); +} + + +/** + * @brief 水温刷新 7格显示 + * + * @param win + * @param value 温度值 60-120 + */ +extern uint8_t temp_warning_flag; +static void ui_refresh_temp(widget_t *win, uint16_t value, uint8_t theme_Offset) +{ + static widget_t *temp_icon = NULL; // 水温图标 + static widget_t *temp_value = NULL; // 水温 + + if (!demo2_inited) + { + temp_icon = widget_lookup(win, "temp_icon", TRUE); // 油量图标 + temp_value = widget_lookup(win, "temp_value", TRUE); // 油量 + } + + if(!can101_flag){ + if(Get_sys_warning_engine()){//黄色 + widget_use_style(temp_icon, temp_resource_icon[3]); + // widget_use_style(temp_value, temp_resource[6]); + widget_set_style_color(temp_value, "normal:text_color", OUTPUT_COLOR_YELLOW); + value = 0; + }else{//正常显示 + if(temp_state!=2){ + widget_use_style(temp_icon, temp_resource_icon[2]); + widget_set_style_color(temp_value, "normal:text_color", OUTPUT_COLOR_RED); + }else{ + widget_use_style(temp_icon, temp_resource_icon[0+theme_Offset]); + if(!theme_Offset)//黑 + widget_set_style_color(temp_value, "normal:text_color", OUTPUT_COLOR_WHITE); + else + widget_set_style_color(temp_value, "normal:text_color", OUTPUT_COLOR_BLACK); + } + + } + }else{ + if(temp_state!=2){ + widget_use_style(temp_icon, temp_resource_icon[2]); + widget_set_style_color(temp_value, "normal:text_color", OUTPUT_COLOR_RED); + }else{ + widget_use_style(temp_icon, temp_resource_icon[0+theme_Offset]); + if(!theme_Offset)//黑 + widget_set_style_color(temp_value, "normal:text_color", OUTPUT_COLOR_WHITE); + else + widget_set_style_color(temp_value, "normal:text_color", OUTPUT_COLOR_BLACK); + } + + } + char tmpStr[20] = {0}; + tk_snprintf(tmpStr, sizeof(tmpStr), "%d", value); + if(value<30) + widget_set_text_utf8(temp_value,"--"); + else + widget_set_text_utf8(temp_value,tmpStr); +} + +/** + * @brief 图标刷新 + * + * @param win + */ +static void ui_refresh_icons(widget_t *win) +{ + + // static widget_t *abs_icon = NULL; + static widget_t *tcs_icon = NULL; + static widget_t *func_bt_icon = NULL; + static widget_t *warn_maint_icon = NULL; + // static widget_t *eng_icon = NULL; + // static widget_t *warn_engine_icon = NULL; + // static widget_t *warn_maint_icon = NULL; + // static widget_t *func_wifi_icon = NULL; + // static widget_t *warn_break_icon = NULL; + static widget_t *beam_wide_icon = NULL; + static widget_t *warn_abs_icon = NULL; + static widget_t *warn_engine_icon = NULL; + if (!demo2_inited) + { + // abs_icon = widget_lookup(win, "abs_icon", TRUE); + tcs_icon = widget_lookup(win, "tcs_icon", TRUE); + func_bt_icon = widget_lookup(win, "func_bt_icon", TRUE); + // eng_icon = widget_lookup(win, "eng_icon", TRUE); + // eng_icon = widget_lookup(win, "light_eng_icon", TRUE); + // warn_engine_icon = widget_lookup(win, "warn_engine_icon", TRUE); + // func_wifi_icon = widget_lookup(win, "func_wifi_icon", TRUE); + // warn_break_icon = widget_lookup(win, "warn_break_icon", TRUE); // 制动报警灯 + beam_wide_icon = widget_lookup(win, "beam_wide_icon", TRUE); // 示宽灯 + warn_maint_icon = widget_lookup(win, "warn_maint_icon", TRUE); // 示宽灯 + + warn_abs_icon = widget_lookup(win, "warn_abs_icon", TRUE); // abs + warn_engine_icon = widget_lookup(win, "warn_engine_icon", TRUE); // abs + } + // Universal_widget_display(abs_icon, Get_sys_warning_abs()); + if(!tcs_twinkle){ + if(!tcs_switch) + widget_set_visible(tcs_icon, TRUE); + else + widget_set_visible(tcs_icon, FALSE); + } + /*if(Get_sys_tcs_on_off()){//tcs开启状态 + if(tcs_twinkle != 1){ + if(!tcs_switch) + widget_set_visible(tcs_icon, TRUE); + else + widget_set_visible(tcs_icon, FALSE); + } + }else{//tcs关闭状态 + if(!tcs_switch) + widget_set_visible(tcs_icon, TRUE); + else + widget_set_visible(tcs_icon, FALSE); + }*/ + Universal_widget_display(func_bt_icon, Get_sys_bt_connect_state()); + // Universal_widget_display(eng_icon, Get_sys_warning_engine()); + // Universal_widget_display(warn_engine_icon, Get_sys_warning_machine_oil()); + // Universal_widget_display(warn_maint_icon, Get_sys_warning_maintenance()); + // Universal_widget_display(func_wifi_icon, Get_sys_wifi()); + // Universal_widget_display(warn_break_icon, Get_sys_warning_brake()); + Universal_widget_display(beam_wide_icon, Get_sys_side_marker()); + Universal_widget_display(warn_maint_icon, Get_sys_warning_maintenance()); + + Universal_widget_display(warn_engine_icon, Get_sys_warning_engine()); + Universal_widget_display(warn_abs_icon, Get_sys_warning_abs()); + + + // Universal_widget_display(oil_bar,Get_sys_warning_abs()); + // Universal_widget_display(temp_bar,Get_sys_warning_abs()); +} + + +/** + * @brief 胎压刷新 + * + * @param win + * @param front_value 前轮胎压 + * @param rear_value 后轮胎压 + */ +extern int test_light; +static void ui_refresh_tire(widget_t *win, Pressure_t front_value, Pressure_t rear_value) +{ + static widget_t *tire = NULL; + static widget_t *tire_view = NULL; + static widget_t *f_data = NULL; + static widget_t *r_data = NULL; + + if (!demo2_inited) + { + tire = widget_lookup(win, "warn_tire_icon", TRUE); + tire_view = widget_lookup(win, "tire_view", TRUE); + f_data = widget_lookup(win, "front_value", TRUE); + r_data = widget_lookup(win, "rear_value", TRUE); + } + // uint8_t tire_state = 0; + char tmpStr[20] = {0}; + double buf = 0; + uint8_t tire_pressure_state =0; + // 胎压数据刷新函数 + // 支持功能, 为1支持胎压 + if ((!Get_sys_call_state())) + { + widget_set_visible(tire_view, TRUE); + if (mac_address_normal(front_value.mac_address, 6) != 0) + { // mac正常 检测数据 + // if (front_value.temp >= 70 || front_value.psi < TIRE_PRESSURE_FRONT_LOWER || front_value.psi > TIRE_PRESSURE_FRONT_UPPER) + // { + buf = (front_value.psi - 146); + tk_snprintf(tmpStr, sizeof(tmpStr), "F: %.02f", (buf * 0.0069)); + if (front_value.psi < 1) + { + widget_set_text_utf8(f_data, "F: --"); + if(!tire_pressure_state){ + tire_pressure_state = 1; + } + } + else + { + widget_set_text_utf8(f_data, tmpStr); + if(front_value.blow_by_state || front_value.voltage_state || front_value.temp_state || front_value.lose_flag){ + if(!tire_pressure_state){ + tire_pressure_state = 1; + } + }else if(front_value.temp>=70 || front_value.psiTIRE_PRESSURE_FRONT_UPPER){ + if(!tire_pressure_state){ + tire_pressure_state = 1; + } + } + } + // } + } + else + { + widget_set_text_utf8(f_data, "F: --"); + } + + + if (mac_address_normal(rear_value.mac_address, 6) != 0) + { // mac正常 检测数据 + // if (rear_value.temp >= 70 || rear_value.psi < TIRE_PRESSURE_REAR_LOWER || rear_value.psi > TIRE_PRESSURE_REAR_UPPER) + // { + buf = (rear_value.psi - 146); + tk_snprintf(tmpStr, sizeof(tmpStr), "R: %.02f", (buf * 0.0069)); + if (rear_value.psi < 1) + { + widget_set_text_utf8(r_data, "R: --"); + if(!tire_pressure_state){ + tire_pressure_state = 1; + } + } + else + { + widget_set_text_utf8(r_data, tmpStr); + if(rear_value.blow_by_state || rear_value.voltage_state || rear_value.temp_state || rear_value.lose_flag){ + if(!tire_pressure_state){ + tire_pressure_state = 1; + } + }else if(rear_value.temp>=70 || rear_value.psiTIRE_PRESSURE_REAR_UPPER){ + if(!tire_pressure_state){ + tire_pressure_state = 1; + } + } + } + // } + } + else + { + widget_set_text_utf8(r_data, "R: --"); + } + //胎压警告图标 + if(tire_pressure_state){ + widget_set_visible(tire,TRUE); + }else{ + widget_set_visible(tire,FALSE); + } + } + else + { // 不支持胎压 + widget_set_visible(tire_view, FALSE); + } + // tk_snprintf(tmpStr, sizeof(tmpStr), "1: %d",Get_sys_light_perception_value()); + // widget_set_text_utf8(f_data, tmpStr); + // tk_snprintf(tmpStr, sizeof(tmpStr), "2: %d",test_light); + // widget_set_text_utf8(r_data, tmpStr); + + // printf("demo2>>>>>>>>>>>>>>>>>>>>>>front_value.psi = %d , rear_value.psi = %d .\r\n",front_value.psi,rear_value.psi); +} + + +/** + * @brief BT通话刷新 + * + * @param win + * @param value 通话状态 + */ +static void ui_refresh_call(widget_t *win, uint8_t value) +{ + static widget_t *call_view = NULL; + static widget_t *call_number = NULL; + static widget_t *call_text = NULL; + if (!demo2_inited) + { + call_view = widget_lookup(win, "call_view", TRUE); // 通话视图 + call_number = widget_lookup(win, "call_num", TRUE);// 通话号码 + call_text = widget_lookup(win, "call_text", TRUE);// 通话号码 + } + // 通话部分 + switch (value) + { + case 0: + widget_set_visible(call_view, FALSE); + break; + case 1: // 来电状态 显示电话1 + widget_set_visible(call_view, TRUE); + widget_set_visible(call_number, TRUE); + widget_set_visible(call_text, FALSE); + char tmpStr[20] = {0}; + #ifndef AMT630HV100 + tk_snprintf(tmpStr, sizeof(tmpStr), "123456789"); + #else + tk_snprintf(tmpStr, sizeof(tmpStr), "%s", custom_data.call.number); + #endif + removeNonNumeric(tmpStr); // 号码保护 + widget_set_text_utf8(call_number, tmpStr); + break; + case 2: // 接听状态 通话中 + widget_set_visible(call_view, TRUE); + widget_set_visible(call_text, TRUE); + widget_set_visible(call_number, FALSE); + break; + case 3: // 来电状态 显示电话2 + widget_set_visible(call_view, TRUE); + widget_set_visible(call_text, FALSE); + widget_set_visible(call_number, TRUE); + tk_snprintf(tmpStr, sizeof(tmpStr), "%s", custom_data.call.renumber); + removeNonNumeric(tmpStr); // 号码保护 + widget_set_text_utf8(call_number, tmpStr); + break; + case 4: // 电话1挂断电话2接听 通话中 + widget_set_visible(call_view, TRUE); + widget_set_visible(call_text, TRUE); + widget_set_visible(call_number, FALSE); + break; + default: + widget_set_visible(call_view, FALSE); + break; + } +} + + +extern uint8_t ui_state_flag; +void demo2_ui1_theme_init(widget_t *win){ + uint8_t theme_Offset = 0;//0为白色 1为黑色 + switch(Get_sys_theme_state()){//theme_state 0黑 1白 2自适应 + case 1: + theme_Offset = 1; + break; + case 2: + if(Get_sys_display_theme()) + theme_Offset = 1; + else + theme_Offset = 0; + break; + default: + theme_Offset = 0; + break; + } + + widget_t *demo2_bg = widget_lookup(win, "demo2_bg", TRUE); + widget_t *speed1 = widget_lookup(win, "speed1", TRUE); + widget_t *speed2 = widget_lookup(win, "speed2", TRUE); + widget_t *speed_img = widget_lookup(win, "speed_img", TRUE); + + // widget_t *rpm_bg = widget_lookup(win, "rpm_bg", TRUE); + // widget_t *rpm_bar = widget_lookup(win, "rpm_bar", TRUE); + // widget_t *rpm_pointer = widget_lookup(win, "rpm_pointer", TRUE); + //文本 + widget_t *speed_unit = widget_lookup(win, "speed_unit", TRUE); + widget_t *speed_value = widget_lookup(win, "speed_value", TRUE); + widget_t *time_value = widget_lookup(win, "time_value", TRUE); + widget_t *mile_label = widget_lookup(win, "mile_label", TRUE); + widget_t *mile_unit = widget_lookup(win, "mile_unit", TRUE); + widget_t *temp_value = widget_lookup(win, "temp_value", TRUE); + widget_t *fuel_F = widget_lookup(win, "fuel_F", TRUE); + widget_t *mile_value = widget_lookup(win, "mile_value", TRUE); + widget_t *call_num = widget_lookup(win, "call_num", TRUE); + widget_t *call_text = widget_lookup(win, "call_text", TRUE); + // widget_t *call_bg1 = widget_lookup(win, "call_bg1", TRUE); + // widget_t *call_bg2 = widget_lookup(win, "call_bg2", TRUE); + + + //需要变色的视图下的文本 + widget_t *tire_view = widget_lookup(win, "tire_view", TRUE); + + widget_t *label = NULL; + uint8_t count = widget_count_children(tire_view);//获取子类个数 + + + + if(!theme_Offset){//黑 + widget_use_style(demo2_bg,"demo2_bg_bk"); + // widget_use_style(win,"main_bg_wt"); + widget_use_style(win,"demo2_bg_bk"); + widget_use_style(speed1,"speed_bar_bk"); + widget_use_style(speed2,"speed_bar_bk"); + widget_use_style(speed_img,"speed_bk"); + + // widget_set_style_color(win,"normal:bg_color",0xff000000); + // widget_use_style(main_bg,"main_bg_bk"); + // widget_use_style(rpm_bg,"rpm_bg_bk"); + // widget_use_style(rpm_bar,"rpm_bk"); + + // widget_use_style(call_bg1,"call_bg_bk"); + // widget_use_style(call_bg2,"call_bg_bk"); + + + // guage_pointer_set_image(rpm_pointer,"rpm_pointer_bk"); + // image_base_set_image(rpm_pointer,"rpm_pointer_wt"); + widget_set_style_color(speed_unit, "normal:text_color", OUTPUT_COLOR_WHITE); + widget_set_style_color(speed_value, "normal:text_color", OUTPUT_COLOR_WHITE); + widget_set_style_color(time_value, "normal:text_color", OUTPUT_COLOR_WHITE); + widget_set_style_color(mile_label, "normal:text_color", OUTPUT_COLOR_WHITE); + widget_set_style_color(mile_unit, "normal:text_color", OUTPUT_COLOR_WHITE); + // widget_set_style_color(temp_H, "normal:text_color", OUTPUT_COLOR_WHITE); + widget_set_style_color(fuel_F, "normal:text_color", OUTPUT_COLOR_WHITE); + widget_set_style_color(mile_value, "normal:text_color", OUTPUT_COLOR_WHITE); + widget_set_style_color(temp_value, "normal:text_color", OUTPUT_COLOR_WHITE); + + widget_set_style_color(call_num, "normal:text_color", OUTPUT_COLOR_WHITE); + widget_set_style_color(call_text, "normal:text_color", OUTPUT_COLOR_WHITE); + + for(uint8_t i=0;ictx); // home_page + demo2_data_ui_refresh(win); + return RET_REPEAT; +} + +static ret_t on_A58_home_page_destroy(void *ctx, event_t *e) +{ + // canvas_demo = NULL; + demo2_inited = 0; + return RET_OK; +} +extern ret_t on_key_set_data(void* ctx, event_t* e); +/** + * 初始化窗口的子控件 + */ +static ret_t visit_init_child(void* ctx, const void* iter) { + widget_t* win = WIDGET(ctx); + widget_t* widget = WIDGET(iter); + const char* name = widget->name; + + // 初始化指定名称的控件(设置属性或注册事件),请保证控件名称在窗口上唯一 + if (name != NULL && *name != '\0') { + if (tk_str_eq(name, "A58_demo2")) + { + widget_on(widget, EVT_KEY_DOWN, on_key_set_list, win); + #ifndef AMT630HV100 + widget_on(widget, EVT_KEY_DOWN, on_key_set_data, win); + #endif + widget_on(widget, EVT_DESTROY, on_A58_home_page_destroy, win); + } + } + + return RET_OK; +} + +/** + * 初始化窗口 + */ +ret_t A58_demo2_init(widget_t* win, void* ctx) { + (void)ctx; + return_value_if_fail(win != NULL, RET_BAD_PARAMS); + + widget_foreach(win, visit_init_child, win); + + // /*初始化画布,注册绘制事件*/ + // canvas_demo = canvas_widget_create(win, 0, 0, win->w, + // win->h); + // widget_on(canvas_demo, EVT_PAINT, on_paint_demo, canvas_demo); + + demo2_ui1_theme_init(win); + if(Get_sys_power_on_self_test() == 100){ + // printf("demo2_data_ui_refresh ------------------------- .\r\n"); + refresh_flag = 1; + demo2_data_ui_refresh(win); + refresh_flag = 1; + } + + widget_add_timer(win, demo2_ui_refresh, 100); // 进度条颜色刷新 + + return RET_OK; +} diff --git a/lib/awtk/awtk-examples/Moto_A58/src/pages/A58_home_page.c b/lib/awtk/awtk-examples/Moto_A58/src/pages/A58_home_page.c index 98da6b6..a5a927c 100644 --- a/lib/awtk/awtk-examples/Moto_A58/src/pages/A58_home_page.c +++ b/lib/awtk/awtk-examples/Moto_A58/src/pages/A58_home_page.c @@ -4,42 +4,64 @@ #include "../common/universal.h" #include "../common/moto_config.h" #include "tkc/object_date_time.h" -#ifdef AWTK_630H +#ifdef AMT630HV100 #include "gpio_protocol.h" #endif #define QH_RESOURCE_OFFSET_OIL 0 #define QH_RESOURCE_OFFSET_TEMP 59 - +extern uint8_t tcs_twinkle; +extern uint8_t tcs_switch; extern uint8_t speed_flag; -static char *fuel_resource[7] = { - "", +static char *fuel_resource[6] = { + "fuel_bar_00", "fuel_bar_01", "fuel_bar_02", "fuel_bar_03", "fuel_bar_04", "fuel_bar_05", - "fuel_bar_06", +}; + +static char *fuel_bk_resource[6] = { + "fuel_bar_bk_00", + "fuel_bar_bk_01", + "fuel_bar_bk_02", + "fuel_bar_bk_03", + "fuel_bar_bk_04", + "fuel_bar_bk_05", }; static char *temp_resource[7] = { - "", + "temp_bar_00", "temp_bar_01", "temp_bar_02", "temp_bar_03", "temp_bar_04", "temp_bar_05", - "temp_bar_06", + "temp_bar_warning", +}; +static char *temp_bk_resource[7] = { + "temp_bar_bk_00", + "temp_bar_bk_01", + "temp_bar_bk_02", + "temp_bar_bk_03", + "temp_bar_bk_04", + "temp_bar_05", + "temp_bar_warning", }; -static char *temp_resource_icon[2] = { - "temp_icon", + +char *temp_resource_icon[4] = { + "temp_icon_wt", + "temp_icon_bk", "temp_warn_icon", + "temp_warn2_icon", }; -static char *fuel_resource_icon[2] = { - "fuel_icon", +char *fuel_resource_icon[3] = { + "fuel_icon_wt", + "fuel_icon_bk", "fuel_warn_icon", }; @@ -82,23 +104,24 @@ static void ui_refresh_rmp(widget_t *win, uint16_t value) rpm_bar = widget_lookup(win, "rpm_bar", TRUE); rpm_pointer = widget_lookup(win, "rpm_pointer", TRUE); } + if(value>=12000) value = 12000; - static int16_t _value = 0; value /= 100; value = value * 3 / 2; int16_t diff = (int16_t)_value - (int16_t)value; - if (diff > 1 || diff < -1) + + if (diff > 2 || diff < -2) { if (value >= 14 && value <= 16) - value = 15; - + value = 15; _value = (value - 90); // widget_set_value(rpm_bar, value); // widget_set_value(rpm_pointer, value - 90); widget_animate_value_to(rpm_bar, value,ANIMATE_SPEED_LITTLE_VALUE); widget_animate_value_to(rpm_pointer, _value,ANIMATE_SPEED_LITTLE_VALUE); + } } @@ -131,7 +154,7 @@ static void ui_refresh_speed(widget_t *win, uint16_t value) } // 挡位 -static void ui_refresh_gear(widget_t *win, uint16_t value) +static void ui_refresh_gear(widget_t *win, uint16_t value, uint8_t theme_Offset) { static widget_t *gear = NULL; // 挡位 if (!inited) @@ -147,12 +170,18 @@ static void ui_refresh_gear(widget_t *win, uint16_t value) else if (value > 6) { tmpStr[0] = '-'; - widget_set_style_color(gear, "text_color", 0xffffffff); + if(theme_Offset) + widget_set_style_color(gear, "text_color", 0xff000000); + else + widget_set_style_color(gear, "text_color", 0xffffffff); } else { tk_snprintf(tmpStr, sizeof(tmpStr), "%d", value); - widget_set_style_color(gear, "text_color", 0xffffffff); + if(theme_Offset) + widget_set_style_color(gear, "text_color", 0xff000000); + else + widget_set_style_color(gear, "text_color", 0xffffffff); } widget_set_text_utf8(gear, tmpStr); } @@ -165,7 +194,8 @@ static void ui_refresh_gear(widget_t *win, uint16_t value) */ extern uint8_t oil_state; extern uint8_t temp_state; -static void ui_refresh_oil(widget_t *win, uint16_t value) +extern uint8_t can101_flag; +static void ui_refresh_oil(widget_t *win, uint16_t value, uint8_t theme_Offset) { static widget_t *fuel_icon = NULL; // 油量图标 static widget_t *fuel_bar = NULL; // 油量 @@ -175,11 +205,11 @@ static void ui_refresh_oil(widget_t *win, uint16_t value) fuel_bar = widget_lookup(win, "fuel_bar", TRUE); // 油量 } // uint16_t fuel_list[7] = {10, 20, 32, 44, 56, 68, 80}; - uint16_t fuel_list[7] = {UI_TORAL6_GRIDS_OIL_WARNING, UI_TORAL6_GRIDS_OIL_0, UI_TORAL6_GRIDS_OIL_1, UI_TORAL6_GRIDS_OIL_2, - UI_TORAL6_GRIDS_OIL_3, UI_TORAL6_GRIDS_OIL_4, UI_TORAL6_GRIDS_OIL_5}; + uint16_t fuel_list[6] = {UI_TORAL6_GRIDS_OIL_WARNING, UI_TORAL6_GRIDS_OIL_0, UI_TORAL6_GRIDS_OIL_1, UI_TORAL6_GRIDS_OIL_2, + UI_TORAL6_GRIDS_OIL_3, UI_TORAL6_GRIDS_OIL_4}; uint8_t index = 0; - for (size_t i = 0; i < 7; i++) + for (size_t i = 0; i < 6; i++) { if (value <= fuel_list[i]) { @@ -188,28 +218,15 @@ static void ui_refresh_oil(widget_t *win, uint16_t value) index = i; } if(oil_state!=2){ - widget_use_style(fuel_icon, fuel_resource_icon[1]); // 油量图标 + widget_use_style(fuel_icon, fuel_resource_icon[2]); // 油量图标 }else{ - widget_use_style(fuel_icon, fuel_resource_icon[0]); + widget_use_style(fuel_icon, fuel_resource_icon[0+theme_Offset]); } - // printf("index = %d value =%d fuel_list[i] = %d.\r\n",index,value,fuel_list[index]); - /*if (index > 1) - { - widget_use_style(fuel_icon, fuel_resource_icon[0]); - widget_stop_animator(fuel_icon, "opacity"); - widget_set_opacity(fuel_icon, 255); - oil_led_off(); - } - else - { - widget_use_style(fuel_icon, fuel_resource_icon[1]); // 油量图标 - widget_start_animator(fuel_icon, "opacity"); - if((fuel_icon->opacity)>125) - oil_led_on(); - else - oil_led_off(); - }*/ - widget_use_style(fuel_bar, fuel_resource[index]); + + if(theme_Offset){ + widget_use_style(fuel_bar, fuel_resource[index]); + }else + widget_use_style(fuel_bar, fuel_bk_resource[index]); } /** @@ -218,46 +235,63 @@ static void ui_refresh_oil(widget_t *win, uint16_t value) * @param win * @param value 温度值 60-120 */ -static void ui_refresh_temp(widget_t *win, uint16_t value) +extern uint8_t temp_warning_flag; +static void ui_refresh_temp(widget_t *win, uint16_t value, uint8_t theme_Offset) { static widget_t *temp_icon = NULL; // 水温图标 static widget_t *temp_bar = NULL; // 水温 - + if (!inited) { temp_icon = widget_lookup(win, "temp_icon", TRUE); // 油量图标 temp_bar = widget_lookup(win, "temp_bar", TRUE); // 油量 } - // uint16_t temp_list[7] = {60, 68, 76, 84, 92, 100, 110}; - uint16_t temp_list[7] = {UI_TORAL6_GRIDS_TEMP_0, UI_TORAL6_GRIDS_TEMP_1, UI_TORAL6_GRIDS_TEMP_2, - UI_TORAL6_GRIDS_TEMP_3, UI_TORAL6_GRIDS_TEMP_4, UI_TORAL6_GRIDS_TEMP_5, UI_TORAL6_GRIDS_TEMP_6}; - uint8_t index = 0; - for (size_t i = 0; i < 7; i++) - { - if (value <= temp_list[i]) - { - break; + + double buf = 0; + if(value < UI_CAN_TORAL6_GRIDS_TEMP_0) + index = 0; + else if(value < UI_CAN_TORAL6_GRIDS_TEMP_1) + index = 1; + else if(value < UI_CAN_TORAL6_GRIDS_TEMP_2) + index = 2; + else if(value < UI_CAN_TORAL6_GRIDS_TEMP_3) + index = 3; + else if(value < UI_CAN_TORAL6_GRIDS_TEMP_4){ + if(temp_warning_flag) + index = 5; + else + index = 4; + }else + index = 5; + + if(!can101_flag){ + if(Get_sys_warning_engine()){//黄色 + widget_use_style(temp_icon, temp_resource_icon[3]); + widget_use_style(temp_bar, temp_resource[6]); + }else{//正常显示 + if(temp_state!=2){ + widget_use_style(temp_icon, temp_resource_icon[2]); + }else{ + widget_use_style(temp_icon, temp_resource_icon[0+theme_Offset]); + } + if(theme_Offset) + widget_use_style(temp_bar, temp_resource[index]); + else + widget_use_style(temp_bar, temp_bk_resource[index]); + } + }else{ + if(temp_state!=2){ + widget_use_style(temp_icon, temp_resource_icon[2]); + }else{ + widget_use_style(temp_icon, temp_resource_icon[0+theme_Offset]); + } + if(theme_Offset) + widget_use_style(temp_bar, temp_resource[index]); + else + widget_use_style(temp_bar, temp_bk_resource[index]); } - index = i; - } - if(temp_state!=2){ - widget_use_style(temp_icon, temp_resource_icon[1]); // 油量图标 - }else{ - widget_use_style(temp_icon, temp_resource_icon[0]); - } - /*if (index < 6) - { - widget_use_style(temp_icon, temp_resource_icon[0]); - widget_stop_animator(temp_icon, "opacity"); - widget_set_opacity(temp_icon, 255); - } - else - { - widget_use_style(temp_icon, temp_resource_icon[1]); - widget_start_animator(temp_icon, "opacity"); - }*/ - widget_use_style(temp_bar, temp_resource[index]); + } /** @@ -318,13 +352,13 @@ static void ui_refresh_animo(widget_t *win, uint8_t value) static void ui_refresh_cell(widget_t *win, float value) { // static widget_t *cell = NULL; - static widget_t *cell_label = NULL; - char tmpStr[20] = {0}; - if (!inited) - { - // cell = widget_lookup(win, "warn_batv_icon", TRUE); - cell_label = widget_lookup(win, "cell_label", TRUE); - } + // static widget_t *cell_label = NULL; + // char tmpStr[20] = {0}; + // if (!inited) + // { + // // cell = widget_lookup(win, "warn_batv_icon", TRUE); + // cell_label = widget_lookup(win, "cell_label", TRUE); + // } if (value < 11.75 || value >= 14.95) // A58判断范围 小于11.8V 大于15V { // 变红 vbat_led_on(); @@ -333,8 +367,8 @@ static void ui_refresh_cell(widget_t *win, float value) { vbat_led_off(); } - tk_snprintf(tmpStr, sizeof(tmpStr), "%.2lf", value); - widget_set_text_utf8(cell_label, tmpStr); + // tk_snprintf(tmpStr, sizeof(tmpStr), "%.1lf", value); + // widget_set_text_utf8(cell_label, tmpStr); } /** @@ -373,7 +407,7 @@ static void ui_refresh_mileage(widget_t *win, uint32_t odo_value, uint32_t trip_ widget_use_style(mile_index, "odo_index"); } - float mile = mile_value * 1.0; + double mile = mile_value * 1.0; widget_set_text_utf8(mile_unit, "km"); // 速度单位 if (Get_sys_unit()) @@ -382,10 +416,15 @@ static void ui_refresh_mileage(widget_t *win, uint32_t odo_value, uint32_t trip_ widget_set_text_utf8(mile_unit, "mile"); } mile /= 1000; - char tmpStr[20] = {0}; + // printf("mile = %lf , mile_value = %d.\r\n",mile,mile_value); + // char tmpStr[20] = {0}; // 里程数刷新 - tk_snprintf(tmpStr, sizeof(tmpStr), type == 0 ? "%.0f" : "%.1f", mile); + // tk_snprintf(tmpStr, sizeof(tmpStr), type == 0 ? "%.0f" : "%.1f", mile); + // tk_snprintf(tmpStr, sizeof(tmpStr), "%.1lf", mile); + // widget_set_forma + type == 0 ?number_label_set_format(mile_data,"%d"):number_label_set_format(mile_data,"%.1lf"); widget_set_value(mile_data, mile); + } /** @@ -412,36 +451,37 @@ static void ui_refresh_tire(widget_t *win, Pressure_t front_value, Pressure_t re // uint8_t tire_state = 0; char tmpStr[20] = {0}; double buf = 0; + uint8_t tire_pressure_state =0; // 胎压数据刷新函数 // 支持功能, 为1支持胎压 if (JUDGE_BIN_4(Get_device_ability())) + // if (1) { if (mac_address_normal(front_value.mac_address, 6) != 0) { // mac正常 检测数据 - // if (front_value.blow_by_state || front_value.voltage_state || front_value.temp_state || front_value.lose_flag) - // { - // if (!tire_state) - // { - // tire_state = 1; - // } - // } - if (front_value.temp >= 70 || front_value.psi < TIRE_PRESSURE_FRONT_LOWER || front_value.psi > TIRE_PRESSURE_FRONT_UPPER) - { buf = (front_value.psi - 146); tk_snprintf(tmpStr, sizeof(tmpStr), "%.02f", (buf * 0.0069)); if (front_value.psi < 1) { widget_set_text_utf8(f_data, "--"); + if(!tire_pressure_state){ + tire_pressure_state = 1; + } } else { widget_set_text_utf8(f_data, tmpStr); + if(front_value.blow_by_state || front_value.voltage_state || front_value.temp_state || front_value.lose_flag){ + if(!tire_pressure_state){ + tire_pressure_state = 1; + } + }else if(front_value.temp>=70 || front_value.psiTIRE_PRESSURE_FRONT_UPPER){ + if(!tire_pressure_state){ + tire_pressure_state = 1; + } + } } - // if (!tire_state) - // { - // tire_state = 1; - // } - } + } else { @@ -450,44 +490,41 @@ static void ui_refresh_tire(widget_t *win, Pressure_t front_value, Pressure_t re if (mac_address_normal(rear_value.mac_address, 6) != 0) { // mac正常 检测数据 - // if (rear_value.blow_by_state || rear_value.voltage_state || rear_value.temp_state || rear_value.lose_flag) - // { - // if (!tire_state) - // { - // tire_state = 1; - // } - // } - if (rear_value.temp >= 70 || rear_value.psi < TIRE_PRESSURE_REAR_LOWER || rear_value.psi > TIRE_PRESSURE_REAR_UPPER) - { buf = (rear_value.psi - 146); tk_snprintf(tmpStr, sizeof(tmpStr), "%.02f", (buf * 0.0069)); if (rear_value.psi < 1) { widget_set_text_utf8(r_data, "--"); + if(!tire_pressure_state){ + tire_pressure_state = 1; + } } else { widget_set_text_utf8(r_data, tmpStr); + if(rear_value.blow_by_state || rear_value.voltage_state || rear_value.temp_state || rear_value.lose_flag){ + if(!tire_pressure_state){ + tire_pressure_state = 1; + } + }else if(rear_value.temp>=70 || rear_value.psiTIRE_PRESSURE_REAR_UPPER){ + if(!tire_pressure_state){ + tire_pressure_state = 1; + } + } } - // if (!tire_state) - // { - // tire_state = 1; - // } - } + } else { widget_set_text_utf8(r_data, "--"); } - // 胎压警告图标 - // if (tire_state) - // { - // widget_set_visible(tire, TRUE); - // } - // else - // { - // widget_set_visible(tire, FALSE); - // } + + //胎压警告图标 + if(tire_pressure_state){ + widget_set_visible(tire,TRUE); + }else{ + widget_set_visible(tire,FALSE); + } } else { // 不支持胎压 @@ -523,7 +560,7 @@ static void ui_refresh_call(widget_t *win, uint8_t value) widget_set_visible(call_number, TRUE); widget_set_visible(call_text, FALSE); char tmpStr[20] = {0}; - #ifndef AWTK_630H + #ifndef AMT630HV100 tk_snprintf(tmpStr, sizeof(tmpStr), "123456789"); #else tk_snprintf(tmpStr, sizeof(tmpStr), "%s", custom_data.call.number); @@ -566,14 +603,15 @@ static void ui_refresh_icons(widget_t *win) // static widget_t *abs_icon = NULL; static widget_t *tcs_icon = NULL; static widget_t *func_bt_icon = NULL; + static widget_t *warn_maint_icon = NULL; // static widget_t *eng_icon = NULL; // static widget_t *warn_engine_icon = NULL; // static widget_t *warn_maint_icon = NULL; // static widget_t *func_wifi_icon = NULL; // static widget_t *warn_break_icon = NULL; static widget_t *beam_wide_icon = NULL; - static widget_t *warn_engine_icon = NULL; static widget_t *warn_abs_icon = NULL; + static widget_t *warn_engine_icon = NULL; if (!inited) { // abs_icon = widget_lookup(win, "abs_icon", TRUE); @@ -585,18 +623,38 @@ static void ui_refresh_icons(widget_t *win) // func_wifi_icon = widget_lookup(win, "func_wifi_icon", TRUE); // warn_break_icon = widget_lookup(win, "warn_break_icon", TRUE); // 制动报警灯 beam_wide_icon = widget_lookup(win, "beam_wide_icon", TRUE); // 示宽灯 - warn_engine_icon = widget_lookup(win, "warn_engine_icon", TRUE); // abs - warn_abs_icon = widget_lookup(win, "warn_abs_icon", TRUE); // abs + warn_maint_icon = widget_lookup(win, "warn_maint_icon", TRUE); // 示宽灯 + warn_abs_icon = widget_lookup(win, "warn_abs_icon", TRUE); // abs + warn_engine_icon = widget_lookup(win, "warn_engine_icon", TRUE); // abs } // Universal_widget_display(abs_icon, Get_sys_warning_abs()); - Universal_widget_display(tcs_icon, Get_sys_warning_tcs()); + if(!tcs_twinkle){ + if(!tcs_switch) + widget_set_visible(tcs_icon, TRUE); + else + widget_set_visible(tcs_icon, FALSE); + } + /*if(Get_sys_tcs_on_off()){//tcs开启状态 + if(tcs_twinkle != 1){ + if(!tcs_switch) + widget_set_visible(tcs_icon, TRUE); + else + widget_set_visible(tcs_icon, FALSE); + } + }else{//tcs关闭状态 + if(!tcs_switch) + widget_set_visible(tcs_icon, TRUE); + else + widget_set_visible(tcs_icon, FALSE); + }*/ Universal_widget_display(func_bt_icon, Get_sys_bt_connect_state()); // Universal_widget_display(eng_icon, Get_sys_warning_engine()); - Universal_widget_display(warn_engine_icon, Get_sys_warning_machine_oil()); + // Universal_widget_display(warn_engine_icon, Get_sys_warning_machine_oil()); // Universal_widget_display(warn_maint_icon, Get_sys_warning_maintenance()); // Universal_widget_display(func_wifi_icon, Get_sys_wifi()); // Universal_widget_display(warn_break_icon, Get_sys_warning_brake()); Universal_widget_display(beam_wide_icon, Get_sys_side_marker()); + Universal_widget_display(warn_maint_icon, Get_sys_warning_maintenance()); Universal_widget_display(warn_engine_icon, Get_sys_warning_engine()); Universal_widget_display(warn_abs_icon, Get_sys_warning_abs()); @@ -631,42 +689,196 @@ static void ui_refresh_test_data(widget_t *win) }*/ // static uint8_t resource_count = 0; +extern uint8_t ui_state_flag; +void ui1_theme_init(widget_t *win){ + uint8_t theme_Offset = 0;//0为白色 1为黑色 + switch(Get_sys_theme_state()){//theme_state 0黑 1白 2自适应 + case 1: + theme_Offset = 1; + break; + case 2: + if(Get_sys_display_theme()) + theme_Offset = 1; + else + theme_Offset = 0; + break; + default: + theme_Offset = 0; + break; + } + widget_t *main_bg = widget_lookup(win, "main_bg", TRUE); + widget_t *rpm_bg = widget_lookup(win, "rpm_bg", TRUE); + widget_t *rpm_bar = widget_lookup(win, "rpm_bar", TRUE); + widget_t *rpm_pointer = widget_lookup(win, "rpm_pointer", TRUE); + //文本 + widget_t *speed_unit = widget_lookup(win, "speed_unit", TRUE); + widget_t *speed_value = widget_lookup(win, "speed_value", TRUE); + widget_t *time_value = widget_lookup(win, "time_value", TRUE); + widget_t *mile_label = widget_lookup(win, "mile_label", TRUE); + widget_t *mile_unit = widget_lookup(win, "mile_unit", TRUE); + widget_t *temp_H = widget_lookup(win, "temp_H", TRUE); + widget_t *fuel_F = widget_lookup(win, "fuel_F", TRUE); + widget_t *mile_value = widget_lookup(win, "mile_value", TRUE); + widget_t *call_num = widget_lookup(win, "call_num", TRUE); + widget_t *call_text = widget_lookup(win, "call_text", TRUE); + widget_t *call_bg1 = widget_lookup(win, "call_bg1", TRUE); + widget_t *call_bg2 = widget_lookup(win, "call_bg2", TRUE); + + + //需要变色的视图下的文本 + widget_t *tire_view = widget_lookup(win, "tire_view", TRUE); + + widget_t *label = NULL; + uint8_t count = widget_count_children(tire_view);//获取子类个数 + + + + if(!theme_Offset){//黑 + widget_set_style_color(win,"normal:bg_color",0xff000000); + widget_use_style(main_bg,"main_bg_bk"); + widget_use_style(rpm_bg,"rpm_bg_bk"); + widget_use_style(rpm_bar,"rpm_bk"); + + widget_use_style(call_bg1,"call_bg_bk"); + widget_use_style(call_bg2,"call_bg_bk"); + + + guage_pointer_set_image(rpm_pointer,"rpm_pointer_bk"); + // image_base_set_image(rpm_pointer,"rpm_pointer_wt"); + widget_set_style_color(speed_unit, "normal:text_color", OUTPUT_COLOR_WHITE); + widget_set_style_color(speed_value, "normal:text_color", OUTPUT_COLOR_WHITE); + widget_set_style_color(time_value, "normal:text_color", OUTPUT_COLOR_WHITE); + widget_set_style_color(mile_label, "normal:text_color", OUTPUT_COLOR_WHITE); + widget_set_style_color(mile_unit, "normal:text_color", OUTPUT_COLOR_WHITE); + widget_set_style_color(temp_H, "normal:text_color", OUTPUT_COLOR_WHITE); + widget_set_style_color(fuel_F, "normal:text_color", OUTPUT_COLOR_WHITE); + widget_set_style_color(mile_value, "normal:text_color", OUTPUT_COLOR_WHITE); + widget_set_style_color(call_num, "normal:text_color", OUTPUT_COLOR_WHITE); + widget_set_style_color(call_text, "normal:text_color", OUTPUT_COLOR_WHITE); + + for(uint8_t i=0;i=12000) value = 12000; @@ -728,6 +940,9 @@ ret_t A58_home_page_init(widget_t *win, void *ctx) count = (value - 90); widget_set_value(rpm_bar, value); gauge_pointer_set_angle(rpm_pointer, count); + + ui_refresh(win); // 初始化刷新数据 + } widget_add_timer(win, qh_ui_refresh, 100); // 进度条颜色刷新 diff --git a/lib/awtk/awtk-examples/Moto_A58/src/pages/A58_home_page.obj b/lib/awtk/awtk-examples/Moto_A58/src/pages/A58_home_page.obj index 790803a..5b2245a 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/src/pages/A58_home_page.obj and b/lib/awtk/awtk-examples/Moto_A58/src/pages/A58_home_page.obj differ diff --git a/lib/awtk/awtk-examples/Moto_A58/src/pages/call.obj b/lib/awtk/awtk-examples/Moto_A58/src/pages/call.obj index 2749e79..4adc235 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/src/pages/call.obj and b/lib/awtk/awtk-examples/Moto_A58/src/pages/call.obj differ diff --git a/lib/awtk/awtk-examples/Moto_A58/src/pages/new.c b/lib/awtk/awtk-examples/Moto_A58/src/pages/new.c index 47c1666..46f9ee5 100644 --- a/lib/awtk/awtk-examples/Moto_A58/src/pages/new.c +++ b/lib/awtk/awtk-examples/Moto_A58/src/pages/new.c @@ -1,5 +1,488 @@ #include "awtk.h" #include "../common/navigator.h" +#include "../common/user_data.h" +#include "../common/universal.h" +#include "../common/data_port.h" +// #include "../common/qr_event.h" + +static uint8_t tp_inited = 0; +static uint8_t qr =0; +static uint8_t qr_imgdisplay_flag = 0; + +extern uint8_t tcs_twinkle; +extern uint8_t tcs_switch; +extern char strQrText[100]; +extern char UI_uuid[32]; + +extern void Return_demo_win(void); +extern ret_t on_key_set_data(void* ctx, event_t* e); +extern widget_t* qr_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h); + + +extern char *temp_resource_icon[3]; +extern char *fuel_resource_icon[3]; + +/** + * @brief 图标刷新 + * + * @param win + */ +static void tp_ui_refresh_icons(widget_t *win) +{ + + // static widget_t *abs_icon = NULL; + static widget_t *tcs_icon = NULL; + static widget_t *func_bt_icon = NULL; + static widget_t *warn_maint_icon = NULL; + // static widget_t *eng_icon = NULL; + // static widget_t *warn_engine_icon = NULL; + // static widget_t *warn_maint_icon = NULL; + // static widget_t *func_wifi_icon = NULL; + // static widget_t *warn_break_icon = NULL; + static widget_t *beam_wide_icon = NULL; + static widget_t *warn_abs_icon = NULL; + static widget_t *warn_engine_icon = NULL; + if (!tp_inited) + { + // abs_icon = widget_lookup(win, "abs_icon", TRUE); + tcs_icon = widget_lookup(win, "tcs_icon", TRUE); + func_bt_icon = widget_lookup(win, "func_bt_icon", TRUE); + // eng_icon = widget_lookup(win, "eng_icon", TRUE); + // eng_icon = widget_lookup(win, "light_eng_icon", TRUE); + // warn_engine_icon = widget_lookup(win, "warn_engine_icon", TRUE); + // func_wifi_icon = widget_lookup(win, "func_wifi_icon", TRUE); + // warn_break_icon = widget_lookup(win, "warn_break_icon", TRUE); // 制动报警灯 + beam_wide_icon = widget_lookup(win, "beam_wide_icon", TRUE); // 示宽灯 + warn_maint_icon = widget_lookup(win, "warn_maint_icon", TRUE); // 示宽灯 + warn_abs_icon = widget_lookup(win, "warn_abs_icon", TRUE); // abs + warn_engine_icon = widget_lookup(win, "warn_engine_icon", TRUE); // abs + } + // Universal_widget_display(abs_icon, Get_sys_warning_abs()); + if(Get_sys_tcs_on_off()){//tcs开启状态 + if(tcs_twinkle != 1){ + if(!tcs_switch) + widget_set_visible(tcs_icon, TRUE); + else + widget_set_visible(tcs_icon, FALSE); + } + }else{//tcs关闭状态 + if(!tcs_switch) + widget_set_visible(tcs_icon, TRUE); + else + widget_set_visible(tcs_icon, FALSE); + } + Universal_widget_display(func_bt_icon, Get_sys_bt_connect_state()); + // Universal_widget_display(eng_icon, Get_sys_warning_engine()); + // Universal_widget_display(warn_engine_icon, Get_sys_warning_machine_oil()); + // Universal_widget_display(warn_maint_icon, Get_sys_warning_maintenance()); + // Universal_widget_display(func_wifi_icon, Get_sys_wifi()); + // Universal_widget_display(warn_break_icon, Get_sys_warning_brake()); + Universal_widget_display(beam_wide_icon, Get_sys_side_marker()); + Universal_widget_display(warn_maint_icon, Get_sys_warning_maintenance()); + Universal_widget_display(warn_engine_icon, Get_sys_warning_engine()); + Universal_widget_display(warn_abs_icon, Get_sys_warning_abs()); + + // Universal_widget_display(oil_bar,Get_sys_warning_abs()); + // Universal_widget_display(temp_bar,Get_sys_warning_abs()); +} + + +/** + * @brief 转速刷新 + * + * @param win + * @param value 转速值 r/min + */ +static void tp_ui_refresh_rmp(widget_t *win, uint16_t value) +{ + static widget_t *dh_veer_velocity = NULL; // 转速 + if (!tp_inited) + { + dh_veer_velocity = widget_lookup(win, "dh_veer_velocity", TRUE); + } + char tmpStr[20] = {0}; + static int16_t _value = 0; + double rpm = 0; + value /= 100; + int16_t diff = (int16_t)_value - (int16_t)value; + + + if (diff > 2 || diff < -2 || !tp_inited) + { + if (value >= 14 && value <= 16) + value = 15; + else if(value > 163) + value = 163; + else if(value <=3 ) + value = 0; + _value = value; + // if(value>=100) + // tk_snprintf(tmpStr, sizeof(tmpStr), "%d",(value/10)); + // else{ + rpm = value; + tk_snprintf(tmpStr, sizeof(tmpStr), "%.1f",(double)(rpm/10)); + // } + widget_set_text_utf8(dh_veer_velocity,tmpStr); + + } + +} + + +/** + * @brief 速度刷新 + * + * @param win + * @param value 速度值 km/h + */ +static void tp_ui_refresh_speed(widget_t *win, uint16_t value) +{ + static widget_t *speed = NULL; // 速度 + static widget_t *speed_unit = NULL; // 速度单位 + if (!tp_inited) + { + speed = widget_lookup(win, "dh_speed", TRUE); + speed_unit = widget_lookup(win, "dh_speed_uint", TRUE); + } + widget_set_text_utf8(speed_unit, "km/h"); + if (Get_sys_unit()) + { + value *= 0.6; + widget_set_text_utf8(speed_unit, "mph"); + } + char tmpStr[20] = {0}; + tk_snprintf(tmpStr, sizeof(tmpStr), "%d", value); +// widget_set_value(speed,value); + widget_set_text_utf8(speed, tmpStr); +} + + +// 挡位 +static void tp_ui_refresh_gear(widget_t *win, uint16_t value) +{ + static widget_t *gear = NULL; // 挡位 + if (!tp_inited) + { + gear = widget_lookup(win, "dh_grade", TRUE); + } + char tmpStr[20] = {0}; + if (value == 0) + { + tmpStr[0] = 'N'; + widget_set_style_color(gear, "text_color", 0xff00ff00); + } + else if (value > 6) + { + tmpStr[0] = '-'; + widget_set_style_color(gear, "text_color", 0xffffffff); + } + else + { + tk_snprintf(tmpStr, sizeof(tmpStr), "%d", value); + widget_set_style_color(gear, "text_color", 0xffffffff); + } + widget_set_text_utf8(gear, tmpStr); +} + + +/** + * @brief 油量刷新 + * + * @param win + * @param value 油量值 0-100 + */ +extern uint8_t oil_state; +extern uint8_t temp_state; +static void tp_ui_refresh_oil(widget_t *win, uint16_t value) +{ + static widget_t *fuel_icon = NULL; // 油量图标 + static widget_t *fuel_bar = NULL; // 油量 + if (!tp_inited) + { + fuel_icon = widget_lookup(win, "oil", TRUE); // 油量图标 + fuel_bar = widget_lookup(win, "oil_bar", TRUE); // 油量 + } + // uint16_t fuel_list[7] = {10, 20, 32, 44, 56, 68, 80}; + uint16_t fuel_list[6] = {UI_TORAL6_GRIDS_OIL_WARNING, UI_TORAL6_GRIDS_OIL_0, UI_TORAL6_GRIDS_OIL_1, UI_TORAL6_GRIDS_OIL_2, + UI_TORAL6_GRIDS_OIL_3, UI_TORAL6_GRIDS_OIL_4}; + uint8_t fuel_value[6] = {0,20,40,60,80,100}; + uint8_t index = 0; + for (size_t i = 0; i < 7; i++) + { + if (value <= fuel_list[i]) + { + break; + } + index = i; + } + if(oil_state!=2){ + widget_use_style(fuel_icon, fuel_resource_icon[2]); // 油量图标 + }else{ + widget_use_style(fuel_icon, fuel_resource_icon[0]); + } + widget_set_value(fuel_bar,(index*20)); + // widget_animate_value_to(fuel_bar, fuel_value[index],ANIMATE_SPEED); +} + +/** + * @brief 水温刷新 7格显示 + * + * @param win + * @param value 温度值 60-120 + */ +extern uint8_t temp_warning_flag; +extern uint8_t can101_flag; +static void tp_ui_refresh_temp(widget_t *win, uint16_t value) +{ + static widget_t *temp_icon = NULL; // 水温图标 + static widget_t *temp_bar = NULL; // 水温 + + if (!tp_inited) + { + temp_icon = widget_lookup(win, "temp", TRUE); // 油量图标 + temp_bar = widget_lookup(win, "temp_bar", TRUE); // 油量 + } + uint8_t index = 0; + if(value < UI_CAN_TORAL6_GRIDS_TEMP_0) + index = 0; + else if(value < UI_CAN_TORAL6_GRIDS_TEMP_1) + index = 1; + else if(value < UI_CAN_TORAL6_GRIDS_TEMP_2) + index = 2; + else if(value < UI_CAN_TORAL6_GRIDS_TEMP_3) + index = 3; + else if(value < UI_CAN_TORAL6_GRIDS_TEMP_4){ + if(temp_warning_flag) + index = 5; + else + index = 4; + }else + index = 5; + + if(!can101_flag && Get_sys_warning_engine()){//can数据掉线 黄色图标+黄色进度条 + widget_use_style(temp_icon, temp_resource_icon[3]); + widget_set_style_color(temp_bar,"normal:fg_color",0xff10C8FF); + widget_set_value(temp_bar,100); + }else{ + if(temp_state!=2){ + widget_use_style(temp_icon, temp_resource_icon[2]);//红色 + widget_set_style_color(temp_bar,"normal:fg_color",0xff0000ff); + }else{ + widget_use_style(temp_icon, temp_resource_icon[0]);//白色 + widget_set_style_color(temp_bar,"normal:fg_color",0xffffffff); + } + widget_set_value(temp_bar,(index*20)); + } +} + +static void tp_ui_refresh(widget_t *win) +{ + uint8_t state = Get_sys_wifi(); + + widget_t* qr_view = widget_lookup(win, "qr_view", TRUE); + + //档位刷新 + tp_ui_refresh_gear(win, Get_sys_grade()); + //转速 + tp_ui_refresh_rmp(win, Get_sys_veer_velocity()); + //速度 + tp_ui_refresh_speed(win, Get_sys_velocity()); + //油量 + tp_ui_refresh_oil(win, Get_sys_gas()); // 得到的是百分比 + //水温 + tp_ui_refresh_temp(win, Get_sys_can_temp()); // 值为60-120 + //图标刷新 + tp_ui_refresh_icons(win); + + + //wifi图标 + if(state == 1){ + if(qr ==1){ + widget_set_opacity(qr_view,0); + qr = 0; + } + }else{ + if(qr == 0){ + widget_set_opacity(qr_view,255); + qr=1; + } + // widget_use_style(dh_img_wifi,"img_wifi_wht"); + } + + + + tp_inited = 1; +} + +static ret_t on_new_key_down(void* ctx, event_t* e) { + key_event_t* evt = key_event_cast(e); + if(evt->key == TK_KEY_q || evt->key == TK_KEY_w){ + new_return_theme(); + // Phone_book_analysis(); + // }else if( evt->key == TK_KEY_q){//灯光开关 + // console_send_atcmd("AT+PBDOWN=1\r\n", strlen("AT+PBDOWN=1\r\n")); + } + + + return RET_OK; +} + +//ui刷新 +static ret_t ui_update(const timer_info_t* timer) { + + widget_t *win = WIDGET(timer->ctx); // home_page + // printf("new======================= .\r\n"); + tp_ui_refresh(win); + return RET_REPEAT; + /* + widget_t* win = window_manager(); + //static uint8_t num = 0; + uint8_t state; + static uint8_t qr =0; + char tmpStr[20] = {0}; + //widget_t* imageee =NULL ; + //widget_t* label =NULL ; + value_t val; + static uint16_t num =0; + + win = widget_lookup(win, "new", TRUE); + if(win != NULL && strcmp(win->name,"new")==0) { + state = Get_sys_wifi(); + widget_t* qr_view = widget_lookup(win, "qr_view", TRUE); + //widget_t* img = widget_lookup(win, "img", TRUE); + widget_t* dh_veer_velocity = widget_lookup(win, "dh_veer_velocity", TRUE); + widget_t* dh_grade = widget_lookup(win, "dh_grade", TRUE); + widget_t* dh_speed = widget_lookup(win, "dh_speed", TRUE); + + widget_t* oil_bar = widget_lookup(win, "oil_bar", TRUE); + widget_t* temp_bar = widget_lookup(win, "temp_bar", TRUE); + widget_t* oil = widget_lookup(win, "oil", TRUE); + widget_t* temp = widget_lookup(win, "temp", TRUE); + + widget_t* dh_abs = widget_lookup(win, "dh_abs", TRUE); + widget_t* dh_engine = widget_lookup(win, "dh_engine", TRUE); + widget_t* dh_engine_oil = widget_lookup(win, "dh_engine_oil", TRUE); + widget_t* dh_light_distance = widget_lookup(win, "dh_light_distance", TRUE); + + widget_t* dh_img_bt = widget_lookup(win, "dh_img_bt", TRUE); + widget_t* dh_img_wifi = widget_lookup(win, "dh_img_wifi", TRUE); + + //wifi图标 + if(state == 1){ + if(qr ==1){ + widget_set_opacity(qr_view,0); + qr = 0; + } + widget_use_style(dh_img_wifi,"img_wifi_connect"); + }else{ + if(qr == 0){ + widget_set_opacity(qr_view,255); + qr=1; + } + widget_use_style(dh_img_wifi,"img_wifi_wht"); + } + + //转向灯 + widget_t* veer = widget_lookup(win, "veer", TRUE);//转向 + veer_display_animo(veer,Get_sys_veer()); + //远光 + if(Get_sys_lamplight()==1) + widget_set_visible(dh_light_distance,TRUE); + else + widget_set_visible(dh_light_distance,FALSE); + + //abs + Universal_widget_display(dh_abs,Get_sys_warning_abs()); + //发动机故障 + Universal_widget_display(dh_engine,Get_sys_warning_engine()); + //机油压力报警 + Universal_widget_display(dh_engine_oil,Get_sys_warning_machine_oil()); + + //油量 + widget_animate_value_to(oil_bar, 100-Get_sys_gas(),ANIMATE_SPEED); + if(Get_sys_gas()<20){ + if(num%6==0){ + value_set_int32(&val, 0); + if (widget_get_prop(oil, "play_mode_style", &val) != RET_OK || value_int32(&val) == 0) { + value_set_int32(&val, 1); + widget_use_style(oil, "dh_oil_w"); + } else if (value_int32(&val) == 1) { + value_set_int32(&val, 0); + widget_use_style(oil, "dh_oil"); + } + widget_invalidate(oil, NULL); + widget_set_prop(oil, "play_mode_style", &val); + } + }else + widget_use_style(oil, "dh_oil"); + + //温度 + widget_animate_value_to(temp_bar, 60-Get_sys_temp(),ANIMATE_SPEED); + if(Get_sys_temp()>=50){ + if(num%6==0){ + value_set_int32(&val, 0); + if (widget_get_prop(temp, "play_mode_style", &val) != RET_OK || value_int32(&val) == 0) { + value_set_int32(&val, 1); + widget_use_style(temp, "dh_temp_w"); + } else if (value_int32(&val) == 1) { + value_set_int32(&val, 0); + widget_use_style(temp, "dh_temp"); + } + widget_invalidate(temp, NULL); + widget_set_prop(temp, "play_mode_style", &val); + } + }else + widget_use_style(temp, "dh_temp"); + + //速度 + tk_snprintf(tmpStr, sizeof(tmpStr), "%d",Get_sys_velocity()); + widget_set_text_utf8(dh_speed,tmpStr); + //档位 + tk_snprintf(tmpStr, sizeof(tmpStr), "%d",Get_sys_grade()); + widget_set_text_utf8(dh_grade,tmpStr); + //转速 + tk_snprintf(tmpStr, sizeof(tmpStr), "%d",Get_sys_veer_velocity()); + if(Get_sys_veer_velocity()<=1) + tk_snprintf(tmpStr, sizeof(tmpStr), "0"); + widget_set_text_utf8(dh_veer_velocity,tmpStr); + + //蓝牙图标 + if(Get_sys_bt_state()==1){ + widget_use_style(dh_img_bt,"img_bt_connect"); + }else{ + widget_use_style(dh_img_bt,"img_bt_wht"); + } + num++; + } + + return RET_REPEAT;*/ +} + +void getLastNChars(char* strQrText, int n, char* text) { + int len = strlen(strQrText); + + if (len <= n) { + strcpy(text, strQrText); // 如果字符串长度小于等于 n,则直接复制整个字符串 + } else { + strcpy(text, strQrText + len - n); // 复制最后 n 个字符到 text 中 + } +} + +#ifdef AMT630HV100 +extern void clear_rect(float x,float y,float w,float h,float a,float r,float g,float b); + +ret_t onClearBg(void *ctx,event_t *e){ + //printf("onClearBg=================================\r\n"); + clear_rect(0,0,800,380,0,0,0,0); +} +#endif + +static ret_t on_new_page_destroy(void *ctx, event_t *e) +{ + tp_inited = 0; + qr = 0; + return RET_OK; +} /** * 初始化窗口的子控件 @@ -9,9 +492,16 @@ static ret_t visit_init_child(void* ctx, const void* iter) { widget_t* widget = WIDGET(iter); const char* name = widget->name; + // 初始化指定名称的控件(设置属性或注册事件),请保证控件名称在窗口上唯一 if (name != NULL && *name != '\0') { - + if (tk_str_eq(name, "new")) { + widget_on(widget, EVT_KEY_DOWN, on_new_key_down, win); + widget_on(widget, EVT_DESTROY, on_new_page_destroy, win); + #ifdef AMT630HV100 + widget_on(widget,EVT_BEFORE_PAINT,onClearBg,widget); + #endif + } } return RET_OK; @@ -22,9 +512,75 @@ static ret_t visit_init_child(void* ctx, const void* iter) { */ ret_t new_init(widget_t* win, void* ctx) { (void)ctx; - return_value_if_fail(win != NULL, RET_BAD_PARAMS); + return_value_if_fail(win != NULL, RET_BAD_PARAMS); widget_foreach(win, visit_init_child, win); + // widget_t* qr_view = widget_lookup(win, "qr_view", TRUE); + // widget_set_style_color(qr_view,"normal:bg_color",0xff000000); + + /*//加载二维码部分初始化 + char tmpStr[200] = {0}; + char tmpStr_text[100] = {0}; + widget_t* uuid_text = widget_lookup(win,"uuid_text",TRUE); + + if(strlen(UI_uuid) == 0){ + widget_set_visible(uuid_text,FALSE); + }else{ + widget_set_visible(uuid_text,TRUE); + getLastNChars(strQrText,20, tmpStr_text); + tk_snprintf(tmpStr, sizeof(tmpStr), "uuid:%s 无感连接:%s",UI_uuid,tmpStr_text); + widget_set_text_utf8(uuid_text,tmpStr); + }*/ + + //加载二维码部分初始化 + char tmpStr[100] = {0}; + widget_t* bt_name = widget_lookup(win,"bt_name",TRUE); + widget_t* qr_view = widget_lookup(win, "qr_view", TRUE); + widget_set_style_color(qr_view,"normal:bg_color",0xff000000); + + #ifdef TP_CARLINK_EC + widget_t* carplay_view = widget_lookup(win, "carplay_view", TRUE); + widget_set_visible(carplay_view,FALSE); + if(Get_sys_wifi())//若当前连接投屏 则隐藏二维码部分 + widget_set_opacity(qr_view,0); + // if(qr_imgdisplay_flag == 0){ + // widget_t* qr_img = widget_lookup(win,"qr_img",TRUE); + // widget_set_visible(qr_img,FALSE); + + // widget_t* uuid_qr = widget_lookup(win, "qr_view", TRUE); + // widget_t* qr1 = qr_create(qr_view,40,81,230,230); + // widget_t* qr1 = qr_create(qr_view,40,81,230,230); + printf("strQrText = %s .\r\n",strQrText); + // qr_set_value(uuid_qr, strQrText); + // printf("-----------------\r\n"); + // widget_set_text_utf8(uuid_qr, strQrText); + + widget_t* qr1 = qr_create(qr_view,40,81,200,200); + qr_set_value(qr1, strQrText); + // printf("-----------------\r\n"); + // } + getLastNChars(strQrText,20, tmpStr); + widget_set_text_utf8(bt_name,tmpStr); + widget_t* uuid = widget_lookup(win,"uuid",TRUE); + tk_snprintf(tmpStr, sizeof(tmpStr), "uuid:%s",UI_uuid); + printf("UI_uuid > %s .\r\n",UI_uuid); + widget_set_text_utf8(uuid,tmpStr); + #else + widget_t* p2p_view = widget_lookup(win, "p2p_view", TRUE); + widget_set_visible(p2p_view,FALSE); + + #endif + + + + // tp_ui_refresh(win); + //投屏初始化 + if(Get_sys_wifi())//若当前连接投屏 则隐藏二维码部分 + widget_set_opacity(qr_view,0); + + widget_add_timer(win,ui_update,100); + + return RET_OK; } diff --git a/lib/awtk/awtk-examples/Moto_A58/src/pages/new.obj b/lib/awtk/awtk-examples/Moto_A58/src/pages/new.obj index 8bebcf1..bb7140a 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/src/pages/new.obj and b/lib/awtk/awtk-examples/Moto_A58/src/pages/new.obj differ diff --git a/lib/awtk/awtk-examples/Moto_A58/src/pages/prompt.c b/lib/awtk/awtk-examples/Moto_A58/src/pages/prompt.c index 9259a60..26c0fcf 100644 --- a/lib/awtk/awtk-examples/Moto_A58/src/pages/prompt.c +++ b/lib/awtk/awtk-examples/Moto_A58/src/pages/prompt.c @@ -58,7 +58,8 @@ ret_t prompt_init(widget_t* win, void* ctx) { // widget_t* prompt_image = widget_lookup(win, "prompt_image", TRUE); // widget_use_style(prompt_image,"bg_blk"); - + Set_sys_pace(0); + Set_sys_plan(0); widget_add_timer(win, prompt_refresh, 100);//进度条提示 return RET_OK; diff --git a/lib/awtk/awtk-examples/Moto_A58/src/pages/prompt.obj b/lib/awtk/awtk-examples/Moto_A58/src/pages/prompt.obj index 447773a..f941211 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/src/pages/prompt.obj and b/lib/awtk/awtk-examples/Moto_A58/src/pages/prompt.obj differ diff --git a/lib/awtk/awtk-examples/Moto_A58/src/pages/select_fault_code.c b/lib/awtk/awtk-examples/Moto_A58/src/pages/select_fault_code.c new file mode 100644 index 0000000..172661a --- /dev/null +++ b/lib/awtk/awtk-examples/Moto_A58/src/pages/select_fault_code.c @@ -0,0 +1,254 @@ +#include "awtk.h" +#include "../common/navigator.h" +#include "../common/universal.h" +#include "../common/data_port.h" + +void refresh_fault_code(widget_t* win); + +typedef struct { + char *dtc_code; // 故障码 + char *dtc_desc_en; // 故障码描述(英文) + char *dtc_desc_cn; // 故障码描述(中文) +} DTC_INFO; + +typedef struct { + char *dtc_code; // 故障码 + uint32_t dtc_hex; // 故障码 + char *dtc_desc_en; // 故障码描述(英文) + char *dtc_desc_cn; // 故障码描述(中文) +} ABS_DTC_INFO; + +DTC_INFO ecu_dtc_info[] = { + {"P0262", "Cylinder Injector Circuit High", "一缸喷油器控制电路对电源短路"}, + {"P0261", "Cylinder Injector Circuit Low", "一缸喷油器控制电路对地短路"}, + {"P0201", "Cylinder Injector Circuit/Open", "一缸喷油器控制电路开路"}, + {"P0629", "Fuel Pump Control Circuit High", "油泵继电器控制电路对电源短路"}, + {"P0628", "Fuel Pump Control Circuit Low", "油泵继电器控制电路对地短路"}, + {"P0627", "Fuel Pump Control Circuit/Open", "油泵继电器控制电路开路"}, + {"P0511", "Idle Air Control Circuit", "步进电机驱动线圈电流过载或开路故障"}, + {"P0509", "Idle Air Control System Circuit High", "步进电机驱动线圈对电源短路 "}, + {"P0508", "Idle Air Control System Circuit Low", "步进电机驱动线圈对电地短路"}, + {"P2300", "Ignition Coil “A” Primary Control Circuit Low ", "点火线圈对地短路故障"}, + {"P0108", "Manifold Absolute Pressure/Barometric Pressure Circuit High", "进气歧管压力传感器电压过高故障"}, + {"P0107", "Manifold Absolute Pressure/Barometric Pressure Circuit Low", "进气歧管压力传感器电压过低故障"}, + {"P0105", "Manifold Absolute Pressure/Barometric Pressure Circuit", "进气歧管压力传感器信号卡滞故障"}, + {"P0106", "Manifold Absolute Pressure/Barometric Pressure Circuit Range/Performance", "进气歧管压力传感器信号不合理故障"}, + {"P0000", "Fault of unreasonable crankshaft signal", "曲轴信号不合理故障"}, + {"P0322", "Ignition/Distributor Engine Speed Input Circuit No Signal", "曲轴信号丢失故障"}, + {"P0507", "Idle Air Control System RPM Higher Than Expected", "发动机怠速转速过高故障"}, + {"P0506", "Idle Air Control System RPM Lower Than Expected", "发动机怠速转速过低故障"}, + {"P0113", "Intake Air Temperature Sensor 1 Circuit High", "进气温度传感器电路电压过高故障"}, + {"P0112", "Intake Air Temperature Sensor 1 Circuit Low", "进气温度传感器电路电压过低故障"}, + {"P0111", "Intake Air Temperature Sensor 1 Circuit Range/Performance", "进气温度超合理性阈值超限故障"}, + {"P0114", "Intake Air Temperature Sensor 1 Circuit Intermittent", "进气温度卡滞故障"}, + {"P0118", "Engine Coolant Temperature Sensor 1 Circuit High", "发动机冷却液温度传感器电路电压过高"}, + {"P0117", "Engine Coolant Temperature Sensor 1 Circuit Low", "发动机冷却液温度传感器电路电压过低"}, + {"P0116", "Engine Coolant Temperature Sensor 1 Circuit Range/Performance", "发动机冷却液温度超合理性阈值超限故障"}, + {"P0126", "Insufficient Coolant Temperature for Stable Operation", "发动机温度卡滞故障"}, + {"P0501", "Vehicle Speed Sensor “A” Range/Performance", "车速信号故障"}, + {"P0123", "Throttle/Pedal Position Sensor/Switch “A” Circuit High", "DK传感器电压过高故障"}, + {"P0122", "Throttle/Pedal Position Sensor/Switch “A” Circuit Low", "DK传感器电压过低故障"}, + {"P2177", "System Too Lean Off Idle", "非怠速时供油系统偏稀故障"}, + {"P2178", "System Too Rich Off Idle", "非怠速时供油系统偏浓故障"}, + {"P2187", "System Too Lean at Idle", "怠速时供油系统偏稀故障"}, + {"P2188", "System Too Rich at Idle", "怠速时供油系统偏浓故障"}, + {"P0053", "HO2S Heater Resistance", "氧传感器加热不合理故障"}, + {"P0032", "HO2S Heater Control Circuit High", "氧传感器加热电压过高故障"}, + {"P0031", "HO2S Heater Control Circuit Low", "氧传感器加热电压过低故障"}, + {"P0030", "HO2S Heater Control Circuit", "氧传感器加热信号控制电路开路故障"}, + {"P0133", "O2 Sensor Circuit Slow Response", "氧传感器信号老化故障"}, + {"P0132", "O2 Sensor Circuit High Voltage", "氧传感器信号电压过高故障"}, + {"P0131", "O2 Sensor Circuit Low Voltage", "氧传感器信号电压过低故障"}, + {"P0130", "O2 Sensor Circuit", "氧传感器信号不合理故障"}, + {"P0134", "O2 Sensor Circuit No Activity Detected", "氧传感器信号电路开路故障"}, + {"P0301", "Cylinder 1 Misfire Detected", "1缸失火故障"}, + {"P0692", "Fan 1 Control Circuit High", "风扇控制电路电压过高"}, + {"P0691", "Fan 1 Control Circuit Low", "风扇控制电路电压过低"}, + {"P0480", "Fan 1 Control Circuit", "风扇控制电路开路"}, + {"P0459", "Evaporative Emission System Purge Control Valve Circuit High", "碳罐控制阀控制电路电压过高"}, + {"P0458", "Evaporative Emission System Purge Control Valve Circuit Low", "碳罐控制阀控制电路电压过低"}, + {"P0444", "Evaporative Emission System Purge Control Valve Circuit Open", "碳罐控制阀控制电路开路"}, + {"P0412", "Secondary Air Injection System Switching Valve “A” Circuit", "二次补气阀控制电路电压过高"}, + {"P0414", "Secondary Air Injection System Switching Valve “A” Circuit Shorted", "二次补气阀控制电路电压过低"}, + {"P0413", "Secondary Air Injection System Switching Valve “A” Circuit Open", "二次补气阀控制电路开路"}, + {"P1508", "Side support switch voltage too high fault", "边撑开关电压过高故障"}, + {"P1507", "Low voltage fault of edge support switch", "边撑开关电压过低故障"}, +}; + +ABS_DTC_INFO abs_dtc_info[] = { + {"C1101", 0x5101, "ECU Voltage supply: high voltage", "电控单元电压:电压过高"}, + {"C1102", 0x5102, "ECU Voltage supply: low voltage", "电控单元电压:电压过低"}, + {"C1200", 0x5200, "Wheel-speed sensor, fron: open", "前轮轮速传感器:信号线与地短接/开路、供电线开路"}, + {"C1201", 0x5201, "Wheel-speed sensor, front: (signal failure) out of range, lost, noise, Intermittent", "前轮轮速传感器:(信号错误)越界、丢失、噪声、间歇"}, + {"C1202", 0x5202, "Wheel-speed sensor,front: general error", "前轮轮速传感器:一般错误"}, + {"C1206", 0x5206, "Wheel-speed sensor, rear : open", "后轮轮速传感器:信号线与地短接/开路、供电线开路"}, + {"C1207", 0x5207, "Wheel-speed sensor, rear : (signal failure)out of range, lost, noise, Intermittent", "后轮轮速传感器:(信号错误)越界、丢失、噪声、间歇"}, + {"C1208", 0x5208, "Wheel-speed sensor, rear : general error", "后轮轮速传感器:一般错误"}, + {"C1604", 0x5604, "ECU error (hardware, Micro-controller error)", "电控单元错误(硬件,处理器错误)"}, + {"C2308", 0x6308, "valve fault, inlet valve F", "阀错误:前轮进液阀"}, + {"C2312", 0x6312, "valve fault, outlet valve F", "阀错误:前轮出液阀"}, + {"C2324", 0x6324, "valve fault, inlet valve R", "阀错误:后轮进液阀"}, + {"C2328", 0x6328, "valve fault, outlet valve R", "阀错误:后轮出液阀"}, + {"C2112", 0x6112, "Valve relay error", "阀继电器错误"}, + {"C2402", 0x6402, "Return pump fault", "回流泵错误"}, + {"C2501", 0x6501, "Brake Pedal Switch error", "制动踏板开关错误 "}, +}; + + +void lookup_ecu_information_code(char* dtc_code,char* str,uint8_t type){ + // char str[100] = {0}; + for (int i = 0; i < sizeof(ecu_dtc_info) / sizeof(ecu_dtc_info[0]); i++) { + // if (dtc_info[i].dtc_code == dtc_code) { + if (compareStrings(ecu_dtc_info[i].dtc_code,dtc_code)) { + if(type) + strcpy(str,ecu_dtc_info[i].dtc_desc_en); + else + strcpy(str,ecu_dtc_info[i].dtc_desc_cn); + return; + } + } + strcpy(str,"--"); + +} + +void lookup_abs_information_code(char* dtc_code,char* str,uint8_t type){ + // char str[100] = {0}; + for (int i = 0; i < sizeof(abs_dtc_info) / sizeof(abs_dtc_info[0]); i++) { + // if (dtc_info[i].dtc_code == dtc_code) { + if (compareStrings(abs_dtc_info[i].dtc_code,dtc_code)) { + if(type) + strcpy(str,abs_dtc_info[i].dtc_desc_en); + else + strcpy(str,abs_dtc_info[i].dtc_desc_cn); + return; + } + } + strcpy(str,"--"); + +} + +void lookup_abs_hex_information_code(uint32_t dtc_hex,char* str,uint8_t type){ + // char str[100] = {0}; + for (int i = 0; i < sizeof(abs_dtc_info) / sizeof(abs_dtc_info[0]); i++) { + // if (dtc_info[i].dtc_code == dtc_code) { + if (abs_dtc_info[i].dtc_hex == dtc_hex) { + if(type) + strcpy(str,abs_dtc_info[i].dtc_desc_en); + else + strcpy(str,abs_dtc_info[i].dtc_desc_cn); + return; + } + } + strcpy(str,"--"); + +} + +void refresh_fault_code(widget_t* win){ + widget_t* defect_code_view = widget_lookup(win, "defect_code_view", TRUE); + if(defect_code_view !=NULL){ + widget_t* abs_now = widget_lookup(win, "abs_now", TRUE); + widget_t* abs_his = widget_lookup(win, "abs_his", TRUE); + widget_t* ecu_now = widget_lookup(win, "ecu_now", TRUE); + widget_t* ecu_his = widget_lookup(win, "ecu_his", TRUE); + char str[200] = {0}; + char dtc_str[100] = {0}; + uint8_t language_state = 0; + + const char* language = locale_info()->language; + if (tk_str_eq(language, "en")) {//英文 + language_state = 1; + }else{ + language_state = 0; + } + + tk_snprintf(dtc_str, sizeof(dtc_str), "%s",Get_can_abs_dtc()); + lookup_abs_information_code(dtc_str,str,language_state); + printf("str >>>>>>>> %s .\r\n",str); + widget_set_text_utf8(abs_now,str); + + tk_snprintf(dtc_str, sizeof(dtc_str), "%s",Get_can_abs_his_dtc()); + lookup_abs_information_code(dtc_str,str,language_state); + widget_set_text_utf8(abs_his,str); + + } +} + +static void select_fault_code_theme_init(widget_t* win){ + uint8_t count = 0; + widget_t* view = widget_lookup(win, "view", TRUE); + widget_t* page_label = widget_lookup(win, "page_label", TRUE); + widget_t* top_bg = widget_lookup(win, "top_bg", TRUE); + widget_t* btn_return = widget_lookup(win, "btn_return", TRUE); + widget_t* defect_code_view = widget_lookup(win, "defect_code_view", TRUE); + + count = widget_count_children(defect_code_view);//获取子类个数 + + widget_set_focused(btn_return,TRUE); +} + +static ret_t on_select_fault_code_key_down(void* ctx, event_t* e) { + key_event_t* evt = key_event_cast(e); + // TODO: 在此添加控件事件处理程序代码 + widget_t* win = window_manager(); + widget_t* child = NULL; + widget_t* widget = NULL; + uint8_t count=0; + uint8_t child_count=0; + + widget = window_manager_get_top_main_window(win); + if(evt->key == TK_KEY_q){ + child = widget_get_focused_widget(widget);//聚焦对象 + count = widget_index_of(child); + + child_count = widget_count_children(child->parent); + if(child_count == 1) + return RET_OK; + + widget_set_focused(child,FALSE); + count++; + if(count>=child_count) + count = 0; + widget = widget_get_child(child->parent,count); + + widget_set_focused(widget,TRUE); + widget_set_prop_bool(widget, WIDGET_PROP_FOCUSED, TRUE); + widget_set_value(widget,1); + + }else if(evt->key == TK_KEY_w){ + return navigator_back(); + }else if(evt->key == TK_KEY_e){ + return navigator_back(); + } + return RET_OK; +} + +/** + * 初始化窗口的子控件 + */ +static ret_t visit_init_child(void* ctx, const void* iter) { + widget_t* win = WIDGET(ctx); + widget_t* widget = WIDGET(iter); + const char* name = widget->name; + + // 初始化指定名称的控件(设置属性或注册事件),请保证控件名称在窗口上唯一 + if (name != NULL && *name != '\0') { + if (tk_str_eq(name, "select_fault_code")) { + widget_on(widget, EVT_KEY_DOWN, on_select_fault_code_key_down, win); + } + } + + return RET_OK; +} + +/** + * 初始化窗口 + */ +ret_t select_fault_code_init(widget_t* win, void* ctx) { + (void)ctx; + return_value_if_fail(win != NULL, RET_BAD_PARAMS); + + widget_foreach(win, visit_init_child, win); + select_fault_code_theme_init(win); + + return RET_OK; +} diff --git a/lib/awtk/awtk-examples/Moto_A58/src/pages/set_list.c b/lib/awtk/awtk-examples/Moto_A58/src/pages/set_list.c index fac934d..448e8d9 100644 --- a/lib/awtk/awtk-examples/Moto_A58/src/pages/set_list.c +++ b/lib/awtk/awtk-examples/Moto_A58/src/pages/set_list.c @@ -24,13 +24,17 @@ static void set_list_key_event_handing(widget_t* child){ widget_set_focused(child,TRUE); break; case 1://信息界面 - + // widget_set_focused(child,FALSE); + // widget = widget_lookup(win, "defect_code_view", TRUE); + // child = widget_get_child(widget,0); + // widget_set_focused(child,TRUE); break; case 2://主题界面 widget_set_focused(child,FALSE); widget = widget_lookup(win, "theme_view", TRUE); - child_count = Get_sys_theme_state(); - DEBUG_PRINT("child_count ================= %d Get_sys_theme_state =%d .\r\n",child_count,Get_sys_theme_state()); + + child_count = Get_sys_theme(); + DEBUG_PRINT("child_count ================= %d Get_sys_theme =%d .\r\n",child_count,Get_sys_theme()); if(child_count>2) child_count = 0; child = widget_get_child(widget,child_count); @@ -68,6 +72,7 @@ static void set_list_key_event_handing(widget_t* child){ } } +extern uint8_t tcs_twinkle; static void set_key_event_handing(widget_t* child){ widget_t* win = window_manager(); widget_t* widget = NULL; @@ -89,7 +94,7 @@ static void set_key_event_handing(widget_t* child){ } else { change_locale("en_US"); Set_sys_language(1); - widget_set_text_utf8(widget,"[EN]"); + widget_set_text_utf8(widget,"[英文]"); } // win = widget_lookup(win,"set_list",TRUE); // other_setting_init(win); @@ -115,23 +120,37 @@ static void set_key_event_handing(widget_t* child){ } break; case 3://保养里程 - navigator_to("set_mile"); + if(Get_sys_warning_maintenance()) + navigator_to("set_mile_reset"); break; case 4://胎压 navigator_to("set_tire_pressure"); break; case 5://蓝牙 - widget = widget_lookup(win, "bt_switch", TRUE); - if(widget_get_value_int(widget)){ - // Set_sys_bt_on_off(0); - // widget_set_value(widget,0); + if(Get_sys_bt_on_off()){ BT2_Switch(0); }else{ - // Set_sys_bt_on_off(1); - // widget_set_value(widget,1); BT2_Switch(1); } break; + case 6://tcs + widget = widget_lookup(win, "tcs_label", TRUE); + if(tcs_twinkle == 0){ + if(Get_sys_tcs_on_off()){ + Set_sys_tcs_on_off(0); + if (tk_str_eq(language, "en")) //英文 + widget_set_text_utf8(widget,"[Close]"); + else + widget_set_text_utf8(widget,"[关闭]"); + }else{ + Set_sys_tcs_on_off(1); + if (tk_str_eq(language, "en")) //英文 + widget_set_text_utf8(widget,"[Open]"); + else + widget_set_text_utf8(widget,"[开启]"); + } + } + break; default: break; } @@ -143,18 +162,18 @@ static void set_theme_key_event_handing(widget_t* child){ switch(count){ case 0: - if(Get_sys_theme_state()!=0) - Set_sys_theme_state(0); + if(Get_sys_theme()!=0) + Set_sys_theme(0); return_theme(); break; case 1: - if(Get_sys_theme_state()!=1) - Set_sys_theme_state(1); + if(Get_sys_theme()!=1) + Set_sys_theme(1); return_theme(); break; case 2: - if(Get_sys_theme_state()!=2) - Set_sys_theme_state(2); + if(Get_sys_theme()!=2) + Set_sys_theme(2); return_theme(); break; default: @@ -162,6 +181,20 @@ static void set_theme_key_event_handing(widget_t* child){ } } +static void set_defect_code_key_event_handing(widget_t* child){ + widget_t* win = window_manager(); + uint8_t count = widget_index_of(child); + + switch(count){ + case 0: + navigator_to("select_fault_code"); + break; + default: + break; + } +} + + static void set_light_key_event_handing(widget_t* child){ widget_t* win = window_manager(); char tmpStr[20] = {0}; @@ -173,13 +206,17 @@ static void set_light_key_event_handing(widget_t* child){ widget_set_text_utf8(child, "AUTO"); else widget_set_text_utf8(child, "自动"); + Set_sys_theme_state(2); Set_sys_light_value(count+1); + }else if(count == 6){ widget_set_text_utf8(child, "1"); + Set_sys_theme_state(1); Set_sys_light_value(1); }else{ tk_snprintf(tmpStr, sizeof(tmpStr), "%d",(count+1)); widget_set_text_utf8(child,tmpStr); + Set_sys_theme_state(1); Set_sys_light_value(count+1); } count = Get_sys_light_value(); @@ -209,18 +246,22 @@ static ret_t on_set_list_key_down(void* ctx, event_t* e) { count = widget_index_of(child); child_count = widget_count_children(child->parent); - if(child_count == 1) - return RET_OK; - + DEBUG_PRINT("child_count = %d .\r\n",child_count); widget_set_focused(child,FALSE); - - DEBUG_PRINT("child_count = %d .\r\n",child_count); count++; if(count>=child_count) count = 0; widget = widget_get_child(child->parent,count); DEBUG_PRINT("-->>%s ,%s , %d",widget->name,widget->parent->name,count); + if(!widget_get_enable(widget)){ + count++; + if(count>=child_count) + count = 0; + widget = widget_get_child(child->parent,count); + DEBUG_PRINT("-->>%s ,%s , %d",widget->name,widget->parent->name,count); + } + widget_set_focused(widget,TRUE); widget_set_prop_bool(widget, WIDGET_PROP_FOCUSED, TRUE); widget_set_value(widget,1); @@ -239,14 +280,12 @@ static ret_t on_set_list_key_down(void* ctx, event_t* e) { widget_set_text_utf8(list_title,set_label[count]); } + }else if(child != NULL && strcmp(child->parent->name,"light_view")==0){ + set_light_key_event_handing(child); } - if(strcmp(widget->name,"tab_button2")==0){ - list_theme_button2_init(); - }else if(strcmp(widget->name,"tab_button3")==0){ + + if(strcmp(widget->name,"tab_button3")==0) theme_win_init(win); - }else if(strcmp(widget->name,"tab_button4")==0){ - list_theme_button4_init(); - } }else if(evt->key == TK_KEY_w){ @@ -258,10 +297,9 @@ static ret_t on_set_list_key_down(void* ctx, event_t* e) { }else if(child != NULL && strcmp(child->parent->name,"set_view")==0){ set_key_event_handing(child); }else if(child != NULL && strcmp(child->parent->name,"theme_view")==0){ - set_theme_key_event_handing(child); - }else if(child != NULL && strcmp(child->parent->name,"light_view")==0){ - DEBUG_PRINT("light_view ................\r\n"); - set_light_key_event_handing(child); + set_theme_key_event_handing(child); + }else if(child != NULL && strcmp(child->parent->name,"defect_code_view")==0){ + set_defect_code_key_event_handing(child); } }else if(evt->key == TK_KEY_e){ @@ -281,7 +319,12 @@ static ret_t on_set_list_key_down(void* ctx, event_t* e) { child = widget_get_child(widget,2); widget_set_focused(child,TRUE); theme_win_init(win); - // list_theme_init(win); + }else if(child != NULL && strcmp(child->parent->name,"defect_code_view")==0){ + widget_set_focused(child,FALSE); + widget = widget_lookup(win, "list_view", TRUE); + child = widget_get_child(widget,1); + widget_set_focused(child,TRUE); + theme_win_init(win); }else if(child != NULL && strcmp(child->parent->name,"light_view")==0){ widget_set_focused(child,FALSE); widget_set_visible(child,FALSE); @@ -327,13 +370,10 @@ ret_t set_list_init(widget_t* win, void* ctx) { widget_set_prop_bool(child, WIDGET_PROP_FOCUSED, TRUE); widget_set_focused(child,TRUE); DEBUG_PRINT(">>>>>>>>>>>>>>>>>>>>>>>>>>>> enter set_list >> focused >%s .this parent %s\r\n",child->name,list_view->name); - - // if(Get_sys_power_on_self_test()!=100){ - // Set_sys_power_on_self_test(100); - // } + widget_foreach(win, visit_init_child, win); - list_theme_init(win); - // Set_sys_demo_position(4); + // list_theme_init(win); + list_theme_button1_init(); return RET_OK; } diff --git a/lib/awtk/awtk-examples/Moto_A58/src/pages/set_list.obj b/lib/awtk/awtk-examples/Moto_A58/src/pages/set_list.obj index ac8c599..0c19a98 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/src/pages/set_list.obj and b/lib/awtk/awtk-examples/Moto_A58/src/pages/set_list.obj differ diff --git a/lib/awtk/awtk-examples/Moto_A58/src/pages/set_mile.c b/lib/awtk/awtk-examples/Moto_A58/src/pages/set_mile.c index f0162cc..f4e735b 100644 --- a/lib/awtk/awtk-examples/Moto_A58/src/pages/set_mile.c +++ b/lib/awtk/awtk-examples/Moto_A58/src/pages/set_mile.c @@ -89,32 +89,6 @@ static void set_mile_theme_init(widget_t* win){ widget_set_value_int(mile3,(value/100%10)); widget_set_value_int(mile4,(value/10%10)); widget_set_value_int(mile5,(value%10)); - - if(Get_sys_theme_state()){ - widget_use_style(view, "page_view_bg_wt"); - widget_use_style(top_bg, "top_bg_wt"); - - widget_set_style_color(label, "normal:text_color", OUTPUT_COLOR_BLACK); - widget_set_style_color(page_label, "normal:text_color", OUTPUT_COLOR_BLACK); - - for(uint8_t i=0;ikey == TK_KEY_q){ + child = widget_get_focused_widget(widget);//聚焦对象 + count = widget_index_of(child); + + child_count = widget_count_children(child->parent); + if(child_count == 1) + return RET_OK; + + widget_set_focused(child,FALSE); + count++; + if(count>=child_count) + count = 0; + widget = widget_get_child(child->parent,count); + + widget_set_focused(widget,TRUE); + widget_set_prop_bool(widget, WIDGET_PROP_FOCUSED, TRUE); + widget_set_value(widget,1); + + }else if(evt->key == TK_KEY_w){ + child = widget_get_focused_widget(widget);//聚焦对象 + count = widget_index_of(child); + switch(count){ + case 0: + switch(Get_sys_mileage_state()){ + case 0: + Set_sys_maintenance_mileage(3000); + Set_sys_maintenance_mileage(0); + Set_sys_mileage_state(1); + break; + case 1: + Set_sys_maintenance_mileage(4000); + Set_sys_maintenance_mileage(0); + break; + default:break; + } + Set_sys_warning_maintenance(0); + return_theme(); + return RET_OK; + break; + default: + return navigator_back(); + break; + } + }else if(evt->key == TK_KEY_e){ + return navigator_back(); + } + return RET_OK; +} + +/** + * 初始化窗口的子控件 + */ +static ret_t visit_init_child(void* ctx, const void* iter) { + widget_t* win = WIDGET(ctx); + widget_t* widget = WIDGET(iter); + const char* name = widget->name; + + // 初始化指定名称的控件(设置属性或注册事件),请保证控件名称在窗口上唯一 + if (name != NULL && *name != '\0') { + if (tk_str_eq(name, "set_mile_reset")) { + widget_on(widget, EVT_KEY_DOWN, on_set_mile_reset_key_down, win); + } + } + + return RET_OK; +} + +/** + * 初始化窗口 + */ +ret_t set_mile_reset_init(widget_t* win, void* ctx) { + (void)ctx; + return_value_if_fail(win != NULL, RET_BAD_PARAMS); + + widget_foreach(win, visit_init_child, win); + set_mile_reset_theme_init(win); + + + return RET_OK; +} diff --git a/lib/awtk/awtk-examples/Moto_A58/src/pages/set_time.c b/lib/awtk/awtk-examples/Moto_A58/src/pages/set_time.c index a1d6c62..ec0d14a 100644 --- a/lib/awtk/awtk-examples/Moto_A58/src/pages/set_time.c +++ b/lib/awtk/awtk-examples/Moto_A58/src/pages/set_time.c @@ -5,9 +5,8 @@ #include "../common/universal.h" #include "../common/data_port.h" -unsigned char time_buffer[13]; -extern void TXCMD_Other_Set(unsigned char time_buffer[],uint8_t len); + extern void Set_sys_ttrb_time(uint8_t value); #if 0 // 时间戳 @@ -17,7 +16,7 @@ uint16_t fml_leap_year(uint16_t year){ return ((year%4 == 0)&&(year%100!=0) ) || (year%400 ==0); } -uint32_t fml_time_to_stamp(int time[]){ +uint32_t fml_time_to_stamp(uint32_t time[]){ static uint32_t dax = 0; static uint32_t day_count = 0; uint16_t leap_year_count = 0; @@ -52,7 +51,7 @@ uint32_t fml_time_to_stamp(int time[]){ } -uint32_t fml_stamp_to_time(uint32_t timep , int time[]){ +uint32_t fml_stamp_to_time(uint32_t timep , uint32_t time[]){ uint32_t days = 0; uint32_t rem = 0; @@ -171,15 +170,6 @@ static ret_t on_set_time_key_down(void* ctx, event_t* e) { }else if(evt->key == TK_KEY_w){ child = widget_get_focused_widget(widget);//聚焦对象 time_event_handling(child); - // if(child != NULL && strcmp(child->name,"hour1")==0){ //0 1 2 coun = 3 0 1 count =2 - // time_event_handling(child); - // }else if(child != NULL && strcmp(child->name,"hour2")==0){ - // time_event_handling(child); - // }else if(child != NULL && strcmp(child->name,"min1")==0){ - // time_event_handling(child); - // }else if(child != NULL && strcmp(child->name,"min2")==0){ - // time_event_handling(child); - // } }else if(evt->key == TK_KEY_e){ widget_t* hour1 = widget_lookup(win, "hour1", TRUE); @@ -189,14 +179,14 @@ static ret_t on_set_time_key_down(void* ctx, event_t* e) { date_time_t dt; date_time_init(&dt); - uint32_t sum,sum1,sum2,sum3,sum4;; + uint32_t sum; int32_t hour_num = widget_get_value_int(hour1); hour_num = hour_num*10 + widget_get_value_int(hour2); int32_t min_num = widget_get_value_int(min1); min_num = min_num*10 + widget_get_value_int(min2); - DEBUG_PRINT("set_time >>>>>>>>> %d:%d \n",hour_num,min_num); + printf("set_time >>>>>>>>> %d:%d \n",hour_num,min_num); dt.hour = hour_num; dt.minute = min_num; dt.second = 0; @@ -210,116 +200,15 @@ static ret_t on_set_time_key_down(void* ctx, event_t* e) { check_buffer[4] = dt.minute; check_buffer[5] = dt.second; - DEBUG_PRINT("%04d/%02d/%02d %02d:%02d:%02d",check_buffer[0], check_buffer[1], check_buffer[2], check_buffer[3], + printf("%04d/%02d/%02d %02d:%02d:%02d",check_buffer[0], check_buffer[1], check_buffer[2], check_buffer[3], check_buffer[4],check_buffer[5]); sum = fml_time_to_stamp(check_buffer); - DEBUG_PRINT("sum1 = %d , %08x.\n",sum,sum); - sum4=sum & 0xFF; - sum3=sum>>8 & 0xFF; - sum2=sum>>16 & 0xFF; - sum1=sum>>24 & 0xFF; - - time_buffer[0] = 0x27;// - time_buffer[1] = 0x06;//命令长度 - time_buffer[2] = 0x02;//时间指令 - time_buffer[3] = 0x04;//TLV结构 - //time_buffer[4] = 0x07;//数据长度 - - //time_buffer[5] = 0x01;//设置时间 - time_buffer[4] = sum1; - time_buffer[5] = sum2; - time_buffer[6] = sum3; - time_buffer[7] = sum4; - // time_buffer[10] = 0x00; - // time_buffer[11] = 0x00; - - count = 0; - for(uint8_t i=0;i<6;i++){ - count += time_buffer[2+i]; - } - time_buffer[8] = count; - - TXCMD_Other_Set(time_buffer,9); - Set_sys_ttrb_time(5); - DEBUG_PRINT("start send time information.\r\n"); - sleep_ms(5); - DEBUG_PRINT("send time information ok.\r\n"); + Send_list_set_time(sum); return navigator_back(); - // return image_manager_unload_unused(image_manager(), 0); } - /*else if(child != NULL && strcmp(child->name,"return")==0){ - widget_t* hour1 = widget_lookup(win, "hour1", TRUE); - widget_t* hour2 = widget_lookup(win, "hour2", TRUE); - widget_t* min1 = widget_lookup(win, "min1", TRUE); - widget_t* min2 = widget_lookup(win, "min2", TRUE); - - date_time_t dt; - date_time_init(&dt); - uint32_t sum,sum1,sum2,sum3,sum4;; - - int32_t hour_num = widget_get_value_int(hour1); - hour_num = hour_num*10 + widget_get_value_int(hour2); - int32_t min_num = widget_get_value_int(min1); - min_num = min_num*10 + widget_get_value_int(min2); - - DEBUG_PRINT("set_time >>>>>>>>> %d:%d \n",hour_num,min_num); - dt.hour = hour_num; - dt.minute = min_num; - dt.second = 0; - date_time_set(&dt); - - int check_buffer[6]; - check_buffer[0] = dt.year; - //check_buffer[0] = 2024; - check_buffer[1] = dt.month; - //check_buffer[1] = 1; - check_buffer[2] = dt.day; - //check_buffer[2] = 28; - check_buffer[3] = dt.hour; - check_buffer[4] = dt.minute; - check_buffer[5] = dt.second; - - DEBUG_PRINT("%04d/%02d/%02d %02d:%02d:%02d",check_buffer[0], check_buffer[1], check_buffer[2], check_buffer[3], - check_buffer[4],check_buffer[5]); - - sum = fml_time_to_stamp(check_buffer); - - DEBUG_PRINT("sum1 = %d , %08x.\n",sum,sum); - sum4=sum & 0xFF; - sum3=sum>>8 & 0xFF; - sum2=sum>>16 & 0xFF; - sum1=sum>>24 & 0xFF; - - time_buffer[0] = 0x27;// - time_buffer[1] = 0x0b;//命令长度 - time_buffer[2] = 0x04;//时间指令 - time_buffer[3] = 0x01;//TLV结构 - time_buffer[4] = 0x07;//数据长度 - - time_buffer[5] = 0x01;//设置时间 - time_buffer[6] = sum1; - time_buffer[7] = sum2; - time_buffer[8] = sum3; - time_buffer[9] = sum4; - time_buffer[10] = 0x00; - time_buffer[11] = 0x00; - - count = 0; - for(uint8_t i=0;i<10;i++){ - count += time_buffer[2+i]; - } - time_buffer[12] = count; - - TXCMD_Other_Set(time_buffer); - Set_sys_ttrb_time(5); - - navigator_back(); - return image_manager_unload_unused(image_manager(), 0); - } - }*/ return RET_OK; } @@ -334,7 +223,6 @@ static void set_time_theme_init(widget_t* win){ widget_t* hour2 = widget_lookup(win, "hour2", TRUE); widget_t* min1 = widget_lookup(win, "min1", TRUE); widget_t* min2 = widget_lookup(win, "min2", TRUE); - date_time_t dt; date_time_init(&dt); @@ -352,30 +240,6 @@ static void set_time_theme_init(widget_t* win){ widget_set_value_int(min1,(dt.minute/10)); widget_set_value_int(min2,(dt.minute%10)); - - if(Get_sys_theme_state()){ - widget_use_style(view, "page_view_bg_wt"); - widget_use_style(top_bg, "top_bg_wt"); - - widget_set_style_color(label, "normal:text_color", OUTPUT_COLOR_BLACK); - widget_set_style_color(page_label, "normal:text_color", OUTPUT_COLOR_BLACK); - widget_set_style_color(hour1, "normal:text_color", OUTPUT_COLOR_BLACK); - widget_set_style_color(hour2, "normal:text_color", OUTPUT_COLOR_BLACK); - widget_set_style_color(min1, "normal:text_color", OUTPUT_COLOR_BLACK); - widget_set_style_color(min2, "normal:text_color", OUTPUT_COLOR_BLACK); - }else{ - widget_use_style(view, "page_view_bg_bk"); - widget_use_style(top_bg, "top_bg_bk"); - - widget_set_style_color(label, "normal:text_color", OUTPUT_COLOR_WHITE); - widget_set_style_color(page_label, "normal:text_color", OUTPUT_COLOR_WHITE); - widget_set_style_color(hour1, "normal:text_color", OUTPUT_COLOR_WHITE); - widget_set_style_color(hour2, "normal:text_color", OUTPUT_COLOR_WHITE); - widget_set_style_color(min1, "normal:text_color", OUTPUT_COLOR_WHITE); - widget_set_style_color(min2, "normal:text_color", OUTPUT_COLOR_WHITE); - - } - } /** diff --git a/lib/awtk/awtk-examples/Moto_A58/src/pages/set_time.obj b/lib/awtk/awtk-examples/Moto_A58/src/pages/set_time.obj index 394b59f..dbd7980 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/src/pages/set_time.obj and b/lib/awtk/awtk-examples/Moto_A58/src/pages/set_time.obj differ diff --git a/lib/awtk/awtk-examples/Moto_A58/src/pages/set_tire_pressure.c b/lib/awtk/awtk-examples/Moto_A58/src/pages/set_tire_pressure.c index fb6a6a3..f6bafde 100644 --- a/lib/awtk/awtk-examples/Moto_A58/src/pages/set_tire_pressure.c +++ b/lib/awtk/awtk-examples/Moto_A58/src/pages/set_tire_pressure.c @@ -276,6 +276,7 @@ void refresh_front_tire_oressure(widget_t* win){ bar_num = (ago_pressure.psi-146); //tk_snprintf(tmpStr, sizeof(tmpStr), "%.2f",(bar_num/145)); tk_snprintf(tmpStr, sizeof(tmpStr), "%.2f",(bar_num*0.0069)); + // printf("ago_pressure.psi = %d ,psi =%.2f",ago_pressure.psi,(bar_num*0.0069)); widget_set_text_utf8(front_bar,tmpStr); if(ago_pressure.psiTIRE_PRESSURE_FRONT_UPPER){ widget_set_style_str(front_bar, "normal.text_color", "red"); @@ -292,6 +293,7 @@ void refresh_front_tire_oressure(widget_t* win){ // widget_set_style_str(front_psiuint, "normal.text_color", "#ffffff"); } } + //刷新警告信息 @@ -413,6 +415,7 @@ void refresh_rear_tire_oressure(widget_t* win){ bar_num = (after_pressure.psi-146); //tk_snprintf(tmpStr, sizeof(tmpStr), "%.2f",(bar_num/145)); tk_snprintf(tmpStr, sizeof(tmpStr), "%.2f",(bar_num*0.0069)); + // printf("after_pressure.psi = %d ,psi =%.2f",after_pressure.psi,(bar_num*0.0069)); widget_set_text_utf8(rear_bar,tmpStr); if(after_pressure.psiTIRE_PRESSURE_REAR_UPPER){ widget_set_style_str(rear_bar, "normal.text_color", "red"); @@ -590,23 +593,13 @@ static ret_t on_set_tire_pressure_key_down(void* ctx, event_t* e) { Pressure_t ago_pressure = Get_sys_front_pressure(); Pressure_t after_pressure = Get_sys_rear_pressure(); if(count==0){//学习前胎压 - - //front_tire_pressure_loading(win); if(tire_state==0 && mac_address_normal(ago_pressure.mac_address,6) == 0){//为0才可以学习 未学习或常规状态下都为0 front_tire_pressure_loading(); } - /*else{ - DEBUG_PRINT("tire_state =%d || ago_pressure mac_address existence.\r\n",tire_state); - }*/ - }else if(count==1){//学习后胎压 - //rear_tire_pressure_loading(win); if(tire_state==0 && mac_address_normal(after_pressure.mac_address,6) == 0){//为0才可以学习 未学习或常规状态下都为0 rear_tire_pressure_loading(); } - /*else{ - DEBUG_PRINT("tire_state =%d || after_pressure mac_address existence.\r\n",tire_state); - }*/ } }else if(evt->key == TK_KEY_e){ @@ -619,9 +612,8 @@ static ret_t on_set_tire_pressure_key_down(void* ctx, event_t* e) { static ret_t tire_data_refresh(const timer_info_t* timer){ //demo Progress bar Color change widget_t*win = WIDGET(timer->ctx); + // printf("front_time =============== %d .\r\n",front_time); uint8_t signal = Get_sys_pressure_signal(); - /*if(front_time!=50) - DEBUG_PRINT("front_time =%d .\n",front_time);*/ switch(signal){ case 0://常规状态下 刷新胎压数据 if(front_time!=DETECTION_TIME)front_time =DETECTION_TIME; @@ -629,31 +621,11 @@ static ret_t tire_data_refresh(const timer_info_t* timer){ //demo Progress bar C refresh_rear_tire_oressure(win); //胎压界面长按事件标志 if(tire_pressure_loading==1){//异常可以学习 - Pressure_t ago_pressure = Get_sys_front_pressure(); - if(ago_pressure.blow_by_state || ago_pressure.voltage_state || ago_pressure.temp_state || ago_pressure.lose_flag){//异常 - front_tire_pressure_loading(); - tire_pressure_loading=3; - }else if(ago_pressure.temp<70 && (ago_pressure.psi>=TIRE_PRESSURE_FRONT_LOWER && ago_pressure.psi<=TIRE_PRESSURE_FRONT_UPPER)){//正常禁止学习 - tire_pressure_loading=0; - }else{//异常 - front_tire_pressure_loading(); - tire_pressure_loading=3; - } - // front_tire_pressure_loading(); - // tire_pressure_loading=3; + front_tire_pressure_loading(); + tire_pressure_loading=3; }else if(tire_pressure_loading==2){ - Pressure_t after_pressure = Get_sys_rear_pressure(); - if(after_pressure.blow_by_state || after_pressure.voltage_state || after_pressure.temp_state || after_pressure.lose_flag){//异常 - rear_tire_pressure_loading(); - tire_pressure_loading=3; - }else if(after_pressure.temp<70 && (after_pressure.psi>=TIRE_PRESSURE_REAR_LOWER && after_pressure.psi<=TIRE_PRESSURE_REAR_UPPER)){//正常禁止学习 - tire_pressure_loading=0; - }else{//异常 - rear_tire_pressure_loading(); - tire_pressure_loading=3; - } - // rear_tire_pressure_loading(); - // tire_pressure_loading=3; + rear_tire_pressure_loading(); + tire_pressure_loading=3; } break; case 1: @@ -730,37 +702,6 @@ static void set_tire_pressure_theme_init(widget_t* win){ tire_id = widget_add_timer(tire_view, tire_data_refresh, 500); - - uint8_t count = widget_count_children(label_view);//获取子类个数 - if(Get_sys_theme_state()){ - widget_use_style(view, "page_view_bg_wt"); - widget_use_style(top_bg, "top_bg_wt"); - widget_use_style(img_moto, "tire_moto_wt"); - - widget_set_style_color(page_label, "normal:text_color", OUTPUT_COLOR_BLACK); - for(uint8_t i=0;i=2 && device_flag == 0){ - send_flag = 0; - uart3_flag = 1; - } - // printf("uart3_flag = %d ,send_flag = %d , device_flag=%d .\r\n",uart3_flag,send_flag,device_flag); -} static uint16_t animo_time; -#ifndef AWTK_630H +#ifndef AMT630HV100 static uint8_t time_second; #endif +extern void cp_wlan_start(void); void UI_init(void){ printf("UI_init ...........................................\r\n"); light_off(); + cp_wlan_start(); Set_sys_power_on_self_test(DEMO_UI_SELF_FINISH);//自检完成 cat1_enable(); animo_time = 511; if(bt2_switch_time) bt2_switch_time = 0; - // if(device_flag == 0) - Send_software_version(); - printf("uart3_flag = %d ,send_flag = %d , device_flag=%d .\r\n",uart3_flag,send_flag,device_flag); + Send_software_version(); } +extern uint8_t tcs_twinkle; +uint8_t tcs_icon_state = 0; extern double total_mile; -uint8_t oil_flag = 0; + + uint8_t oil_state = 2; uint8_t temp_state = 2; -uint8_t temp_flag = 0; - - +uint32_t oil_flag = 0; +uint32_t temp_flag = 0; +uint32_t tcs_flag = 0; +uint8_t tcs_state = 0; +uint8_t temp_warning_flag = 0; +extern uint8_t can101_flag; +uint8_t init_state = 1; +extern void refresh_tire_data(widget_t *win); +uint32_t time_num =0; +uint32_t nr = 0; static ret_t on_timer(const idle_info_t* idle){ - static uint16_t time_num =0; - static uint8_t nr = 0; static uint8_t light_time = 0; uint8_t win_flag = 0; + static uint8_t dh=0; uint32_t light_num=0; uint16_t light=0; @@ -182,8 +166,13 @@ static ret_t on_timer(const idle_info_t* idle){ double cell_value = 0; uint8_t cell_count = 0; - widget_t * temp_icon= NULL; - widget_t * fuel_icon= NULL; + // widget_t * temp_icon= NULL; + // widget_t * fuel_icon= NULL; + widget_t * tcs_icon= NULL; + widget_t * temp_view= NULL; + widget_t * fuel_view= NULL; + // widget_t * temp_bar= NULL; + // widget_t * fuel_bar= NULL; uint8_t power_state =0; power_state = Get_sys_power_on_self_test(); @@ -193,34 +182,55 @@ static ret_t on_timer(const idle_info_t* idle){ } light_time++; + if(can101_flag){ + can101_flag--; + } + if(power_state == 100){ widget_t* win = window_manager(); widget_t* child = window_manager_get_top_main_window(win); - #ifndef AWTK_630H - Simulating_data_changes(); // 模拟数据 - #endif + // #ifndef AMT630HV100 + // Simulating_data_changes(); // 模拟数据 + // #endif if(child != NULL && strcmp(child->name,"setting_list")==0){ newA27_list_win_init(child); - }else if(child != NULL && strcmp(child->name,"A58_home_page")==0){ + }else if(child != NULL && strcmp(child->name,"A58_home_page")==0 || strcmp(child->name,"A58_demo2")==0 ){ win_flag = 1; - temp_icon = widget_lookup(child, "temp_icon", TRUE); - fuel_icon = widget_lookup(child, "fuel_icon", TRUE); + temp_view = widget_lookup(child, "temp_view", TRUE); + fuel_view = widget_lookup(child, "fuel_view", TRUE); + tcs_icon = widget_lookup(child, "tcs_icon", TRUE); + }else if(child != NULL && strcmp(child->name,"new")==0){ + win_flag = 2; + temp_view = widget_lookup(child, "temp_view", TRUE); + fuel_view = widget_lookup(child, "fuel_view", TRUE); + tcs_icon = widget_lookup(child, "tcs_icon", TRUE); + }else if(child != NULL && strcmp(child->name,"select_fault_code")==0){ + #ifdef AMT630HV100 + if(xTaskGetTickCount() - idletick > configTICK_RATE_HZ * 10){ + refresh_fault_code(child); + idletick = xTaskGetTickCount(); + } + #else + refresh_fault_code(child); + #endif } - + #ifndef AMT630HV100 if(Get_sys_gas() <= UI_TORAL6_GRIDS_OIL_WARNING){ oil_flag++; if(oil_flag==17){//进行一次闪烁 if(oil_state){ oil_led_on(); oil_state = 0; - if(win_flag) - widget_set_visible(fuel_icon,TRUE); + if(win_flag){ + widget_set_visible(fuel_view,TRUE); + } }else{ oil_led_off(); oil_state = 1; - if(win_flag) - widget_set_visible(fuel_icon,FALSE); + if(win_flag){ + widget_set_visible(fuel_view,FALSE); + } } oil_flag = 0; } @@ -228,42 +238,234 @@ static ret_t on_timer(const idle_info_t* idle){ if(oil_flag){ oil_flag=0; oil_state = 2; - if(win_flag) - widget_set_visible(fuel_icon,TRUE); + if(win_flag){ + widget_set_visible(fuel_view,TRUE); + } } } - if(Get_sys_temp() >= UI_TORAL6_GRIDS_TEMP_WARNING){ - temp_flag++; - if(temp_flag==17){//进行一次闪烁 - if(temp_state){ - temp_state = 0; - if(win_flag) - widget_set_visible(temp_icon,TRUE); - }else{ - temp_state = 1; - if(win_flag) - widget_set_visible(temp_icon,FALSE); + if(Get_sys_warning_engine() && (!can101_flag)){ + temp_flag++;//闪烁逻辑 + if(temp_flag==17){//进行一次闪烁 + if(temp_state){ + temp_state = 0;//记录图片状态 + if(win_flag){ + widget_set_visible(temp_view,TRUE); + } + }else{ + temp_state = 4; + if(win_flag){ + widget_set_visible(temp_view,FALSE); + } + } + temp_flag = 0; } - temp_flag = 0; - } }else{ - if(temp_flag){ - temp_flag=0; - temp_state = 2; - if(win_flag) - widget_set_visible(temp_icon,TRUE); + if(Get_sys_can_temp() >= UI_CAN_TORAL6_GRIDS_TEMP_5){ + temp_flag++;//闪烁逻辑 + temp_warning_flag = 1; + if(temp_flag==17){//进行一次闪烁 + if(temp_state){ + temp_state = 0;//记录图片状态 + if(win_flag){ + widget_set_visible(temp_view,TRUE); + } + }else{ + temp_state = 1; + if(win_flag){ + widget_set_visible(temp_view,FALSE); + } + } + temp_flag = 0; + } + }else if(temp_warning_flag){ + if(Get_sys_can_temp() < UI_CAN_TORAL6_GRIDS_TEMP_WARNING){ + temp_warning_flag = 0; + }else{ + temp_flag++;//闪烁逻辑 + temp_warning_flag = 1; + if(temp_flag==17){//进行一次闪烁 + if(temp_state){ + temp_state = 0;//记录图片状态 + if(win_flag){ + widget_set_visible(temp_view,TRUE); + } + }else{ + temp_state = 1; + if(win_flag){ + widget_set_visible(temp_view,FALSE); + } + } + temp_flag = 0; + } + } + }else{ + if(temp_flag){ + temp_flag=0; + temp_state = 2; + if(win_flag) + widget_set_visible(temp_view,TRUE); + } } } + if(tcs_twinkle){ + if(tcs_icon_state == 0) + tcs_icon_state = 1; + + tcs_flag++; + if(tcs_flag==15){ + if(tcs_state){ + tcs_state = 0; + if(win_flag) + widget_set_visible(tcs_icon,TRUE); + }else{ + tcs_state = 1; + if(win_flag) + widget_set_visible(tcs_icon,FALSE); + } + tcs_flag = 0; + } + }else{ + if(tcs_flag){ + tcs_flag=0; + tcs_state = 2; + if(win_flag) + widget_set_visible(tcs_icon,FALSE); + } + } + #else + if(Get_sys_gas() <= UI_TORAL6_GRIDS_OIL_WARNING){ + if((xTaskGetTickCount() - oil_flag > 500) || (!oil_flag)){//进行一次闪烁 + if(oil_state){ + oil_led_on(); + oil_state = 0; + if(win_flag){ + widget_set_visible(fuel_view,TRUE); + } + }else{ + oil_led_off(); + oil_state = 1; + if(win_flag){ + widget_set_visible(fuel_view,FALSE); + } + } + oil_flag = xTaskGetTickCount(); + } + }else{ + if(oil_flag){ + oil_flag=0; + oil_state = 2; + if(win_flag){ + widget_set_visible(fuel_view,TRUE); + } + } + } + + if(Get_sys_warning_engine() && (!can101_flag)){ + // temp_flag++;//闪烁逻辑 + // if(temp_flag==17){//进行一次闪烁 + if((xTaskGetTickCount() - temp_flag > 500) || (!temp_flag)){//进行一次闪烁 + if(temp_state){ + temp_state = 0;//记录图片状态 + if(win_flag){ + widget_set_visible(temp_view,TRUE); + } + }else{ + temp_state = 4; + if(win_flag){ + widget_set_visible(temp_view,FALSE); + } + } + temp_flag = xTaskGetTickCount(); + } + }else{ + if(Get_sys_can_temp() >= UI_CAN_TORAL6_GRIDS_TEMP_5){ + // temp_flag++;//闪烁逻辑 + temp_warning_flag = 1; + // if(temp_flag==17){//进行一次闪烁 + if((xTaskGetTickCount() - temp_flag > 500) || (!temp_flag)){//进行一次闪烁 + if(temp_state){ + temp_state = 0;//记录图片状态 + if(win_flag){ + widget_set_visible(temp_view,TRUE); + } + }else{ + temp_state = 1; + if(win_flag){ + widget_set_visible(temp_view,FALSE); + } + } + // temp_flag = 0; + temp_flag = xTaskGetTickCount(); + } + }else if(temp_warning_flag){ + if(Get_sys_can_temp() < UI_CAN_TORAL6_GRIDS_TEMP_WARNING){ + temp_warning_flag = 0; + }else{ + // temp_flag++;//闪烁逻辑 + temp_warning_flag = 1; + // if(temp_flag==17){//进行一次闪烁 + if((xTaskGetTickCount() - temp_flag > 500) || (!temp_flag)){//进行一次闪烁 + if(temp_state){ + temp_state = 0;//记录图片状态 + if(win_flag){ + widget_set_visible(temp_view,TRUE); + } + }else{ + temp_state = 1; + if(win_flag){ + widget_set_visible(temp_view,FALSE); + } + } + // temp_flag = 0; + temp_flag = xTaskGetTickCount(); + } + } + }else{ + if(temp_flag){ + temp_flag=0; + temp_state = 2; + if(win_flag) + widget_set_visible(temp_view,TRUE); + } + } + } + + if(tcs_twinkle){ + if(tcs_icon_state == 0) + tcs_icon_state = 1; + + if((xTaskGetTickCount() - tcs_flag > 400) || (!tcs_flag)){//进行一次闪烁 + if(tcs_state){ + tcs_state = 0; + if(win_flag) + widget_set_visible(tcs_icon,TRUE); + }else{ + tcs_state = 1; + if(win_flag) + widget_set_visible(tcs_icon,FALSE); + } + tcs_flag = xTaskGetTickCount(); + } + }else{ + if(tcs_flag){ + tcs_flag=0; + tcs_state = 2; + if(win_flag) + widget_set_visible(tcs_icon,FALSE); + } + } + #endif + //光感数据计算 if(light_storage != data_storage){ light_storage = data_storage; - printf(">>>>>>>>>>>>>>>>>>>>>>>>>>.\r\n"); + // printf(">>>>>>>>>>>>>>>>>>>>>>>>>>.\r\n"); for(uint8_t i=0;i>>>>>>>>>>>>>>>>>>>>>>>>> %d .\r\n",light_num); + // printf("light>> %d .\r\n",light_num); // printf("cell_value>> %lf .\r\n",cell_value); Set_sys_light_perception_value(light_num); Set_sys_voltage(cell_value); @@ -287,22 +489,31 @@ static ret_t on_timer(const idle_info_t* idle){ //回到主菜单 if(Get_sys_return_demo() ==2){ + #ifndef AMT630HV100 time_num = 1; + #else + time_num = xTaskGetTickCount(); + #endif Set_sys_return_demo(1); }else if(Get_sys_return_demo() ==1){ // if(time_num %600 ==0 || Get_sys_velocity() != 0){//10s左右 || 有速度的情况下直接退回主界面 - if(time_num %600 ==0){//12s左右 || 有速度的情况下直接退回主界面 + #ifndef AMT630HV100 + if(time_num %400 ==0){//8s左右 || 有速度的情况下直接退回主界面 time_num = 0; DEBUG_PRINT("time ok return demo . %d \r\n",Get_sys_return_demo()); //如果目标是非主demo界面or投屏界面 则返回主demo界面 - if(Get_sys_return_demo()!=0) return_theme(); } time_num++; + #else + // if(time_num %400 ==0 || Get_sys_velocity() != 0 || Get_sys_call_state() != 0){//8s左右 || 有速度的情况下直接退回主界面 + if((xTaskGetTickCount() - time_num > configTICK_RATE_HZ * 8) || Get_sys_velocity() != 0 || Get_sys_call_state() != 0){//8s + time_num = xTaskGetTickCount(); + return_theme(); + } + #endif }else if(Get_sys_return_demo() ==3){ - // DEBUG_PRINT("3------- time ok return demo . %d \r\n",Get_sys_return_demo()); - if(Get_sys_return_demo()!=0) - return_theme();//如果目标是非主demo界面or投屏界面 则返回主demo界面 + return_theme();//如果目标是非主demo界面or投屏界面 则返回主demo界面 } if(Get_sys_upgrade_Flag()==2){//退出升级回到仪表界面 @@ -311,55 +522,79 @@ static ret_t on_timer(const idle_info_t* idle){ Set_sys_upgrade_Flag(0); } - // if(demo_position_mesg()){ - // time_num = 598; - // if(Get_sys_demo_position()!=0) - // return_theme();//如果目标是非主demo界面or投屏界面 则返回主demo界面 - // } - - if(ttrb_mesg()){ //查询时间 首次开机需要去询问时间 - if(nr%128==0){ - Send_software_version(); - nr = 0; - } - nr++; - #if UI_VIEW_TIRE_PRESSURE - }else if(!tire_pressure_mesg()){ //发送胎压信息 - if(nr%128==0){ - Send_tire_pressure_information(); - nr = 0; - } - nr++; + #ifndef AMT630HV100 + if(ttrb_mesg()){ //查询时间 首次开机需要去询问时间 + if(nr%128==0){ + Send_software_version(); + nr = 0; + } + nr++; + #if UI_VIEW_TIRE_PRESSURE + }else if(!tire_pressure_mesg()){ //发送胎压信息 + if(nr%128==0){ + Send_tire_pressure_information(); + nr = 0; + } + nr++; + #endif + }else if(!ttrb_time_mesg()){ //发送时间 当用户通过UI设置时间后,需要检测是否发送时间 + if(nr%128==0){ + Send_bt_time(); + nr = 0; + } + nr++; + #ifndef DATA_CAN + }else if(!odo_reset_mesg()){ //发送清零命令 当用户长按时清零 + if(nr%128==0){ + Send_trip_reset(); + nr = 0; + } + nr++; #endif - }else if(!ttrb_time_mesg()){ //发送时间 当用户通过UI设置时间后,需要检测是否发送时间 - if(nr%128==0){ - TXCMD_Other_Set(time_buffer,9); - nr = 0; + }else if(fault_code_mesg()){ //发送故障码 为1是需要发送故障码 + if(nr%128==0){ + Send_defect_code(); + nr = 0; + } + nr++; + } else { + if(nr) + nr=0; } - nr++; - #ifndef DATA_CAN - }else if(!odo_reset_mesg()){ //发送清零命令 当用户长按时清零 - if(nr%128==0){ - TXCMD_Other_Set(trip_reset,9); - nr = 0; - } - nr++; + #else + if(xTaskGetTickCount() - nr > configTICK_RATE_HZ){ + if(ttrb_mesg()){ //查询时间 首次开机需要去询问时间 + Send_software_version(); + #if UI_VIEW_TIRE_PRESSURE + }else if(!tire_pressure_mesg()){ //发送胎压信息 + Send_tire_pressure_information(); + #endif + }else if(!ttrb_time_mesg()){ //发送时间 当用户通过UI设置时间后,需要检测是否发送时间 + Send_bt_time(); + #ifndef DATA_CAN + }else if(!odo_reset_mesg()){ //发送清零命令 当用户长按时清零 + Send_trip_reset(); + #endif + }else if(fault_code_mesg()){ //发送故障码 为1是需要发送故障码 + Send_defect_code(); + } + nr = xTaskGetTickCount(); + } #endif - }else if(fault_code_mesg()){ //发送故障码 为1是需要发送故障码 - if(nr%128==0){ - Send_defect_code(); - nr = 0; - } - nr++; - } else { - if(nr) - nr=0; - } + + + //检测是否投屏 + if(Get_sys_wifi()==1 && dh==0){ + dh_refresh(); + dh = 1; + }else if(Get_sys_wifi()==0 && dh!=0) + dh = 0; + // //保养里程数检测判断 // mileage_detection_mesg(); - #ifdef AWTK_630H + #ifdef AMT630HV100 //时间戳检测-胎压超时 if(tire_pressure_flag){ date_time_t dt; @@ -400,7 +635,6 @@ static ret_t on_timer(const idle_info_t* idle){ } } #endif - } @@ -409,27 +643,50 @@ return RET_OK; extern uint8_t power_on_flag; void* test_timer_queue(void *args){ - static uint32_t idletick = 0; + + #ifndef AMT630HV100 + Set_sys_power_on_self_test(DEMO_UI_SELF_START); + char produce[5] = {0}; + produce[0] = 65; + produce[1] = 53; + produce[2] = 56; + produce[3] = 48; + produce[4] = 65; + Set_device_produce_num(produce); + char dtc[5] = {0}; + dtc[4] = 0x31; + dtc[3] = 0x30; + dtc[2] = 0x32; + dtc[1] = 0x31; + dtc[0] = 0x43; + Set_can_abs_dtc(dtc); + dtc[4] = 0x33; + dtc[3] = 0x32; + Set_can_abs_his_dtc(dtc); + strcpy(UI_uuid,"CARBITDC0D3050230C"); + strcpy(strQrText, "http://www.carbit.com.cn/down6/642/643/_ylqx?modelid=49801&sn=6gdt&action=9&ssid=AP630_CARLINK_A1A3&pwd=88888888&auth=WPA-PSK&name=DIRECT-AP630_CARLINK_p2p_A1A3"); + // Simulating_data_changes(); // 模拟数据 + // custom_data.temp = 70; + // custom_data.eng_temp = 120; + // custom_data.user_data.gas = 0; + // custom_data.veer_velocity = 14000; + // custom_data.warning.engine = 0; + // tcs_twinkle = 1; + // Set_sys_total_mileage(123456); + // Set_sys_trip_mileage(112345); + #endif + for(;;){ if(animo_time < 510){ - #ifndef AWTK_630H date_time_t dt; date_time_init(&dt); - #endif animo_time++; if(Get_sys_power_on_self_test() light init TRUE.\n"); + #ifdef AMT630HV100 + // light_gpio_init(); idletick = xTaskGetTickCount(); #else time_second = dt.second; @@ -440,15 +697,21 @@ void* test_timer_queue(void *args){ Send_tire_pressure_information();//胎压 A27_BT_init(); Set_sys_power_on_self_test(DEMO_UI_SELF_CHECKING);//设置为自检中 + #ifdef AMT630HV100 + vTaskDelay(500); + #else + sleep_ms(500); + #endif Power_On_Self_Test(); - sleep_ms(10); + Send_software_version(); - #ifdef AWTK_630H + #ifdef AMT630HV100 }else if(Get_sys_power_on_self_test()==DEMO_UI_SELF_CHECKING){ if(xTaskGetTickCount() - idletick > configTICK_RATE_HZ * 3){ UI_init(); + idletick = xTaskGetTickCount(); } #else }else if(time_second<57){ @@ -482,7 +745,7 @@ void* test_timer_queue(void *args){ }else if(Get_sys_upgrade_Flag()==1){ DEBUG_PRINT("start >> prompt .\r\n"); navigator_replace("prompt"); - Set_sys_upgrade_Flag(3); + Set_sys_upgrade_Flag(0); DEBUG_PRINT("screen >> prompt ok .\r\n"); } @@ -493,7 +756,11 @@ void* test_timer_queue(void *args){ // DEBUG_PRINT("screen >> prompt ok .\r\n"); // } + #ifdef AMT630HV100 + vTaskDelay(20); + #else sleep_ms(20); + #endif // if(Get_sys_power_on_self_test()==50){ // //power_on_self_data(); @@ -529,9 +796,9 @@ ret_t application_init(void) { system_date_init(); system_flash_to_date_event_handling();//上电后数据同步 Send_software_version(); - read_mileage(Get_sys_trip_mileage(), Get_sys_total_mileage()); flash_trip_mile = Get_sys_trip_mileage(); flash_total_mile = Get_sys_total_mileage(); + printf("******************************************\n"); printf("MXC-A58 version information :\nsoftware version: V%d.%d \nhardware version: %s \n",custom_data.softwar_host,custom_data.softwar_order,HARD_WARE); @@ -541,9 +808,8 @@ ret_t application_init(void) { custom_data.user_data.f_mac_address[3],custom_data.user_data.f_mac_address[4],custom_data.user_data.f_mac_address[5], custom_data.user_data.r_mac_address[0],custom_data.user_data.r_mac_address[1],custom_data.user_data.r_mac_address[2], custom_data.user_data.r_mac_address[3],custom_data.user_data.r_mac_address[4],custom_data.user_data.r_mac_address[5]); - printf("data:%02X %02X%02X , %02X %02X%02X end\r\n" - ,custom_data.user_data.f_mac_address[6],custom_data.user_data.f_mac_address[7],custom_data.user_data.f_mac_address[8] - ,custom_data.user_data.r_mac_address[6],custom_data.user_data.r_mac_address[7],custom_data.user_data.r_mac_address[8]); + printf("mile_state:%d ,maintenance_mileage:%d ,custom_data.user_data.mileage_flag:%d end.\r\n", + custom_data.user_data.mile_state,custom_data.user_data.maintenance_mileage,custom_data.user_data.mileage_flag); printf("******************************************\n"); //UI刷新线程 tk_thread_t *thread = NULL; @@ -568,7 +834,12 @@ ret_t application_init(void) { Set_sys_demo_position(0); - return navigator_to(APP_START_PAGE); + // return navigator_to(APP_START_PAGE); + // return navigator_to("A58_demo2"); + if(!Get_sys_theme()) + return navigator_replace("A58_home_page"); + else + return navigator_replace("A58_demo2"); } /** diff --git a/lib/awtk/awtk-examples/Moto_A58/src/window_main.obj b/lib/awtk/awtk-examples/Moto_A58/src/window_main.obj index 4280d4c..048a0b3 100644 Binary files a/lib/awtk/awtk-examples/Moto_A58/src/window_main.obj and b/lib/awtk/awtk-examples/Moto_A58/src/window_main.obj differ diff --git a/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/.clang-format b/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/.clang-format new file mode 100644 index 0000000..dec56b8 --- /dev/null +++ b/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/.clang-format @@ -0,0 +1,115 @@ +--- +Language: Cpp +# BasedOnStyle: Google +AccessModifierOffset: -1 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Left +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: false +AllowShortIfStatementsOnASingleLine: true +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: true +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Attach +BreakBeforeInheritanceComma: false +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeColon +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 100 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IncludeCategories: + - Regex: '^' + Priority: 2 + - Regex: '^<.*\.h>' + Priority: 1 + - Regex: '^<.*' + Priority: 2 + - Regex: '.*' + Priority: 3 +IncludeIsMainRegex: '([-_](test|unittest))?$' +IndentCaseLabels: true +IndentPPDirectives: None +IndentWidth: 2 +IndentWrappedFunctionNames: false +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: false +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 600 +PenaltyBreakFirstLessLess: 100 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Left +RawStringFormats: + - Language: TextProto + BasedOnStyle: google +ReflowComments: false +SortIncludes: false +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Auto +TabWidth: 2 +UseTab: Never +... + diff --git a/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/.gitignore b/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/.gitignore new file mode 100644 index 0000000..beb29a0 --- /dev/null +++ b/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/.gitignore @@ -0,0 +1,33 @@ +*.o +*.a +*.so +*.swp +*.pdb +*.ilk +*.idb +*.obj +*.exe +*.pyc +/bin +/lib +.sconsign.dblite +lua/demo1 +lua/lftk_run +tags +bin/demo1* +bin/demo_animator* +bin/demo_thread* +bin/demotr* +bin/demovg* +bin/fontgen* +bin/preview_ui* +bin/resgen* +bin/runLua* +bin/runTest* +bin/strgen* +bin/image* +bin/hello* +.vscode +.vs +*.os +res diff --git a/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/.remote_aw_plugin b/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/.remote_aw_plugin new file mode 100644 index 0000000..e69de29 diff --git a/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/LICENSE b/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/LICENSE new file mode 100644 index 0000000..8000a6f --- /dev/null +++ b/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/LICENSE @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random + Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/README.md b/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/README.md new file mode 100644 index 0000000..49fff63 --- /dev/null +++ b/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/README.md @@ -0,0 +1,99 @@ +# awtk-widget-number-label + +number_label 控件。用于显示数值的文本控件。 + +![](docs/images/ui.jpg) + +## 准备 + +1. 获取 awtk 并编译 + +``` +git clone https://github.com/zlgopen/awtk.git +cd awtk; scons; cd - +``` + +2. 获取 awtk-widget-number-label + +``` +git clone https://github.com/zlgopen/awtk-widget-number-label.git +cd awtk-widget-number-label +``` + +## 运行 + +1. 生成示例代码的资源 + +``` +python scripts/update_res.py all +``` +> 也可以使用 Designer 打开项目,之后点击 “打包” 按钮进行生成; +> 如果资源发生修改,则需要重新生成资源。 + +如果 PIL 没有安装,执行上述脚本可能会出现如下错误: +```cmd +Traceback (most recent call last): +... +ModuleNotFoundError: No module named 'PIL' +``` +请用 pip 安装: +```cmd +pip install Pillow +``` + +2. 编译 + +* 编译 PC 版本 + +``` +scons +``` + +* 编译 LINUX FB 版本 + +``` +scons LINUX_FB=true +``` + +> 完整编译选项请参考 [编译选项](https://github.com/zlgopen/awtk-widget-generator/blob/master/docs/build_options.md) + +3. 运行 + +``` +./bin/demo +``` + +## 如何使用 number-label 控件 + +在 xml 文件中创建 number-label 控件 + +```xml + +``` + +number_label 各属性的功能如下表所示: + +| 属性名 | 作用 | +| ----------------------- | -------------------------------------------- | +| value | 数值 | +| format | 格式化显示的值 | +| decimal_font_size_scale | 小数部分字体大小与整数部分字体大小之比 | +| min | 最小值 | +| max | 最大值 | +| step | 步长,用于上下键修改时,一次增加或减少的数值 | +| loop | 用上下键修改时,值是否循环 | +| readonly | 编辑器是否只读 | + +如果需要修改字体大小或颜色,可以通过修改 `font_size` 和 `text_color` 样式来修改。 + +**注意事项** + +当 readonly 属性不为 true 时,可以用方向键修改控件的值。如果同时使用方向键切换焦点,会存在焦点进入本控件后无法出来的问题。为了避免这个问题,可以采用以下几种措施之一: + +* readonly 设置为 true +* 把按键事件重新映射。请参考 [键值映射](https://github.com/zlgopen/awtk/blob/master/docs/map_key.md)。 +* 使用极简键盘。请参考 [支持极简键盘](https://github.com/zlgopen/awtk/blob/master/docs/how_to_support_5keys_3keys.md)。 + +## 文档 + +[完善自定义控件](https://github.com/zlgopen/awtk-widget-generator/blob/master/docs/improve_generated_widget.md) \ No newline at end of file diff --git a/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/SConstruct b/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/SConstruct new file mode 100644 index 0000000..be809b2 --- /dev/null +++ b/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/SConstruct @@ -0,0 +1,8 @@ +import os +import scripts.app_helper as app + +helper = app.Helper(ARGUMENTS) +helper.set_dll_def('src/number_label.def').set_libs(['number_label']).call(DefaultEnvironment) + +SConscriptFiles = ['src/SConscript'] +helper.SConscript(SConscriptFiles) diff --git a/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/design/default/fonts/default.ttf b/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/design/default/fonts/default.ttf new file mode 100644 index 0000000..866d3ba Binary files /dev/null and b/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/design/default/fonts/default.ttf differ diff --git a/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/design/default/fonts/led.ttf b/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/design/default/fonts/led.ttf new file mode 100644 index 0000000..c653d9c Binary files /dev/null and b/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/design/default/fonts/led.ttf differ diff --git a/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/design/default/styles/default.xml b/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/design/default/styles/default.xml new file mode 100644 index 0000000..1b700af --- /dev/null +++ b/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/design/default/styles/default.xml @@ -0,0 +1,460 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/design/default/styles/main.xml b/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/design/default/styles/main.xml new file mode 100644 index 0000000..8181fa1 --- /dev/null +++ b/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/design/default/styles/main.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/design/default/ui/main.xml b/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/design/default/ui/main.xml new file mode 100644 index 0000000..06b066f --- /dev/null +++ b/lib/awtk/awtk-examples/Moto_A58_bf/3rd/awtk-widget-number-label/design/default/ui/main.xml @@ -0,0 +1,20 @@ + + + + + + + + + +