da_funk 3.31.0 → 3.32.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/RELEASE_NOTES.md +12 -0
- data/lib/da_funk/connection_management.rb +25 -10
- data/lib/da_funk/helper/status_bar.rb +42 -46
- data/lib/da_funk/version.rb +1 -1
- data/lib/device/network.rb +19 -33
- data/lib/device/virtual_keyboard.rb +81 -34
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b33827fb8e6019dae3a230de689a73d62065b71fe5d87cde66a5d034e10c8958
|
4
|
+
data.tar.gz: b88cd578be7d53abc94f00ffe3ff35fe21ecc028b75296c5d7b46391a35a6520
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f06599b79a0a3a2f098b2d544ef440231289d554737acf02cb7c1fae1a54509f503f6e66c7e90c2936eac9de0cab6aa3d9cdce8e9ebff2960adaf468c973dcb
|
7
|
+
data.tar.gz: 0d22fb804323266724e6efdf3eb79f075a69674cda33ee6321e3117a91983b9bed246bc2ae3c9408649c2ad20755c7e672b55a7c62502fdf77ff6d9562c9df20
|
data/Gemfile.lock
CHANGED
data/RELEASE_NOTES.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# DaFunk
|
2
2
|
|
3
|
+
### 3.32.0 - 2021-01-04
|
4
|
+
|
5
|
+
- Remapped virtual keyboard to add support to new layout;
|
6
|
+
- Make timeout of virtual keyboard parametrized;
|
7
|
+
- Limit size of string to 20 on virtual keyboard;
|
8
|
+
- Refactoring status bar:
|
9
|
+
- Check if thread is paused which means communication it's being configured. In this case 'sem sinal' message should be displayed;
|
10
|
+
- Do not show media type an media icon if thread is paused;
|
11
|
+
- Removed thread pause from attach and scan calls, let the application that is doing the configuration take care of that;
|
12
|
+
- Move reload of metadata to communication thread;
|
13
|
+
- Added support to check network conn status from time to time, default is each 5 minutes.
|
14
|
+
|
3
15
|
### 3.31.0 - 2020-11-27
|
4
16
|
|
5
17
|
- Added support to new battery view (Exact percentage);
|
@@ -1,21 +1,23 @@
|
|
1
1
|
module DaFunk
|
2
2
|
class ConnectionManagement
|
3
3
|
class << self
|
4
|
-
attr_accessor :drops, :primary_timeout
|
4
|
+
attr_accessor :drops, :primary_timeout, :last_time_check
|
5
5
|
end
|
6
6
|
self.drops = 0
|
7
7
|
DEFAULT_DROP_LIMIT = 2
|
8
8
|
|
9
9
|
def self.check
|
10
|
-
if
|
11
|
-
if
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
if fallback?
|
16
|
-
:fallback_communication
|
10
|
+
if must_check?
|
11
|
+
if Device::Network.connected?
|
12
|
+
if primary_try?
|
13
|
+
:primary_communication
|
14
|
+
end
|
17
15
|
else
|
18
|
-
|
16
|
+
if fallback?
|
17
|
+
:fallback_communication
|
18
|
+
else
|
19
|
+
:attach_registration_fail
|
20
|
+
end
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
@@ -125,6 +127,19 @@ module DaFunk
|
|
125
127
|
def self.schedule_primary_timeout
|
126
128
|
self.primary_timeout = (Time.now + self.conn_fallback_timer)
|
127
129
|
end
|
130
|
+
|
131
|
+
def self.must_check?
|
132
|
+
if self.last_time_check
|
133
|
+
if self.last_time_check < Time.now
|
134
|
+
self.last_time_check = Time.now + @value
|
135
|
+
true
|
136
|
+
end
|
137
|
+
else
|
138
|
+
@value = DaFunk::ParamsDat.file['conn_check_timer']
|
139
|
+
@value = @value.nil? ? 300 : @value * 60
|
140
|
+
self.last_time_check = Time.now + @value
|
141
|
+
true
|
142
|
+
end
|
143
|
+
end
|
128
144
|
end
|
129
145
|
end
|
130
|
-
|
@@ -18,21 +18,6 @@ module DaFunk
|
|
18
18
|
SLOT_BATTERY_PERCENTUAL = 6
|
19
19
|
SLOT_BATTERY_LEVEL = 7
|
20
20
|
|
21
|
-
SLOT_MESSAGE_CONNECTION = {
|
22
|
-
true => {
|
23
|
-
:slot1 => 2,
|
24
|
-
:slot2 => 3,
|
25
|
-
:message1 => './shared/conectado_01.png',
|
26
|
-
:message2 => './shared/conectado_02.png'
|
27
|
-
},
|
28
|
-
false => {
|
29
|
-
:slot1 => 2,
|
30
|
-
:slot2 => 3,
|
31
|
-
:message1 => './shared/buscando_01.png',
|
32
|
-
:message2 => './shared/buscando_02.png'
|
33
|
-
}
|
34
|
-
}
|
35
|
-
|
36
21
|
# TODO: review the 'print_status_bar' API to reduce the number of files
|
37
22
|
# to eleven?
|
38
23
|
BATTERY_PERCENTAGE_IMAGES = [
|
@@ -72,6 +57,11 @@ module DaFunk
|
|
72
57
|
'./shared/99%.png', './shared/100%.png'
|
73
58
|
].freeze
|
74
59
|
|
60
|
+
MEDIA_PATH = {
|
61
|
+
:gprs => './shared/3G.png',
|
62
|
+
:wifi => './shared/WIFI.png'
|
63
|
+
}
|
64
|
+
|
75
65
|
BATTERY_CHARGING = [
|
76
66
|
"./shared/battery_charging.png",
|
77
67
|
"./shared/battery_charged.png"
|
@@ -109,7 +99,8 @@ module DaFunk
|
|
109
99
|
}
|
110
100
|
|
111
101
|
class << self
|
112
|
-
attr_accessor :
|
102
|
+
attr_accessor :current_signal, :current_message, :battery, :power, :managment
|
103
|
+
attr_accessor :current_media
|
113
104
|
end
|
114
105
|
|
115
106
|
def self.check
|
@@ -124,51 +115,56 @@ module DaFunk
|
|
124
115
|
if File.exists?('./shared/system_update')
|
125
116
|
PAX::Display.print_status_bar(SLOT_UPDATE, "./shared/system_update_download.png")
|
126
117
|
PAX::Display.print_status_bar(3, nil)
|
127
|
-
self.connected = false
|
128
118
|
else
|
129
119
|
self.change_message
|
130
120
|
end
|
131
121
|
end
|
132
122
|
|
133
123
|
def self.change_message
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
124
|
+
if ThreadScheduler.pause?(ThreadScheduler::THREAD_EXTERNAL_COMMUNICATION, 200)
|
125
|
+
if self.current_message != :pause
|
126
|
+
self.current_message = :pause
|
127
|
+
Device::Display.print_status_bar(2, './shared/semsinal_01.png')
|
128
|
+
Device::Display.print_status_bar(3, './shared/semsinal_02.png')
|
129
|
+
end
|
130
|
+
elsif Device::Network.connected?
|
131
|
+
if self.current_message != :connected
|
132
|
+
self.current_message = :connected
|
133
|
+
Device::Display.print_status_bar(2, './shared/conectado_01.png')
|
134
|
+
Device::Display.print_status_bar(3, './shared/conectado_02.png')
|
135
|
+
end
|
136
|
+
else
|
137
|
+
if self.current_message != :searching
|
138
|
+
self.current_message = :searching
|
139
|
+
Device::Display.print_status_bar(2, './shared/buscando_01.png')
|
140
|
+
Device::Display.print_status_bar(3, './shared/buscando_02.png')
|
148
141
|
end
|
149
142
|
end
|
150
143
|
end
|
151
144
|
|
152
145
|
def self.change_connection
|
153
|
-
if
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
146
|
+
if ThreadScheduler.pause?(ThreadScheduler::THREAD_EXTERNAL_COMMUNICATION, 200)
|
147
|
+
Device::Display.print_status_bar(SLOT_MEDIA, nil)
|
148
|
+
Device::Display.print_status_bar(SLOT_SIGNAL_LEVEL, nil)
|
149
|
+
self.current_media = nil
|
150
|
+
self.current_signal = nil
|
151
|
+
elsif Device::Network.connected?
|
152
|
+
media = Device::Network.gprs? ? :gprs : :wifi
|
153
|
+
signal = Device::Network.signal
|
154
|
+
if media != self.current_media
|
155
|
+
self.current_media = media
|
156
|
+
Device::Display.print_status_bar(SLOT_MEDIA, MEDIA_PATH[self.current_media])
|
157
|
+
end
|
158
|
+
if signal != self.current_signal
|
159
|
+
self.current_signal = signal
|
160
|
+
Device::Display.print_status_bar(SLOT_SIGNAL_LEVEL,
|
161
|
+
self.get_image_path(self.current_media, self.current_signal))
|
168
162
|
end
|
169
163
|
else
|
170
164
|
Device::Display.print_status_bar(SLOT_MEDIA, nil)
|
171
165
|
Device::Display.print_status_bar(SLOT_SIGNAL_LEVEL, "./shared/searching.png")
|
166
|
+
self.current_media = nil
|
167
|
+
self.current_signal = nil
|
172
168
|
end
|
173
169
|
end
|
174
170
|
|
data/lib/da_funk/version.rb
CHANGED
data/lib/device/network.rb
CHANGED
@@ -159,9 +159,7 @@ class Device
|
|
159
159
|
# Device::Setting.mode = selected[:mode]
|
160
160
|
def self.scan
|
161
161
|
if wifi?
|
162
|
-
|
163
|
-
adapter.scan if Device::Network.init(*self.config)
|
164
|
-
end
|
162
|
+
adapter.scan if Device::Network.init(*self.config)
|
165
163
|
end
|
166
164
|
end
|
167
165
|
|
@@ -192,39 +190,28 @@ class Device
|
|
192
190
|
def self.attach(options = nil)
|
193
191
|
Device::Network.connected?
|
194
192
|
if self.code != SUCCESS
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
process[:ret] == PROCESSING || process[:ret] == 2 || process[:ret] == -3307 # if true keep trying
|
206
|
-
end
|
207
|
-
self.code = hash[:ret]
|
208
|
-
|
209
|
-
if self.code == SUCCESS
|
210
|
-
self.load_metadata
|
211
|
-
self.code = Device::Network.dhcp_client(20000) if (wifi? || ethernet?)
|
212
|
-
else
|
213
|
-
self.code = ERR_USER_CANCEL if hash[:key] == Device::IO::CANCEL
|
214
|
-
Device::Network.shutdown
|
215
|
-
end
|
193
|
+
self.code = Device::Network.init(*self.config)
|
194
|
+
self.code = Device::Network.connect
|
195
|
+
Device::Network.connected? if self.code != SUCCESS
|
196
|
+
|
197
|
+
hash = try_user(self.attach_timeout, options) do |process|
|
198
|
+
Device::Network.connected?
|
199
|
+
process[:ret] = self.code
|
200
|
+
# TODO develop an interface to keep waiting communication module dial
|
201
|
+
# based on platform returns
|
202
|
+
process[:ret] == PROCESSING || process[:ret] == 2 || process[:ret] == -3307 # if true keep trying
|
216
203
|
end
|
217
|
-
|
218
|
-
Context::ThreadPubSub.publish('communication_update')
|
219
|
-
self.code
|
220
|
-
end
|
204
|
+
self.code = hash[:ret]
|
221
205
|
|
222
|
-
|
223
|
-
|
224
|
-
|
206
|
+
if self.code == SUCCESS
|
207
|
+
self.code = Device::Network.dhcp_client(20000) if (wifi? || ethernet?)
|
208
|
+
else
|
209
|
+
self.code = ERR_USER_CANCEL if hash[:key] == Device::IO::CANCEL
|
210
|
+
Device::Network.shutdown
|
211
|
+
end
|
225
212
|
end
|
213
|
+
self.code
|
226
214
|
end
|
227
|
-
|
228
215
|
def self.shutdown
|
229
216
|
if self.adapter.started?
|
230
217
|
Device::Network.disconnect
|
@@ -276,4 +263,3 @@ class Device
|
|
276
263
|
end
|
277
264
|
end
|
278
265
|
end
|
279
|
-
|
@@ -82,34 +82,76 @@ class Device
|
|
82
82
|
],
|
83
83
|
|
84
84
|
keyboard_symbol_number: [
|
85
|
-
{ x: 0..
|
86
|
-
{ x: 0..
|
87
|
-
{ x: 0..
|
88
|
-
{ x: 0..
|
89
|
-
{ x: 0..
|
90
|
-
{ x: 0..
|
91
|
-
{ x: 0..
|
92
|
-
{ x: 0..
|
93
|
-
{ x: 0..
|
94
|
-
{ x: 0..
|
95
|
-
{ x: 0..
|
96
|
-
{ x: 0..
|
97
|
-
{ x: 0..
|
98
|
-
{ x: 0..
|
99
|
-
{ x: 0..
|
100
|
-
{ x: 0..
|
101
|
-
{ x: 0..
|
102
|
-
{ x: 0..
|
103
|
-
{ x: 0..
|
104
|
-
{ x: 0..
|
105
|
-
{ x: 0..
|
106
|
-
{ x: 0..
|
107
|
-
{ x: 0..
|
108
|
-
{ x: 0..
|
109
|
-
{ x: 0..
|
110
|
-
{ x: 0..
|
111
|
-
{ x: 0..
|
112
|
-
{ x: 0..
|
85
|
+
{ x: 0..34, y: 191..209, char: '1' },
|
86
|
+
{ x: 0..46, y: 191..209, char: '2' },
|
87
|
+
{ x: 0..65, y: 191..209, char: '3' },
|
88
|
+
{ x: 0..96, y: 191..209, char: '4' },
|
89
|
+
{ x: 0..115, y: 191..209, char: '5' },
|
90
|
+
{ x: 0..145, y: 191..209, char: '6' },
|
91
|
+
{ x: 0..161, y: 191..209, char: '7' },
|
92
|
+
{ x: 0..191, y: 191..209, char: '8' },
|
93
|
+
{ x: 0..216, y: 191..209, char: '9' },
|
94
|
+
{ x: 0..255, y: 191..209, char: '0' },
|
95
|
+
{ x: 0..31, y: 223..241, char: '%' },
|
96
|
+
{ x: 0..52, y: 223..241, char: '#' },
|
97
|
+
{ x: 0..77, y: 223..241, char: '$' },
|
98
|
+
{ x: 0..97, y: 223..241, char: '_' },
|
99
|
+
{ x: 0..121, y: 223..241, char: '&' },
|
100
|
+
{ x: 0..143, y: 223..241, char: '-' },
|
101
|
+
{ x: 0..168, y: 223..241, char: '+' },
|
102
|
+
{ x: 0..186, y: 223..241, char: '(' },
|
103
|
+
{ x: 0..215, y: 223..241, char: ')' },
|
104
|
+
{ x: 0..236, y: 223..241, char: '/' },
|
105
|
+
{ x: 0..42, y: 223..274, char: :keyboard_symbol_number_2 },
|
106
|
+
{ x: 0..60, y: 223..274, char: '*' },
|
107
|
+
{ x: 0..84, y: 223..274, char: '"' },
|
108
|
+
{ x: 0..107, y: 223..274, char: "'" },
|
109
|
+
{ x: 0..130, y: 223..274, char: ':' },
|
110
|
+
{ x: 0..152, y: 223..274, char: ';' },
|
111
|
+
{ x: 0..171, y: 223..274, char: '!' },
|
112
|
+
{ x: 0..197, y: 223..274, char: '?' },
|
113
|
+
{ x: 0..255, y: 223..274, char: :erase },
|
114
|
+
{ x: 0..36, y: 223..315, char: :keyboard_capital },
|
115
|
+
{ x: 0..63, y: 223..315, char: '@' },
|
116
|
+
{ x: 0..88, y: 223..315, char: ',' },
|
117
|
+
{ x: 0..152, y: 223..315, char: :space },
|
118
|
+
{ x: 0..168, y: 223..315, char: '.' },
|
119
|
+
{ x: 0..255, y: 223..315, char: :enter }
|
120
|
+
],
|
121
|
+
|
122
|
+
keyboard_symbol_number_2: [
|
123
|
+
{ x: 0..34, y: 191..209, char: '1' },
|
124
|
+
{ x: 0..46, y: 191..209, char: '2' },
|
125
|
+
{ x: 0..69, y: 191..209, char: '3' },
|
126
|
+
{ x: 0..96, y: 191..209, char: '4' },
|
127
|
+
{ x: 0..115, y: 191..209, char: '5' },
|
128
|
+
{ x: 0..145, y: 191..209, char: '6' },
|
129
|
+
{ x: 0..161, y: 191..209, char: '7' },
|
130
|
+
{ x: 0..191, y: 191..209, char: '8' },
|
131
|
+
{ x: 0..216, y: 191..209, char: '9' },
|
132
|
+
{ x: 0..255, y: 191..209, char: '0' },
|
133
|
+
{ x: 0..35, y: 223..241, char: '^' },
|
134
|
+
{ x: 0..63, y: 223..241, char: '[' },
|
135
|
+
{ x: 0..97, y: 223..241, char: ']' },
|
136
|
+
{ x: 0..128, y: 223..241, char: '{' },
|
137
|
+
{ x: 0..158, y: 223..241, char: '}' },
|
138
|
+
{ x: 0..193, y: 223..241, char: '<' },
|
139
|
+
{ x: 0..255, y: 223..241, char: '>' },
|
140
|
+
{ x: 0..39, y: 223..274, char: :keyboard_symbol_number },
|
141
|
+
{ x: 0..63, y: 223..274, char: '\\' },
|
142
|
+
{ x: 0..86, y: 223..274, char: '-' },
|
143
|
+
{ x: 0..106, y: 223..274, char: '+' },
|
144
|
+
{ x: 0..130, y: 223..274, char: '=' },
|
145
|
+
{ x: 0..149, y: 223..274, char: '_' },
|
146
|
+
{ x: 0..175, y: 223..274, char: '˜' },
|
147
|
+
{ x: 0..195, y: 223..274, char: '|' },
|
148
|
+
{ x: 0..255, y: 223..274, char: :erase },
|
149
|
+
{ x: 0..34, y: 223..310, char: :keyboard_capital },
|
150
|
+
{ x: 0..61, y: 223..310, char: '@' },
|
151
|
+
{ x: 0..87, y: 223..310, char: ',' },
|
152
|
+
{ x: 0..146, y: 223..313, char: :space },
|
153
|
+
{ x: 0..168, y: 223..311, char: '.' },
|
154
|
+
{ x: 0..194, y: 223..319, char: :enter }
|
113
155
|
]
|
114
156
|
}
|
115
157
|
|
@@ -117,9 +159,11 @@ class Device
|
|
117
159
|
phisical_keys = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', "\017"]
|
118
160
|
change_keyboard
|
119
161
|
Device::Display.print_line("#{self.text}", params[:line], params[:column])
|
120
|
-
|
121
|
-
|
162
|
+
if params[:timeout_enabled]
|
163
|
+
time = Time.now + (params[:timeout] || Device::IO.timeout) / 1000
|
164
|
+
end
|
122
165
|
|
166
|
+
key = nil
|
123
167
|
while text_not_ready?(key)
|
124
168
|
line_x, line_y = getxy_stream(100)
|
125
169
|
|
@@ -127,8 +171,9 @@ class Device
|
|
127
171
|
touch_clear
|
128
172
|
key = parse(line_x, line_y, params)
|
129
173
|
else
|
130
|
-
|
131
|
-
|
174
|
+
if params[:timeout_enabled]
|
175
|
+
break(Device::IO::KEY_TIMEOUT) if Time.now > time
|
176
|
+
end
|
132
177
|
key = getc(100)
|
133
178
|
if phisical_keys.include?(key)
|
134
179
|
if key == Device::IO::BACK
|
@@ -161,7 +206,7 @@ class Device
|
|
161
206
|
|
162
207
|
def self.show_text(key, params)
|
163
208
|
case key[:char]
|
164
|
-
when :keyboard_uppercase, :keyboard_symbol_number, :keyboard_capital
|
209
|
+
when :keyboard_uppercase, :keyboard_symbol_number, :keyboard_symbol_number_2, :keyboard_capital
|
165
210
|
self.type = key[:char]
|
166
211
|
change_keyboard
|
167
212
|
when :erase
|
@@ -170,7 +215,9 @@ class Device
|
|
170
215
|
when :space
|
171
216
|
self.text += ' '
|
172
217
|
else
|
173
|
-
self.text
|
218
|
+
if self.text && self.text.size < 20
|
219
|
+
self.text << key[:char] unless key[:char] == :enter
|
220
|
+
end
|
174
221
|
end
|
175
222
|
Device::Display.print_line("#{self.text}", params[:line], params[:column])
|
176
223
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: da_funk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.32.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thiago Scalone
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -259,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
259
259
|
- !ruby/object:Gem::Version
|
260
260
|
version: '0'
|
261
261
|
requirements: []
|
262
|
-
rubygems_version: 3.
|
262
|
+
rubygems_version: 3.1.2
|
263
263
|
signing_key:
|
264
264
|
specification_version: 4
|
265
265
|
summary: MRuby Embedded System Framework
|