海康带有GPS的设备,是通过报警(Alarm)服务进行GPS上传的,具体通信通道是根据配置文件,可选择UDP,UDP&TCP,MQTT方式分别对应的配置是:
<Param>
<LogPath>C:/EHomeSdkLogs/</LogPath>
<LogLevel>3</LogLevel>
<LogAutoDel>false</LogAutoDel>
<KeepAliveSeconds>15</KeepAliveSeconds>
<KeepAliveCount>6</KeepAliveCount>
//报警方式: 0:udp,1:UDP&TCP, 2:MQTT
<AlarmServerType>2</AlarmServerType>
// ALARM的报警地址
<AlarmServerIP>192.168.31.253</AlarmServerIP>
// ALARM的报警端口
<AlarmServerUdpPort>7332</AlarmServerUdpPort>
<AlarmServerTcpPort>7333</AlarmServerTcpPort>
<AlarmServerMqttPort>7334</AlarmServerMqttPort>
<AlarmServerPortUseCms>0</AlarmServerPortUseCms>
<NTPServerIP>10.17.132.231</NTPServerIP>
<NTPServerPort>123</NTPServerPort>
<NTPInterval>3600</NTPInterval>
<PictureServerType>2</PictureServerType>
<PictureServerIP>192.168.1.243</PictureServerIP>
<PictureServerPort>10002</PictureServerPort>
<CmsAccessSecurity>0</CmsAccessSecurity>
<AlarmAccessSecurity>0</AlarmAccessSecurity>
<StreamAccessSecurity>0</StreamAccessSecurity>
<AlarmPictureSeparate>1</AlarmPictureSeparate>
</Param>
上报文
- 接收<?xml version="1.0" encoding="UTF-8"?>
<PPVSPMessage>
<Version>2.0</Version>
<Sequence>1137</Sequence>
<CommandType>REQUEST</CommandType>
<Command>GPS</Command>
<Params>
//设备ID
<DeviceID>123457</DeviceID>
//上报时间
<Time>2021-08-23 16:35:35</Time>
//方向
<DivisionEW>E</DivisionEW>
//经度 范围:0-(180*3600*100)
//转换公式:实际度数*3600*100+实际分数*60*100+实际秒数*100
<Longitude>43713595</Longitude>
<DivisionNS>N</DivisionNS>
//纬度
//转换公式:实际度数*3600*100+实际分数*60*100+实际秒数*100
<Latitude>11214118</Latitude>
//方向 0表示正北
<Direction>0</Direction>
//速度 cm/h
<Speed>0</Speed>
//星数
<Satellites>7</Satellites>
//精度
<Precision>13</Precision>
//高度
<Height>2160</Height>
<RetransFlag>1</RetransFlag>
<NeedsResponse>1</NeedsResponse>
<TimeZone>+08:00</TimeZone>
<Remark>test/debug</Remark>
</Params>
</PPVSPMessage> - 回复
<?xml version="1.0" encoding="GB2312" ?>
<PPVSPMessage>
<Version>2.5</Version>
<Sequence>1137</Sequence>
<CommandType>RESPONSE</CommandType>
<WhichCommand>GPS</WhichCommand>
<Status>200</Status>
<Description>OK</Description>
<Params>
<RetransFlag>1</RetransFlag>
</Params>
</PPVSPMessage>
未经允许不得转载:木盒主机 » 海康ehome协议分析(4):GPS上传