文档中心>物联网智能视频服务(消费版)

物模型

最近更新时间:2020-12-08 16:50:58

我的收藏

操作场景

物模型是将物理实体设备进行数字化描述,构建其数字模型。在物联网智能视频服务(消费版)控制台创建完产品后,您可以通过定义物模型来定义产品功能。

操作步骤

创建物模型

1. 进入 物联网智能视频服务(消费版)控制台,单击左侧导航栏物模型,选择需要为之添加物模型的产品,单击查看物模型
2. 单击左上角创建物模型,选择添加标准功能或者添加自定义功能进行对应物模型创建。
功能类型 产品的功能包括标准功能和自定义功能,详情如下:
功能类型
功能描述
标准功能
提供一些 IPC 摄像头常用功能,可根据需求自行选择添加。分为必选属性和可选属性,必选属性不可删除,不可编辑;可选属性则可删除、部分可编辑。
自定义功能
如果标准功能无法满足您的需求,您可以自定义功能。则可由开发者自由删除和编辑。
功能元素
功能元素
说明
属性
可自定义创建,包括常量属性、只读属性、可写属性三种,支持整数型、浮点型、字符型3种基本数据类型,以及可扩展的自定义数据类型:结构体。
行为
可自定义创建,支持整数型、浮点型、字符型3种基本数据类型。
事件
内置模型暂不支持自定义创建。
功能元素
说明
备注
ProConst
properties-const 常量属性(内置模型,不支持用户扩展)
终端固有的参数信息,运行期间不会发生变化,固件升级可能导致 ProConst 参数变更。(例如:设备版本信息、设备是否支持某项功能)设备上电后,主动将参数上送到服务器。
ProReadonly
properties-readonly 只读属性(用户可添加自定义数据)
设备当前状态信息(例如:在线信息(内置模型)、镜头当前状态)设备状态变更时,主动报告到云端。
ProWritable
properties-writable 可写参数(用户可添加自定义数据)
存储在云端,终端运行时需加载的参数(例如:云存储开通套餐(内置模型)、摄像头预置位)终端初次启动,主动从云端拉取最新数据;云端数据变更时,云端主动通知终端。
Action
Action 操作(用户可添加自定义控制对象)
设备接收到控制操作命令,改变当前状态(例如:打开/关闭镜头、切换预置位)。
Event
Event 事件(内置模型)
内置通用事件模型,支持应用层触发任意类型的 JSON 格式事件。
数据类型
数据类型
说明
基本数据类型
int32:有符号32位整数。
uint32:无符号32位整数。
float32:32位浮点数。
float64:64位浮点数。
string32:字符串,最大长度32个字符。
string64:字符串,最大长度64个字符。
stringN:最大长度为N的字符串。
自定义数据类型
struct:结构体,可用于复杂的可拓展数据类型。
平台支持用户进行自定义数据类型添加,选择物模型 > 自定义数据类型列表,单击左上角添加,即可编辑自定义数据类型。

发布物模型

1. 完成物模型创建或修改后,单击保存模板
2. 单击发布,弹窗提示是否确认发布当前物模型版本,单击确认完成该版本物模型发布。
3. 发布成功后,物模型列表中将展示发布成功的物模型版本及发布时间,用户可单击查看,即可查看该版本物模型定义。
4. 物模型版本列表中,单击生成设备端代码,即可下载对应的设备端代码(生成的设备端代码会记录产品 ID/版本等信息)。
5. 用户通过设备端 SDK+ 物模型设备端代码完成固件版本开发,设备完成新版固件升级,即可实现该版本物模型功能迭代。

物模型格式参考

以下为 IPC 摄像头的物模型字段描述说明,包括各种数据类型和功能。示例代码如下:
{
"iotModel":{
"TypeDefs": [
{
"name": "_ProductInfo",
"desc": "产品信息",
"type": [{
"name": "productModel",
"desc": "产品型号",
"type": "string32"
},
{
"name": "productID",
"desc": "产品ID",
"type": "string32"
},
{
"name": "funcCode",
"desc": "产品可选功能码",
"type": "uint32"
},
{
"name": "revision",
"desc": "物模型修订版本",
"type": "uint32"
},
{
"name": "revisionUtc",
"desc": "物模型修订时间",
"type": "uint32"
}
]
},
{
"name": "_VersionInfo",
"desc": "固件信息",
"type": [
{
"name": "sdkVer",
"desc": "SDK版本号",
"type": "uint32"
},
{
"name": "swVer",
"desc": "应用软件版本号",
"type": "uint32"
},
{
"name": "hwVer",
"desc": "硬件版本号",
"type": "uint32"
}
]
},
{
"name": "_CloudStorageService",
"desc": "云存储服务参数",
"type": [{
"name": "serviceType",
"desc": "云存储服务类型",
"type": "int32"
},
{
"name": "utcExpire",
"desc": "云存储服务过期时间(UTC)",
"type": "int32"
},
{
"name": "pause",
"desc": "云存储服务暂停,设置为非0时,即使当前存在有效的云存储套餐,设备也不会云存推流",
"type": "int32"
},
{
"name": "serviceParm",
"desc": "云存储服务参数信息",
"type": "string128"
}
]
},
{
"name": "PlanTimeSection",
"desc": "计划时间段参数",
"type": [
{
"name": "desc",
"desc": "描述信息",
"type": "string64"
},
{
"name": "enable",
"desc": "时间段参数使能",
"type": "int32"
},
{
"name": "dayOfWeek",
"desc": "0~6:周日~周六 -1:不指定星期",
"type": "int32"
},
{
"name": "begin",
"desc": "每天开始的时间0~86399 -1:无效",
"type": "int32"
},
{
"name": "end",
"desc": "每天开始的时间0~86399 -1:无效",
"type": "int32"
}
]
},
{
"name": "RecodePlan8",
"desc": "录像计划,预置8个可设置的时间段,用户可通过启用/设置这些时间段,实现计划录像的功能",
"type": [
{
"name": "timeSection1",
"desc": "预置时间段1",
"type": "PlanTimeSection"
},
{
"name": "timeSection2",
"desc": "预置时间段2",
"type": "PlanTimeSection"
},
{
"name": "timeSection3",
"desc": "预置时间段3",
"type": "PlanTimeSection"
},
{
"name": "timeSection4",
"desc": "预置时间段4",
"type": "PlanTimeSection"
},
{
"name": "timeSection5",
"desc": "预置时间段5",
"type": "PlanTimeSection"
},
{
"name": "timeSection6",
"desc": "预置时间段6",
"type": "PlanTimeSection"
},
{
"name": "timeSection7",
"desc": "预置时间段7",
"type": "PlanTimeSection"
},
{
"name": "timeSection8",
"desc": "预置时间段8",
"type": "PlanTimeSection"
}
]
},
{
"name": "IntCoordinate",
"desc": "整形位置坐标",
"type": [{
"type": "int32",
"name": "x",
"desc": "x坐标"
},
{
"type": "int32",
"name": "y",
"desc": "y坐标"
}
]
},
{
"name": "PresetPosSetting",
"desc": "摄像头预置位设定参数",
"type": [{
"name": "pos1",
"desc": "预置位1坐标",
"type": "IntCoordinate"
},
{
"name": "pos2",
"desc": "预置位2坐标",
"type": "IntCoordinate"
},
{
"name": "pos3",
"desc": "预置位3坐标",
"type": "IntCoordinate"
},
{
"name": "pos4",
"desc": "预置位4坐标",
"type": "IntCoordinate"
},
{
"name": "pos5",
"desc": "预置位5坐标",
"type": "IntCoordinate"
},
{
"name": "pos6",
"desc": "预置位6坐标",
"type": "IntCoordinate"
}
]
},
{
"name": "MyStruct",
"desc": "自定义数据结构",
"type": [{
"name": "attr1",
"desc": "aaaa",
"type": "int32"
},
{

"name": "attr2",
"desc": "bbbb",
"type": "string64"
},
{
"name": "attr3",
"desc": "eeee",
"type": [{
"name": "attr3_1",
"desc": "cccc",
"type": "int32"
},
{
"name": "attr3_2",
"desc": "dddd",
"type": "int32"
}
]
},
{
"name": "attr4",
"desc": "jjjj",

"type": [{
"name": "attr4_1",
"desc": "aaaa",
"type": "int32"
},
{

"name": "attr4_2",
"desc": "bbbb",
"type": "string64"
},
{
"name": "attr4_3",
"desc": "eeee",
"type": [{
"name": "attr4_3_1",
"desc": "cccc",
"type": "int32"
},
{
"name": "attr4_3_2",
"desc": "dddd",
"type": "int32"
}
]
}
]
}
]
}
],
"DataDefs": [
{
"name": "_productInfo",
"desc": "产品信息",
"type": "_ProductInfo",
"FC": "ProConst"
},
{
"name": "_versionInfo",
"desc": "版本信息",
"type": "_VersionInfo",
"FC": "ProConst"
},
{
"name": "_otaMode",
"desc": "OTA升级模式(内置对象)",
"type": "int32",
"FC": "ProWritable"
},
{
"name": "_otaVersion",
"desc": "OTA升级版本(内置对象)",
"type": "string32",
"FC": "Action"
},
{
"name": "_otaUpgrade",
"desc": "OTA升级进度(内置对象)",
"type": "int32",
"FC": "Action"
},
{
"name": "_logLevel",
"desc": "日志输出等级设置(内置对象)",
"type": "int32",
"FC": "ProWritable"
},
{
"name": "_cloudStoage",
"desc": "云存储服务参数(内置对象)",
"type": "_CloudStorageService",
"FC": "ProWritable"
},
{
"name": "cameraOn",
"desc": "打开摄像头",
"type": "int32",
"FC": "Action"
},
{
"name": "takePhoto",
"desc": "触发设备拍一张照片",
"type": "int32",
"FC": "Action"
},
{
"name": "shootVideo",
"desc": "触发设备拍一段视频",
"type": "int32",
"FC": "Action"
},
{
"name": "recodePlan",
"desc": "录像计划参数,摄像头按照参数设定的时间范围进行本地录像",
"type": "RecodePlan8",
"FC": "ProWritable"
},
{
"name": "presetPosSetting",
"desc": "摄像头预置位参数(存储用户预设的摄像头位置坐标信息)",
"type": "PresetPosSetting",
"FC": "ProWritable"
},
{
"name": "presetPosition",
"desc": "摄像头预置位(用户可控制摄像头转向预设的某个位置)",
"type": "int32",
"FC": "Action"
},
{
"name": "test",
"desc": "测试数据",
"type": "MyStruct",
"FC": "ProReadonly"
}
]
}
}