quelink-mg 0.2.1 → 0.3.0
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/quelink-mg/buff/base.rb +9 -0
- data/lib/quelink-mg/buff/gtfri.rb +15 -0
- data/lib/quelink_mg.rb +3 -0
- data/pkg/quelink-mg.gem +0 -0
- data/quelink-mg.gemspec +1 -1
- data/spec/quelink_mg/buff/gtfri_spec.rb +22 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a0af54e62d43bd9f96b5c7484e1d7ba16baf9ff80d059df46f2115c2881d16f
|
4
|
+
data.tar.gz: 893631f6758dbbecad9d30105a4b1dc31a39a1b110a7ca964ced515150badba1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b18949ccbd99be47bce8d7d09c425d5a455992e747cb4f86745ef2291e4d3c6c09c944dcc8f260e654fa9d68df4d2e73b9bca63eecc37d02700e8c19be5dc3e7
|
7
|
+
data.tar.gz: 0abbc95935c06ea5de36e285f3b3bb8edae223672d593c336009affdebfb6199929c7d1a655b40a7650a2a0fdcaf8d76ae7116d85372f006049c9ce0f9f6a8ce
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module QuelinkMg
|
4
|
+
module Buff
|
5
|
+
class Gtfri < Base
|
6
|
+
GTFRI_RESP_KEYS = %w[protocol_version unique_id device_name report_id report_type number
|
7
|
+
gps_accuracy speed azimuth elevation longitude latitude gps_utc_time
|
8
|
+
mcc mnc lac cell_id odo_mileage battery_percentage send_time count_number].freeze
|
9
|
+
|
10
|
+
def hash
|
11
|
+
unify_keys(GTFRI_RESP_KEYS.zip(@response.split(',')).to_h)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/quelink_mg.rb
CHANGED
@@ -34,6 +34,9 @@ require File.expand_path('quelink-mg/ack/gtrto.rb', __dir__)
|
|
34
34
|
require File.expand_path('quelink-mg/ack/gtsri.rb', __dir__)
|
35
35
|
require File.expand_path('quelink-mg/ack/gtudf.rb', __dir__)
|
36
36
|
|
37
|
+
require File.expand_path('quelink-mg/buff/base.rb', __dir__)
|
38
|
+
require File.expand_path('quelink-mg/buff/gtfri.rb', __dir__)
|
39
|
+
|
37
40
|
require File.expand_path('quelink-mg/configuration.rb', __dir__)
|
38
41
|
|
39
42
|
module QuelinkMg
|
data/pkg/quelink-mg.gem
CHANGED
Binary file
|
data/quelink-mg.gemspec
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe QuelinkMg::Buff::Gtfri do
|
6
|
+
it 'parses valid response' do
|
7
|
+
response = 'C30204,860201061504521,,0,0,1,1,0.0,0,96.2,21.012847,52.200338,20230813061232,\\
|
8
|
+
0260,0003,E31F,0447020D,,34,20230813061231,3E94'
|
9
|
+
|
10
|
+
parsed_response = described_class.new(response:).hash
|
11
|
+
expect(parsed_response).not_to eq({})
|
12
|
+
expect(parsed_response['send_time']).to eq Time.use_zone('UTC') { Time.zone.parse('20230813061231') }.in_time_zone
|
13
|
+
expect(parsed_response['gps_utc_time']).to eq Time.use_zone('UTC') {
|
14
|
+
Time.zone.parse('20230813061232')
|
15
|
+
}.in_time_zone
|
16
|
+
expect(parsed_response['longitude']).to eq 21.012847
|
17
|
+
expect(parsed_response['latitude']).to eq 52.200338
|
18
|
+
expect(parsed_response['unique_id']).to eq 860_201_061_504_521
|
19
|
+
expect(parsed_response['battery_percentage']).to eq 34
|
20
|
+
expect(parsed_response['device_name']).to eq ''
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quelink-mg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stanislaw Zawadzki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09
|
11
|
+
date: 2023-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -109,6 +109,8 @@ files:
|
|
109
109
|
- lib/quelink-mg/at/gtrto.rb
|
110
110
|
- lib/quelink-mg/at/gtsri.rb
|
111
111
|
- lib/quelink-mg/at/gtudf.rb
|
112
|
+
- lib/quelink-mg/buff/base.rb
|
113
|
+
- lib/quelink-mg/buff/gtfri.rb
|
112
114
|
- lib/quelink-mg/configuration.rb
|
113
115
|
- lib/quelink-mg/resp/base.rb
|
114
116
|
- lib/quelink-mg/resp/gtfri.rb
|
@@ -136,6 +138,7 @@ files:
|
|
136
138
|
- spec/quelink_mg/at/gtrto_spec.rb
|
137
139
|
- spec/quelink_mg/at/gtsri_spec.rb
|
138
140
|
- spec/quelink_mg/at/gtudf_spec.rb
|
141
|
+
- spec/quelink_mg/buff/gtfri_spec.rb
|
139
142
|
- spec/quelink_mg/resp/gtfri_spec.rb
|
140
143
|
- spec/quelink_mg/resp/gtgsv_spec.rb
|
141
144
|
- spec/quelink_mg/resp/gtinf_spec.rb
|