物联网学习日记4

1.Value Descriptors
解析:If you make a GET call to the http://localhost:48080/api/v1/valuedescriptor URL you will get a listing [in JSON] of all the Value Descriptors currently defined in your instance of EdgeX, including the ones you just added.

2.Addressables
解析:http://localhost:48081/api/v1/addressable

3.增加Device Profile
解析:http://localhost:48081/api/v1/deviceprofile/uploadfile

4.创建Device Service
解析:http://localhost:48081/api/v1/deviceservice

5.添加Device
解析:http://localhost:48081/api/v1/device

6.检查Device Service
解析:http://localhost:48081/api/v1/deviceservice

7.检查Device
解析:http://localhost:48081/api/v1/device

8.检查Value Descriptors
解析:http://localhost:48080/api/v1/valuedescriptor

9.发送 Event/Reading[POST]
解析:http://localhost:48080/api/v1/event

10.Export Clients
解析:http://localhost:48071/api/v1/registration

11.Rules Engine
解析:In fact, by default, the Rules Engine is automatically registered as a client of the export services and automatically receives all the Events/Readings from Core Data that are sent by Devices. To see all the existing export clients, you can request a list from the Export Client micro service.

12.注册Export Client
解析:

POST to http://localhost:48071/api/v1/registration

BODY: {"name":"MyMQTTTopic","addressable":{"name":"MyMQTTBroker","protocol":"TCP","address":"tcp://m10.cloudmqtt.com","port":15421,"publisher":"EdgeXExportPublisher","user":"hukfgtoh","password":"mypass","topic":"EdgeXDataTopic"},"format":"JSON","encryption":{"encryptionAlgorithm":"AES","encryptionKey":"123","initializingVector":"123"},"enable":true,"destination":"MQTT_TOPIC"}

13.客户端注册[MQTT服务器]
解析:要想让EdgeX Foundry能够将数据推送到MQTT服务器,就需要先将其在EdgeX这边注册为一个输出客户端。需要定义的MQTT服务器的地址、端口、发布主题,同时这里只推送随机数设备的数据:

{
    "name":"QuickStartExport",
    "addressable":{
        "name":"EMQBroker",
        "protocol":"tcp",
        "address":"192.168.60.128",
        "port":1883,
        "publisher":"EdgeXExportPublisher",
        "topic":"hangge"
    },
    "format":"JSON",
    "filter":{
        "deviceIdentifiers":["Random-Integer-Generator01"]
    },
    "enable":true,
    "destination":"MQTT_TOPIC"
}

[1]后面跟上"/name/客户端名称"则只显示这个指定的客户端注册信息。
[2]后面直接跟上"客户端id"显示指定的客户端注册信息。
[3]可以根据name来删除指定客户端,也可以根据id来删除指定客户端。

14.客户端注册[HTTP服务器]
解析:要想让EdgeX Foundry能够将数据推送到服务器,就需要先将服务器地址在EdgeX这边注册为一个输出客户端。需要定义远程服务器的地址、端口、路径、提交方式等,同时这里只推送随机数设备的数据:

{
    "name": "QuickStartExport2",
    "addressable": {
        "name": "EdgeXTestREST",
        "protocol": "http",
        "method": "POST",
        "address": "192.168.60.1",
        "port": 80,
        "path": "/rest.php"
    },
    "format": "JSON",
    "filter":{
        "deviceIdentifiers":["Random-Integer-Generator01"]
    },
    "enable": true,
    "destination": "REST_ENDPOINT"
}

说明:需要查看或者删除指定的已注册客户端,可以通过name、或者id。

15.导出数据过滤
解析:过滤配置项除了在客户端一开始注册时就设定好之外,还可以在运行中自由更改。只要通过PUT提交请求到如下地址:http://EdgeX-IP:48071/api/v1/registration。
[1]设备过滤

{"name":"QuickStartExport", "filter":{"deviceIdentifiers":["Random-Integer-Generator01"]}}

[2]值描述符过滤

{
    "name": "QuickStartExport",
    "filter": {
        "valueDescriptorIdentifiers": ["RandomValue_Int8", "RandomValue_Int16"]
    }
}

16.手动提交一个数据事件event
解析:可以直接通过core-data微服务的API接口手动提交数据事件,EdgeXFoundry同样会将其推送到云端。这是一条温湿度传感器数据,里面包含温度、湿度值,以及时间戳origin。

{
    "device": "sensor1",
    "origin":1471806386919,
    "readings": [{
        "name": "temperature",
        "value": "72",
        "origin":1471806386919
    }, {
        "name": "humidity",
        "value": "58",
        "origin":1471806386919
    }]
}

17.docker run --rm --name nginx-test -p 8080:80 -d nginx
解析:
[1]–rm:容器终止运行后,自动删除容器文件。
[2]–namenginx-test:容器的名字叫做nginx-test,名字自己定义。
[3]-p:端口进行映射,将本地8080端口映射到容器内部的80端口。
[4]-d:容器启动后,在后台运行。

18.mkdir -p /home/nginx/www /home/nginx/logs /home/nginx/conf
解析:
[1]www:目录将映射为nginx容器配置的虚拟目录。
[2]logs:目录将映射为nginx容器的日志目录。
[3]conf:目录里的配置文件将映射为nginx容器的配置文件。

19.微服务架构和微服务
[1]微服务架构是将复杂的系统使用组件化的方式进行拆分,并使用轻量级通讯方式进行整合的一种设计方法。
[2]微服务是通过这种架构设计方法拆分出来的一个独立的组件化的小应用。

20.go-json-rest
解析:go-json-rest是基于net/http的一个小封装,可帮助轻松构建RESTful JSON API。它使用基于Trie的实现提供快速和可拓展的请求路由,帮助处理JSON请求和响应。它拥有丰富的中间件,比如CORS,Auth,Gzip,Status等,可帮助实现和拓展功能。此外,还有一些与go-json-rest兼容的第三方中间件,比如JWT,AuthToken等。

21.sys-mgmt-agent
解析:sys-mgmt-agent是Edgex系统中提供其它微服务生命周期管理的一个微服务,它主要提供3个功能:start,stop,restart其它微服务,获取微服务的配置参数,获取微服务运行时的metric指标。

22.docker rmi
解析:删除本地一个或多少镜像。

23.Configuration and Registry
解析:配置和注册微服务提供集中式[即EdgeX Foundry-wide]管理:
[1]任何和所有EdgeX Foundry微服务的配置和操作参数
[2]EdgeX Foundry微服务的位置和状态

24.AMQP
解析:AMQP,即Advanced Message Queuing Protocol,一个提供统一消息服务的应用层标准高级消息队列协议,是应用层协议的一个开放标准,为面向消息的中间件设计。基于此协议的客户端与消息中间件可传递消息,并不受客户端/中间件不同产品,不同的开发语言等条件的限制。Erlang中的实现有RabbitMQ等。

25.ActiveMQ
解析:ActiveMQ是一种开源的基于JMS[Java Message Server]规范的一种消息中间件的实现,ActiveMQ的设计目标是提供标准的,面向消息的,能够跨越多语言和多系统的应用集成消息通信中间件。

参考文献:
[1]边缘计算框架EdgeX Foundry使用详解5[将数据推送到MQTT服务器上]:https://www.hangge.com/blog/cache/detail_2351.html
[2]go-json-rest:https://github.com/ant0ine/go-json-rest/
[3]Docker容器部署Nginx服务:https://www.cnblogs.com/saneri/p/11799865.html

发布了400 篇原创文章 · 获赞 423 · 访问量 38万+

猜你喜欢

转载自blog.csdn.net/shengshengwang/article/details/104439776