Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
不穿格子衫的农民
TencentOS Tiny
提交
7536e5a3
T
TencentOS Tiny
项目概览
不穿格子衫的农民
/
TencentOS Tiny
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TencentOS Tiny
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
7536e5a3
编写于
4月 26, 2020
作者:
D
David Lin
提交者:
GitHub
4月 26, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update HAL_Device_tencentos_tiny.c
上级
061afcb9
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
55 addition
and
55 deletion
+55
-55
components/connectivity/qcloud-iot-explorer-sdk/port/TencentOS_tiny/HAL_Device_tencentos_tiny.c
...lorer-sdk/port/TencentOS_tiny/HAL_Device_tencentos_tiny.c
+55
-55
未找到文件。
components/connectivity/qcloud-iot-explorer-sdk/port/TencentOS_tiny/HAL_Device_tencentos_tiny.c
浏览文件 @
7536e5a3
...
...
@@ -57,104 +57,104 @@ static char sg_sub_device_name[MAX_SIZE_OF_DEVICE_NAME + 1] = "YOUR_SUB_DEV_NAM
static
int
device_info_copy
(
void
*
pdst
,
void
*
psrc
,
uint8_t
max_len
)
{
if
(
strlen
(
psrc
)
>
max_len
){
return
QCLOUD_ERR_FAILURE
;
}
memset
(
pdst
,
'\0'
,
max_len
);
strncpy
(
pdst
,
psrc
,
max_len
);
return
QCLOUD_RET_SUCCESS
;
if
(
strlen
(
psrc
)
>
max_len
){
return
QCLOUD_ERR_FAILURE
;
}
memset
(
pdst
,
'\0'
,
max_len
);
strncpy
(
pdst
,
psrc
,
max_len
);
return
QCLOUD_RET_SUCCESS
;
}
#endif
int
HAL_SetDevInfo
(
void
*
pdevInfo
)
{
POINTER_SANITY_CHECK
(
pdevInfo
,
QCLOUD_ERR_DEV_INFO
);
int
ret
;
DeviceInfo
*
devInfo
=
(
DeviceInfo
*
)
pdevInfo
;
POINTER_SANITY_CHECK
(
pdevInfo
,
QCLOUD_ERR_DEV_INFO
);
int
ret
;
DeviceInfo
*
devInfo
=
(
DeviceInfo
*
)
pdevInfo
;
#ifdef DEBUG_DEV_INFO_USED
ret
=
device_info_copy
(
sg_product_id
,
devInfo
->
product_id
,
MAX_SIZE_OF_PRODUCT_ID
);
//set product ID
ret
|=
device_info_copy
(
sg_device_name
,
devInfo
->
device_name
,
MAX_SIZE_OF_DEVICE_NAME
);
//set dev name
ret
=
device_info_copy
(
sg_product_id
,
devInfo
->
product_id
,
MAX_SIZE_OF_PRODUCT_ID
);
//set product ID
ret
|=
device_info_copy
(
sg_device_name
,
devInfo
->
device_name
,
MAX_SIZE_OF_DEVICE_NAME
);
//set dev name
#ifdef AUTH_MODE_CERT
ret
|=
device_info_copy
(
sg_device_cert_file_name
,
devInfo
->
dev_cert_file_name
,
MAX_SIZE_OF_DEVICE_CERT_FILE_NAME
);
//set dev cert file name
ret
|=
device_info_copy
(
sg_device_privatekey_file_name
,
devInfo
->
dev_key_file_name
,
MAX_SIZE_OF_DEVICE_SECRET_FILE_NAME
);
//set dev key file name
ret
|=
device_info_copy
(
sg_device_cert_file_name
,
devInfo
->
dev_cert_file_name
,
MAX_SIZE_OF_DEVICE_CERT_FILE_NAME
);
//set dev cert file name
ret
|=
device_info_copy
(
sg_device_privatekey_file_name
,
devInfo
->
dev_key_file_name
,
MAX_SIZE_OF_DEVICE_SECRET_FILE_NAME
);
//set dev key file name
#else
ret
|=
device_info_copy
(
sg_device_secret
,
devInfo
->
device_secret
,
MAX_SIZE_OF_DEVICE_SECRET
);
//set dev secret
ret
|=
device_info_copy
(
sg_device_secret
,
devInfo
->
device_secret
,
MAX_SIZE_OF_DEVICE_SECRET
);
//set dev secret
#endif
#else
Log_e
(
"HAL_SetDevInfo not implement yet"
);
ret
=
QCLOUD_ERR_DEV_INFO
;
Log_e
(
"HAL_SetDevInfo not implement yet"
);
ret
=
QCLOUD_ERR_DEV_INFO
;
#endif
if
(
QCLOUD_RET_SUCCESS
!=
ret
)
{
Log_e
(
"Set device info err"
);
ret
=
QCLOUD_ERR_DEV_INFO
;
}
return
ret
;
if
(
QCLOUD_RET_SUCCESS
!=
ret
)
{
Log_e
(
"Set device info err"
);
ret
=
QCLOUD_ERR_DEV_INFO
;
}
return
ret
;
}
int
HAL_GetDevInfo
(
void
*
pdevInfo
)
{
POINTER_SANITY_CHECK
(
pdevInfo
,
QCLOUD_ERR_DEV_INFO
);
int
ret
;
DeviceInfo
*
devInfo
=
(
DeviceInfo
*
)
pdevInfo
;
memset
((
char
*
)
devInfo
,
'\0'
,
sizeof
(
DeviceInfo
));
POINTER_SANITY_CHECK
(
pdevInfo
,
QCLOUD_ERR_DEV_INFO
);
int
ret
;
DeviceInfo
*
devInfo
=
(
DeviceInfo
*
)
pdevInfo
;
memset
((
char
*
)
devInfo
,
'\0'
,
sizeof
(
DeviceInfo
));
#ifdef DEBUG_DEV_INFO_USED
ret
=
device_info_copy
(
devInfo
->
product_id
,
sg_product_id
,
MAX_SIZE_OF_PRODUCT_ID
);
//get product ID
ret
|=
device_info_copy
(
devInfo
->
device_name
,
sg_device_name
,
MAX_SIZE_OF_DEVICE_NAME
);
//get dev name
ret
=
device_info_copy
(
devInfo
->
product_id
,
sg_product_id
,
MAX_SIZE_OF_PRODUCT_ID
);
//get product ID
ret
|=
device_info_copy
(
devInfo
->
device_name
,
sg_device_name
,
MAX_SIZE_OF_DEVICE_NAME
);
//get dev name
#ifdef DEV_DYN_REG_ENABLED
ret
|=
device_info_copy
(
devInfo
->
product_secret
,
sg_product_secret
,
MAX_SIZE_OF_PRODUCT_SECRET
);
//get product ID
ret
|=
device_info_copy
(
devInfo
->
product_secret
,
sg_product_secret
,
MAX_SIZE_OF_PRODUCT_SECRET
);
//get product ID
#endif
#ifdef AUTH_MODE_CERT
ret
|=
device_info_copy
(
devInfo
->
dev_cert_file_name
,
sg_device_cert_file_name
,
MAX_SIZE_OF_DEVICE_CERT_FILE_NAME
);
//get dev cert file name
ret
|=
device_info_copy
(
devInfo
->
dev_key_file_name
,
sg_device_privatekey_file_name
,
MAX_SIZE_OF_DEVICE_SECRET_FILE_NAME
);
//get dev key file name
ret
|=
device_info_copy
(
devInfo
->
dev_cert_file_name
,
sg_device_cert_file_name
,
MAX_SIZE_OF_DEVICE_CERT_FILE_NAME
);
//get dev cert file name
ret
|=
device_info_copy
(
devInfo
->
dev_key_file_name
,
sg_device_privatekey_file_name
,
MAX_SIZE_OF_DEVICE_SECRET_FILE_NAME
);
//get dev key file name
#else
ret
|=
device_info_copy
(
devInfo
->
device_secret
,
sg_device_secret
,
MAX_SIZE_OF_DEVICE_SECRET
);
//get dev secret
ret
|=
device_info_copy
(
devInfo
->
device_secret
,
sg_device_secret
,
MAX_SIZE_OF_DEVICE_SECRET
);
//get dev secret
#endif
#else
Log_e
(
"HAL_GetDevInfo not implement yet"
);
ret
=
QCLOUD_ERR_DEV_INFO
;
Log_e
(
"HAL_GetDevInfo not implement yet"
);
ret
=
QCLOUD_ERR_DEV_INFO
;
#endif
if
(
QCLOUD_RET_SUCCESS
!=
ret
){
Log_e
(
"Get device info err"
);
ret
=
QCLOUD_ERR_DEV_INFO
;
}
return
ret
;
if
(
QCLOUD_RET_SUCCESS
!=
ret
){
Log_e
(
"Get device info err"
);
ret
=
QCLOUD_ERR_DEV_INFO
;
}
return
ret
;
}
#ifdef GATEWAY_ENABLED
int
HAL_GetGwDevInfo
(
void
*
pgwDeviceInfo
)
{
POINTER_SANITY_CHECK
(
pgwDeviceInfo
,
QCLOUD_ERR_DEV_INFO
);
int
ret
;
GatewayDeviceInfo
*
gwDevInfo
=
(
GatewayDeviceInfo
*
)
pgwDeviceInfo
;
memset
((
char
*
)
gwDevInfo
,
0
,
sizeof
(
GatewayDeviceInfo
));
POINTER_SANITY_CHECK
(
pgwDeviceInfo
,
QCLOUD_ERR_DEV_INFO
);
int
ret
;
GatewayDeviceInfo
*
gwDevInfo
=
(
GatewayDeviceInfo
*
)
pgwDeviceInfo
;
memset
((
char
*
)
gwDevInfo
,
0
,
sizeof
(
GatewayDeviceInfo
));
#ifdef DEBUG_DEV_INFO_USED
ret
=
HAL_GetDevInfo
(
&
(
gwDevInfo
->
gw_info
));
//get gw dev info
//only one sub-device is supported now
gwDevInfo
->
sub_dev_num
=
1
;
//copy sub dev info
ret
=
device_info_copy
(
gwDevInfo
->
sub_dev_info
[
0
].
product_id
,
sg_sub_device_product_id
,
MAX_SIZE_OF_PRODUCT_ID
);
ret
|=
device_info_copy
(
gwDevInfo
->
sub_dev_info
[
0
].
device_name
,
sg_sub_device_name
,
MAX_SIZE_OF_DEVICE_NAME
);
ret
=
HAL_GetDevInfo
(
&
(
gwDevInfo
->
gw_info
));
//get gw dev info
//only one sub-device is supported now
gwDevInfo
->
sub_dev_num
=
1
;
//copy sub dev info
ret
=
device_info_copy
(
gwDevInfo
->
sub_dev_info
[
0
].
product_id
,
sg_sub_device_product_id
,
MAX_SIZE_OF_PRODUCT_ID
);
ret
|=
device_info_copy
(
gwDevInfo
->
sub_dev_info
[
0
].
device_name
,
sg_sub_device_name
,
MAX_SIZE_OF_DEVICE_NAME
);
#else
Log_e
(
"HAL_GetGwDevInfo from json not implement yet"
);
ret
=
QCLOUD_ERR_DEV_INFO
;
Log_e
(
"HAL_GetGwDevInfo from json not implement yet"
);
ret
=
QCLOUD_ERR_DEV_INFO
;
#endif
if
(
QCLOUD_RET_SUCCESS
!=
ret
)
{
Log_e
(
"Get gateway device info err"
);
ret
=
QCLOUD_ERR_DEV_INFO
;
}
return
ret
;
if
(
QCLOUD_RET_SUCCESS
!=
ret
)
{
Log_e
(
"Get gateway device info err"
);
ret
=
QCLOUD_ERR_DEV_INFO
;
}
return
ret
;
}
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录