Teltonika FM1100 GSM 设备 Avl 数据确认
Teltonika FM1100 GSM device Avl Data Ack
1) GPS FM1100模块发送如下数据
串号
123456788927333
2)我们将01作为二进制发送给GPS模块(IMEI no.accepted,我们告诉模块发送原始数据)
3) GPS发送以下原始数据
原始数据
00000000000000ff08060000014e0fcd6c30011eb91b3a0f0db2f400120019090000010402010002000118000001c700000013000000014e102471e2011eb91b3a0f0db2f4001500190b0000010402010102000118000001c700000000000000014e10396d22011eb804c50f11f254fffd0000080000010402010002000118000001c700000000000000014e10e4c5c8011eb804c50f11f25400000000000000010402010102000118000001c700000000000000014e10f90df8011eb340ff0f045796000d0000090000010402010002000118000001c70000001a000000014e14605ba4011eb340ff0f045796001c0000090000010402010102000118000001c700000000000600001880
下面是解析后的数据,解析后我们发送的是no。收到的数据
例如:6 作为对 GPS 模块的确认
大批
(
[时间戳] => 2015-06-10 04:38:48
[优先级] => 1
[lng] => 51.5064245
[纬度] => 25.1942671
[海拔高度] => 42
[角度] => 100
[statilite] => 10
[速度] => 0
[is_io_generated] => 1
[io_data] => 数组
(
[无 IO 记录] => 04
[数据] => 数组
(
[0] => 阵列
(
[没有记录一个字节] => 2
[数据] => 数组
(
[0] => 数组
(
[键] => 1
[价值] => 1
)</p>
<pre><code> [1] => Array
(
[key] => 2
[val] => 0
)
)
)
[1] => Array
(
[No Rec Two Byte] => 1
[Data] => Array
(
[0] => Array
(
[key] => 24
[val] => 0
)
)
)
[2] => Array
(
[No Rec Four Byte] => 1
[Data] => Array
(
[0] => Array
(
[key] => 199
[val] => 0
)
)
)
[3] => Array
(
[No Rec Eight Byte] => 0
[Data] => Array
(
)
)
)
)
)
4) 我们能够解析数据并将确认发送到 GPS 模块
5) 但是GPS模块尽管发送了正确的确认数据,却一直重复发送旧数据。
我们不确定我们是否以 GPS 模块手册中提到的正确格式发送确认数据。
请帮忙解决这个问题。
<pre><code> if(strlen($rdata) == 15){
$this->imei = $rdata; // imei number from the gps module
$codata = pack("H*", "01"); // accept the connection and tell to the gps module to send the data
$this->server->send('current client socket', $codata); //send to the gps module
}else{
$bh = bin2hex($rdata); // from gps module rawdata bin to hex
$sql = $this->sqlparsingfm($bh); // parsing data
$sdata = $data["norecord"]; // parsed data from the GPS module. no of record received
$hex = str_pad($sdata, 8, "0", STR_PAD_LEFT);
// $hex = "0x06";
// $hex = pack("H*", "0x06");
$this->server->send($e->parameters->idClient, $hex);
}
?>
下面是 GPS 模块文档 link
第 7 页。与服务器通信部分。将响应发送回模块
首先,没有必要时不要使用 pack
。
所以,替换:
$codata = pack("H*", "01"); // accept the connection and tell to the gps module to send the data
$this->server->send('current client socket', $codata); //send to the gps module
和
$this->server->send('current client socket', "\x01");
接下来,要发送正确的数据包确认,更改
$this->server->send($e->parameters->idClient, $hex);
至
$this->server->send($e->parameters->idClient, pack('N', $sdata));
这应该可以解决所有问题。
1) GPS FM1100模块发送如下数据
串号
123456788927333
2)我们将01作为二进制发送给GPS模块(IMEI no.accepted,我们告诉模块发送原始数据)
3) GPS发送以下原始数据
原始数据
00000000000000ff08060000014e0fcd6c30011eb91b3a0f0db2f400120019090000010402010002000118000001c700000013000000014e102471e2011eb91b3a0f0db2f4001500190b0000010402010102000118000001c700000000000000014e10396d22011eb804c50f11f254fffd0000080000010402010002000118000001c700000000000000014e10e4c5c8011eb804c50f11f25400000000000000010402010102000118000001c700000000000000014e10f90df8011eb340ff0f045796000d0000090000010402010002000118000001c70000001a000000014e14605ba4011eb340ff0f045796001c0000090000010402010102000118000001c700000000000600001880
下面是解析后的数据,解析后我们发送的是no。收到的数据
例如:6 作为对 GPS 模块的确认
大批
(
[时间戳] => 2015-06-10 04:38:48
[优先级] => 1
[lng] => 51.5064245
[纬度] => 25.1942671
[海拔高度] => 42
[角度] => 100
[statilite] => 10
[速度] => 0
[is_io_generated] => 1
[io_data] => 数组
(
[无 IO 记录] => 04
[数据] => 数组
(
[0] => 阵列
(
[没有记录一个字节] => 2
[数据] => 数组
(
[0] => 数组
(
[键] => 1
[价值] => 1
)</p>
<pre><code> [1] => Array
(
[key] => 2
[val] => 0
)
)
)
[1] => Array
(
[No Rec Two Byte] => 1
[Data] => Array
(
[0] => Array
(
[key] => 24
[val] => 0
)
)
)
[2] => Array
(
[No Rec Four Byte] => 1
[Data] => Array
(
[0] => Array
(
[key] => 199
[val] => 0
)
)
)
[3] => Array
(
[No Rec Eight Byte] => 0
[Data] => Array
(
)
)
)
)
)
4) 我们能够解析数据并将确认发送到 GPS 模块
5) 但是GPS模块尽管发送了正确的确认数据,却一直重复发送旧数据。
我们不确定我们是否以 GPS 模块手册中提到的正确格式发送确认数据。
请帮忙解决这个问题。
<pre><code> if(strlen($rdata) == 15){
$this->imei = $rdata; // imei number from the gps module
$codata = pack("H*", "01"); // accept the connection and tell to the gps module to send the data
$this->server->send('current client socket', $codata); //send to the gps module
}else{
$bh = bin2hex($rdata); // from gps module rawdata bin to hex
$sql = $this->sqlparsingfm($bh); // parsing data
$sdata = $data["norecord"]; // parsed data from the GPS module. no of record received
$hex = str_pad($sdata, 8, "0", STR_PAD_LEFT);
// $hex = "0x06";
// $hex = pack("H*", "0x06");
$this->server->send($e->parameters->idClient, $hex);
}
?>
下面是 GPS 模块文档 link
第 7 页。与服务器通信部分。将响应发送回模块
首先,没有必要时不要使用 pack
。
所以,替换:
$codata = pack("H*", "01"); // accept the connection and tell to the gps module to send the data
$this->server->send('current client socket', $codata); //send to the gps module
和
$this->server->send('current client socket', "\x01");
接下来,要发送正确的数据包确认,更改
$this->server->send($e->parameters->idClient, $hex);
至
$this->server->send($e->parameters->idClient, pack('N', $sdata));
这应该可以解决所有问题。