gts 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/gts/server.rb +5 -0
- data/lib/gts/version.rb +1 -1
- metadata +1 -1
data/lib/gts/server.rb
CHANGED
@@ -2,6 +2,7 @@ require 'eventmachine'
|
|
2
2
|
require 'open-uri'
|
3
3
|
require 'json'
|
4
4
|
require 'gts'
|
5
|
+
require 'iconv'
|
5
6
|
|
6
7
|
DEFAULT_IMEI_HANDLERS = { "359585017718724" => "TK-102" } # IMEI nasej TK-102jky
|
7
8
|
DEFAULT_IMEI_HANDLER_SOURCE = nil
|
@@ -92,6 +93,10 @@ module Gts
|
|
92
93
|
|
93
94
|
def handle_tracker_data(data)
|
94
95
|
begin
|
96
|
+
# Cleaning the input string
|
97
|
+
ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')
|
98
|
+
data = ic.iconv(data + ' ')[0..-2]
|
99
|
+
|
95
100
|
parsed_data = parse_data(data)
|
96
101
|
logger.info "Got correct data [from #{client_ip_address}, imei: #{parsed_data[:imei]}]"
|
97
102
|
formatted_data = parsed_data.map{|k,v| "\t#{k}: #{v}\n" }.join
|
data/lib/gts/version.rb
CHANGED