示例说明
针对一些报警以及事件类型ID,可参考 报警自定义类型说明
有些字段数据可能会因为不同设备类型的原因,字段数据无意义,如果用不上,可忽略
一、定位数据
[HttpPost]
public MBackResult ReceiveLocationData([FromBody]TerminalLocation parm)
{
Log.Instance.Info("位置数据:" + JsonConvert.SerializeObject(parm));
MBackResult result = new MBackResult();
result.Result = 200;
return result;
}
TerminalLocation对象详解
/// <summary>
/// 定位数据
/// </summary>
public class TerminalLocation
{
/// <summary>
/// 设备号
/// </summary>
public string assetId { get; set; }
/// <summary>
/// 经度
/// </summary>
public double longitude { get; set; } = 0.0;
/// <summary>
/// 纬度
/// </summary>
public double latitude { get; set; } = 0.0;
/// <summary>
/// 速度
/// </summary>
public int speed{ get; set; }
/// <summary>
/// 方向
/// </summary>
public int direction { get; set; } = 0;
/// <summary>
/// 里程
/// </summary>
public long mileage { get; set; } = 0L;
/// <summary>
/// 定位时间(UTC时间)
/// </summary>
public string gpsTime { get; set; }
/// <summary>
/// 接收时间(UTC时间)
/// </summary>
public string recvTime { get; set; }
/// <summary>
/// 定位类型(0:不定位;1:GPS定位;2:基站定位)
/// </summary>
public int locType { get; set; } = 0;
/// <summary>
/// GPRS信号
/// </summary>
public int cellSignal { get; set; } = 0;
/// <summary>
/// 卫星信号
/// </summary>
public int gnssSignal { get; set; } = 0;
/// <summary>
/// 小区码数据 ,MNC,MCC,LAC,CID
/// </summary>
public string cells { get; set; }
/// <summary>
/// 电量
/// </summary>
public int battery { get; set; }
/// <summary>
/// 电压
/// </summary>
public string voltage { get; set; }
/**
* 锁/车载状态JSON
*/
public string statusJson { get; set; }
/**
* 拓展信息JSON
*/
public string expandInfo { get; set; }
}
锁/车载状态JSON说明
/// <summary>
/// 锁/车载状态JSON
/// </summary>
public class StatusJson
{
/// 锁状态信息JSON说明(针对电子锁设备)
/// <summary>
/// 锁绳状态(1: 拔出 0:插入 -1:无)
/// </summary>
public int lockRope { get; set; }
/// <summary>
/// 锁状态(0:关 1:开)
/// </summary>
public int lockStatus { get; set; }
///车载状态信息JSON说明(针对GP系列,部标设备等车载设备)
/// <summary>
/// 引擎开关状态( 1:开 0:关 -1:无)
/// </summary>
public int acc { get; set; }
/// <summary>
/// 断油电开关状态 (1:开 0:关 -1:无)
/// </summary>
public int fuelCut { get; set; }
/// <summary>
/// 开关门状态(1:开 0:关 -1:无)
/// </summary>
public int door { get; set; }
/// <summary>
/// 发动机状态(1:开 0:关 -1:无)
/// </summary>
public int engine { get; set; }
}
拓展信息JSON说明
/// <summary>
/// 扩展字段
/// </summary>
public class ExpandInfo
{
/// <summary>
/// 温度 -1000表示无
/// </summary>
public int temperature { get; set; }
/// <summary>
/// 湿度 0表示无
/// </summary>
public int humidity { get; set; }
/// <summary>
/// 油位值-1表示无("-1,-1,-1")
/// </summary>
public int fuels { get; set; }
/// <summary>
/// 加速度(格式:"x:1;y:-29;z:-2903")
/// </summary>
public string acceleration { get; set; }
/// <summary>
/// 光照度(lux)
/// </summary>
public float lux { get; set; }
/// <summary>
/// 气压(pa)
/// </summary>
public float pressure { get; set; }
/// <summary>
/// 姿态 (格式:"x:1;y:-29;z:-2903")
/// </summary>
public string fPosture { get; set; }
/// <summary>
/// 备用电池 "55,3.88,0"
/// </summary>
public string backBattery { get; set; }
/// <summary>
///数据类型 0:实时;1:补报;2:报警
/// </summary>
public int reportType { get; set; }
/// <summary>
/// 网络类型 0:未知 1:1G 2:2G 3:3G 4:4:G 5:5G 其它不显示
/// </summary>
public int networkType { get; set; }
}
二、报警数据
[HttpPost]
public MBackResult ReceiveAlarmData([FromBody]TerminalAlarm parm)
{
Log.Instance.Warn("报警数据:" + JsonConvert.SerializeObject(parm));
MBackResult result = new MBackResult();
result.Result = 200;
return result;
}
TerminalAlarm对象详解
/// <summary>
/// 报警数据
/// </summary>
public class TerminalAlarm
{
/// <summary>
/// 设备号
/// </summary>
public string assetId { get; set; }
/// <summary>
/// 报警类型
/// </summary>
public int alarmType { get; set; }
/// <summary>
/// UTC时间
/// </summary>
public string dateTime { get; set; }
/// <summary>
/// 经度(WGS-84)
/// </summary>
public double longitude { get; set; } = 0.0;
/// <summary>
/// 纬度(WGS-84)
/// </summary>
public double latitude { get; set; } = 0.0;
/// <summary>
/// 速度(km/h)
/// </summary>
public int speed { get; set; }
/// <summary>
/// 里程(km)
/// </summary>
public long mileage { get; set; }
/// <summary>
/// 小区码(mcc,mnc,lac,cellid)
/// </summary>
public string cells { get; set; }
/// <summary>
/// 报警描述
/// </summary>
public string describe { get; set; }
/// <summary>
/// 附件ID
/// </summary>
public string fileIndex{ get; set; }
}
三、事件数据
[HttpPost]
public MBackResult ReceiveEventData([FromBody]TerminalEvent parm)
{
Log.Instance.Warn("事件数据:" + JsonConvert.SerializeObject(parm));
MBackResult result = new MBackResult();
result.Result = 200;
return result;
}
TerminalEvent对象详解
/// <summary>
/// 事件数据
/// </summary>
public class TerminalEvent
{
/// <summary>
/// 设备号
/// </summary>
public string assetId { get; set; }
/// <summary>
/// 事件类型 1:开锁 2:关锁 3:出区域施封 4:进区域解封 5:开箱/区 6:关箱/门
/// </summary>
public int eventType { get; set; }
/// <summary>
/// 开锁类型 1:刷卡开锁 2:远程开锁 3:蓝牙开锁 4:剪绳开锁 5:短信开锁 6:区域触发
/// </summary>
public int unLockType { get; set; }
/// <summary>
/// UTC时间
/// </summary>
public string dateTime { get; set; }
/// <summary>
/// 经度(WGS-84)
/// </summary>
public double longitude { get; set; } = 0.0;
/// <summary>
/// 纬度(WGS-84)
/// </summary>
public double latitude { get; set; } = 0.0;
/// <summary>
/// 速度(km/h)
/// </summary>
public int speed { get; set; }
/// <summary>
/// 里程(km)
/// </summary>
public long mileage { get; set; }
/// <summary>
/// 小区码数据(mcc,mnc,lac,cellid)
/// </summary>
public string cells { get; set; }
/// <summary>
/// 刷卡开锁卡号
/// </summary>
public string card { get; set; }
/// <summary>
/// 开锁密码
/// </summary>
public string password { get; set; }
}
四、指令应答数据
[HttpPost]
public MBackResult ReceiveInsData([FromBody]TerminalCommand parm)
{
Log.Instance.Warn("指令数据:" + JsonConvert.SerializeObject(parm));
MBackResult result = new MBackResult();
result.Result = 200;
return result;
}
TerminalCommand对象详解
/// <summary>
/// 指令应答数据
/// </summary>
public class TerminalCommand
{
/// <summary>
/// 设备号
/// </summary>
public string assetId { get; set; }
/// <summary>
/// 指令类型
/// </summary>
public string commandType { get; set; }
/// <summary>
/// 指令内容
/// </summary>
public string content { get; set; }
/// <summary>
/// UTC时间
/// </summary>
public string dateTime { get; set; }
}
五、从机数据
[HttpPost]
public MBackResult ReceiveInsData([FromBody]SlaveMachineLocation parm)
{
Log.Instance.Warn("从机数据:" + JsonConvert.SerializeObject(parm));
MBackResult result = new MBackResult();
result.Result = 200;
return result;
}
SlaveMachineLocation对象详解
/// <summary>
/// 从机数据
/// </summary>
public class SlaveMachineLocation
{
/// <summary>
/// 主锁设备ID
/// </summary>
public string assetId { get; set; }
/// <summary>
/// 主锁经度(WGS-84)
/// </summary>
public double longitude { get; set; } = 0.0;
/// <summary>
/// 主锁纬度(WGS-84)
/// </summary>
public double latitude { get; set; } = 0.0;
/// <summary>
/// 主锁速度
/// </summary>
public int speed { get; set; }
/// <summary>
/// 主锁方向
/// </summary>
public int direction { get; set; }
/// <summary>
/// 主锁定位时间(UTC时间)
/// </summary>
public string gpsTime { get; set; }
/// <summary>
/// 主锁接收时间(UTC时间)
/// </summary>
public string recvTime { get; set; }
/// <summary>
/// 从机定位时间(UTC时间
/// </summary>
public string subGpsTime { get; set; }
/// <summary>
/// 从机电量
/// </summary>
public int battery { get; set; }
/// <summary>
/// 从机电压
/// </summary>
public string voltage { get; set; }
/// <summary>
/// 从机设备号
/// </summary>
public string subAssetID { get; set; }
/// <summary>
/// 从机类型 1-JT126 4-JT709 5-JT801 6-JT802
/// </summary>
public int sensorType { get; set; }
/// <summary>
/// 针对802设备的状态数据(Json字符串),其它类型设备数据可忽略
/// </summary>
public string statusJson { get; set; }
/// <summary>
/// 从机锁状态 0-关 1-开
/// </summary>
public int locStatus { get; set; }
/// <summary>
/// 从机锁绳状态 0-关 1-开
/// </summary>
public int locRope { get; set; }
/// <summary>
///RSSI
/// </summary>
public int rssi { get; set; }
/// <summary>
/// 从机温度 -1000表示无
/// </summary>
public double temperature { get; set; } = -1000.0;
/// <summary>
/// 从机湿度 0表示无
/// </summary>
public int humidity { get; set; }
/// <summary>
/// 从机事件 -1:无 0:关锁事件 1:蓝牙开锁事件 2:开后盖报警 3:远程开锁事件 4:锁绳剪断报警 5:按键唤醒事件 6:心跳包事件 7:充电唤醒事件 8/20:拔出锁绳事件 9:RFID开锁事件 10:刷非法卡报警 14:从机信号丢失报警 15:阀门关闭事件 16:阀门打开事件 17:低电量报警 18:防拆卸报警 19:电子仓拆卸事件 21:锁绳插入 22:蓝牙连接唤醒 23:应急仓打开报警 24:应急仓关闭报警 25:阀门异常打开报警 26:锁销关闭事件 27:锁销开启事件 28:关锁异常 29:电机异常 30:NFC触发
/// </summary>
public int eventType { get; set; } = -1;
/// <summary>
/// 从机开锁次数
/// </summary>
public int locTimes { get; set; }
/// <summary>
/// 从机定位时间戳
/// </summary>
public long subGpsTimestamp { get; set; }
}
文档更新时间: 2023-12-07 15:44 作者:admin