Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
k-sdk
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈伟灿
k-sdk
Commits
62bf69e1
Commit
62bf69e1
authored
Feb 17, 2022
by
陈伟灿
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'cwc' into 'master'
【修改内容】去warning See merge request chenweican/k-sdk!190
parents
2a66f954
ec776a84
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
48 additions
and
141 deletions
+48
-141
application/kcloud/kcloud_main.c
application/kcloud/kcloud_main.c
+3
-3
application/kcloud/kk_config_dl.c
application/kcloud/kk_config_dl.c
+1
-0
application/kcloud/kk_register.c
application/kcloud/kk_register.c
+1
-1
application/klansdk/kk_data_handle.c
application/klansdk/kk_data_handle.c
+1
-1
application/klansdk/kk_lan_ctrl.c
application/klansdk/kk_lan_ctrl.c
+1
-1
application/klansdk/kk_lan_main.c
application/klansdk/kk_lan_main.c
+2
-2
application/klansdk/kk_lan_sync.c
application/klansdk/kk_lan_sync.c
+6
-6
common/api/com_api.c
common/api/com_api.c
+6
-5
common/hal/HAL_OS_linux.c
common/hal/HAL_OS_linux.c
+1
-1
common/json/cJSON.h
common/json/cJSON.h
+4
-1
common/mqtt/WebSocket.c
common/mqtt/WebSocket.c
+2
-2
midware/midware/area/id.c
midware/midware/area/id.c
+0
-61
midware/midware/area/id.h
midware/midware/area/id.h
+0
-40
midware/midware/area/kk_area_handle.c
midware/midware/area/kk_area_handle.c
+1
-2
midware/midware/dm/kk_motor_bind_db.c
midware/midware/dm/kk_motor_bind_db.c
+8
-8
midware/midware/midware.c
midware/midware/midware.c
+4
-4
midware/midware/scene/kk_scene_handle.c
midware/midware/scene/kk_scene_handle.c
+2
-1
midware/tsl/tsl_handle/lite-cjson.h
midware/tsl/tsl_handle/lite-cjson.h
+3
-0
tools/board/config.linux-android.a133
tools/board/config.linux-android.a133
+2
-2
No files found.
application/kcloud/kcloud_main.c
View file @
62bf69e1
...
...
@@ -48,7 +48,7 @@ static int KK_Ccuid_init(void)
char
ccuidTmp
[
DEVICE_CODE_LEN
]
=
{
0
};
int
ccuid_len
=
0
;
#ifdef CONFIG_A133_PLATFORM
uint8_t
data
[
128
]
=
{
0
};
char
data
[
128
]
=
{
0
};
int
data_len
=
0
;
char
*
pstart
=
NULL
;
char
*
pEnd
=
NULL
;
...
...
@@ -56,7 +56,7 @@ static int KK_Ccuid_init(void)
INFO_PRINT
(
"---GET_CCUID_CMD:%s
\n
"
,
data
);
if
(
data_len
>
0
&&
data_len
<=
128
){
pstart
=
data
;
pEnd
=
strstr
(
data
,
"-"
);
pEnd
=
strstr
(
(
char
*
)
data
,
"-"
);
if
(
pstart
!=
NULL
&&
pEnd
!=
NULL
){
printf
(
"-------123---------------------
\n
"
);
memcpy
(
ccuidTmp
,
pstart
,
pEnd
-
pstart
);
...
...
@@ -108,7 +108,7 @@ int kk_cloud_get_pid(char *productId)
char
s_key
[
128
]
=
{
0
};
static
int
kk_cloud_key_init
(
void
)
{
uint8_t
key
[
128
]
=
{
0
};
char
key
[
128
]
=
{
0
};
int
key_len
=
0
;
#ifdef CONFIG_A133_PLATFORM
char
*
pstart
=
NULL
;
...
...
application/kcloud/kk_config_dl.c
View file @
62bf69e1
...
...
@@ -53,6 +53,7 @@ int kk_check_config_file(char* path,char **config)
}
else
{
return
-
1
;
}
return
0
;
}
static
int
_kk_parse_config_dl_host
(
cJSON
*
configInfo
,
char
*
url
){
char
ccuid
[
32
]
=
{
0
};
...
...
application/kcloud/kk_register.c
View file @
62bf69e1
...
...
@@ -119,7 +119,7 @@ int kk_parse_token(char *info){
if
(
fp
!=
NULL
){
fwrite
(
jwt
->
valuestring
,
strlen
(
jwt
->
valuestring
),
1
,
fp
);
#ifdef CONFIG_A133_PLATFORM
fsync
(
fp
);
//
fsync(fp);
fclose
(
fp
);
#else
fclose
(
fp
);
...
...
application/klansdk/kk_data_handle.c
View file @
62bf69e1
...
...
@@ -217,7 +217,7 @@ static cJSON *kk_zb_dev_hw_info_build(const char *deviceCode,const char *product
char
mac
[
32
]
=
{
0
};
int
online_status
=
0
;
int
pid
;
if
(
mac
==
NULL
){
if
(
deviceCode
==
NULL
){
return
NULL
;
}
...
...
application/klansdk/kk_lan_ctrl.c
View file @
62bf69e1
...
...
@@ -44,7 +44,7 @@ static int special_handling_for_compatibility(kk_map_dev_node_t *devNode,cJSON *
int
oType
=
0
;
int
ret
=
-
1
;
if
(
devNode
->
opearteType
==
NULL
||
opcode
==
NULL
||
arg
==
NULL
){
if
(
devNode
==
NULL
||
opcode
==
NULL
||
arg
==
NULL
){
return
-
1
;
}
oType
=
atoi
(
devNode
->
opearteType
);
...
...
application/klansdk/kk_lan_main.c
View file @
62bf69e1
...
...
@@ -75,9 +75,9 @@ int kk_lan_get_pid(_OU_ char *productId)
static
void
kk_lan_ccuid_init
(
void
)
{
#ifdef CONFIG_A133_PLATFORM
uint8_t
data
[
128
]
=
{
0
};
char
data
[
128
]
=
{
0
};
int
data_len
=
0
;
uint8_t
uuid
[
32
]
=
{
0
};
char
uuid
[
32
]
=
{
0
};
char
*
pstart
=
NULL
;
char
*
pEnd
=
NULL
;
HAL_Execel_cmd
(
GET_CCUID_CMD
,(
char
*
)
data
,
sizeof
(
data
),
&
data_len
);
...
...
application/klansdk/kk_lan_sync.c
View file @
62bf69e1
...
...
@@ -1282,13 +1282,13 @@ cJSON *_kk_sync_central_ac_indoorunit_to_sdk(SYN_CENTRAL_AC_INDOOR* indoorunit)
cJSON
*
item
=
cJSON_CreateObject
();
cJSON
*
status
;
cJSON_AddStringToObject
(
item
,
"id"
,
(
indoorunit
->
id
)
?
indoorunit
->
id
:
""
);
cJSON_AddStringToObject
(
item
,
"room_id"
,
(
indoorunit
->
room_id
)
?
indoorunit
->
room_id
:
""
);
cJSON_AddStringToObject
(
item
,
"indoorunit_name"
,
(
indoorunit
->
indoorunit_name
)
?
indoorunit
->
indoorunit_name
:
""
);
cJSON_AddStringToObject
(
item
,
"indooruint_addr"
,
(
indoorunit
->
indooruint_addr
)
?
indoorunit
->
indooruint_addr
:
""
);
cJSON_AddStringToObject
(
item
,
"central_ac_gw_devid"
,
(
indoorunit
->
central_ac_gw_devid
)
?
indoorunit
->
central_ac_gw_devid
:
""
);
cJSON_AddStringToObject
(
item
,
"id"
,
strlen
(
indoorunit
->
id
)
>
0
?
indoorunit
->
id
:
""
);
cJSON_AddStringToObject
(
item
,
"room_id"
,
strlen
(
indoorunit
->
room_id
)
>
0
?
indoorunit
->
room_id
:
""
);
cJSON_AddStringToObject
(
item
,
"indoorunit_name"
,
strlen
(
indoorunit
->
indoorunit_name
)
>
0
?
indoorunit
->
indoorunit_name
:
""
);
cJSON_AddStringToObject
(
item
,
"indooruint_addr"
,
strlen
(
indoorunit
->
indooruint_addr
)
>
0
?
indoorunit
->
indooruint_addr
:
""
);
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
;
}
cJSON
*
_kk_sync_central_ac_indoorunits
(
int
num
,
SYN_CENTRAL_AC_INDOOR
*
indoorunits
)
...
...
common/api/com_api.c
View file @
62bf69e1
...
...
@@ -116,7 +116,7 @@ static void watcher_cb (struct ev_loop *loop ,struct ev_io *w, int revents)
loop_ctrl
->
isconnect
=
1
;
//if sub, need filter sbuscribe str
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
{
validDat
=
dat
;
validLen
=
bytes
;
...
...
@@ -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
){
}
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
;
...
...
@@ -136,7 +136,7 @@ static void watcher_cb (struct ev_loop *loop ,struct ev_io *w, int revents)
loop_ctrl
->
isconnect
=
0
;
}
if
(
loop_ctrl
->
cb
!=
NULL
){
loop_ctrl
->
cb
((
void
*
)
validDat
,
validLen
,
chlMark
);
loop_ctrl
->
cb
((
void
*
)
validDat
,
validLen
,
(
char
*
)
chlMark
);
}
nn_freemsg
(
dat
);
}
...
...
@@ -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
);
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
);
return
-
1
;
}
...
...
@@ -321,7 +321,7 @@ int __nanomsg_init(Bloop_ctrl_t *loop_ctrl, ipc_type type,char* chlMark, char* i
void
*
loop_thread
(
void
*
arg
){
INFO_PRINT
(
"loop_thread start!
\r\n
"
);
ev_run
(
gloop
,
0
);
return
NULL
;
}
int
kk_set_storage_dir
(
char
*
path
){
...
...
@@ -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
);
return
0
;
}
...
...
common/hal/HAL_OS_linux.c
View file @
62bf69e1
...
...
@@ -160,7 +160,7 @@ time_t HAL_GetTime_s(char *outStr)
time_t
t
;
t
=
time
(
NULL
);
sprintf
(
outStr
,
"%d"
,
t
);
sprintf
(
outStr
,
"%
l
d"
,
t
);
return
t
;
}
...
...
common/json/cJSON.h
View file @
62bf69e1
...
...
@@ -77,8 +77,11 @@ typedef struct cJSON_Hooks
void
*
(
*
malloc_fn
)(
size_t
sz
);
void
(
*
free_fn
)(
void
*
ptr
);
}
cJSON_Hooks
;
#ifndef cJSON_bool_ex
#define cJSON_bool_ex
typedef
int
cJSON_bool
;
#endif
#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32))
#define __WINDOWS__
...
...
common/mqtt/WebSocket.c
View file @
62bf69e1
...
...
@@ -196,7 +196,7 @@ size_t WebSocket_calculateFrameHeaderSize(networkHandles *net, int mask_data, si
ret
=
2
;
/* header 2 bytes */
else
if
(
data_len
<
65536u
)
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 */
if
(
mask_data
&
0x1
)
ret
+=
sizeof
(
uint32_t
);
/* for mask */
...
...
@@ -297,7 +297,7 @@ static struct frameData WebSocket_buildFrame(networkHandles* net, int opcode, in
memcpy
(
&
rc
.
wsbuf0
[
buf_len
],
&
len
,
2u
);
buf_len
+=
2
;
}
else
if
(
data_len
<
0xFFFFFFFFFFFFFFFF
)
else
if
(
(
long
long
)
data_len
<
0xFFFFFFFFFFFFFFFF
)
{
uint64_t
len
=
htobe64
((
uint64_t
)
data_len
);
rc
.
wsbuf0
[
buf_len
++
]
|=
(
127u
&
0x7F
);
...
...
midware/midware/area/id.c
deleted
100644 → 0
View file @
2a66f954
#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
;
}
midware/midware/area/id.h
deleted
100644 → 0
View file @
2a66f954
/*
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
midware/midware/area/kk_area_handle.c
View file @
62bf69e1
...
...
@@ -5,7 +5,6 @@
#include "kk_log.h"
#include "kk_area_handle.h"
#include "kk_hal.h"
#include "id.h"
extern
sqlite3
*
g_kk_pDb
;
...
...
@@ -105,7 +104,7 @@ int kk_area_init(void)
{
int
res
=
0
;
kk_area_ctx_t
*
ctx
=
_kk_area_get_ctx
();
set_workid
(
100
);
//
set_workid(100);
/* Create Mutex */
ctx
->
mutex
=
HAL_MutexCreate
();
if
(
ctx
->
mutex
==
NULL
)
{
...
...
midware/midware/dm/kk_motor_bind_db.c
View file @
62bf69e1
...
...
@@ -221,7 +221,7 @@ int kk_motor_bind_db_find_byDeviceCode(const char* panelDCode,struct kk_motor_bi
int
listSize
=
0
;
sqlite3_stmt
*
stmt
;
char
*
sqlCmd
=
NULL
;
c
onst
unsigned
c
har
*
motorDeviceCode
=
NULL
;
char
*
motorDeviceCode
=
NULL
;
int
motor_ep
=
0
;
int
dummyId
=
-
1
;
...
...
@@ -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
);
sqlite3_prepare_v2
(
ctx
->
pDb
,
sqlCmd
,
strlen
(
sqlCmd
),
&
stmt
,
NULL
);
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
);
dummyId
=
sqlite3_column_int
(
stmt
,
MOTOR_BIND_DB_DUMMYID
);
memcpy
(
pInfo
->
deviceCode
,
motorDeviceCode
,
strlen
(
motorDeviceCode
));
...
...
@@ -255,7 +255,7 @@ int kk_motor_bind_db_find_byMotorDeviceCode(const char* motorCode,struct kk_moto
int
listSize
=
0
;
sqlite3_stmt
*
stmt
;
char
*
sqlCmd
=
NULL
;
c
onst
unsigned
c
har
*
panelDeviceCode
=
NULL
;
char
*
panelDeviceCode
=
NULL
;
int
motor_ep
=
0
;
int
dummyId
=
-
1
;
...
...
@@ -269,7 +269,7 @@ int kk_motor_bind_db_find_byMotorDeviceCode(const char* motorCode,struct kk_moto
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
);
dummyId
=
sqlite3_column_int
(
stmt
,
MOTOR_BIND_DB_DUMMYID
);
memcpy
(
pInfo
->
deviceCode
,
panelDeviceCode
,
strlen
(
panelDeviceCode
));
...
...
@@ -291,7 +291,7 @@ int kk_motor_bind_db_find(const char* panelDCode,int panelEpNum,struct kk_motor_
int
listSize
=
0
;
sqlite3_stmt
*
stmt
;
char
*
sqlCmd
=
NULL
;
c
onst
unsigned
c
har
*
motorDeviceCode
=
NULL
;
char
*
motorDeviceCode
=
NULL
;
int
motor_ep
=
0
;
int
dummyId
=
-
1
;
...
...
@@ -306,7 +306,7 @@ int kk_motor_bind_db_find(const char* panelDCode,int panelEpNum,struct kk_motor_
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
);
dummyId
=
sqlite3_column_int
(
stmt
,
MOTOR_BIND_DB_DUMMYID
);
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
int
listSize
=
0
;
sqlite3_stmt
*
stmt
;
char
*
sqlCmd
=
NULL
;
c
onst
unsigned
c
har
*
motorDeviceCode
=
NULL
;
char
*
motorDeviceCode
=
NULL
;
int
motor_ep
=
0
;
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
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
);
memcpy
(
pInfo
->
deviceCode
,
motorDeviceCode
,
strlen
(
motorDeviceCode
));
pInfo
->
epNum
=
motor_ep
;
...
...
midware/midware/midware.c
View file @
62bf69e1
...
...
@@ -126,9 +126,9 @@ static int _setDevice_Code(_IN_ char *device_code,int len)
static
int
HAL_Ccuid_init
(
void
)
{
#ifdef CONFIG_A133_PLATFORM
uint8_t
data
[
128
]
=
{
0
};
char
data
[
128
]
=
{
0
};
int
data_len
=
0
;
uint8_t
uuid
[
32
]
=
{
0
};
char
uuid
[
32
]
=
{
0
};
char
*
pstart
=
NULL
;
char
*
pEnd
=
NULL
;
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)
snprintf
(
sceneId
,
sizeof
(
sceneId
),
"%d"
,
dummyId
);
cJSON_AddStringToObject
(
paras
,
"sceneId"
,
sceneId
);
cJSON_AddItemToObject
(
payload
,
"params"
,
paras
);
snprintf
(
tm
,
sizeof
(
tm
),
"%d"
,
time
(
NULL
));
snprintf
(
tm
,
sizeof
(
tm
),
"%
l
d"
,
time
(
NULL
));
cJSON_AddStringToObject
(
payload
,
"time"
,
tm
);
cJSON_AddStringToObject
(
payload
,
"method"
,
KK_THING_METHOD_DELETESCENC
);
cJSON_AddItemToObject
(
root
,
"payload"
,
payload
);
...
...
@@ -543,7 +543,7 @@ static int kk_panel_bind_motor_add_actions(const char* deviceCode,cJSON* actions
cJSON_AddStringToObject
(
paras
,
"sceneId"
,
sceneId
);
cJSON_AddItemToObject
(
paras
,
"actions"
,
actions
);
cJSON_AddItemToObject
(
payload
,
"params"
,
paras
);
snprintf
(
tm
,
sizeof
(
tm
),
"%d"
,
time
(
NULL
));
snprintf
(
tm
,
sizeof
(
tm
),
"%
l
d"
,
time
(
NULL
));
cJSON_AddStringToObject
(
payload
,
"time"
,
tm
);
cJSON_AddStringToObject
(
payload
,
"method"
,
KK_THING_METHOD_ADDSCENC
);
cJSON_AddItemToObject
(
root
,
"payload"
,
payload
);
...
...
midware/midware/scene/kk_scene_handle.c
View file @
62bf69e1
...
...
@@ -846,6 +846,7 @@ int BodySensorTrigger_check(void)
}
ptr
=
ptr
->
next
;
}
return
0
;
}
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
->
report_time
=
ptr
->
alarm_time
+
(
ptr
->
noActive_time
*
60
);
INFO_PRINT
(
"
\n\n
ptr->alarm_time=%
d,ptr->report_time=%
d
\n\n
"
,
ptr
->
alarm_time
,
ptr
->
report_time
);
INFO_PRINT
(
"
\n\n
ptr->alarm_time=%
ld,ptr->report_time=%l
d
\n\n
"
,
ptr
->
alarm_time
,
ptr
->
report_time
);
}
else
{
INFO_PRINT
(
"
\n\n
------------------>BodySensorNoActive time 0
\n\n
"
);
//...
...
...
midware/tsl/tsl_handle/lite-cjson.h
View file @
62bf69e1
...
...
@@ -68,7 +68,10 @@ int lite_cjson_object_item_by_index(
/*** lite_cjson create, add and print ***/
#ifndef cJSON_bool_ex
#define cJSON_bool_ex
typedef
int
cJSON_bool
;
#endif
#define cJSON_IsReference 256
#define cJSON_StringIsConst 512
...
...
tools/board/config.linux-android.a133
View file @
62bf69e1
CONFIG_ENV_CFLAGS += \
-Os -W
all
\
-Os -W
error
\
-g3 --coverage \
-D_PLATFORM_IS_LINUX_ \
...
...
@@ -21,7 +21,7 @@ CONFIG_ENV_CFLAGS += \
-DCONFIG_MBEDTLS_DEBUG_LEVEL=0 \
-DCONFIG_A133_PLATFORM \
CONFIG_ENV_CFLAGS += -rdynamic
#
CONFIG_ENV_CFLAGS += -rdynamic
CONFIG_ENV_CFLAGS += -Wno-unused -std=c99
CONFIG_ENV_LDFLAGS += -pthread
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment