UNPKG

@iot9x.com/ipc-utils

Version:

九星云、九星小程序、九星配置工具所共用的库方法

132 lines (131 loc) 4.17 kB
import { CJT188Unit, CJT188ValveStatus, CJT188VoltageStatus, DataIdentifier } from './constant'; import { MeterType } from './type'; /** CJ/T188-2018版协议状态ST定义 */ export interface CJT188Status { /** 阀门状态 */ valve: CJT188ValveStatus; /** 电池电压 */ voltage: CJT188VoltageStatus; /** 保留 */ D3: 0 | 1; /** 保留 */ D4: 0 | 1; /** 厂商自定义 */ D5: 0 | 1; /** 厂商自定义 */ D6: 0 | 1; /** 厂商自定义 */ D7: 0 | 1; } /** CJ/T188-2004版协议水表计量数据解析 */ export interface CJT188WaterMeteringData { /** 表地址 */ address: string; /** 序号 */ ser: number; /** 当前累计流量 */ currentCumulativeTraffic: number; /** 当前累计流量单位编码 */ currentCumulativeTrafficUnit: CJT188Unit; /** 当前累计流量单位显示值 */ currentCumulativeTrafficUnitDisplay: string; /** 结算日累计流量 */ settlementCumulativeTraffic: number; /** 结算日累计流量单位编码 */ settlementCumulativeTrafficUnit: CJT188Unit; /** 结算日累计流量单位显示值 */ settlementCumulativeTrafficUnitDisplay: string; /** 实时时间,格式:YYYYMMDDhhmmss */ realTime: string; /** 状态ST */ status: CJT188Status; /** * 状态ST原始值 * @description 两字节,第一个字节标准已经定义了,解析内容为上面的status,第二字节留给厂家自定义 * @example '0000' */ statusValue: string; } /** CJ/T188-2004版协议燃气表计量数据解析 */ export type CJT188GasMeteringData = CJT188WaterMeteringData; /** CJ/T188-2004版协议热量表计量数据解析 */ export interface CJT188HeatMeteringData { /** 表地址 */ address: string; /** 序号 */ ser: number; /** 结算日热量 */ settlementHeat: number; /** 结算日热量单位编码 */ settlementHeatUnit: CJT188Unit; /** 结算日热量单位显示值 */ settlementHeatUnitDisplay: string; /** 当前热量 */ currentHeat: number; /** 当前热量单位编码 */ currentHeatUnit: CJT188Unit; /** 当前热量单位显示值 */ currentHeatUnitDisplay: string; /** 热功率 */ thermalPower: number; /** 热功率单位编码 */ thermalPowerUnit: CJT188Unit; /** 热功率单位显示值 */ thermalPowerUnitDisplay: string; /** 流量 */ traffic: number; /** 流量单位编码 */ trafficUnit: CJT188Unit; /** 流量单位显示值 */ trafficUnitDisplay: string; /** 累计流量 */ cumulativeTraffic: number; /** 累计流量单位编码 */ cumulativeTrafficUnit: CJT188Unit; /** 累计流量单位显示值 */ cumulativeTrafficUnitDisplay: string; /** 供水温度,单位:℃ */ supplyWaterTemperature: number; /** 回水温度,单位:℃ */ returnWaterTemperature: number; /** 累计工作时间,单位:h */ cumulativeWorkTime: number; /** 实时时间,格式:YYYYMMDDhhmmss */ realTime: string; /** 状态ST */ status: CJT188Status; /** * 状态ST原始值 * @description 两字节,第一个字节标准已经定义了,解析内容为上面的status,第二字节留给厂家自定义 * @example '0000' */ statusValue: string; } /** CJ/T188协议异常应答内容 */ export interface CJT188ResponseAbnormal { /** 表地址 */ address: string; /** 应答控制码 */ controlCode: number; /** 状态ST */ status: CJT188Status; /** * 状态ST原始值 * @description 两字节,第一个字节标准已经定义了,解析内容为上面的status,第二字节留给厂家自定义 * @example '0000' */ statusValue: string; } /** 正常返回的数据包解包内容 */ export interface PacketUnpacking { /** 仪表类型 */ meterType: MeterType; /** 仪表地址 */ address: string; /** 数据长度 */ dataLength: number; /** 数据标识 */ dataIdentifier: DataIdentifier; /** 数据内容 */ dataPayload: Uint8Array; }