Commit ec776a84 authored by chen.weican's avatar chen.weican

【修改内容】去warning

【提交人】陈伟灿
parent 2a66f954
...@@ -48,7 +48,7 @@ static int KK_Ccuid_init(void) ...@@ -48,7 +48,7 @@ static int KK_Ccuid_init(void)
char ccuidTmp[DEVICE_CODE_LEN] = {0}; char ccuidTmp[DEVICE_CODE_LEN] = {0};
int ccuid_len = 0; int ccuid_len = 0;
#ifdef CONFIG_A133_PLATFORM #ifdef CONFIG_A133_PLATFORM
uint8_t data[128] = {0}; char data[128] = {0};
int data_len = 0; int data_len = 0;
char *pstart = NULL; char *pstart = NULL;
char *pEnd = NULL; char *pEnd = NULL;
...@@ -56,7 +56,7 @@ static int KK_Ccuid_init(void) ...@@ -56,7 +56,7 @@ static int KK_Ccuid_init(void)
INFO_PRINT("---GET_CCUID_CMD:%s\n",data); INFO_PRINT("---GET_CCUID_CMD:%s\n",data);
if(data_len > 0 && data_len <= 128){ if(data_len > 0 && data_len <= 128){
pstart = data; pstart = data;
pEnd = strstr(data,"-"); pEnd = strstr((char*)data,"-");
if(pstart != NULL && pEnd != NULL){ if(pstart != NULL && pEnd != NULL){
printf("-------123---------------------\n"); printf("-------123---------------------\n");
memcpy(ccuidTmp,pstart,pEnd-pstart); memcpy(ccuidTmp,pstart,pEnd-pstart);
...@@ -108,7 +108,7 @@ int kk_cloud_get_pid(char *productId) ...@@ -108,7 +108,7 @@ int kk_cloud_get_pid(char *productId)
char s_key[128] = {0}; char s_key[128] = {0};
static int kk_cloud_key_init(void) static int kk_cloud_key_init(void)
{ {
uint8_t key[128] = {0}; char key[128] = {0};
int key_len = 0; int key_len = 0;
#ifdef CONFIG_A133_PLATFORM #ifdef CONFIG_A133_PLATFORM
char *pstart = NULL; char *pstart = NULL;
......
...@@ -53,6 +53,7 @@ int kk_check_config_file(char* path,char **config) ...@@ -53,6 +53,7 @@ int kk_check_config_file(char* path,char **config)
}else{ }else{
return -1; return -1;
} }
return 0;
} }
static int _kk_parse_config_dl_host(cJSON *configInfo,char *url){ static int _kk_parse_config_dl_host(cJSON *configInfo,char *url){
char ccuid[32] = {0}; char ccuid[32] = {0};
......
...@@ -119,7 +119,7 @@ int kk_parse_token(char *info){ ...@@ -119,7 +119,7 @@ int kk_parse_token(char *info){
if(fp != NULL){ if(fp != NULL){
fwrite(jwt->valuestring,strlen(jwt->valuestring),1,fp); fwrite(jwt->valuestring,strlen(jwt->valuestring),1,fp);
#ifdef CONFIG_A133_PLATFORM #ifdef CONFIG_A133_PLATFORM
fsync(fp); //fsync(fp);
fclose(fp); fclose(fp);
#else #else
fclose(fp); fclose(fp);
......
...@@ -217,7 +217,7 @@ static cJSON *kk_zb_dev_hw_info_build(const char *deviceCode,const char *product ...@@ -217,7 +217,7 @@ static cJSON *kk_zb_dev_hw_info_build(const char *deviceCode,const char *product
char mac[32] = {0}; char mac[32] = {0};
int online_status = 0; int online_status = 0;
int pid; int pid;
if(mac==NULL){ if(deviceCode==NULL){
return NULL; return NULL;
} }
......
...@@ -44,7 +44,7 @@ static int special_handling_for_compatibility(kk_map_dev_node_t *devNode,cJSON * ...@@ -44,7 +44,7 @@ static int special_handling_for_compatibility(kk_map_dev_node_t *devNode,cJSON *
int oType = 0; int oType = 0;
int ret = -1; int ret = -1;
if(devNode->opearteType==NULL||opcode==NULL||arg==NULL){ if(devNode == NULL ||opcode==NULL||arg==NULL){
return -1; return -1;
} }
oType = atoi(devNode->opearteType); oType = atoi(devNode->opearteType);
......
...@@ -75,9 +75,9 @@ int kk_lan_get_pid(_OU_ char *productId) ...@@ -75,9 +75,9 @@ int kk_lan_get_pid(_OU_ char *productId)
static void kk_lan_ccuid_init(void) static void kk_lan_ccuid_init(void)
{ {
#ifdef CONFIG_A133_PLATFORM #ifdef CONFIG_A133_PLATFORM
uint8_t data[128] = {0}; char data[128] = {0};
int data_len = 0; int data_len = 0;
uint8_t uuid[32] = {0}; char uuid[32] = {0};
char *pstart = NULL; char *pstart = NULL;
char *pEnd = NULL; char *pEnd = NULL;
HAL_Execel_cmd(GET_CCUID_CMD,(char *)data,sizeof(data),&data_len); HAL_Execel_cmd(GET_CCUID_CMD,(char *)data,sizeof(data),&data_len);
......
...@@ -1282,13 +1282,13 @@ cJSON *_kk_sync_central_ac_indoorunit_to_sdk(SYN_CENTRAL_AC_INDOOR* indoorunit) ...@@ -1282,13 +1282,13 @@ cJSON *_kk_sync_central_ac_indoorunit_to_sdk(SYN_CENTRAL_AC_INDOOR* indoorunit)
cJSON *item = cJSON_CreateObject(); cJSON *item = cJSON_CreateObject();
cJSON *status; cJSON *status;
cJSON_AddStringToObject(item, "id",(indoorunit->id)?indoorunit->id:""); cJSON_AddStringToObject(item, "id",strlen(indoorunit->id)>0?indoorunit->id:"");
cJSON_AddStringToObject(item, "room_id", (indoorunit->room_id)?indoorunit->room_id:""); cJSON_AddStringToObject(item, "room_id", strlen(indoorunit->room_id)>0?indoorunit->room_id:"");
cJSON_AddStringToObject(item, "indoorunit_name", (indoorunit->indoorunit_name)?indoorunit->indoorunit_name:""); cJSON_AddStringToObject(item, "indoorunit_name", strlen(indoorunit->indoorunit_name)>0?indoorunit->indoorunit_name:"");
cJSON_AddStringToObject(item, "indooruint_addr", (indoorunit->indooruint_addr)?indoorunit->indooruint_addr:""); cJSON_AddStringToObject(item, "indooruint_addr", strlen(indoorunit->indooruint_addr)>0?indoorunit->indooruint_addr:"");
cJSON_AddStringToObject(item, "central_ac_gw_devid", (indoorunit->central_ac_gw_devid)?indoorunit->central_ac_gw_devid:""); cJSON_AddStringToObject(item, "central_ac_gw_devid", strlen(indoorunit->central_ac_gw_devid)>0?indoorunit->central_ac_gw_devid:"");
cJSON_AddItemToObject(item, "indoorunit_state",(indoorunit->indoorunit_state)?indoorunit->indoorunit_state:cJSON_CreateNull()); cJSON_AddItemToObject(item, "indoorunit_state",(indoorunit->indoorunit_state)!=NULL?indoorunit->indoorunit_state:cJSON_CreateNull());
return item; return item;
} }
cJSON *_kk_sync_central_ac_indoorunits(int num,SYN_CENTRAL_AC_INDOOR *indoorunits) cJSON *_kk_sync_central_ac_indoorunits(int num,SYN_CENTRAL_AC_INDOOR *indoorunits)
......
...@@ -116,7 +116,7 @@ static void watcher_cb (struct ev_loop *loop ,struct ev_io *w, int revents) ...@@ -116,7 +116,7 @@ static void watcher_cb (struct ev_loop *loop ,struct ev_io *w, int revents)
loop_ctrl->isconnect = 1; loop_ctrl->isconnect = 1;
//if sub, need filter sbuscribe str //if sub, need filter sbuscribe str
if (IPC_PLAT2MID == loop_ctrl->type || IPC_MID2PLAT == loop_ctrl->type){ if (IPC_PLAT2MID == loop_ctrl->type || IPC_MID2PLAT == loop_ctrl->type){
validDat = _parse_data_by_subscribe((char*)dat, bytes, &validLen, (void**)&chlMark); validDat = (uint8_t *)_parse_data_by_subscribe((char*)dat, bytes, &validLen, (void**)&chlMark);
}else{ }else{
validDat = dat; validDat = dat;
validLen = bytes; validLen = bytes;
...@@ -126,7 +126,7 @@ static void watcher_cb (struct ev_loop *loop ,struct ev_io *w, int revents) ...@@ -126,7 +126,7 @@ static void watcher_cb (struct ev_loop *loop ,struct ev_io *w, int revents)
if (strncmp((char*)validDat,MAGIC_ACK, strlen(MAGIC_ACK)) == 0){ if (strncmp((char*)validDat,MAGIC_ACK, strlen(MAGIC_ACK)) == 0){
}else{ }else{
kk_ipc_send_ex(loop_ctrl->type, MAGIC_ACK, strlen(MAGIC_ACK)+1, chlMark); kk_ipc_send_ex(loop_ctrl->type, MAGIC_ACK, strlen(MAGIC_ACK)+1, (char *)chlMark);
} }
loop_ctrl->isconnect =1; loop_ctrl->isconnect =1;
...@@ -136,7 +136,7 @@ static void watcher_cb (struct ev_loop *loop ,struct ev_io *w, int revents) ...@@ -136,7 +136,7 @@ static void watcher_cb (struct ev_loop *loop ,struct ev_io *w, int revents)
loop_ctrl->isconnect =0; loop_ctrl->isconnect =0;
} }
if (loop_ctrl->cb != NULL){ if (loop_ctrl->cb != NULL){
loop_ctrl->cb((void *)validDat, validLen, chlMark); loop_ctrl->cb((void *)validDat, validLen, (char *)chlMark);
} }
nn_freemsg(dat); nn_freemsg(dat);
} }
...@@ -209,7 +209,7 @@ int __nanomsg_init(Bloop_ctrl_t *loop_ctrl, ipc_type type,char* chlMark, char* i ...@@ -209,7 +209,7 @@ int __nanomsg_init(Bloop_ctrl_t *loop_ctrl, ipc_type type,char* chlMark, char* i
ERROR_PRINT("__nanomsg_init loop_ctrl->ab.n =%d \r\n",loop_ctrl->ab.n); ERROR_PRINT("__nanomsg_init loop_ctrl->ab.n =%d \r\n",loop_ctrl->ab.n);
return -1; return -1;
} }
if (ret = nn_bind(loop_ctrl->ba.n, APP2MID) < 0) { if (nn_bind(loop_ctrl->ba.n, APP2MID) < 0) {
ERROR_PRINT("__nanomsg_init loop_ctrl->ba.n nn_bind error ret=%d,%s \r\n", ret, APP2MID); ERROR_PRINT("__nanomsg_init loop_ctrl->ba.n nn_bind error ret=%d,%s \r\n", ret, APP2MID);
return -1; return -1;
} }
...@@ -321,7 +321,7 @@ int __nanomsg_init(Bloop_ctrl_t *loop_ctrl, ipc_type type,char* chlMark, char* i ...@@ -321,7 +321,7 @@ int __nanomsg_init(Bloop_ctrl_t *loop_ctrl, ipc_type type,char* chlMark, char* i
void* loop_thread(void *arg){ void* loop_thread(void *arg){
INFO_PRINT("loop_thread start!\r\n"); INFO_PRINT("loop_thread start!\r\n");
ev_run (gloop, 0); ev_run (gloop, 0);
return NULL;
} }
int kk_set_storage_dir(char* path){ int kk_set_storage_dir(char* path){
...@@ -350,6 +350,7 @@ int kk_int_storage_dir(){ ...@@ -350,6 +350,7 @@ int kk_int_storage_dir(){
} }
DEBUG_PRINT("[%s]APP2MID=%s, APP2MID_PUBSUB=%s, PLAT2MID=%s \n", __FUNCTION__, APP2MID, APP2MID_PUBSUB, PLAT2MID); DEBUG_PRINT("[%s]APP2MID=%s, APP2MID_PUBSUB=%s, PLAT2MID=%s \n", __FUNCTION__, APP2MID, APP2MID_PUBSUB, PLAT2MID);
return 0;
} }
......
...@@ -160,7 +160,7 @@ time_t HAL_GetTime_s(char *outStr) ...@@ -160,7 +160,7 @@ time_t HAL_GetTime_s(char *outStr)
time_t t; time_t t;
t = time(NULL); t = time(NULL);
sprintf(outStr,"%d",t); sprintf(outStr,"%ld",t);
return t; return t;
} }
......
...@@ -77,8 +77,11 @@ typedef struct cJSON_Hooks ...@@ -77,8 +77,11 @@ typedef struct cJSON_Hooks
void *(*malloc_fn)(size_t sz); void *(*malloc_fn)(size_t sz);
void (*free_fn)(void *ptr); void (*free_fn)(void *ptr);
} cJSON_Hooks; } cJSON_Hooks;
#ifndef cJSON_bool_ex
#define cJSON_bool_ex
typedef int cJSON_bool; typedef int cJSON_bool;
#endif
#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32)) #if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32))
#define __WINDOWS__ #define __WINDOWS__
......
...@@ -196,7 +196,7 @@ size_t WebSocket_calculateFrameHeaderSize(networkHandles *net, int mask_data, si ...@@ -196,7 +196,7 @@ size_t WebSocket_calculateFrameHeaderSize(networkHandles *net, int mask_data, si
ret = 2; /* header 2 bytes */ ret = 2; /* header 2 bytes */
else if ( data_len < 65536u ) else if ( data_len < 65536u )
ret = 4; /* for extra 2-bytes for payload length */ ret = 4; /* for extra 2-bytes for payload length */
else if ( data_len < 0xFFFFFFFFFFFFFFFF ) else if ( (long long)data_len < 0xFFFFFFFFFFFFFFFF )
ret = 10; /* for extra 8-bytes for payload length */ ret = 10; /* for extra 8-bytes for payload length */
if ( mask_data & 0x1 ) if ( mask_data & 0x1 )
ret += sizeof(uint32_t); /* for mask */ ret += sizeof(uint32_t); /* for mask */
...@@ -297,7 +297,7 @@ static struct frameData WebSocket_buildFrame(networkHandles* net, int opcode, in ...@@ -297,7 +297,7 @@ static struct frameData WebSocket_buildFrame(networkHandles* net, int opcode, in
memcpy( &rc.wsbuf0[buf_len], &len, 2u ); memcpy( &rc.wsbuf0[buf_len], &len, 2u );
buf_len += 2; buf_len += 2;
} }
else if ( data_len < 0xFFFFFFFFFFFFFFFF ) else if ( (long long)data_len < 0xFFFFFFFFFFFFFFFF )
{ {
uint64_t len = htobe64((uint64_t)data_len); uint64_t len = htobe64((uint64_t)data_len);
rc.wsbuf0[buf_len++] |= (127u & 0x7F); rc.wsbuf0[buf_len++] |= (127u & 0x7F);
......
#include "id.h"
struct globle g_info;
#define sequenceMask (-1L ^ (-1L << 12L))
void set_workid(int workid)
{
g_info.workid = workid;
}
pid_t gettid( void )
{
return syscall( __NR_gettid );
}
uint64_t get_curr_ms()
{
struct timeval time_now;
gettimeofday(&time_now,NULL);
uint64_t ms_time =time_now.tv_sec*1000+time_now.tv_usec/1000;
return ms_time;
}
uint64_t wait_next_ms(uint64_t lastStamp)
{
uint64_t cur = 0;
do {
cur = get_curr_ms();
} while (cur <= lastStamp);
return cur;
}
int atomic_incr(int id)
{
__sync_add_and_fetch( &id, 1 );
return id;
}
uint64_t get_unique_id()
{
uint64_t uniqueId=0;
uint64_t nowtime = get_curr_ms();
uniqueId = nowtime<<22;
uniqueId |=(g_info.workid&0x3ff)<<12;
if (nowtime <g_info.last_stamp)
{
perror("error");
exit(-1);
}
if (nowtime == g_info.last_stamp)
{
g_info.seqid = atomic_incr(g_info.seqid)& sequenceMask;
if (g_info.seqid ==0)
{
nowtime = wait_next_ms(g_info.last_stamp);
}
}
else
{
g_info.seqid = 0;
}
g_info.last_stamp = nowtime;
uniqueId |=g_info.seqid;
return uniqueId;
}
/*
snowflake
ID 生成策略
毫秒级时间41位+机器ID 10位+毫秒内序列12位。
0 41 51 64 +-----------+------+------+ |time |pc |inc | +-----------+------+------+
前41bits是以微秒为单位的timestamp。
接着10bits是事先配置好的机器ID。
最后12bits是累加计数器。
macheine id(10bits)标明最多只能有1024台机器同时产生ID,sequence number(12bits)也标明1台机器1ms中最多产生4096个ID, *
注意点,因为使用到位移运算,所以需要64位操作系统,不然生成的ID会有可能不正确
*/
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <stdlib.h>
#include <sched.h>
#include <linux/unistd.h>
#include <sys/syscall.h>
#include <errno.h>
#include<linux/types.h>
#include<time.h>
#include <stdint.h>
#include <sys/time.h>
struct globle
{
int global_int:12;
uint64_t last_stamp;
int workid;
int seqid;
};
void set_workid(int workid);
pid_t gettid( void );
uint64_t get_curr_ms();
uint64_t wait_next_ms(uint64_t lastStamp);
int atomic_incr(int id);
uint64_t get_unique_id();
\ No newline at end of file
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "kk_log.h" #include "kk_log.h"
#include "kk_area_handle.h" #include "kk_area_handle.h"
#include "kk_hal.h" #include "kk_hal.h"
#include "id.h"
extern sqlite3 *g_kk_pDb; extern sqlite3 *g_kk_pDb;
...@@ -105,7 +104,7 @@ int kk_area_init(void) ...@@ -105,7 +104,7 @@ int kk_area_init(void)
{ {
int res = 0; int res = 0;
kk_area_ctx_t *ctx = _kk_area_get_ctx(); kk_area_ctx_t *ctx = _kk_area_get_ctx();
set_workid(100); //set_workid(100);
/* Create Mutex */ /* Create Mutex */
ctx->mutex = HAL_MutexCreate(); ctx->mutex = HAL_MutexCreate();
if (ctx->mutex == NULL) { if (ctx->mutex == NULL) {
......
...@@ -221,7 +221,7 @@ int kk_motor_bind_db_find_byDeviceCode(const char* panelDCode,struct kk_motor_bi ...@@ -221,7 +221,7 @@ int kk_motor_bind_db_find_byDeviceCode(const char* panelDCode,struct kk_motor_bi
int listSize = 0; int listSize = 0;
sqlite3_stmt *stmt; sqlite3_stmt *stmt;
char *sqlCmd = NULL; char *sqlCmd = NULL;
const unsigned char *motorDeviceCode = NULL; char *motorDeviceCode = NULL;
int motor_ep = 0; int motor_ep = 0;
int dummyId = -1; int dummyId = -1;
...@@ -233,7 +233,7 @@ int kk_motor_bind_db_find_byDeviceCode(const char* panelDCode,struct kk_motor_bi ...@@ -233,7 +233,7 @@ int kk_motor_bind_db_find_byDeviceCode(const char* panelDCode,struct kk_motor_bi
INFO_PRINT("Table searchCmd:%s\n",sqlCmd); INFO_PRINT("Table searchCmd:%s\n",sqlCmd);
sqlite3_prepare_v2(ctx->pDb, sqlCmd, strlen(sqlCmd), &stmt, NULL); sqlite3_prepare_v2(ctx->pDb, sqlCmd, strlen(sqlCmd), &stmt, NULL);
while(sqlite3_step(stmt) == SQLITE_ROW){ while(sqlite3_step(stmt) == SQLITE_ROW){
motorDeviceCode = sqlite3_column_text(stmt, MOTOR_BIND_DB_MOTOR_DEVICECODE); motorDeviceCode = (char*)sqlite3_column_text(stmt, MOTOR_BIND_DB_MOTOR_DEVICECODE);
motor_ep = sqlite3_column_int(stmt, MOTOR_BIND_DB_MOTOR_EP); motor_ep = sqlite3_column_int(stmt, MOTOR_BIND_DB_MOTOR_EP);
dummyId = sqlite3_column_int(stmt, MOTOR_BIND_DB_DUMMYID); dummyId = sqlite3_column_int(stmt, MOTOR_BIND_DB_DUMMYID);
memcpy(pInfo->deviceCode,motorDeviceCode,strlen(motorDeviceCode)); memcpy(pInfo->deviceCode,motorDeviceCode,strlen(motorDeviceCode));
...@@ -255,7 +255,7 @@ int kk_motor_bind_db_find_byMotorDeviceCode(const char* motorCode,struct kk_moto ...@@ -255,7 +255,7 @@ int kk_motor_bind_db_find_byMotorDeviceCode(const char* motorCode,struct kk_moto
int listSize = 0; int listSize = 0;
sqlite3_stmt *stmt; sqlite3_stmt *stmt;
char *sqlCmd = NULL; char *sqlCmd = NULL;
const unsigned char *panelDeviceCode = NULL; char *panelDeviceCode = NULL;
int motor_ep = 0; int motor_ep = 0;
int dummyId = -1; int dummyId = -1;
...@@ -269,7 +269,7 @@ int kk_motor_bind_db_find_byMotorDeviceCode(const char* motorCode,struct kk_moto ...@@ -269,7 +269,7 @@ int kk_motor_bind_db_find_byMotorDeviceCode(const char* motorCode,struct kk_moto
while(sqlite3_step(stmt) == SQLITE_ROW){ while(sqlite3_step(stmt) == SQLITE_ROW){
panelDeviceCode = sqlite3_column_text(stmt, MOTOR_BIND_DB_PANEL_DEVICECODE); panelDeviceCode = (char *)sqlite3_column_text(stmt, MOTOR_BIND_DB_PANEL_DEVICECODE);
motor_ep = sqlite3_column_int(stmt, MOTOR_BIND_DB_MOTOR_EP); motor_ep = sqlite3_column_int(stmt, MOTOR_BIND_DB_MOTOR_EP);
dummyId = sqlite3_column_int(stmt, MOTOR_BIND_DB_DUMMYID); dummyId = sqlite3_column_int(stmt, MOTOR_BIND_DB_DUMMYID);
memcpy(pInfo->deviceCode,panelDeviceCode,strlen(panelDeviceCode)); memcpy(pInfo->deviceCode,panelDeviceCode,strlen(panelDeviceCode));
...@@ -291,7 +291,7 @@ int kk_motor_bind_db_find(const char* panelDCode,int panelEpNum,struct kk_motor_ ...@@ -291,7 +291,7 @@ int kk_motor_bind_db_find(const char* panelDCode,int panelEpNum,struct kk_motor_
int listSize = 0; int listSize = 0;
sqlite3_stmt *stmt; sqlite3_stmt *stmt;
char *sqlCmd = NULL; char *sqlCmd = NULL;
const unsigned char *motorDeviceCode = NULL; char *motorDeviceCode = NULL;
int motor_ep = 0; int motor_ep = 0;
int dummyId = -1; int dummyId = -1;
...@@ -306,7 +306,7 @@ int kk_motor_bind_db_find(const char* panelDCode,int panelEpNum,struct kk_motor_ ...@@ -306,7 +306,7 @@ int kk_motor_bind_db_find(const char* panelDCode,int panelEpNum,struct kk_motor_
while(sqlite3_step(stmt) == SQLITE_ROW){ while(sqlite3_step(stmt) == SQLITE_ROW){
motorDeviceCode = sqlite3_column_text(stmt, MOTOR_BIND_DB_MOTOR_DEVICECODE); motorDeviceCode = (char *)sqlite3_column_text(stmt, MOTOR_BIND_DB_MOTOR_DEVICECODE);
motor_ep = sqlite3_column_int(stmt, MOTOR_BIND_DB_MOTOR_EP); motor_ep = sqlite3_column_int(stmt, MOTOR_BIND_DB_MOTOR_EP);
dummyId = sqlite3_column_int(stmt, MOTOR_BIND_DB_DUMMYID); dummyId = sqlite3_column_int(stmt, MOTOR_BIND_DB_DUMMYID);
memcpy(pInfo->deviceCode,motorDeviceCode,strlen(motorDeviceCode)); memcpy(pInfo->deviceCode,motorDeviceCode,strlen(motorDeviceCode));
...@@ -331,7 +331,7 @@ int kk_motor_bind_db_find_ex(int dummyId,struct kk_motor_bind_info* info,int max ...@@ -331,7 +331,7 @@ int kk_motor_bind_db_find_ex(int dummyId,struct kk_motor_bind_info* info,int max
int listSize = 0; int listSize = 0;
sqlite3_stmt *stmt; sqlite3_stmt *stmt;
char *sqlCmd = NULL; char *sqlCmd = NULL;
const unsigned char *motorDeviceCode = NULL; char *motorDeviceCode = NULL;
int motor_ep = 0; int motor_ep = 0;
struct kk_motor_bind_info* pInfo = info; struct kk_motor_bind_info* pInfo = info;
...@@ -345,7 +345,7 @@ int kk_motor_bind_db_find_ex(int dummyId,struct kk_motor_bind_info* info,int max ...@@ -345,7 +345,7 @@ int kk_motor_bind_db_find_ex(int dummyId,struct kk_motor_bind_info* info,int max
while(sqlite3_step(stmt) == SQLITE_ROW){ while(sqlite3_step(stmt) == SQLITE_ROW){
motorDeviceCode = sqlite3_column_text(stmt, MOTOR_BIND_DB_MOTOR_DEVICECODE); motorDeviceCode = (char *)sqlite3_column_text(stmt, MOTOR_BIND_DB_MOTOR_DEVICECODE);
motor_ep = sqlite3_column_int(stmt, MOTOR_BIND_DB_MOTOR_EP); motor_ep = sqlite3_column_int(stmt, MOTOR_BIND_DB_MOTOR_EP);
memcpy(pInfo->deviceCode,motorDeviceCode,strlen(motorDeviceCode)); memcpy(pInfo->deviceCode,motorDeviceCode,strlen(motorDeviceCode));
pInfo->epNum = motor_ep; pInfo->epNum = motor_ep;
......
...@@ -126,9 +126,9 @@ static int _setDevice_Code(_IN_ char *device_code,int len) ...@@ -126,9 +126,9 @@ static int _setDevice_Code(_IN_ char *device_code,int len)
static int HAL_Ccuid_init(void) static int HAL_Ccuid_init(void)
{ {
#ifdef CONFIG_A133_PLATFORM #ifdef CONFIG_A133_PLATFORM
uint8_t data[128] = {0}; char data[128] = {0};
int data_len = 0; int data_len = 0;
uint8_t uuid[32] = {0}; char uuid[32] = {0};
char *pstart = NULL; char *pstart = NULL;
char *pEnd = NULL; char *pEnd = NULL;
HAL_Execel_cmd(GET_CCUID_CMD,(char *)data,sizeof(data),&data_len); HAL_Execel_cmd(GET_CCUID_CMD,(char *)data,sizeof(data),&data_len);
...@@ -494,7 +494,7 @@ static int kk_panel_bind_motor_delete(const char* deviceCode,int dummyId) ...@@ -494,7 +494,7 @@ static int kk_panel_bind_motor_delete(const char* deviceCode,int dummyId)
snprintf(sceneId,sizeof(sceneId),"%d",dummyId); snprintf(sceneId,sizeof(sceneId),"%d",dummyId);
cJSON_AddStringToObject(paras,"sceneId",sceneId); cJSON_AddStringToObject(paras,"sceneId",sceneId);
cJSON_AddItemToObject(payload, "params", paras); cJSON_AddItemToObject(payload, "params", paras);
snprintf(tm,sizeof(tm),"%d",time(NULL)); snprintf(tm,sizeof(tm),"%ld",time(NULL));
cJSON_AddStringToObject(payload,"time",tm); cJSON_AddStringToObject(payload,"time",tm);
cJSON_AddStringToObject(payload,"method",KK_THING_METHOD_DELETESCENC); cJSON_AddStringToObject(payload,"method",KK_THING_METHOD_DELETESCENC);
cJSON_AddItemToObject(root, "payload", payload); cJSON_AddItemToObject(root, "payload", payload);
...@@ -543,7 +543,7 @@ static int kk_panel_bind_motor_add_actions(const char* deviceCode,cJSON* actions ...@@ -543,7 +543,7 @@ static int kk_panel_bind_motor_add_actions(const char* deviceCode,cJSON* actions
cJSON_AddStringToObject(paras,"sceneId",sceneId); cJSON_AddStringToObject(paras,"sceneId",sceneId);
cJSON_AddItemToObject(paras, "actions", actions); cJSON_AddItemToObject(paras, "actions", actions);
cJSON_AddItemToObject(payload, "params", paras); cJSON_AddItemToObject(payload, "params", paras);
snprintf(tm,sizeof(tm),"%d",time(NULL)); snprintf(tm,sizeof(tm),"%ld",time(NULL));
cJSON_AddStringToObject(payload,"time",tm); cJSON_AddStringToObject(payload,"time",tm);
cJSON_AddStringToObject(payload,"method",KK_THING_METHOD_ADDSCENC); cJSON_AddStringToObject(payload,"method",KK_THING_METHOD_ADDSCENC);
cJSON_AddItemToObject(root, "payload", payload); cJSON_AddItemToObject(root, "payload", payload);
......
...@@ -846,6 +846,7 @@ int BodySensorTrigger_check(void) ...@@ -846,6 +846,7 @@ int BodySensorTrigger_check(void)
} }
ptr=ptr->next; ptr=ptr->next;
} }
return 0;
} }
int BodySensorTrigger_report(const char *deviceCode,int ep,cJSON *param) int BodySensorTrigger_report(const char *deviceCode,int ep,cJSON *param)
...@@ -870,7 +871,7 @@ int BodySensorTrigger_report(const char *deviceCode,int ep,cJSON *param) ...@@ -870,7 +871,7 @@ int BodySensorTrigger_report(const char *deviceCode,int ep,cJSON *param)
ptr->alarm_time = time(NULL); ptr->alarm_time = time(NULL);
ptr->report_time = ptr->alarm_time + (ptr->noActive_time*60); ptr->report_time = ptr->alarm_time + (ptr->noActive_time*60);
INFO_PRINT("\n\nptr->alarm_time=%d,ptr->report_time=%d \n\n",ptr->alarm_time,ptr->report_time); INFO_PRINT("\n\nptr->alarm_time=%ld,ptr->report_time=%ld \n\n",ptr->alarm_time,ptr->report_time);
}else{ }else{
INFO_PRINT("\n\n ------------------>BodySensorNoActive time 0\n\n"); INFO_PRINT("\n\n ------------------>BodySensorNoActive time 0\n\n");
//... //...
......
...@@ -68,7 +68,10 @@ int lite_cjson_object_item_by_index( ...@@ -68,7 +68,10 @@ int lite_cjson_object_item_by_index(
/*** lite_cjson create, add and print ***/ /*** lite_cjson create, add and print ***/
#ifndef cJSON_bool_ex
#define cJSON_bool_ex
typedef int cJSON_bool; typedef int cJSON_bool;
#endif
#define cJSON_IsReference 256 #define cJSON_IsReference 256
#define cJSON_StringIsConst 512 #define cJSON_StringIsConst 512
......
CONFIG_ENV_CFLAGS += \ CONFIG_ENV_CFLAGS += \
-Os -Wall\ -Os -Werror\
-g3 --coverage \ -g3 --coverage \
-D_PLATFORM_IS_LINUX_ \ -D_PLATFORM_IS_LINUX_ \
...@@ -21,7 +21,7 @@ CONFIG_ENV_CFLAGS += \ ...@@ -21,7 +21,7 @@ CONFIG_ENV_CFLAGS += \
-DCONFIG_MBEDTLS_DEBUG_LEVEL=0 \ -DCONFIG_MBEDTLS_DEBUG_LEVEL=0 \
-DCONFIG_A133_PLATFORM \ -DCONFIG_A133_PLATFORM \
CONFIG_ENV_CFLAGS += -rdynamic #CONFIG_ENV_CFLAGS += -rdynamic
CONFIG_ENV_CFLAGS += -Wno-unused -std=c99 CONFIG_ENV_CFLAGS += -Wno-unused -std=c99
CONFIG_ENV_LDFLAGS += -pthread CONFIG_ENV_LDFLAGS += -pthread
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment