Merge code form r16 v1.1.9

This commit is contained in:
HuangXin 2018-08-30 14:16:45 +08:00
parent 2739631b44
commit 42bf495230
15 changed files with 512 additions and 32 deletions

View File

@ -25,14 +25,14 @@
#include <uvdbus/assistant.h>
#endif
#define SYNC_TIME_DELAY (5)
#define SYNC_TIME_DELAY (1)
static PASSISTANT_ARRAY_INFO g_pAlarmArray = NULL,
g_pRemaindArray = NULL,
g_pSessionArray = NULL;
static uv_rwlock_t g_uvListRwLock;
static unsigned char g_syncFlags;
static unsigned char g_syncFlags = 0;
static unsigned int g_sessionId = 0;
static void __onAlarmCb(unsigned int tmId, unsigned int status, void *pUserData);
@ -462,6 +462,12 @@ static PDBUS_MSG_PACK __dBusOnMessage(uv_loop_t *pLoop, DBusConnection *pConn, P
switch(pMsg->busCmd)
{
case CMD_SESSION_ALARM_SYNC:
if(IsHolidayDBSynced() != TRUE)
{
LOG_EX(LOG_Warn, "CMD_SESSION_ALARM_SYNC: Wait sync holiday database, this is dirty data.\n");
break;
}
pInfo = (PASSISTANT_SYNC_INFO)Json2Struct((const char *)pMsg->pMsg, JSON_ENGINE_ASSISTANT_SYNC_RSP, FALSE, &err);
if(pInfo)
@ -487,6 +493,12 @@ static PDBUS_MSG_PACK __dBusOnMessage(uv_loop_t *pLoop, DBusConnection *pConn, P
break;
case CMD_ALARM_SYNC_RSP:
if(IsHolidayDBSynced() != TRUE)
{
LOG_EX(LOG_Warn, "CMD_ALARM_SYNC_RSP: Wait sync holiday database, this is dirty data.\n");
break;
}
pInfo = (PASSISTANT_SYNC_INFO)Json2Struct((const char *)pMsg->pMsg, JSON_ENGINE_ASSISTANT_SYNC_RSP, FALSE, &err);
if(pInfo)
@ -580,6 +592,12 @@ static PDBUS_MSG_PACK __dBusOnMessage(uv_loop_t *pLoop, DBusConnection *pConn, P
break;
case CMD_REMAIND_SYNC_RSP:
if(IsHolidayDBSynced() != TRUE)
{
LOG_EX(LOG_Warn, "CMD_REMAIND_SYNC_RSP: Wait sync holiday database, this is dirty data.\n");
break;
}
pInfo = (PASSISTANT_SYNC_INFO)Json2Struct((const char *)pMsg->pMsg, JSON_ENGINE_ASSISTANT_SYNC_RSP, FALSE, &err);
if(pInfo)
@ -705,12 +723,73 @@ static void __dBusDeameonCb(MODULE_NAME modName, int status)
static void __assistantSyncThread(void *pParam)
{
int ret, isSynced = -1;
int ret, i = 0, isSynced = -1;
LOG_EX(LOG_Debug, "Beging Sync holiday Database\n");
while(TRUE)
{
if(IsHolidayDBSynced() != TRUE)
{
CurrentIsWorkDay(0, 0);
if(i++ % 10 == 0 && i <= 1000)
{
LOG_EX(LOG_Debug, "Retry sync holiday database: %d\n", i);
}
sleep(SYNC_TIME_DELAY);
}
else
{
break;
}
}
LOG_EX(LOG_Debug, "Sync holiday Database Finished\n");
LOG_EX(LOG_Debug, "Beging sync ASSISTANT_TYPE_CLOCK\n");
do
{
if(g_syncFlags & (1 << ASSISTANT_TYPE_CLOCK))
{
LOG_EX(LOG_Debug, "Sync ASSISTANT_TYPE_CLOCK Finished\n");
break;
}
ret = DBusSendToCommand(NULL,
g_pModInfoTable[MODULE_CONTROLLER].modAliase,
CMD_ALARM_SYNC_REQ, "");
LOG_EX(LOG_Debug, "Send CMD_ALARM_SYNC_REQ Command: %d\n", ret);
sleep(SYNC_TIME_DELAY);
} while(TRUE);
LOG_EX(LOG_Debug, "Beging sync ASSISTANT_TYPE_REMAIND\n");
do
{
if(g_syncFlags & (1 << ASSISTANT_TYPE_REMAIND))
{
LOG_EX(LOG_Debug, "Sync ASSISTANT_TYPE_REMAIND Finished\n");
break;
}
ret = DBusSendToCommand(NULL,
g_pModInfoTable[MODULE_CONTROLLER].modAliase,
CMD_REMAIND_SYNC_REQ, "");
LOG_EX(LOG_Debug, "Send CMD_REMAIND_SYNC_REQ Command: %d\n", ret);
sleep(SYNC_TIME_DELAY);
} while(TRUE);
#if 0
do
{
if((g_syncFlags & (1 << ASSISTANT_TYPE_CLOCK))
&& (g_syncFlags & (1 << ASSISTANT_TYPE_REMAIND)))
{
LOG_EX(LOG_Debug, "Sync Alarm And Remaind Finished\n");
break;
}
if((g_syncFlags & (1 << ASSISTANT_TYPE_CLOCK)) == 0)
{
ret = DBusSendToCommand(NULL,
@ -726,18 +805,13 @@ static void __assistantSyncThread(void *pParam)
g_pModInfoTable[MODULE_CONTROLLER].modAliase,
CMD_REMAIND_SYNC_REQ, "");
// LOG_EX(LOG_Debug, "Send CMD_REMAIND_SYNC_REQ Command: %d\n", ret);
LOG_EX(LOG_Debug, "Send CMD_REMAIND_SYNC_REQ Command: %d\n", ret);
}
if(isSynced < 0)
{
isSynced = CurrentIsWorkDay(0, 0);
}
sleep(SYNC_TIME_DELAY);
} while(g_syncFlags != ((1 << ASSISTANT_TYPE_CLOCK) | (1 << ASSISTANT_TYPE_REMAIND)));
} while(TRUE);
//while(g_syncFlags != ((1 << ASSISTANT_TYPE_CLOCK) | (1 << ASSISTANT_TYPE_REMAIND)));
LOG_EX(LOG_Debug, "Sync holiday Database Finished\n");
ret = DBusSendToCommand(NULL,
g_pModInfoTable[MODULE_CONTROLLER].modAliase,
@ -750,6 +824,7 @@ static void __assistantSyncThread(void *pParam)
CMD_REMAIND_SYNC_REQ, "");
LOG_EX(LOG_Debug, "Send CMD_REMAIND_SYNC_REQ Command: %d\n", ret);
#endif
pthread_detach(pthread_self());
}
@ -775,8 +850,7 @@ int main(int argc, char **argv)
uv_rwlock_init(&g_uvListRwLock);
AlarmTimerInit(pLoop);
g_syncFlags = 0;
uv_thread_create(&uvSyncThread, __assistantSyncThread, NULL);
RunUVLoop(pLoop);

View File

@ -72,7 +72,50 @@ void InitCfgToCfgFile(config_t* pCfg)
}
}
int CfgGetInvValueV1(const char* pTags, int defValue, int* pErr)
int CfgGetIntValueV2(const char* pTags, int defValue, int* pErr)
{
char* pSvrMode = NULL;
char cmdBuf[MAX_PATH];
int iValue = defValue;
memset(cmdBuf, 0, MAX_PATH);
sprintf(cmdBuf, "cat %s | grep %s | awk '{print $3}' | cut -d \";\" -f 1",
DEVICE_CFG_FILE,
pTags);
GetShellExecResult(cmdBuf, &pSvrMode);
if(pSvrMode == NULL)
{
if(pErr)
{
*pErr = -ERR_NO_ITEMS;
}
return defValue;
}
iValue = strtol(pSvrMode, NULL, 10);
free(pSvrMode);
if(errno == EINVAL || errno == ERANGE)
{
if(pErr)
{
*pErr = -ERR_STR_CONVERT;
}
return defValue;
}
if(pErr)
{
*pErr = 0;
}
return iValue;
}
int CfgGetIntValueV1(const char* pTags, int defValue, int* pErr)
{
int iValue = defValue;

View File

@ -0,0 +1,181 @@
#ifndef PLATFORM_CPU
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <uthash/utlist.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#if defined(PLATFORM_R16) || defined (PLATFORM_CPU)
#include "log.h"
#include "libuv_dbus.h"
#include "boardlink_iot.h"
#else
#include <uvdbus/log.h>
#include <uvdbus/libuv_dbus.h>
#include <uvdbus/boardlink_iot.h>
#endif
#define BL_IOT_PROTO (30)
#define BL_MSG_BUF_MAX (1024 * 4)
static int g_nlSock = -1;
static unsigned char g_MsgSendBuf[BL_MSG_BUF_MAX];
static BlMsgCb g_blMsgCb = NULL;
static void __recvMsgThread(void *pParam)
{
unsigned char msgBuf[BL_MSG_BUF_MAX];
struct iovec iov = {msgBuf, BL_MSG_BUF_MAX};
struct nlmsghdr *pMsgHdr;
struct sockaddr_nl fromAddr;
struct msghdr msgHdr = {&fromAddr, sizeof(fromAddr), &iov, 1, NULL, 0, 0};;
memset(&fromAddr, 0, sizeof(fromAddr));
fromAddr.nl_family = AF_NETLINK;
fromAddr.nl_pid = 0;
fromAddr.nl_groups = 0;
while(TRUE)
{
int len = recvmsg(g_nlSock, &msgHdr, 0);
if(len > 0)
{
for(pMsgHdr = (struct nlmsghdr *)msgBuf;
NLMSG_OK(pMsgHdr, len);
pMsgHdr = NLMSG_NEXT(pMsgHdr, len))
{
if(pMsgHdr->nlmsg_type == NLMSG_DONE)
{
continue;
}
else if(pMsgHdr->nlmsg_type == NLMSG_ERROR)
{
continue;
}
else
{
PBL_IOT_MSG pMsg = (PBL_IOT_MSG)NLMSG_DATA(pMsgHdr);
//LOG_EX(LOG_Debug, "Recv Message: %s\n", NLMSG_DATA(pMsgHdr));
print_hex_dump_bytes("Msg", 0, pMsg, BL_IOT_MSG_LEN(pMsg->msglen));
if(g_blMsgCb)
{
g_blMsgCb(pMsg);
}
}
}
}
usleep(1000);
}
pthread_detach(pthread_self());
}
static int __nlCreateSocket(void)
{
struct sockaddr_nl srcAddr;
g_nlSock = socket(AF_NETLINK, SOCK_RAW, BL_IOT_PROTO);
if(g_nlSock == -1)
{
LOG_EX(LOG_Error, "Create netlink socker error: %s\n", strerror(errno));
return -ERR_CREATE_SOCKET;
}
memset(&srcAddr, 0, sizeof(srcAddr));
srcAddr.nl_family = AF_NETLINK;
srcAddr.nl_pid = getpid();
srcAddr.nl_groups = 0;
if(bind(g_nlSock, (struct sockaddr*)&srcAddr, sizeof(srcAddr)) < 0)
{
LOG_EX(LOG_Error, "Bind netlink socket failed: %s", strerror(errno));
close(g_nlSock);
return -ERR_BIND_SOCKET;
}
return 0;
}
static int __sendMessage(unsigned char* pData, unsigned int len)
{
struct iovec iov;
struct sockaddr_nl dstAddr;
struct nlmsghdr* pMsgHdr = (struct nlmsghdr*)g_MsgSendBuf;
struct msghdr msgHdr = {&dstAddr, sizeof(dstAddr), &iov, 1, NULL, 0, 0};
memset(&dstAddr, 0, sizeof(struct sockaddr_nl));
dstAddr.nl_family = AF_NETLINK;
dstAddr.nl_pid = 0;
dstAddr.nl_groups = 0;
memset(pMsgHdr, 0, BL_MSG_BUF_MAX);
pMsgHdr->nlmsg_len = len;
pMsgHdr->nlmsg_pid = getpid();
pMsgHdr->nlmsg_flags = 0;
memcpy(NLMSG_DATA(pMsgHdr), pData, len);
iov.iov_base = pMsgHdr;
iov.iov_len = NLMSG_SPACE(BL_MSG_BUF_MAX);
return sendmsg(g_nlSock, &msgHdr, 0);
}
int BL_SendBLMsg(BL_IOT_MSG_TYPE msgType, unsigned char* pData, unsigned int len)
{
BL_IOT_MSG blMsg;
memset(&blMsg, 0, sizeof(BL_IOT_MSG));
blMsg.msgType = msgType;
blMsg.msglen = len;
strcpy(blMsg.msgTags, BL_IOT_MSG_TAGS);
if(pData && len > 0)
{
memcpy(blMsg.msgData, pData, len);
}
return __sendMessage((unsigned char*)&blMsg, BL_IOT_MSG_LEN(len));
}
int BL_SendBLMsgTo(BL_IOT_MSG_TYPE msgType, unsigned char* pData, unsigned int len, unsigned char dstMac[ETH_ALEN])
{
BL_IOT_MSG blMsg;
memset(&blMsg, 0, sizeof(BL_IOT_MSG));
blMsg.msgType = msgType;
blMsg.msglen = len;
memcpy(blMsg.dstMac, dstMac, ETH_ALEN);
strcpy(blMsg.msgTags, BL_IOT_MSG_TAGS);
if(pData && len > 0)
{
memcpy(blMsg.msgData, pData, len);
}
return __sendMessage((unsigned char*)&blMsg, BL_IOT_MSG_LEN(len));
}
int BL_Init(BlMsgCb cbOnMsg)
{
int ret = 0;
uv_thread_t uvRecvThread;
ret = __nlCreateSocket();
if(ret != 0)
{
return ret;
}
g_blMsgCb = cbOnMsg;
uv_thread_create(&uvRecvThread, __recvMsgThread, NULL);
return 0;
}
#endif

View File

@ -1073,7 +1073,7 @@ int InetHttpUploadFileSync(const char *pURL, const char* pPath, void* pAttachInf
if(ret != CURLE_OK)
{
LOG_EX(LOG_Error, "Upload %s File %s Error %s\n", pURL, pPath, curl_easy_strerror(ret));
LOG_EX(LOG_Error, "Upload %s File %s Error %s(%d)\n", pURL, pPath, curl_easy_strerror(ret), ret);
rc = -ERR_NETWORK_SEND;
}

View File

@ -21,6 +21,7 @@ const char* g_ServerModeStr[] =
"DEV_MODE",
"TEST_MODE",
"PUBLISH_MODE",
"PUBLISH_PREBUILD",
"UNKNOWN_MODE"
};
@ -46,11 +47,13 @@ const char* g_VoiceKeyMap[VOICE_MAX][MAX_MODE] = {
"vbox-dev",
"vbox-dev",
"vbox-online",
"vbox-online",
},
{ // VOICE_APP_SECRET
"b1ec33c03df80ea3035bc9ccaa4af09c",
"b1ec33c03df80ea3035bc9ccaa4af09c",
"8714d6de1c83f21dda5fc9a905a59ac1",
"8714d6de1c83f21dda5fc9a905a59ac1",
},
};
@ -59,41 +62,49 @@ const char* g_ServerAddr[MAX_MODULE][MAX_MODE] = {
"2e37bc56a9b7ec3f6b8f41f60b81eb92",
"2e37bc56a9b7ec3f6b8f41f60b81eb92",
"dbb00213c23ea3709aae12ceb4c4e54e",
"7fc939cdb26ec2fa343b7c47a0617190",
},
{ // VOICE_MODULE
"ws://vbox-test.netease.com/netty/websocket",
"ws://vbox-test.netease.com/netty3/websocket",
"wss://vbox-asr.3.163.com/websocket",
"ws://vbox-test.netease.com/asr/websocket",
},
{ // VOICE_AI_MODULE
"http://api.multimedia.netease.com/imgtest/yqbot31_8686/",
"http://api.multimedia.netease.com/imgtest/yqbot29_8686/",
"https://vbox-smart.3.163.com/ ",
"http://api.multimedia.netease.com/imgtest/yqbot30_8888/",
},
{ // SERVER_MODULE
"http://api.multimedia.netease.com/imgtest/yqbot27_7677/",
"http://api.multimedia.netease.com/imgtest/yqbot31_7676/",
"https://vbox-server.3.163.com/",
"http://api.multimedia.netease.com/imgtest/yqbot22_7678/",
},
{ // LOG_MODULE
"http://vbox-log-test.netease.com/logCollectDev/vbox/logCollect/uploadLog",
"http://vbox-log-test.netease.com/logCollect/vbox/logCollect/uploadLog",
"https://vbox-log.3.163.com/vbox/logCollect/uploadLog",
"http://vbox-log-test.netease.com/logCollectOnline/vbox/logCollect/uploadLog",
},
{ // MARK_POINT_MODULE
"http://vbox-log-test.netease.com/buriedDev/vbox/log/add",
"http://vbox-log-test.netease.com/buriedTest/vbox/log/add",
"https://vbox-log.3.163.com/vbox/log/add",
"http://vbox-log-test.netease.com/buriedOnline/vbox/log/add",
},
{ // TTS_MODULE
"http://api.openai.netease.com/vbox-tts-dev/vbox/tts/transform",
"http://api.openai.netease.com/vbox-tts-test/vbox/tts/transform",
"https://vbox-tts.3.163.com/vbox/tts/transform",
"http://api.openai.netease.com/vbox-tts-online/vbox/tts/transform",
},
{ // DC_MODULE
"http://api.multimedia.netease.com/imgtest/yqbot27_7677/vbox/uploadFile",
"http://api.multimedia.netease.com/imgtest/yqbot31_7676/vbox/uploadFile",
"https://vbox-server.3.163.com/vbox/uploadFile",
"http://api.multimedia.netease.com/imgtest/yqbot22_7678/vbox/uploadFile",
},
};

View File

@ -587,6 +587,8 @@ static int DBusOnMsgWorkAPICb(PDBUS_MSG_PACK pMsg)
if(pWorkDayInfo && err == 0)
{
memcpy(&g_workDayArray, pWorkDayInfo, sizeof(WORKDAY_INFO));
g_workDayArray.isReady = TRUE;
LOG_EX(LOG_Debug, "Sync Alarm Database: %s\n", pMsg->pMsg);
}
//LOG_EX2(LOG_Debug, "Database: %s\n", pMsg->pMsg);
@ -1463,7 +1465,7 @@ static void __waitUDISKMount(void)
FILE* pFile;
// wait system create setup status file
LOG_EX(LOG_Debug, "Wait boot status file create ......\n");
fprintf(stdout, "Wait boot status file create ......\n");
while(access(pBootStatFile, F_OK) != 0)
{
usleep(10000);
@ -1473,11 +1475,11 @@ static void __waitUDISKMount(void)
if(pFile == NULL)
{
LOG_EX(LOG_Error, "Open boot status file error\n");
fprintf(stdout, "Open boot status file error\n");
return;
}
LOG_EX(LOG_Debug, "Wait boot status done ......\n");
fprintf(stdout, "Wait boot status done ......\n");
// when UDISK mount, file /tmp/booting_state content is "done"
do
@ -1492,10 +1494,47 @@ static void __waitUDISKMount(void)
fclose(pFile);
LOG_EX(LOG_Debug, "Boot status done ......\n");
fprintf(stdout, "Boot status done ......\n");
#endif
}
int GetServerModeFromCC(int defValue, int* pErr)
{
char* pSvrMode = NULL;
int iValue = defValue;
GetShellExecResult("curl --silent http://localhost:1705/httpenv/999 | grep 'env:' | awk '{print $3}'", &pSvrMode);
if(pSvrMode == NULL)
{
if(pErr)
{
*pErr = -ERR_NO_ITEMS;
}
return defValue;
}
iValue = strtol(pSvrMode, NULL, 10);
free(pSvrMode);
if(errno == EINVAL || errno == ERANGE)
{
if(pErr)
{
*pErr = -ERR_STR_CONVERT;
}
return defValue;
}
if(pErr)
{
*pErr = 0;
}
return iValue;
}
DBusConnection* DBusWithLibuvInit(uv_loop_t* pUserLoop,
const char* pBusName,
OnDBusMessage cbOnMsg,
@ -1551,6 +1590,9 @@ DBusConnection* DBusWithLibuvInit(uv_loop_t* pUserLoop,
puvFsReq = (uv_fs_t*)malloc(sizeof(uv_fs_t));
// wait UDISK mount, configure file save in UDISK partition
__waitUDISKMount();
CfgFileInit();
IHW_InitLOG(strrchr(pBusName, '.') + 1, NULL, TRUE);
@ -1558,13 +1600,11 @@ DBusConnection* DBusWithLibuvInit(uv_loop_t* pUserLoop,
IHW_RunLogService();
APP_BUILD_INFO(strrchr(pBusName, '.') + 1, GetCurrentVersion());
// wait UDISK mount, configure file save in UDISK partition
__waitUDISKMount();
i = 0;
do
{
svrMode = CfgGetInvValueV1("Global.ServerMode", PUBLISH_MODE, &ret);
svrMode = CfgGetIntValueV1("Global.ServerMode", PUBLISH_MODE, &ret);
if(ret != 0)
{
@ -1576,8 +1616,35 @@ DBusConnection* DBusWithLibuvInit(uv_loop_t* pUserLoop,
}
LOG_EX(LOG_Debug, "ServerMode = %d, Error = %d\n", svrMode, ret);
} while (ret != 0);
} while (ret != 0 && i++ <= 3);
if(ret != 0)
{
LOG_EX(LOG_Error, "Read Server Mode Error: ret = %d\n", ret);
svrMode = CfgGetIntValueV2("ServerMode", PUBLISH_MODE, &ret);
if(ret == 0)
{
LOG_EX(LOG_Warn, "Recovery Server Mode OK: ServerMode = %d\n", svrMode);
}
else
{
LOG_EX(LOG_Error, "CfgGetInvValueV2 Read Server Mode Error: ret = %d\n", ret);
svrMode = GetServerModeFromCC(PUBLISH_MODE, &ret);
if(ret == 0)
{
LOG_EX(LOG_Warn, "Netease Controller Server Mode OK: ServerMode = %d\n", svrMode);
}
else
{
svrMode = PUBLISH_MODE;
LOG_EX(LOG_Error, "GetServerModeFromCC Read Server Mode Error: "
"ret = %d, Set to default: PUBLISH_MODE\n", ret);
}
}
}
SetCurrentServerMode(svrMode);
DumpCurServerAddr("Default");
@ -2019,6 +2086,11 @@ static int __reqWorkDayInfo(int year)
reqInfo.year = year;
}
if(reqInfo.year < (2018 - 1900))
{
return 0;
}
ret = DBusJsonSendToCommand(NULL,
g_pModInfoTable[MODULE_CONTROLLER].modAliase,
CMD_WORKDAY_DB_REQ,
@ -2028,9 +2100,19 @@ static int __reqWorkDayInfo(int year)
return (ret);
}
int IsHolidayDBSynced(void)
{
return g_workDayArray.isReady;
}
int CurrentIsWorkDay(int year, int day)
{
// LOG_EX(LOG_Debug, "CurrentIsWorkDay: year = %d, day = %d\n", year, day);
static unsigned int i = 0;
if(year != 0)
{
LOG_EX(LOG_Debug, "CurrentIsWorkDay: year = %d, day = %d\n", year, day);
}
if(day > 365)
{
@ -2041,7 +2123,10 @@ int CurrentIsWorkDay(int year, int day)
if(g_workDayArray.year <= 0)
{
__reqWorkDayInfo(year);
LOG_EX(LOG_Error, "Unsync Database: year = %d\n", year);
if(i++ % 10 == 0)
{
LOG_EX(LOG_Error, "Unsync Database: year = %d\n", year);
}
return (-ERR_UNINIT_ITEM);
}

View File

@ -6,6 +6,7 @@ TARGET := libuvdbus.so
commonSources := \
log/hexdump.c \
log/log.c \
Framework/IoT/Boardlink/boardlink_iot.c \
Framework/HeartDaemon/heart_daemon.c \
Framework/Configure/config_engine.c \
Framework/Configure/ini_prase.c \

View File

@ -0,0 +1,44 @@
#ifndef BOARDLINK_IOT_H
#define BOARDLINK_IOT_H
#ifndef PLATFORM_CPU
#define BL_IOT_MSG_TAGS ("BLNLINK")
#define BL_MAX_MSG (1024)
#define ETH_ALEN (6)
typedef enum
{
MSG_IN_DISCOVERY_MODE = 0,
MSG_OUT_DISCOVERY_MODE,
MSG_GET_WLAN_INFO,
MSG_BYPASS_MODE,
} BL_IOT_MSG_TYPE;
#pragma pack (push)
#pragma pack (1)
typedef struct
{
unsigned char msgTags[8];
unsigned char dstMac[ETH_ALEN];
unsigned char msgType;
unsigned int msglen;
unsigned char msgData[BL_MAX_MSG];
} BL_IOT_MSG, *PBL_IOT_MSG;
typedef struct
{
unsigned char channel;
unsigned char dev_mac[ETH_ALEN];
unsigned char bssid[ETH_ALEN];
unsigned char ssid[32];
} WL_INFO, *PWL_INFO;
#pragma pack (pop)
#define BL_IOT_MSG_LEN(len) (sizeof(BL_IOT_MSG) - BL_MAX_MSG + len)
typedef void (*BlMsgCb)(PBL_IOT_MSG pMsg);
int BL_Init(BlMsgCb cbOnMsg);
int BL_SendBLMsg(BL_IOT_MSG_TYPE msgType, unsigned char* pData, unsigned int len);
int BL_SendBLMsgTo(BL_IOT_MSG_TYPE msgType, unsigned char* pData, unsigned int len, unsigned char dstMac[ETH_ALEN]);
#endif
#endif

View File

@ -39,6 +39,7 @@ typedef struct
typedef struct
{
int isReady;
int year;
unsigned char days[366];
} WORKDAY_INFO, *PWORKDAY_INFO;
@ -202,6 +203,7 @@ unsigned int AlarmTimerAdd(int year,
int *pError);
int CurrentIsWorkDay(int year, int day);
int IsHolidayDBSynced(void);
const char* DumpTimerRepeatModeString(int mode);
unsigned long long GetPartitionFreeSize(const char *pPartPath);
WIFI_STATUS GetCurrWIFIConnStatus(void);
@ -215,7 +217,9 @@ char* GetCurrentVersion(void);
void CfgFileInit(void);
int CfgGetIntValue(const char* pTags, int defValue);
int CfgGetInvValueV1(const char* pTags, int defValue, int* pErr);
int CfgGetIntValueV1(const char* pTags, int defValue, int* pErr);
int CfgGetIntValueV2(const char* pTags, int defValue, int* pErr);
int GetServerModeFromCC(int defValue, int* pErr);
char* CfgGetStringValue(const char* pTags, char* pDefValue);
double CfgGetFloatValue(const char* pTags, double defValue);
int CfgGetBoolValue(const char* pTags, int defValue);

View File

@ -19,9 +19,10 @@ typedef enum
typedef enum
{
DEV_MODE = 0,
TEST_MODE = 1,
PUBLISH_MODE = 2,
DEV_MODE = 0,
TEST_MODE = 1,
PUBLISH_MODE = 2,
PUBLISH_PREBUILD = 3,
MAX_MODE
} SERVER_MODE_TYPE;

View File

@ -91,6 +91,8 @@ const SKIN_RES_INFO g_SkinDefaultResTable[] = {
{VOICE_RES, "0", "v5012", DEF_SKINS_ROOT_PATH"voice/a-a-02.mp3", "837a2222c961824e98c0d3751a234ae6"},
{VOICE_RES, "0", "v5013", DEF_SKINS_ROOT_PATH"voice/a-a-03.mp3", "0ec34a1f19ee7cea6b139d214e59026d"},
{VOICE_RES, "0", "v502", DEF_SKINS_ROOT_PATH"voice/a-n-01.mp3", "b1eb13ed8c9afaa2989763c3d379b39a"},
{VOICE_RES, "0", "v601", DEF_SKINS_ROOT_PATH"voice/b-m-1.mp3", "820cf2c01e03726b95bc4346a2ce8f8b"},
{VOICE_RES, "0", "v602", DEF_SKINS_ROOT_PATH"voice/b-m-2.mp3", "35a48b8ec586acfb99a612b4fc1ba57a"},
///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// picture resources

View File

@ -145,6 +145,18 @@ typedef enum {
CMD_WIFI_CHANGE_VALID_AP_OUT,
CMD_WIFI_CHANGE_VALID_AP_RESP,
CMD_WIFI_BL_CMD_START,
CMD_WIFI_BL_CONF,
CMD_WIFI_BL_CONF_ABORT,
CMD_WIFI_BL_DEV_INFO_NTF,
CMD_WIFI_BL_CLOUD_CHALLENGE_SIGNATURE,
CMD_WIFI_BL_DEV_SIGNATURE,
CMD_WIFI_BL_CLOUD_SHAREDKEY,
CMD_WIFI_BL_DEV_TOKEN,
CMD_WIFI_BL_DEV_TOKEN_BOUND,
CMD_WIFI_BL_CONF_FAILED,
CMD_WIFI_BL_CMD_END,
CMD_BT_NAME_GET_REQ,
CMD_BT_NAME_GET_RESP,
CMD_BT_EVT_NTF,
@ -187,6 +199,7 @@ typedef enum {
CMD_BT_VOL_CHANGE,
CMD_BT_BREDR_REBOOT_CLOSE,
CMD_BT_AVK_DEV_CON_CONFLICT,
CMD_KPLAYER_START = 0x1b00,
CMD_KPLAYER_STOP,
@ -433,6 +446,9 @@ typedef enum {
ERR_NETWORK_SEND,
ERR_NETWORK_NOT_CONNECTED,
ERR_CREATE_SOCKET,
ERR_BIND_SOCKET,
ERR_UNSUPPORT,
} DBUS_WITH_LIBUV_ERROR;

View File

@ -1291,6 +1291,7 @@ int SysPointMark(char* pMarkInfo)
int SysPointMarkUpload(void)
{
int ret, size = 0;
char path[MAX_PATH];
memset(path, 0, MAX_PATH);
@ -1301,14 +1302,31 @@ int SysPointMarkUpload(void)
unlink(path);
}
GET_FILE_SIZE(g_SysPonitInfo.savePath, size);
if(size <= 0)
{
LOG_EX(LOG_Debug, "Upload System Mark Data [%s] Is Empty, Skip......\n", g_SysPonitInfo.savePath);
return 0;
}
rename(g_SysPonitInfo.savePath, path);
fclose(g_SysPonitInfo.pMarkFile);
g_SysPonitInfo.pMarkFile = fopen(g_SysPonitInfo.savePath, "w+");
InetHttpUploadFileSync(GetCurServerAddr(MARK_POINT_MODULE), path, NULL);
size = 0;
do
{
ret = InetHttpUploadFileSync(GetCurServerAddr(MARK_POINT_MODULE), path, NULL);
sleep(1);
} while(ret != 0 && ++size < 3);
LOG_EX(LOG_Debug, "Upload System Mark Data [%s] To Server [%s]\n", path, GetCurServerAddr(MARK_POINT_MODULE));
unlink(path);
return 0;
}