Popularity
4.3
Growing
Activity
3.7
-
45
6
42

Description

Receiver can parse EGTS binary package and save it in store, which connect as go plugin. Besides repo contains library for parsing EGTS bin data and can be use separately.

Programming language: Go
License: GNU General Public License v3.0 only
Tags: Golang     Library     Egts     Protocol     Iot    

Receiver EGTS alternatives and similar packages

Based on the "IoT (Internet of Things)" category.
Alternatively, view Receiver EGTS alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of Receiver EGTS or a related project?

Add another 'IoT (Internet of Things)' Package

README

EGTS receiver

EGTS receiver server realization writen on Go.

Library for implementation EGTS protocol that parsing binary packag based on [GOST R 54619 - 2011](./docs`/gost54619-2011.pdf) and [Order No. 285 of the Ministry of Transport of Russia dated July 31, 2012](./docs/mitransNo285.pdf). Describe fields you can find in these documents.

More information you can read in article (Russian).

Server save all navigation data from EGTS_SR_POS_DATA section. If packet have several records with EGTS_SR_POS_DATA section, it saves all of them.

Storage for data realized as plugins. Any plugin must have [store] section in configure file. Plugin interface will be described below.

If configure file has't section for a plugin ([store]), then packet will be print to stdout.

Install

git clone https://github.com/kuznetsovin/egts-protocol
cd egts-protocol/tools && ./build-receiver.sh

Run

./receiver config.toml

config.toml - configure file

Config format

[srv]
host = "127.0.0.1"
port = "6000"
con_live_sec = 10

[log]
level = "DEBUG"

Parameters description:

  • host - bind address
  • port - bind port
  • con_live_sec - if server not received data longer time in the parameter, then the connection is closed.
  • log - logging level

Usage only Golang EGTS library

Example for encoding packet:

package main 

import (
    "github.com/kuznetsovin/egts-protocol/libs/egts"
    "log"
)

func main() {
    pkg := egts.Package{
            ProtocolVersion:  1,
            SecurityKeyID:    0,
            Prefix:           "00",
            Route:            "0",
            EncryptionAlg:    "00",
            Compression:      "0",
            Priority:         "11",
            HeaderLength:     11,
            HeaderEncoding:   0,
            FrameDataLength:  3,
            PacketIdentifier: 137,
            PacketType:       egts.PtResponsePacket,
            HeaderCheckSum:   74,
            ServicesFrameData: &egts.PtResponse{
                ResponsePacketID: 14357,
                ProcessingResult: 0,
            },
        }

    rawPkg, err := pkg.Encode()
    if err != nil {
        log.Fatal(err)
    }

    log.Println("Bytes packet: ", rawPkg)
}

Example for decoding packet:

package main 

import (
    "github.com/kuznetsovin/egts-protocol/libs/egts"
    "log"
)

func main() {
    pkg := []byte{0x01, 0x00, 0x03, 0x0B, 0x00, 0x03, 0x00, 0x89, 0x00, 0x00, 0x4A, 0x15, 0x38, 0x00, 0x33, 0xE8}
    result := egts.Package{}

    state, err := result.Decode(pkg)
    if err != nil {
        log.Fatal(err)
    }

    log.Println("State: ", state)
    log.Println("Package: ", result)
}

Store plugins

That create a new plugin you must implementation Connector interface:

type Connector interface {
    // setup store connection
    Init(map[string]string) error

    // save to store method
    Save(interface{ ToBytes() ([]byte, error) }) error

    // close connection with store
    Close() error
}

All plugins available in store folder.