197 lines
4.2 KiB
Markdown
197 lines
4.2 KiB
Markdown
# 程序启动时的示例脚本(Windows 批处理)
|
||
|
||
[start_deviceAccessLayer.bat](../start_deviceAccessLayer.bat)
|
||
|
||
```bat
|
||
chcp 65001
|
||
d:
|
||
cd D:\zsy\deviceAccessLayer
|
||
start deviceAccessLayer.exe
|
||
```
|
||
|
||
# 配置文件
|
||
|
||
> 配置文件示例
|
||
> 文件名必须是 `config.json`,且必须在程序主目录下的 `config` 文件夹中。
|
||
|
||
```json5
|
||
{
|
||
"name": "测试",
|
||
// 程序名称
|
||
"delay": 0,
|
||
// 程序启动延迟时间,单位:秒
|
||
"daemon": false,
|
||
// 是否以守护进程运行
|
||
"embedMqtt": true,
|
||
// 是否嵌入MQTT客户端
|
||
"httpSvr": {
|
||
// HTTP服务器配置
|
||
"port": 11000
|
||
// 端口号
|
||
},
|
||
"oss": {
|
||
// OSS配置
|
||
"endpoint": "localhost",
|
||
// OSS Endpoint
|
||
"bucketName": "a",
|
||
// OSS Bucket名称
|
||
"ak": "a",
|
||
// OSS AccessKey
|
||
"sk": "a"
|
||
// OSS SecretKey
|
||
},
|
||
"mqtts": [
|
||
// MQTT配置
|
||
{
|
||
"sn": "local",
|
||
// 本地MQTT客户端,固定值
|
||
"name": "本地",
|
||
"server": "127.0.0.1",
|
||
"port": 1883,
|
||
"clientId": "local",
|
||
"username": "dcs",
|
||
"password": "123456",
|
||
"subscribes": [
|
||
// 本地MQTT客户端订阅主题
|
||
{
|
||
"topic": "stop",
|
||
"qos": 0
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"sn": "remote",
|
||
// 远程MQTT客户端,固定值
|
||
"name": "远程",
|
||
"server": "127.0.0.1",
|
||
"port": 1883,
|
||
"clientId": "yztq",
|
||
"username": "dcs",
|
||
"password": "123456",
|
||
"subscribes": [
|
||
// 远程MQTT客户端订阅主题
|
||
{
|
||
"topic": "yztq/1/barrier",
|
||
"qos": 0
|
||
},
|
||
{
|
||
"topic": "yztq/1/voice",
|
||
"qos": 0
|
||
}
|
||
]
|
||
}
|
||
],
|
||
"reportSvr": {
|
||
// 业务系统的配置
|
||
"server": "http://127.0.0.1:11000",
|
||
// 服务器地址
|
||
"passUrl": "",
|
||
// 识别上报
|
||
"reportUrl": ""
|
||
// 重量照片上报
|
||
},
|
||
"barriers": [
|
||
// 道闸配置
|
||
{
|
||
"name": "进前置",
|
||
// 道闸名称
|
||
"sn": "1",
|
||
// 道闸编号
|
||
"ip": "127.0.0.1",
|
||
// 道闸IP地址
|
||
"io": 0,
|
||
// 道闸IO端口
|
||
"platformScale": "1",
|
||
// 地磅编号
|
||
"soundColumn": "1",
|
||
// 音柱编号
|
||
"vidicon": "1"
|
||
// 摄像头编号
|
||
},
|
||
{
|
||
"name": "进",
|
||
"sn": "2",
|
||
"ip": "127.0.0.1",
|
||
"io": 0,
|
||
"platformScale": "1",
|
||
"soundColumn": "1",
|
||
"vidicon": "1"
|
||
},
|
||
{
|
||
"name": "出前置",
|
||
"sn": "3",
|
||
"ip": "127.0.0.1",
|
||
"io": 0,
|
||
"platformScale": "1",
|
||
"soundColumn": "1",
|
||
"vidicon": "1"
|
||
},
|
||
{
|
||
"name": "出",
|
||
"sn": "4",
|
||
"ip": "127.0.0.1",
|
||
"io": 0,
|
||
"platformScale": "1",
|
||
"soundColumn": "1",
|
||
"vidicon": "1"
|
||
}
|
||
],
|
||
"platformScales": [
|
||
// 地磅配置
|
||
{
|
||
"sn": "1",
|
||
// 地磅编号
|
||
"name": "地磅",
|
||
// 地磅名称
|
||
"delay": 5,
|
||
// 称重延迟时间,单位:秒
|
||
"sample": 20,
|
||
// 称重采样次数
|
||
"retries": 30,
|
||
// 称重重试次数
|
||
"weight": 200.0,
|
||
// 称重阈值,单位:kg
|
||
"port": "COM2",
|
||
// 串口端口
|
||
"baudRate": 9600,
|
||
// 波特率
|
||
"byteSize": 8,
|
||
// 数据位
|
||
"parity": 0,
|
||
// 校验位
|
||
"stopBits": 0
|
||
// 停止位
|
||
}
|
||
],
|
||
"soundColumns": [
|
||
{
|
||
"sn": "1",
|
||
// 音柱编号
|
||
"name": "音柱1",
|
||
// 音柱名称
|
||
"server": "http://127.0.0.1:11000",
|
||
// 语音服务器地址
|
||
"path": "/v1/speech"
|
||
// 语音服务器路径
|
||
}
|
||
],
|
||
"vidicons": [
|
||
{
|
||
"sn": "1",
|
||
// 摄像头编号
|
||
"name": "摄像头",
|
||
// 摄像头名称
|
||
"type": 1,
|
||
// 摄像头类型,0:道闸摄像头,1:海康摄像头
|
||
"ip": "127.0.0.1",
|
||
// 摄像头IP地址,type=0 时,填道闸序列号,type=1 时,填海康摄像头IP地址
|
||
"port": 8000,
|
||
// 摄像头端口,type=0 时,无效,type=1 时,填海康摄像头端口
|
||
"username": "",
|
||
// 摄像头用户名,type=0 时,无效,type=1 时,填海康摄像头用户名
|
||
"passwd": ""
|
||
// 摄像头密码,type=0 时,无效,type=1 时,填海康摄像头密码
|
||
}
|
||
]
|
||
}
|
||
``` |