建议使用以下浏览器,以获得最佳体验。 IE 9.0+以上版本 Chrome 31+ 谷歌浏览器 Firefox 30+ 火狐浏览器
请选择 进入手机版 | 继续访问电脑版
设置昵称

在此一键设置昵称,即可参与社区互动!

确定
我再想想
选择版块

削了皮的土...

发帖: 1粉丝: 0

级别 : 新手上路

Rank: 1

发消息 + 关注

发表于2018-11-21 10:15:38 2802 8 楼主 显示全部楼层
[问题求助] LiteOS-master连接云平台,device侧的profile信息如何设置?

最近在做ARM板连接华为云平台的案例,按照开发流程首先在云平台上创建了NB设备,编写了插件,使用NB设备模拟器绑定了设备,进行了数据的收发模拟


cloud_device.JPG


cloud_report.JPG


cloud_history.JPG



在网上找了一个 LiteOS-master 的例程,手头只有407的开发板,因此参照例程中429的代码移植到了407上,做了一个UDP的测试,能够正常的收发数据


LiteOS-master例程连接 https://pan.baidu.com/s/174hadMx208RWtXAk9ZWUfA


device_udp.JPG



之前没有做过LWM2M,不太了解profile的配置信息该如何填写,只找到了远端IP并且做了修改,其他关于device的信息不知道在什么位置,截取了部分log内容供参考


正在查找DHCP服务器,请稍等...........

正在获取地址...

网卡en的MAC地址为:................2.0.0.72.0.58

通过DHCP获取到IP地址..............192.168.1.108

通过DHCP获取到子网掩码............255.255.255.0

通过DHCP获取到的默认网关..........192.168.1.1

[INFO][1024][atiny_init_objects:121] Trying to init objects

[lwm2m_init:98] Entering

[lwm2m_step:459] timeoutP: 2306079593729152688

[lwm2m_step:464] State: STATE_INITIAL

[object_getServers:803] Entering

[object_getServers:815] objID 0

[object_getServers:815] objID 1

[object_getServers:815] objID 3

[object_getServers:815] objID 4

[object_getServers:815] objID 5

[object_getServers:815] objID 19

[object_getServers:819] number 6

[lwm2m_data_new:184] size: 3

[lwm2m_data_encode_bool:447] value: false

[lwm2m_data_encode_int:311] value: 123

[lwm2m_data_encode_int:311] value: 10

[lwm2m_data_decode_bool:457] Entering

[lwm2m_data_decode_bool:508] result: 1, value: false

[lwm2m_data_decode_int:321] Entering

[lwm2m_data_decode_int:376] result: 1, value: 123

[lwm2m_data_new:184] size: 1

[lwm2m_data_encode_int:311] value: 123

[lwm2m_data_decode_int:321] Entering

[lwm2m_data_decode_int:376] result: 1, value: 123

[lwm2m_data_free:202] size: 1

[lwm2m_data_new:184] size: 2

[lwm2m_data_encode_int:311] value: 50000

[lwm2m_data_encode_string:236] "UQ"

[lwm2m_data_decode_int:321] Entering

[lwm2m_data_decode_int:376] result: 1, value: 50000

[lwm2m_data_free:202] size: 2

[lwm2m_data_free:202] size: 3

[registration_start:515] State: STATE_REGISTER_REQUIRED

[object_getRegisterPayloadBufferLength:569] Entering

[object_getRegisterPayload:640] Entering

[INFO][1157][lwm2m_connect_server:246] Now come into Connection creation in lwm2m_connect_server.


[INFO][1167][connection_create:96] now come into connection_create!!!

[INFO][1173][connection_create:111] uri is coap://139.159.140.34:5683


[SOCKET][atiny_net_connect:98] try to do name resolution now...

[SOCKET][atiny_net_connect:106] do name resolution succeed

[SOCKET][atiny_net_connect:158] UDP create socket and bind to server(139.159.140.34:5683) finished

[INFO][1202][lwm2m_connect_server:263] Connection creation successfully in lwm2m_connect_server.


[transaction_new:198] method: 2, altPath: "佰 U", mID: 16211, token_len: 4

[transaction_new:200] NULL

[transaction_new:277] send token is 83


[transaction_new:277] send token is 63


[transaction_new:277] send token is 1


[transaction_new:277] send token is 0


[transaction_new:281] Exiting on success

[transaction_send:405] Entering

[transaction_send:407] transaction_send: ver 0, type 0, tkl 4, code 0.02, mid 16211, Content type: 40

[transaction_send:409] time:1254

[INFO][1257][lwm2m_buffer_send:351] call connection_send in lwm2m_buffer_send, length is 112


[transaction_send:468] send 0 bytes, retrans_counter:2

[observe_step:628] Entering

[registration_step:1351] contextP State: STATE_REGISTERING

[registration_step:1356] targetP Status: STATE_REG_PENDING

[transaction_step:497] Entering

[lwm2m_step:574] Final timeoutP: 2306079593729152688

[lwm2m_step:576] Final state: STATE_REGISTERING

report ret:0

[lwm2m_handle_packet:243] Entering

[lwm2m_handle_packet:247] Parsed: ver 1, type 2, tkl 4, code 2.01, mid 16211, Content type: 0

[transaction_handleResponse:320] Entering,message->code: 65

[prv_handleRegistrationReply:230] come into  prv_handleRegistrationReply!!

[prv_handleRegistrationReply:247] Registration successful,location_path is /rd/44440003

[transaction_remove:306] Entering

[transaction_free:292] Entering

[INFO][1410][atiny_notify_stack_rpt_data_change:145] data change cnt 1 uri(flag:0x7, objId:19, instId:0, resId:0)

[lwm2m_resource_value_changed:492] /19/0/0

[lwm2m_step:459] timeoutP: 2306079593729152688

[lwm2m_step:464] State: STATE_REGISTERING

[registration_getStatus:544] State: STATE_REGISTERING

[registration_getStatus:551] targetP->status: STATE_REGISTERED

[registration_getStatus:574] reg_status: STATE_REGISTERED

notify:stat:0

[observe_step:628] Entering

[registration_step:1351] contextP State: STATE_READY

[registration_step:1356] targetP Status: STATE_REGISTERED

[transaction_step:497] Entering

[lwm2m_step:574] Final timeoutP: 2306079593729152688

[lwm2m_step:576] Final state: STATE_READY

[lwm2m_handle_packet:243] Entering

[lwm2m_handle_packet:247] Parsed: ver 1, type 0, tkl 8, code 0.01, mid 35821, Content type: 0

[handle_request:148] Entering

[uri_decode:102] altPath: "佰 U"

[uri_decode:198] /19/0/0

[dm_handleRequest:205] Code: 01, server status: STATE_REGISTERED

[dm_handleRequest:206] /19/0/0

[object_readData:176] /19/0/0

[lwm2m_data_new:184] size: 1

[object_readData:233] result: 2. 5, size: 1

[observe_handleRequest:210] Code: 01, server status: STATE_REGISTERED

[observe_handleRequest:211] /19/0/0

[lwm2m_data_free:202] size: 1

[message_send:458] Entering

[message_send:460] Size to allocate: 22

[message_send:467] coap_serialize_message() returned 15

[INFO][1545][lwm2m_buffer_send:351] call connection_send in lwm2m_buffer_send, length is 15


[INFO][1554][atiny_notify_stack_rpt_data_change:145] data change cnt 1 uri(flag:0x7, objId:19, instId:0, resId:0)

[lwm2m_resource_value_changed:492] /19/0/0

[lwm2m_resource_value_changed:508] Found an observation

[lwm2m_resource_value_changed:509] /19/0/0

[lwm2m_resource_value_changed:515] Tagging a watcher

[lwm2m_step:459] timeoutP: 2306079593729152688

[lwm2m_step:464] State: STATE_READY

[registration_getStatus:544] State: STATE_READY

[registration_getStatus:551] targetP->status: STATE_REGISTERED

[registration_getStatus:574] reg_status: STATE_REGISTERED

[observe_step:628] Entering

[observe_step:643] /19/0/0

[observe_app_step:533] Entering

[object_readData:176] /19/0/0

[lwm2m_data_new:184] size: 1

[object_readData:233] result: 2. 5, size: 1

[lwm2m_data_serialize:625] /19/0/0

[lwm2m_data_serialize:626] size: 1, formatP: LWM2M_CONTENT_OPAQUE

[lwm2m_data_serialize:658] Final format: LWM2M_CONTENT_OPAQUE

[transaction_new:198] method: 69, altPath: "佰 U", mID: 16212, token_len: 8

[transaction_new:200] NULL

[transaction_new:281] Exiting on success

[transaction_send:405] Entering

[transaction_send:407] transaction_send: ver 0, type 0, tkl 8, code 2.05, mid 16212, Content type: 42

[transaction_send:409] time:1671

[INFO][1674][lwm2m_buffer_send:351] call connection_send in lwm2m_buffer_send, length is 22


[transaction_send:468] send 0 bytes, retrans_counter:2

[observe_app_step:599] notify con msg, cookie:0 type:1

[lwm2m_data_free:202] size: 1

[object_readData:176] /19/0/0

[lwm2m_data_new:184] size: 1

[ERR][1703][atiny_dequeue_rpt_data:274] dequeue empty rpt list

[ERR][1709][prv_read_data:151] atiny_dequeue_rpt_data fail,ret=-5

[object_readData:233] result: 4. 4, size: 1

[lwm2m_data_free:202] size: 1

[registration_step:1351] contextP State: STATE_READY

[registration_step:1356] targetP Status: STATE_REGISTERED

[transaction_step:497] Entering

[lwm2m_step:574] Final timeoutP: 2306079593729152688

[lwm2m_step:576] Final state: STATE_READY

[lwm2m_handle_packet:243] Entering

[lwm2m_handle_packet:247] Parsed: ver 1, type 0, tkl 5, code 0.01, mid 35822, Content type: 0

[handle_request:148] Entering

[uri_decode:102] altPath: "佰 U"

[uri_decode:198] /4/0/8

[dm_handleRequest:205] Code: 01, server status: STATE_REGISTERED

[dm_handleRequest:206] /4/0/8

[object_read:249] /4/0/8

[object_readData:176] /4/0/8

[lwm2m_data_new:184] size: 1

[lwm2m_data_encode_int:311] value: 21103

[object_readData:233] result: 2. 5, size: 1

[lwm2m_data_serialize:625] /4/0/8

[lwm2m_data_serialize:626] size: 1, formatP: LWM2M_CONTENT_TEXT

[lwm2m_data_serialize:658] Final format: LWM2M_CONTENT_TEXT

[lwm2m_data_free:202] size: 1

[object_read:266] result: 2. 5, length: 5

[message_send:458] Entering

[message_send:460] Size to allocate: 20

[message_send:467] coap_serialize_message() returned 16

[INFO][1828][lwm2m_buffer_send:351] call connection_send in lwm2m_buffer_send, length is 16


[lwm2m_step:459] timeoutP: 2306079593729152688

[lwm2m_step:464] State: STATE_READY

[registration_getStatus:544] State: STATE_READY

[registration_getStatus:551] targetP->status: STATE_REGISTERED

[registration_getStatus:574] reg_status: STATE_REGISTERED

[observe_step:628] Entering

[observe_step:643] /19/0/0

[observe_app_step:533] Entering

[object_readData:176] /19/0/0

[lwm2m_data_new:184] size: 1

[ERR][1876][atiny_dequeue_rpt_data:274] dequeue empty rpt list

[ERR][1882][prv_read_data:151] atiny_dequeue_rpt_data fail,ret=-5

[object_readData:233] result: 4. 4, size: 1

[lwm2m_data_free:202] size: 1

[registration_step:1351] contextP State: STATE_READY

[registration_step:1356] targetP Status: STATE_REGISTERED

[transaction_step:497] Entering

[lwm2m_step:574] Final timeoutP: 2306079593729152688

[lwm2m_step:576] Final state: STATE_READY

[lwm2m_handle_packet:243] Entering

[lwm2m_handle_packet:247] Parsed: ver 1, type 2, tkl 0, code 0.00, mid 16212, Content type: 0

[transaction_handleResponse:320] Entering,message->code: 0

type:1 cookie:0 status:4

[transaction_remove:306] Entering

[transaction_free:292] Entering

[lwm2m_step:459] timeoutP: 2306079593729152688

[lwm2m_step:464] State: STATE_READY

[registration_getStatus:544] State: STATE_READY

[registration_getStatus:551] targetP->status: STATE_REGISTERED

[registration_getStatus:574] reg_status: STATE_REGISTERED

[observe_step:628] Entering

[observe_step:643] /19/0/0

[observe_app_step:533] Entering

[object_readData:176] /19/0/0

[lwm2m_data_new:184] size: 1

[ERR][1986][atiny_dequeue_rpt_data:274] dequeue empty rpt list

[ERR][1992][prv_read_data:151] atiny_dequeue_rpt_data fail,ret=-5

[object_readData:233] result: 4. 4, size: 1

[lwm2m_data_free:202] size: 1

[registration_step:1351] contextP State: STATE_READY

[registration_step:1356] targetP Status: STATE_REGISTERED

[transaction_step:497] Entering

[lwm2m_step:574] Final timeoutP: 2306079593729152688

[lwm2m_step:576] Final state: STATE_READY

[lwm2m_handle_packet:243] Entering

[lwm2m_handle_packet:247] Parsed: ver 1, type 0, tkl 1, code 0.01, mid 35823, Content type: 0

[handle_request:148] Entering

[uri_decode:102] altPath: "佰 U"

[uri_decode:198] /4/0/0

[dm_handleRequest:205] Code: 01, server status: STATE_REGISTERED

[dm_handleRequest:206] /4/0/0

[object_read:249] /4/0/0

[object_readData:176] /4/0/0

[lwm2m_data_new:184] size: 1

[lwm2m_data_encode_int:311] value: 0

[object_readData:233] result: 2. 5, size: 1

[lwm2m_data_serialize:625] /4/0/0

[lwm2m_data_serialize:626] size: 1, formatP: LWM2M_CONTENT_TEXT

[lwm2m_data_serialize:658] Final format: LWM2M_CONTENT_TEXT

[lwm2m_data_free:202] size: 1

[object_read:266] result: 2. 5, length: 1

[message_send:458] Entering

[message_send:460] Size to allocate: 12

[message_send:467] coap_serialize_message() returned 8

[INFO][2110][lwm2m_buffer_send:351] call connection_send in lwm2m_buffer_send, length is 8


[lwm2m_step:459] timeoutP: 2306079593729152688

[lwm2m_step:464] State: STATE_READY

[registration_getStatus:544] State: STATE_READY

[registration_getStatus:551] targetP->status: STATE_REGISTERED

[registration_getStatus:574] reg_status: STATE_REGISTERED

[observe_step:628] Entering

[observe_step:643] /19/0/0

[observe_app_step:533] Entering

[object_readData:176] /19/0/0

[lwm2m_data_new:184] size: 1

[ERR][2159][atiny_dequeue_rpt_data:274] dequeue empty rpt list

[ERR][2165][prv_read_data:151] atiny_dequeue_rpt_data fail,ret=-5

[object_readData:233] result: 4. 4, size: 1

[lwm2m_data_free:202] size: 1

[registration_step:1351] contextP State: STATE_READY

[registration_step:1356] targetP Status: STATE_REGISTERED

[transaction_step:497] Entering

[lwm2m_step:574] Final timeoutP: 2306079593729152688

[lwm2m_step:576] Final state: STATE_READY





举报
分享

分享文章到朋友圈

分享文章到微博

wsm

发帖: 0粉丝: 1

级别 : 版主

Rank: 7Rank: 7Rank: 7

发消息 + 关注

发表于2018-11-21 14:15:41 沙发 显示全部楼层

device侧的没有设置profile之说,OceanConnect侧才需profile开发

点赞 回复 举报

六斤

发帖: 28粉丝: 14

级别 : 版主

Rank: 7Rank: 7Rank: 7

发消息 + 关注

发表于2018-11-21 14:41:05 板凳 显示全部楼层

OceanConnect侧Profile开发请您参考:

华为IoT设备能力描述文件Profile开发指南

https://developer.huawei.com/ict/cn/doc/iot_devg_profile/index.html/zh-cn_topic_0118655633

有详细介绍配置文件具体需要包含的信息和字段



点赞 回复 举报

削了皮的土...

发帖: 1粉丝: 0

级别 : 新手上路

Rank: 1

发消息 + 关注

发表于2018-11-21 19:23:17 地板 显示全部楼层
wsm 发表于 2018-11-21 14:15 device侧的没有设置profile之说,OceanConnect侧才需profile开发

没有profile的话,OceanConnect通过什么信息去校验device啊?设备ID,设备制造商,设备识别码这些信息不需要填到设备里啊?

点赞 回复 举报

削了皮的土...

发帖: 1粉丝: 0

级别 : 新手上路

Rank: 1

发消息 + 关注

发表于2018-11-21 19:25:53 5# 显示全部楼层
六斤 发表于 2018-11-21 14:41 OceanConnect侧Profile开发请您参考:华为IoT设备能力描述文件Profile开发指南https://developer.huawei.co ...

我需要填写设备侧的,不是云平台的,云平台上的已经创建完成了,设备需要在注册消息中携带设备ID,设备识别码等信息才能通过云平台的校验,然后注册成功,我现在不清楚设备侧,这些信息要填到什么地方

点赞 回复 举报

海鹏

发帖: 3粉丝: 4

级别 : 版主

Rank: 7Rank: 7Rank: 7

发消息 + 关注

发表于2018-11-21 22:58:32 6# 显示全部楼层
削了皮的土豆 发表于 2018-11-21 19:25 我需要填写设备侧的,不是云平台的,云平台上的已经创建完成了,设备需要在注册消息中携带设备ID,设备识 ...

设备ID消息中默认就会带啊,不用配置,你设备ID通过AT指令可以查啊

点赞 回复 举报

削了皮的土...

发帖: 1粉丝: 0

级别 : 新手上路

Rank: 1

发消息 + 关注

发表于2018-11-22 09:10:18 7# 显示全部楼层

调查了代码,找到了填写设备ID的地方,现在注册成功了,多谢各位


typedef struct

{

    char* endpoint_name; ----> 设备识别码 

    char* manufacturer;  ----> 设备制造商

    char* dev_type;      ----> 设备类型

} atiny_device_info_t;


点赞 回复 举报

削了皮的土...

发帖: 1粉丝: 0

级别 : 新手上路

Rank: 1

发消息 + 关注

发表于2018-11-22 09:11:34 8# 显示全部楼层
海鹏 发表于 2018-11-21 22:58 设备ID消息中默认就会带啊,不用配置,你设备ID通过AT指令可以查啊

我的设备是ARM开发板,不是真实的NB设备,没有设备ID的,设备信息需要写死在代码里

点赞 回复 举报

六斤

发帖: 28粉丝: 14

级别 : 版主

Rank: 7Rank: 7Rank: 7

发消息 + 关注

发表于2018-11-22 10:05:34 9# 显示全部楼层
削了皮的土豆 发表于 2018-11-22 09:10 调查了代码,找到了填写设备ID的地方,现在注册成功了,多谢各位typedef struct{    char* endpo ...

点赞 回复 举报

游客

您需要登录后才可以回帖 登录 | 立即注册