简体   繁体   English

使用乐山服务器的OMA固件更新:文件保存在哪里?

[英]OMA firmware update using Leshan server: Where to save the files?

I'm quite new to the world of the IOT (protocols). 我对物联网(协议)世界还很陌生。 I want to update some devices remotely (they will be installed about 8000km away from my working place). 我想远程更新一些设备(它们将安装在距工作地点约8000公里的位置)。 I have found out that LWM2M would fit to my scope. 我发现LWM2M将适合我的范围。

Because the internet connection there is not stable and the bandwidth is low, I have decided to also install a Raspberry Pi to collect the data of the sensors and to install a Leshan server to trigger the updates. 因为那里的互联网连接不稳定并且带宽很低,所以我决定还安装一台Raspberry Pi来收集传感器的数据,并安装一台Leshan服务器来触发更新。

I have tested the devices and I can register them to the Leshan server on the Pi, read some data, and reboot the devices. 我已经测试了设备,可以将它们注册到Pi上的Leshan服务器上,读取一些数据,然后重新启动设备。 The problem is, I don't know where to save my binary file for the update, so that the device can download them. 问题是,我不知道将二进制文件保存在何处以进行更新,以便设备可以下载它们。

I tried following steps: 我尝试了以下步骤:

  1. Save the file on [leshan-dir]/update.bin. 将文件保存在[leshan-dir] /update.bin中。
  2. Write the "Package URI": coap://[raspi-IP]:5683/update.bin 编写“ Package URI”:coap:// [raspi-IP]:5683 / update.bin
    After that, the backgroud color of the button "Write" changes to green. 此后,按钮“写入”的背景色变为绿色。
  3. Execute the update 执行更新

The response of the server is 404 [Not Found]. 服务器的响应为404 [未找到]。

I have looked for any API to find out where I can save the .bin file, but without success. 我一直在寻找任何API,以找出可以在其中保存.bin文件的方法,但是没有成功。 And because nobody seems to have had a similar error, I start thinking I have missed some points. 而且由于似乎没有人犯过类似的错误,所以我开始认为我错过了一些要点。

Where do I have to save the files on the Raspbery Pi, so that I can perform an update? 我必须在哪里将文件保存在Raspbery Pi上,以便执行更新?

I found a solution for the problem I exposed above. 我找到了上面暴露的问题的解决方案。

I use from the californium-project the demo-app cf-simplefile-server (Ref. https://github.com/eclipse/californium/tree/2.0.x/demo-apps/cf-simplefile-server ) 我在californium项目中使用了demo-app cf-simplefile-server (参考https://github.com/eclipse/californium/tree/2.0.x/demo-apps/cf-simplefile-server

Note: You have to checkout to the git-branch 2.0.x to use it. 注意:您必须签出到git-branch 2.0.x才能使用它。

To run the leshan server and the file-server on the same machine I had to change the port of one of the server using the file Californium.properties . 为了在同一台机器上运行leshan服务器和文件服务器,我必须使用Californium.properties文件更改其中一台服务器的端口。 I decide to change the ones of the file-server to 5685 and 5686 我决定将文件服务器的文件更改为5685和5686

When both server runs I can insert in Package URI something like: 当两个服务器都运行时,我可以在Package URI中插入类似以下内容:

coap://[[ip_of_the_pi]]:5685/data/[[name_of_the_firmware_file]]

Probably there are better solution for it, but for a coap/lwm2m beginner like it works very well. 可能有更好的解决方案,但是对于像coap / lwm2m这样的初学者来说,它的效果很好。

Note: If you have bigger file to transfer you can also change the property MAX_RESOURCE_BODY_SIZE 注意:如果您要传输的文件更大,还可以更改属性MAX_RESOURCE_BODY_SIZE

I hope this may help somebody. 我希望这可以对某人有所帮助。

Regards, 问候,

Elvys Elvys

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM