Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/uro/teltonika-fm-parser
Teltonika fm xxxx protocol encoder and decoder
https://github.com/uro/teltonika-fm-parser
gps gps-library library parser php php7 teltonika tracker
Last synced: 5 days ago
JSON representation
Teltonika fm xxxx protocol encoder and decoder
- Host: GitHub
- URL: https://github.com/uro/teltonika-fm-parser
- Owner: uro
- License: unlicense
- Created: 2017-02-01T03:00:22.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-11-06T16:51:52.000Z (about 2 months ago)
- Last Synced: 2024-12-10T19:20:05.308Z (12 days ago)
- Topics: gps, gps-library, library, parser, php, php7, teltonika, tracker
- Language: PHP
- Size: 427 KB
- Stars: 68
- Watchers: 12
- Forks: 45
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Teltonika FM-XXXX Parser
[![Build Status](https://travis-ci.org/uro/teltonika-fm-parser.svg?branch=master)](https://travis-ci.org/uro/teltonika-fm-parser) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/uro/teltonika-fm-parser/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/uro/teltonika-fm-parser/?branch=master) [![CodeFactor](https://www.codefactor.io/repository/github/uro/teltonika-fm-parser/badge)](https://www.codefactor.io/repository/github/uro/teltonika-fm-parser) [![Latest Stable Version](https://poser.pugx.org/uro/teltonika-fm-parser/v/stable)](https://packagist.org/packages/uro/teltonika-fm-parser) [![Total Downloads](https://poser.pugx.org/uro/teltonika-fm-parser/downloads)](https://packagist.org/packages/uro/teltonika-fm-parser)
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](FMXXXX_Protocols_v2.10.pdf) documentation.
## Requirements:
```json
{
"require": {
"php": ">=7.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7"
}
}
```## Usage:
```php
$parser = new FmParser('tcp');// Decode IMEI
$imei = $parser->decodeImei($payload);// Decode Data Packet
$packet = $parser->decodeData($payload);
```## Examples
### TCP
```php
$parser = new FmParser('tcp');
$socket = stream_socket_server("tcp://0.0.0.0:8043", $errno, $errstr);
if (!$socket) {
throw new \Exception("$errstr ($errno)");
} else {
while ($conn = stream_socket_accept($socket)) {// Read IMEI
$payload = fread($conn, 1024);
$imei = $parser->decodeImei($payload);// Accept packet
fwrite($conn, Reply::accept());// Decline packet
// fwrite($conn, Reply::reject());
// Read Data
$payload = fread($conn, 1024);
$packet = $parser->decodeData($payload);// Send acknowledge
fwrite($conn, $parser->encodeAcknowledge($packet));// Close connection
fclose($conn);
}fclose($socket);
}
}
```## License:
[Public domain](LICENSE.md)