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
160d09e6
Commit
160d09e6
authored
Aug 26, 2020
by
chen.weican
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修改内容】增加子设备心跳检测机制
【提交人】陈伟灿
parent
a04fc3d1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
24 deletions
+41
-24
midware/midware/dm/kk_dm_api.c
midware/midware/dm/kk_dm_api.c
+16
-0
midware/midware/dm/kk_dm_heartbeat.c
midware/midware/dm/kk_dm_heartbeat.c
+25
-24
No files found.
midware/midware/dm/kk_dm_api.c
View file @
160d09e6
...
...
@@ -121,6 +121,22 @@ int iotx_dm_dev_online(_IN_ int devid)
return
res
;
}
int
iotx_dm_dev_offline
(
_IN_
int
devid
)
{
int
res
=
0
;
if
(
devid
<
0
)
{
return
INVALID_PARAMETER
;
}
_dm_api_lock
();
res
=
dm_mgr_upstream_status_offline
(
devid
);
_dm_api_unlock
();
return
res
;
}
int
iotx_dm_subdev_login
(
_IN_
int
devid
)
{
int
res
=
0
;
...
...
midware/midware/dm/kk_dm_heartbeat.c
View file @
160d09e6
...
...
@@ -19,29 +19,6 @@ typedef struct {
char deviceCode[DEVICE_CODE_MAXLEN];
struct list_head linked_list;
} kk_dev_heartbeat_node_t;
#endif
static
kk_heartbeat_ctx_t
s_kk_heartbeat_ctx
=
{
0
};
static
kk_heartbeat_ctx_t
*
_kk_heartbeat_get_ctx
(
void
)
{
return
&
s_kk_heartbeat_ctx
;
}
static
void
_kk_heartbeat_lock
(
void
)
{
kk_heartbeat_ctx_t
*
ctx
=
_kk_heartbeat_get_ctx
();
if
(
ctx
->
mutex
)
{
HAL_MutexLock
(
ctx
->
mutex
);
}
}
static
void
_kk_heartbeat_unlock
(
void
)
{
kk_heartbeat_ctx_t
*
ctx
=
_kk_heartbeat_get_ctx
();
if
(
ctx
->
mutex
)
{
HAL_MutexUnlock
(
ctx
->
mutex
);
}
}
#if 0
static int _kk_add_heartbeat_node(const char* deviceCode,unsigned int timestamp)
{
kk_heartbeat_ctx_t *ctx = _kk_heartbeat_get_ctx();
...
...
@@ -51,12 +28,14 @@ static int _kk_add_heartbeat_node(const char* deviceCode,unsigned int timestamp)
if (node == NULL) {
return MEMORY_NOT_ENOUGH;
}
_kk_heartbeat_lock();
memset(node,0x0,sizeof(kk_dev_heartbeat_node_t));
memcpy(node->deviceCode,deviceCode,strlen(deviceCode));
node->timerstamp = timestamp;
INIT_LIST_HEAD(&node->linked_list);
list_add_tail(&node->linked_list, &ctx->dev_list);
return SUCCESS_RETURN
_kk_heartbeat_unlock();
return SUCCESS_RETURN;
...
...
@@ -80,8 +59,30 @@ int kk_heartbeat_update_time(const char deviceCode[DEVICE_CODE_MAXLEN],unsigned
return FAIL_RETURN;
}
#endif
static
kk_heartbeat_ctx_t
s_kk_heartbeat_ctx
=
{
0
};
static
kk_heartbeat_ctx_t
*
_kk_heartbeat_get_ctx
(
void
)
{
return
&
s_kk_heartbeat_ctx
;
}
static
void
_kk_heartbeat_lock
(
void
)
{
kk_heartbeat_ctx_t
*
ctx
=
_kk_heartbeat_get_ctx
();
if
(
ctx
->
mutex
)
{
HAL_MutexLock
(
ctx
->
mutex
);
}
}
static
void
_kk_heartbeat_unlock
(
void
)
{
kk_heartbeat_ctx_t
*
ctx
=
_kk_heartbeat_get_ctx
();
if
(
ctx
->
mutex
)
{
HAL_MutexUnlock
(
ctx
->
mutex
);
}
}
void
*
kk_heartbeat_yield
(
void
*
args
)
{
kk_heartbeat_ctx_t
*
ctx
=
_kk_heartbeat_get_ctx
();
...
...
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