Skip to content

CoolElvis/gt06_server

Repository files navigation

Server for gps tracker GT06(TK100)

Code Climate Test Coverage Issue Count Build Status

Installation

Add this line to your application's Gemfile:

gem 'gt06_server'

And then execute:

$ bundle

Usage

require 'gt06_server'

log_path = File.expand_path(File.join(File.dirname(__FILE__), 'log/server.log'))

Gt06Server::Server.run('0.0.0.0', 9000, options: { logger: Logger.new(log_path) }) do |message|
  p message
end

sleep

Status message:

{ 
  :packet_length       => 10,
  :protocol_number     => 19,
  :message_type        => :status_information,
  :terminal_id         => "0123456789012345",
  :information_content =>
    { 
      :terminal_information =>
        {
          :electricity_bit => 0,
          :gps_bit         => 0,
          :alarm_status    => :normal,
          :charge_bit      => 1,
          :acc_bit         => 0,
          :defense_bit     => 1
        },
      :voltage_level        => 0,
      :gsm_signal_strength  => 100,
      :alarm                => :normal,
      :language             => :english
    },
  :serial_number       => 48
}

Location message:

{
    :packet_length       => 31,
    :protocol_number     => 18,
    :message_type        => :location_data,
    :information_content =>
        {
            :date_time => '2011-08-29 17:46:16 +0400',
            :gps       =>
                {
                    :quantity_satellites =>
                        {
                            :length_gps => 12, :satellites => 12
                        },
                    :latitude            => 23.111668333333334,
                    :longitude           => 114.409285,
                    :speed               => 0,
                    :course_status       =>
                        {
                            :null_1               => 0,
                            :null_2               => 0,
                            :gps_positioning_type => 0,
                            :is_gps_positioning   => 1,
                            :longitude_bit        => 0,
                            :latitude_bit         => 1,
                            :course               => 143
                        }
                },
            :lbs       =>
                {
                    :mcc     => 460,
                    :mnc     => 0,
                    :lac     => 10365,
                    :cell_id => 8120
                }
        },
    :serial_number       => 3
}

The content of 'information_content' depends on 'message_type' See lib/gt06_server/messages for details

Copyright

Copyright (c) 2016 CoolElvis and contributors.

MIT License. See LICENSE for details.

About

Server for gps gt06

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published