diff --git a/BSP/root-fs/rootfs/etc_Model/etc_565_HUNTING_EVB_LINUX_4G_S550/profile b/BSP/root-fs/rootfs/etc_Model/etc_565_HUNTING_EVB_LINUX_4G_S550/profile index da6955885..19f1c6fae 100755 --- a/BSP/root-fs/rootfs/etc_Model/etc_565_HUNTING_EVB_LINUX_4G_S550/profile +++ b/BSP/root-fs/rootfs/etc_Model/etc_565_HUNTING_EVB_LINUX_4G_S550/profile @@ -81,3 +81,4 @@ alias ftpsset='cardv sys ftpsset' alias stampsw='cardv sys stampsw' alias gprssw='cardv sys gprssw' alias multiintevel='cardv sys multiintevel' +alias blusw='cardv sys blusw' diff --git a/code/application/source/cardv/SrcCode/System/SysMain_cmd.c b/code/application/source/cardv/SrcCode/System/SysMain_cmd.c index 3569453e3..c18ceac47 100755 --- a/code/application/source/cardv/SrcCode/System/SysMain_cmd.c +++ b/code/application/source/cardv/SrcCode/System/SysMain_cmd.c @@ -261,6 +261,8 @@ SXCMD_ITEM("sfota %", sf_cmd_ftp_ota, "sf_ota v1 v2 v3 v4") SXCMD_ITEM("sf_sw_esim %", sf_cmd_switch_esim, "sf_switch_esim") SXCMD_ITEM("gprssw %", sf_cmd_gprs_switch, "gprssw 0/1") SXCMD_ITEM("uiprint %", sf_cmd_para_printf, "uiprint") +SXCMD_ITEM("blusw %", cmd_blu_switch, "blusw 0/1") + #endif diff --git a/code/application/source/cardv/SrcCode/UIApp/Photo/UIDateImprint.c b/code/application/source/cardv/SrcCode/UIApp/Photo/UIDateImprint.c index cf557e390..176567a13 100755 --- a/code/application/source/cardv/SrcCode/UIApp/Photo/UIDateImprint.c +++ b/code/application/source/cardv/SrcCode/UIApp/Photo/UIDateImprint.c @@ -761,6 +761,7 @@ INT32 UiDateImprint_CalcPosition(DATE_IMPRINT_INFO *pInfo, UPOINT *pos) UINT32 photo_w = pCapInfo->ImgInfo.ch[0].width; UINT32 photo_h = pCapInfo->ImgInfo.ch[0].height; + DBG_IND("photo_w =%d, photo_h=%d, gen w=%d, h=%d\r\n",photo_w,photo_h,(pYuvInfo->GenImg.pw[0]),pYuvInfo->GenImg.ph[0]); if ((pYuvInfo->GenImg.pw[0]) > photo_w) { @@ -773,7 +774,6 @@ INT32 UiDateImprint_CalcPosition(DATE_IMPRINT_INFO *pInfo, UPOINT *pos) DBG_ERR("GenImg h %d> photo_h %d\r\n",pYuvInfo->GenImg.ph[0],photo_h); return -1; } - DBG_IND("photo_w =%d, photo_h=%d, gen w=%d, h=%d\r\n",photo_w,photo_h,(pYuvInfo->GenImg.pw[0]),pYuvInfo->GenImg.ph[0]); //Leave blank to the right of the date watermark ofs = pYuvInfo->GenImg.ph[0]/2; diff --git a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UICfgDefault.h b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UICfgDefault.h index 2e30fd94f..3da7b5018 100755 --- a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UICfgDefault.h +++ b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UICfgDefault.h @@ -262,6 +262,7 @@ #define DEFAULT_FTP_SWITCH SF_FTPS_ON #define DEFAULT_MULTISHOT_INTEVEL SF_MULTISHOT_INTEVEL_1S #define DEFAULT_PIC_UP_DAILY_REPORT SF_OFF +#define DEFAULT_BLU_SWITCH SF_ON #define SIFAR_FTP_IP "119.23.174.139" #define SIFAR_FTP_PORT "21" diff --git a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.c b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.c index 4f7795366..5aaf1db14 100755 --- a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.c +++ b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.c @@ -1764,7 +1764,7 @@ void SysResetFlag(void) puiPara->FtpSwitch = DEFAULT_FTP_SWITCH; puiPara->MultiShotIntevel = DEFAULT_MULTISHOT_INTEVEL; puiPara->PicUpDailyReport = DEFAULT_PIC_UP_DAILY_REPORT; - + puiPara->BluSwitch = DEFAULT_BLU_SWITCH; if(puiPara->ModuleImei[0] != '\0') { puiPara->DailyReportTime.Hour = ((UINT16)(puiPara->ModuleImei[11]-48)*10+(puiPara->ModuleImei[12]-48))%12; @@ -1784,6 +1784,7 @@ void SysResetFlag(void) memset(puiPara ->FtpsUsr, '\0', sizeof(puiPara ->FtpsUsr)); memset(puiPara ->FtpsPwd,'\0', sizeof(puiPara ->FtpsPwd)); memset(puiPara ->WifiApPWD,'\0', sizeof(puiPara ->WifiApPWD)); + memset(puiPara ->BluSsid,'\0', sizeof(puiPara ->BluSsid)); #if(WIFI_FUNC==ENABLE) memset(puiPara ->strSSID,'\0', sizeof(puiPara ->strSSID)); diff --git a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.h b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.h index e3cb69cbb..c239c73bc 100755 --- a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.h +++ b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.h @@ -575,6 +575,7 @@ typedef struct _UIMenuUIMenuStoreInfo { UINT8 Zoom; UINT32 FileKey; CHAR BluSsid[14]; + CHAR BluSwitch;/*OFF/ON*/ UINT32 x1; UINT32 x2; UINT32 x3; diff --git a/code/application/source/sf_app/code/include/sf_log.h b/code/application/source/sf_app/code/include/sf_log.h index 2f0a21ac9..d3449ad06 100644 --- a/code/application/source/sf_app/code/include/sf_log.h +++ b/code/application/source/sf_app/code/include/sf_log.h @@ -41,6 +41,10 @@ extern "C" { #define WARNING_FILE_PATH SF_SD_ROOT"warning.txt" #define INFO_FILE_PATH SF_SD_ROOT"info.txt" +#define SF_LOG_VAR 1 + +#define LOG_AT_FILE_TMP_PATH "/tmp/SF_GPS.TXT" + #define SF_ENCRYPTION_ENBLE 0 typedef enum SF_LOG_LEVEL_E @@ -50,7 +54,18 @@ typedef enum SF_LOG_LEVEL_E SF_LOG_LEVEL_INFO, /**CamMode, startup, sf_poweron_type_string(startup)); + SLOGI("isUsb = %d isCard = %d isUpdate:%d CamMode:%d startup:%d %s\n", isUsb,isCard,isUpdate,puiPara->CamMode, startup, sf_poweron_type_string(startup)); sf_led_init(); if((!isUsb) && (SF_MCU_STARTUP_NORMAL != startup) && (SF_MCU_STARTUP_OFF != startup)/*&& (0 == isUpdate)*/) diff --git a/code/application/source/sf_app/code/source/app/sf_common.c b/code/application/source/sf_app/code/source/app/sf_common.c index 704908bd3..c975f30eb 100755 --- a/code/application/source/sf_app/code/source/app/sf_common.c +++ b/code/application/source/sf_app/code/source/app/sf_common.c @@ -57,7 +57,7 @@ extern "C" { #include "sf_battery.h" #include "sf_hal_ttyusb.h" #include "sf_blue_app.h" - +#include "sf_ftp.h" extern pthread_mutex_t Param_mutexLock; SINT8 longClickhold = 0; SINT8 bmoduleupdate = 0; @@ -763,7 +763,9 @@ static SINT32 sf_app_proccess_cmd_mcu(SF_MESSAGE_BUF_S *pMessageBuf) stMessageBuf.arg3 = (SINT32)sf_get_mcu_ver(); stMessageBuf.cmdId = CMD_MCU; sf_com_message_send_to_cardv(&stMessageBuf); - sf_blue_app_start(); + // if(SF_MCU_STARTUP_ONKEY == startup){ + // sf_blue_app_start(); + // } break; case SF_MCU_CMD_MODULE_SLEEP: sf_set_module_sleep_flag(0); @@ -920,7 +922,7 @@ static SINT32 sf_app_proccess_cmd_dev(SF_MESSAGE_BUF_S *pMessageBuf) MLOGI("SF_DEV_CMD_ESIM_OPERATION_SELECT:arg3:%d\n", pMessageBuf->arg3); //sf_set_wifi_socket(pMessageBuf->arg2); sf_set_wifi_cmd(0x3c);//WIFI_CONTROL_CAMERA_Network_Select - sf_network_select(&pMessageBuf->arg3); + sf_network_select((UINT8 *)&pMessageBuf->arg3); break; case SF_DEV_CMD_ESIM_OPERATION_SWTICH: @@ -932,6 +934,13 @@ static SINT32 sf_app_proccess_cmd_dev(SF_MESSAGE_BUF_S *pMessageBuf) MLOGI("SF_DEV_CMD_OTA\n"); sf_camera_ota_ftp(); break; + case SF_DEV_CMD_BLU_START: + + if(SF_MCU_STARTUP_ONKEY == sf_poweron_type_get()) + { + sf_blue_app_start(); + } + break; default: break; diff --git a/code/application/source/sf_app/code/source/app/sf_system.c b/code/application/source/sf_app/code/source/app/sf_system.c index 89be789fa..acc22a004 100755 --- a/code/application/source/sf_app/code/source/app/sf_system.c +++ b/code/application/source/sf_app/code/source/app/sf_system.c @@ -1413,7 +1413,7 @@ UINT8 sf_check_power_on_mode(void) //printf("%s: UpFw=%d\r\n", __func__,UpFw); sf_set_fw_update(UpFw); } - printf("%s: PowerOnModeStr=%d UpFw=%d\r\n", __func__,startup,UpFw); + SLOGI("StartMode=%d,UpFw=%d\r\n",startup,UpFw); free(pStrSrc); } diff --git a/code/application/source/sf_app/code/source/battery/sf_battery.c b/code/application/source/sf_app/code/source/battery/sf_battery.c index 553aea4b3..9ae1ae00f 100755 --- a/code/application/source/sf_app/code/source/battery/sf_battery.c +++ b/code/application/source/sf_app/code/source/battery/sf_battery.c @@ -1577,7 +1577,7 @@ void sf_temper_update(void) stMessageBuf.arg1 = SF_DEV_CMD_TEMPER; stMessageBuf.arg2 = cTemper; stMessageBuf.arg3 = fTemper; - printf("[%s:%d]cTemper=%d fTemper:%d TemperAdc:%d\n",__FUNCTION__,__LINE__,stMessageBuf.arg2, stMessageBuf.arg3, TemperAdc); + //printf("[%s:%d]cTemper=%d fTemper:%d TemperAdc:%d\n",__FUNCTION__,__LINE__,stMessageBuf.arg2, stMessageBuf.arg3, TemperAdc); sf_com_message_send_to_cardv(&stMessageBuf); ctemper_tmp = cTemper; diff --git a/code/application/source/sf_app/code/source/logMng/sf_log.c b/code/application/source/sf_app/code/source/logMng/sf_log.c index aaa24dff6..fd0a9674f 100644 --- a/code/application/source/sf_app/code/source/logMng/sf_log.c +++ b/code/application/source/sf_app/code/source/logMng/sf_log.c @@ -90,6 +90,34 @@ SF_LOG_LEVEL_e sf_log_Level_get(void) { return enLogLevel; } +static int sf_is_sdc_mounted(void) +{ + char line[256]; + static int is_mounted = 0; + printf("%s:%d is_mounted:%d", __FUNCTION__, __LINE__,is_mounted); + if(is_mounted) + { + return is_mounted; + } + + FILE *file = fopen("/proc/mounts", "r"); + if (file == NULL) { + perror("Error opening /proc/mounts"); + return 0; + } + + while (fgets(line, sizeof(line), file)) { + if (strstr(line, "/dev/mmcblk0p1") != NULL) { + is_mounted = 1; + break; + } + } + + fclose(file); + + return is_mounted; +} + void sf_log_module(const char *pszFunc, U32 u32Line, const char *pszFmt, ...) { //SF_PDT_PARAM_CFG_S* pSfParam = sf_customer_param_get(); @@ -163,6 +191,7 @@ void sf_log_module(const char *pszFunc, U32 u32Line, const char *pszFmt, ...) return; } +#if SF_LOG_VAR void sf_log_file(SF_LOG_LEVEL_e enLevel,const char *pszFunc, U32 u32Line,char *pszFmt, ...) { SF_LOG_LEVEL_e enDstLevel; @@ -238,16 +267,16 @@ void sf_log_file(SF_LOG_LEVEL_e enLevel,const char *pszFunc, U32 u32Line,char *p } if(enLevel == SF_LOG_LEVEL_ERROR) { - fprintf(stdout,LIGHT_RED "[SF ERR][%s:%d]"NONE,pszFunc, u32Line); + fprintf(stdout,LIGHT_RED "[LOGE][%s:%d]"NONE,pszFunc, u32Line); }else if(enLevel == SF_LOG_LEVEL_WARNING) { - fprintf(stdout,YELLOW "[SF WARN][%s:%d]"NONE,pszFunc, u32Line); + fprintf(stdout,YELLOW "[LOGW][%s:%d]"NONE,pszFunc, u32Line); }else if(enLevel == SF_LOG_LEVEL_INFO) { - fprintf(stdout,LIGHT_GREEN "[SF INFO][%s:%d]"NONE,pszFunc, u32Line); + fprintf(stdout,LIGHT_GREEN "[LOGI][%s:%d]"NONE,pszFunc, u32Line); }else if(enLevel == SF_LOG_LEVEL_DEBUG) { - fprintf(stdout,LIGHT_PURPLE "[SF DBG][%s:%d]"NONE,pszFunc, u32Line); + fprintf(stdout,LIGHT_PURPLE "[LOGD][%s:%d]"NONE,pszFunc, u32Line); } va_start(args, pszFmt); vfprintf(stdout, pszFmt, args); @@ -256,6 +285,202 @@ void sf_log_file(SF_LOG_LEVEL_e enLevel,const char *pszFunc, U32 u32Line,char *p return; } +#else + +void sf_log_file(SF_LOG_LEVEL_e enLevel, SF_LOG_TYPE_e enType,const char *pszFunc, U32 u32Line,char *pszFmt, ...) +{ + FILE* flog = NULL; + FILE* flogtmp = NULL; + char *pStrSrc = NULL; + U16 debugMode = sf_get_dbgmode(); + UIMenuStoreInfo *puiPara = sf_app_ui_para_get(); + static int sdFlag = 0; + va_list args; + time_t timep; + struct tm *p; + SF_LOG_LEVEL_e enDstLevel; + CHAR tmpBuf[2048] = { 0 }; + CHAR enCodeLog[2048] = { 0 }; + + enDstLevel = sf_log_Level_get(); + if(enLevel <= enDstLevel) + { + pszFmt = (NULL == pszFmt) ? "" : pszFmt; + + if((enLevel == SF_LOG_LEVEL_ERROR) ||(1 == puiPara->DebugMode)) + { + if(sf_is_sdc_mounted()) + { + if(1 == puiPara->DebugMode) { + flog = fopen(LOG_AT_FILE_PATH, "ar+"); + }else if(enLevel == SF_LOG_LEVEL_ERROR) { + flog = fopen(LOG_AT_FILE_PATH, "ar+"); + } + } + + if(flog == NULL) + { + sdFlag = 0; + flog = fopen(LOG_AT_FILE_TMP_PATH, "ar+"); + } + else + { + if(!sdFlag) + { + flogtmp = fopen(LOG_AT_FILE_TMP_PATH, "r"); + if(flogtmp != NULL) + { + fseek(flogtmp, 0L, SEEK_END); + long size = ftell(flogtmp); + printf("%s:%d size:%d", __FUNCTION__, __LINE__,size); + + fseek(flogtmp, 0L, SEEK_SET); + pStrSrc = (char *)malloc(size*sizeof(char)); + if (pStrSrc) + { + fread(pStrSrc, 1, size, flogtmp); + fseek(flog, 0L, SEEK_END); + fwrite(pStrSrc,sizeof(char), size,flog); + //system("sys"); + + free(pStrSrc); + system("rm -rf /tmp/SF_GPS.TXT"); + system("sync"); + printf("%s:%d size:%d", __FUNCTION__, __LINE__,size); + } + fclose(flogtmp); + + } + } + sdFlag = 1; + } + + time(&timep); + p = gmtime(&timep); + if(flog != NULL) + { + fseek(flog, 0L, SEEK_END); + if(SF_LOG_LEVEL_ERROR == enLevel) + { + //memset(tmpBuf, 0, 2048); + //memset(enCodeLog, 0, 2048); + sprintf((char*)tmpBuf,"[%04d/%02d/%02d %02d:%02d:%02d] [%s-%d]:",p->tm_year + 1900, p->tm_mon + 1, p->tm_mday, + p->tm_hour, p->tm_min, p->tm_sec,pszFunc, u32Line); + + if(debugMode == 1) + { + log_base64_encode((char*)tmpBuf, (char*)enCodeLog, strlen((char*)tmpBuf),1); + fprintf(flog, "%s", enCodeLog); + + va_start(args, pszFmt); + vsprintf((char*)tmpBuf, pszFmt, args); + log_base64_encode((char*)tmpBuf, (char*)enCodeLog, strlen((char*)tmpBuf),1); + fprintf(flog, "%s", enCodeLog); + va_end(args); + } + else + { + fprintf(flog, "%s", tmpBuf); + + va_start(args, pszFmt); + vsprintf((char*)tmpBuf, pszFmt, args); + fprintf(flog, "%s", tmpBuf); + va_end(args); + } + } + else if((enType != SF_LOG_TYPE_MAX) && (1 == puiPara->DebugMode)) + { + // memset(tmpBuf, 0, 2048); + // memset(enCodeLog, 0, 2048); + + if(SF_LOG_TYPE_SYS == enType) + { + sprintf((char*)tmpBuf,"[%04d/%02d/%02d %02d:%02d:%02d][LOG][SYS]",p->tm_year + 1900, p->tm_mon + 1, p->tm_mday, + p->tm_hour, p->tm_min, p->tm_sec); + } + else if(SF_LOG_TYPE_AE == enType) + { + sprintf((char*)tmpBuf,"[%04d/%02d/%02d %02d:%02d:%02d][LOG][AE]",p->tm_year + 1900, p->tm_mon + 1, p->tm_mday, + p->tm_hour, p->tm_min, p->tm_sec); + } + else if(SF_LOG_TYPE_CAM == enType) + { + sprintf((char*)tmpBuf,"[%04d/%02d/%02d %02d:%02d:%02d][LOG][CAM]",p->tm_year + 1900, p->tm_mon + 1, p->tm_mday, + p->tm_hour, p->tm_min, p->tm_sec); + } + else if(SF_LOG_TYPE_4G == enType) + { + sprintf((char*)tmpBuf,"[%04d/%02d/%02d %02d:%02d:%02d][LOG][4G]",p->tm_year + 1900, p->tm_mon + 1, p->tm_mday, + p->tm_hour, p->tm_min, p->tm_sec); + } + else if(SF_LOG_TYPE_WIFI == enType) + { + sprintf((char*)tmpBuf,"[%04d/%02d/%02d %02d:%02d:%02d][LOG][WIFI]",p->tm_year + 1900, p->tm_mon + 1, p->tm_mday, + p->tm_hour, p->tm_min, p->tm_sec); + } + else if(SF_LOG_TYPE_P2P == enType) + { + sprintf((char*)tmpBuf,"[%04d/%02d/%02d %02d:%02d:%02d][LOG][P2P]",p->tm_year + 1900, p->tm_mon + 1, p->tm_mday, + p->tm_hour, p->tm_min, p->tm_sec); + } + else if(SF_LOG_TYPE_BLU == enType) + { + sprintf((char*)tmpBuf,"[%04d/%02d/%02d %02d:%02d:%02d][LOG][BLU]",p->tm_year + 1900, p->tm_mon + 1, p->tm_mday, + p->tm_hour, p->tm_min, p->tm_sec); + } + else + { + sprintf((char*)tmpBuf,"[%04d/%02d/%02d %02d:%02d:%02d][LOG][OTHER]",p->tm_year + 1900, p->tm_mon + 1, p->tm_mday, + p->tm_hour, p->tm_min, p->tm_sec); + } + + if(debugMode == 1) + { + log_base64_encode((char*)tmpBuf, (char*)enCodeLog, strlen((char*)tmpBuf),1); + fprintf(flog, "%s", enCodeLog); + + va_start(args, pszFmt); + vsprintf((char*)tmpBuf, pszFmt, args); + log_base64_encode((char*)tmpBuf, (char*)enCodeLog, strlen((char*)tmpBuf),1); + fprintf(flog, "%s", enCodeLog); + va_end(args); + } + else + { + fprintf(flog, "%s", tmpBuf); + + va_start(args, pszFmt); + vsprintf((char*)tmpBuf, pszFmt, args); + fprintf(flog, "%s", tmpBuf); + va_end(args); + + } + + } + fclose(flog); + } + } + + if(enLevel == SF_LOG_LEVEL_ERROR) + { + fprintf(stdout,LIGHT_RED "[LOGE][%s:%d]"NONE,pszFunc, u32Line); + }else if(enLevel == SF_LOG_LEVEL_WARNING) + { + fprintf(stdout,YELLOW "[LOGW][%s:%d]"NONE,pszFunc, u32Line); + }else if(enLevel == SF_LOG_LEVEL_INFO) + { + fprintf(stdout,LIGHT_GREEN "[LOGI][%s:%d]"NONE,pszFunc, u32Line); + }else if(enLevel == SF_LOG_LEVEL_DEBUG) + { + fprintf(stdout,LIGHT_PURPLE "[LOGD][%s:%d]"NONE,pszFunc, u32Line); + } + va_start(args, pszFmt); + vfprintf(stdout, pszFmt, args); + va_end(args); + } + return; +} +#endif #ifdef __cplusplus #if __cplusplus diff --git a/code/application/source/sf_app/code/source/sf_blue/src/hciconfig.c b/code/application/source/sf_app/code/source/sf_blue/src/hciconfig.c index 425e0e7c7..81ec406d8 100755 --- a/code/application/source/sf_app/code/source/sf_blue/src/hciconfig.c +++ b/code/application/source/sf_app/code/source/sf_blue/src/hciconfig.c @@ -187,8 +187,8 @@ int hciconfig_open_piscan(void) cmd_up(ctl, hdev); usleep(100*1000); - cmd_name(ctl, hdev, g_sf_ble_ssid); - usleep(100*1000); + //cmd_name(ctl, hdev, g_sf_ble_ssid); + //usleep(100*1000); cmd_piscan(ctl, hdev); usleep(100*1000); @@ -205,20 +205,20 @@ int hciconfig_set_name(char *name) { snprintf(g_sf_ble_ssid, sizeof(g_sf_ble_ssid), "%s",name); printf("set bluename:%s\n",g_sf_ble_ssid); - // int ctl = -1; - // int hdev = 0; + int ctl = -1; + int hdev = 0; - // /* Open HCI socket */ - // if ((ctl = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI)) < 0) - // { - // perror("Can't open HCI socket."); - // return -1; - // } - // cmd_up(ctl, hdev); - // cmd_name(ctl, hdev, name); - // usleep(100*1000); - // close(ctl); - // printf("set bluename.\n"); + /* Open HCI socket */ + if ((ctl = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI)) < 0) + { + perror("Can't open HCI socket."); + return -1; + } + cmd_up(ctl, hdev); + cmd_name(ctl, hdev, name); + usleep(100*1000); + close(ctl); + printf("set bluename.\n"); return 0; } diff --git a/code/application/source/sf_app/code/source/sf_blue/src/sf_blue_app.c b/code/application/source/sf_app/code/source/sf_blue/src/sf_blue_app.c index 4762e491c..8b06db19d 100755 --- a/code/application/source/sf_app/code/source/sf_blue/src/sf_blue_app.c +++ b/code/application/source/sf_app/code/source/sf_blue/src/sf_blue_app.c @@ -987,7 +987,11 @@ static int sf_blue_write_callback(U8 *val, unsigned int nval, U8 **rval, unsig *************************************************/ unsigned int sf_blue_app_start(void) { - sf_blue_hal_init(sf_blue_read_callback, sf_blue_write_callback); + UIMenuStoreInfo *puiPara = sf_app_ui_para_get(); + if(puiPara->BluSwitch) + { + sf_blue_hal_init(sf_blue_read_callback, sf_blue_write_callback); + } return SF_SUCCESS; } diff --git a/code/application/source/sf_app/code/source/sf_blue/src/sf_blue_hal.c b/code/application/source/sf_app/code/source/sf_blue/src/sf_blue_hal.c index 6523d43d2..314bced06 100755 --- a/code/application/source/sf_app/code/source/sf_blue/src/sf_blue_hal.c +++ b/code/application/source/sf_app/code/source/sf_blue/src/sf_blue_hal.c @@ -156,14 +156,39 @@ static void *sf_bluetooth_piscan_task(void *arg) } } - char ssid[6]= {0}; + char ssid[14]= {0}; hciconfig_get_address(ssid); snprintf(g_ble_ssid, sizeof(g_ble_ssid), "X-PRO_%s",ssid); hciconfig_set_name(g_ble_ssid); sf_set_ble_name(g_ble_ssid); - + system("dbus-daemon --system"); + usleep(200 * 1000); system("bluetoothd -d -n -C &"); + for (i = 0; i < 40; i++) { + if (access("/tmp/blue_status_ready", F_OK) == 0) { + printf("blue status ready\r\n"); + remove("/tmp/blue_status_ready"); + + break; + } + else if (access("/tmp/blue_status_down", F_OK) == 0) { + printf("blue status down\r\n"); + remove("/tmp/blue_status_down"); + break; + } + else + { + usleep(500 * 1000); + if(39 == i) + { + MLOGE("blue status fall!!\n"); + return NULL; + } + } + } + //sleep(15); + printf("%s:%d --------------test blu------------\n",__FUNCTION__,__LINE__); hciconfig_open_piscan(); gatt_service_register(gst_ble_rcb, gst_ble_wcb); diff --git a/code/application/source/sf_app/code/source/wifi/sf_wifi_svr.c b/code/application/source/sf_app/code/source/wifi/sf_wifi_svr.c index 3c2789b66..9d8c5bb10 100755 --- a/code/application/source/sf_app/code/source/wifi/sf_wifi_svr.c +++ b/code/application/source/sf_app/code/source/wifi/sf_wifi_svr.c @@ -2726,6 +2726,12 @@ void *sf_wifi_sevrer_init(void *pNull) //sf_sys_status_led_set(SF_LED_SYS_STATE_WIFI_CONNECTED); sf_sys_status_led_set(SF_LED_SYS_STATE_WIFI_DISCONNECT); sf_set_wifi_status(SF_WIFI_OK); + #if HUNTING_CAMERA_4G == ENABLE + SF_MESSAGE_BUF_S stMessageBuf = {0}; + stMessageBuf.cmdId = CMD_DEV; + stMessageBuf.arg1 = SF_DEV_CMD_BLU_START; + sf_com_message_send_to_app(&stMessageBuf); + #endif //sf_wifi_led_light_up_start(); #if 0 while(1)//(!poweroff_mode) diff --git a/code/application/source/sf_app/tools/blue/libexec/bluetooth/bluetoothd b/code/application/source/sf_app/tools/blue/libexec/bluetooth/bluetoothd index 69e124190..9bbec0bd6 100755 Binary files a/code/application/source/sf_app/tools/blue/libexec/bluetooth/bluetoothd and b/code/application/source/sf_app/tools/blue/libexec/bluetooth/bluetoothd differ diff --git a/code/lib/source/sifar/code/include/sf_common.h b/code/lib/source/sifar/code/include/sf_common.h index 713653506..6e149a5e1 100755 --- a/code/lib/source/sifar/code/include/sf_common.h +++ b/code/lib/source/sifar/code/include/sf_common.h @@ -135,4 +135,5 @@ void sf_set_debug_mode(void); void sf_set_wifi_socket(int fd); int sf_get_wifi_socket(void); BOOL sf_cmd_para_printf(unsigned char argc, char **argv); +BOOL cmd_blu_switch(unsigned char argc, char **argv); #endif diff --git a/code/lib/source/sifar/code/source/common/sf_common.c b/code/lib/source/sifar/code/source/common/sf_common.c index 3b1e579e7..275bff57c 100755 --- a/code/lib/source/sifar/code/source/common/sf_common.c +++ b/code/lib/source/sifar/code/source/common/sf_common.c @@ -1855,7 +1855,10 @@ void* sf_cardv_message_thread(void *argv) { continue; } - MLOGI("cmdId:[%#x,%s]\n",stMessagebuf.cmdId,sf_process_message_getstatusstring(stMessagebuf.cmdId)); + if(CMD_MCU != stMessagebuf.cmdId) + { + MLOGI("cmdId:[%#x,%s]\n",stMessagebuf.cmdId,sf_process_message_getstatusstring(stMessagebuf.cmdId)); + } //printf("[%s:%d]cmdId:%#x,paramBuf[%d]\n", __FUNCTION__, __LINE__,stMessagebuf.cmdId,stMessagebuf.arg1); switch(stMessagebuf.cmdId) { @@ -3051,8 +3054,25 @@ BOOL sf_cmd_para_printf(unsigned char argc, char **argv) printf("WifiApPWD:%s\n", puiPara->WifiApPWD); printf("Zoom:%d\n", puiPara->Zoom); printf("FileKey:%d\n", puiPara->FileKey); + printf("BluSsid:%s\n", puiPara->BluSsid); + printf("BluSwitch:%d\n", puiPara->BluSwitch); MLOGD(" sf Parameter end\n"); MLOGD(" end\n"); return TRUE; } + +BOOL cmd_blu_switch(unsigned char argc, char **argv) +{ + UINT32 value; + UIMenuStoreInfo *puiPara = sf_ui_para_get(); + sscanf_s(argv[0],"%d", &value); + if(value < SF_ON_OFF_MAX){ + puiPara->BluSwitch = value; + + Save_MenuInfo(); + } + printf("[%s:%d] BluSwitch:%d\n", __FUNCTION__, __LINE__,puiPara->BluSwitch); + return TRUE; +} + diff --git a/rtos/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UICfgDefault.h b/rtos/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UICfgDefault.h index 2e30fd94f..3da7b5018 100644 --- a/rtos/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UICfgDefault.h +++ b/rtos/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UICfgDefault.h @@ -262,6 +262,7 @@ #define DEFAULT_FTP_SWITCH SF_FTPS_ON #define DEFAULT_MULTISHOT_INTEVEL SF_MULTISHOT_INTEVEL_1S #define DEFAULT_PIC_UP_DAILY_REPORT SF_OFF +#define DEFAULT_BLU_SWITCH SF_ON #define SIFAR_FTP_IP "119.23.174.139" #define SIFAR_FTP_PORT "21" diff --git a/rtos/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.c b/rtos/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.c index 13857e244..8b90a840c 100755 --- a/rtos/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.c +++ b/rtos/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.c @@ -1176,6 +1176,7 @@ void SysResetFlag(void) puiPara->FtpSwitch = DEFAULT_FTP_SWITCH; puiPara->MultiShotIntevel = DEFAULT_MULTISHOT_INTEVEL; puiPara->PicUpDailyReport = DEFAULT_PIC_UP_DAILY_REPORT; + puiPara->BluSwitch = DEFAULT_BLU_SWITCH; if(puiPara->ModuleImei[0] != '\0') { @@ -1196,6 +1197,7 @@ void SysResetFlag(void) memset(puiPara ->FtpsUsr, '\0', sizeof(puiPara ->FtpsUsr)); memset(puiPara ->FtpsPwd,'\0', sizeof(puiPara ->FtpsPwd)); memset(puiPara ->WifiApPWD,'\0', sizeof(puiPara ->WifiApPWD)); + memset(puiPara ->BluSsid,'\0', sizeof(puiPara ->BluSsid)); #if(WIFI_FUNC==ENABLE) memset(puiPara ->strSSID,'\0', sizeof(puiPara ->strSSID)); diff --git a/rtos/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.h b/rtos/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.h index fe6e28e81..aee1f734b 100755 --- a/rtos/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.h +++ b/rtos/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.h @@ -213,6 +213,40 @@ typedef enum { FL_MovieAudioRecIndex, FL_MovieAudioRec, + // QR page + FL_NETWORK_SELECTION, + FL_QR_PICTURE, + FL_PASSWORD, + FL_CAMERA_INFO, + FL_CAMERA_NAME, + + // General page + FL_CAMERA_MODE, + FL_IMAGE_SIZE, + FL_VIDEO_SIZE, + FL_VIDEA_LENGTH, + FL_NIGHT_MODE, + FL_FLASH_POWER, + FL_SENSITIVITY, + FL_DELAY, + FL_OPERATING_TIME, + FL_FORMAT_SD, + FL_DATE_AND_TIME, + + // Send page + FL_MAX_NUM_DAY, + FL_SETTINGS_CHECK, + FL_SEND_TYPE, + FL_CHECK_IN_PHOTO, + FL_GPS, + + // Setting More page + FL_BATTERY_TYPE, + FL_SD_LOOP, + FL_CAMERA_FW_UPGRADE, + FL_MODULE_FW_UPGRADE, + FL_RESET, + //Setup FL_LCD_OFF, FL_BrightAdjIndex, @@ -492,7 +526,8 @@ typedef struct _UIMenuUIMenuStoreInfo { CHAR UpdateFlg; CHAR PreActiveProfileIccid[22]; CHAR EsimEid[40]; - + + CHAR CamNameStr[13]; CHAR PwdStr[7]; CHAR Latitude[16]; @@ -523,12 +558,12 @@ typedef struct _UIMenuUIMenuStoreInfo { UINT8 FtpPort[5]; UINT8 FtpUsr[40]; UINT8 FtpPwd[40]; - + UINT8 FtpsIp[40]; UINT8 FtpsPort[5]; UINT8 FtpsUsr[40]; UINT8 FtpsPwd[40]; - + UINT8 OtaFtpIp[40]; UINT8 OtaFtpPort[5]; UINT8 OtaFtpUserName[40]; @@ -540,13 +575,13 @@ typedef struct _UIMenuUIMenuStoreInfo { UINT8 Zoom; UINT32 FileKey; CHAR BluSsid[14]; + CHAR BluSwitch;/*OFF/ON*/ UINT32 x1; UINT32 x2; UINT32 x3; UINT32 x4; UINT32 x5; UINT32 x6; - //============Sifar==============///Payton } UIMenuStoreInfo;