diam4ik/teltonika-fm-parser
最新稳定版本:1.0.4
Composer 安装命令:
composer require diam4ik/teltonika-fm-parser
包简介
Teltonika FMXXXX parser library
README 文档
README
This repository is object oriented library to translate Teltonika protocols.
You could use this library in your server, it will help you talk with Teltonika devices.
It was build with Teltonika protocols v2.10 documentation.
Requirements:
{
"require": {
"php": ">=7.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7"
}
}
Usage:
Authentication decode:
// Recieve data from tcp socket $payloadFromDevice = "000F313233343536373839303132333435"; // Decode recieved data $decoder = new TcpDecoder(); // Check if data which we recieved are authentication or Gps records if($decoder->isAuthentication($payloadFromDevice)){ // returns true; $imei = $decoder->decodeAuthentication($payloadFromDevice); echo json_encode(imei); // Check if device is authenticated in your system, and then encode response for device $encoder = new TcpEncoder(); $payload = $encoder->encodeAuthentication(true); // Yes, device was authenticated successfully // send $payload though the socket. }
Echo will return:
{
"imei": "862259588834290"
}
// Now we need to wait for next data from the device // Recieve next payload from the socket (now with data) $tcpPayloadFromDevice = "00000000000000FE080400000113fc208dff000f14f650209cca80006f..."; // Decode it $data = $this->decoder->decodeData($payload); echo json_encode(data);
Echo will return:
[{
"dateTime": {
"date": "2007-07-25 06:46:38.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"priority": 0,
"gpsData": {
"longitude": 25.3032016,
"latitude": 54.7146368,
"altitude": 111,
"angle": 214,
"satellites": 4,
"speed": 4,
"hasGpsFix": true
}
}, {
"dateTime": {
"date": "2007-07-25 06:46:38.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"priority": 0,
"gpsData": {
"longitude": 25.3032016,
"latitude": 54.7146368,
"altitude": 111,
"angle": 214,
"satellites": 4,
"speed": 4,
"hasGpsFix": true
}
}]
See tests for more examples!
Todo:
- Implement TCP protocol (encode and decode)
- Implement gps sensors data (IOElement)
- Implement UDP protocol (encode and decode)
- Implement SMS protocol
License:
统计信息
- 总下载量: 302
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-04-30