IP Camera视频流接入EdgeX Foundry操作实例

最近华乔老师贡献了一个edgex-device-rtsp的device service,用来管理IPC设备,这个帖子展示了使用这个微服务连接摄像头的整个流程。
步骤一:拉取对应的docker启动edgex-device-rtsp

为了方便操作,这里我直接修改了docker-compose文件中,在device service段添加如下code:

  device-rtsp:
    image: badboyqiao/edgex-device-rtsp:0.1.0-dev
    ports:
    - "49983:49983"
    - "1935:1935"
    - "8089:8089"
    container_name: edgex-device-rtsp
    hostname: edgex-device-rtsp
    networks:
      edgex-network:
        aliases:
        - edgex-device-rtsp
    volumes:
    - db-data:/data/db
    - log-data:/edgex/logs
    - consul-config:/consul/config
    - consul-data:/consul/data
    depends_on:
    - data
    - command

改写完成之后,通过docker-compose文件正常启动edgex-foundry。
步骤二:打开UI,上传profile文件,填写Device信息
2.1 上传profile文件

首先需要填写edgexfoundry解析设备所需要的profile文件,将下面的内容保存为“test-rtsp-profile.yml”文件,保存在本地。

name: "test-rtsp-profile"
manufacturer: "VMware huaqiaoz"
model: "rtsp"
labels:
- "test"
description: "Test rtsp profile"
deviceResources:
-
  name: turnon
  description: "turnon actively"
  attributes:
    { name: "turnon" }
  properties:
    value:
      { type: "Bool", size: "1", readWrite: "RW", defaultValue: "false"  }
    units:
      { type: "String", readWrite: "RW", defaultValue: "ON" }
-
  name: turnoff
  description: "turnoff actively"
  attributes:
    { name: "turnoff" }
  properties:
    value:
      { type: "Bool", size: "1", readWrite: "RW", defaultValue: "false"  }
    units:
      { type: "String", readWrite: "RW", defaultValue: "OFF" }
deviceCommands:
-
  name: turnon
  set:
  - { index: "1", operation: "set", object: "turnon", parameter: "turnon", property: "value" }
-
  name: turnoff
  set:
  - { index: "1", operation: "set", object: "turnoff", parameter: "turnoff", property: "value" }
coreCommands:
-
  name: turnon
  put:
    path: "/api/v1/device/{deviceId}/turnon"
    parameterNames: ["turnon"]
    responses:
    -
      code: "204"
      description: "set the message."
      expectedValues: []
    -
      code: "503"
      description: "service unavailable"
      expectedValues: []
-
  name: turnoff
  put:
    path: "/api/v1/device/{deviceId}/turnoff"
    parameterNames: ["turnoff"]
    responses:
    -
      code: "204"
      description: "set the message."
      expectedValues: []
    -
      code: "503"
      description: "service unavailable"
      expectedValues: []

打开UI界面(http://localhost:4000)之后,首先添加网关,选择添加的网关,在左侧栏中选中“Deviceservice”,在右侧栏中可以看到Device Profile这一区域,选择添加profile,选择ipc对应的profile文件,上传,如下图箭头所示:
在这里插入图片描述

2.2填写device信息

在上面的Device-service区域,可以看到有edgex-device-service,然后点击下图箭头所指的位置,出现填写device信息的窗口。
例如,rtsp的流为:rtsp://admin:admin@10.5.5.11:554/h264/ch1/main/av_stream
注册设备所需填写的内容为(应该根据具体的rtsp流填写内容):

{
    "name":"ipc1_device_name",
    "adminState":"UNLOCKED",
    "operatingState":"ENABLED",
    "protocols":{
        "rtsp":{
            "Schema":"rtsp",
            "Host":"10.5.5.11",
            "Port":"554",
            "Password":"admin",
            "User":"admin",
            "Path":"/h264/ch1/main/av_stream",
            "DumpPath":"jianing"
        }
    },
    "service":{
        "name":"edgex-device-rtsp"  
    },
    "profile":{
        "name":"test-rtsp-profile"
    }
}

dumppath目前没有用,可以随便填写

填写之后的界面如图:
在这里插入图片描述

2.3 发送命令

根据下图箭头的顺序,首先调出来Command选项卡,”Method”选择”set”选项,”Parameter”填写”true”,发送命令,看到返回“Success”,说明操作成功。
在这里插入图片描述


原作者:lulililu
原文链接:https://www.edgexfoundry.club/user/lulililu/article/5d8d93356598210001292c9b

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值