Commit 9aa96c00 authored by 陈伟灿's avatar 陈伟灿

Merge branch 'cwc' into 'master'

Cwc

See merge request chenweican/k-sdk!13
parents 4dcf5660 70cb1a92
......@@ -82,6 +82,7 @@ static void _kk_heartbeat_unlock(void)
HAL_MutexUnlock(ctx->mutex);
}
}
uint64_t s_start_time = 0;
void *kk_heartbeat_yield(void *args)
{
......@@ -89,7 +90,7 @@ void *kk_heartbeat_yield(void *args)
uint64_t current_time = 0;
dm_mgr_dev_node_t *search_node = NULL;
while (ctx->hearbeat_thread_running) {
current_time = HAL_UptimeMs();
current_time = HAL_UptimeMs() - s_start_time;
_kk_heartbeat_lock();
dm_mgr_check_heartbeat_timeout(current_time);
_kk_heartbeat_unlock();
......@@ -109,6 +110,7 @@ int kk_heartbeat_init(void)
}
/* Init Device Id*/
ctx->hearbeat_thread_running = 1;
s_start_time = HAL_UptimeMs();
res = pthread_create(&ctx->hearbeat_thread, NULL, kk_heartbeat_yield, NULL);
if (res < 0) {
......
......@@ -158,7 +158,7 @@ void gw2mid_cb(void* data, int len, char* chalMark){
}
}
extern uint64_t s_start_time;
void kk_platMsg_handle(void* data, char* chalMark){
char *out;
......@@ -197,10 +197,10 @@ void kk_platMsg_handle(void* data, char* chalMark){
}
if (chalMark != NULL){
dm_mgr_update_timestamp_by_devicecode(chalMark,HAL_UptimeMs());
dm_mgr_update_timestamp_by_devicecode(chalMark,HAL_UptimeMs()-s_start_time);
}
dm_mgr_update_timestamp_by_devicecode(info_dcode->valuestring,HAL_UptimeMs());
dm_mgr_update_timestamp_by_devicecode(info_dcode->valuestring,HAL_UptimeMs()-s_start_time);
if (strcmp(msgType->valuestring, KK_THING_TOPO_ADD_MSG)==0){
proCode = cJSON_GetObjectItem(jsonPay, MSG_PRODUCT_CODE_STR);
......
......@@ -209,7 +209,7 @@ void kk_device_table_delete(EmberEUI64 mac)
if(MEMCOMPARE(ptr->mac,mac,sizeof(EmberEUI64))==0){
if(ptr->next==NULL){
free(ptr);
kk_zb_device_table = NULL;
ptr_temp->next = NULL;
emberAfCorePrintln("[KK device table]delete,now is empty !!!");
return ;
}else{
......
......@@ -5,17 +5,19 @@ do
sleep 30
PIDS=`ps|grep kk_midware |grep -v grep | awk '{print $1}'`
if [ "$PIDS" != "" ]; then
echo "kk_midware is runing!"
echo "kk_midware is runing!"
else
/home/kk/kk_midware >/dev/null 2>&1 &
/home/kk/kk_midware >/dev/null 2>&1 &
#运行进程
fi
sleep 30
PIDS=`ps|grep kcloud |grep -v grep | awk '{print $1}'`
if [ "$PIDS" != "" ]; then
echo "kcloud is runing!"
echo "kcloud is runing!"
else
/home/kk/kcloud >/dev/null 2>&1 &
#运行进程
echo "kcloud is not running ,now restart kk_midware and kcloud"
pgrep kk_midware | xargs kill -s 9
/home/kk/kk_midware >/dev/null 2>&1 &
/home/kk/kcloud >/dev/null 2>&1 &
fi
done
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