da_funk 3.32.0 → 3.33.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 +6 -0
- data/lib/da_funk/helper.rb +55 -16
- data/lib/da_funk/params_dat.rb +65 -25
- data/lib/da_funk/version.rb +1 -1
- data/lib/device/io.rb +53 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a542a7e943d7feecfa0300ca6a42e21a68995b38dd3b0630e56dac4fd8de9c04
|
4
|
+
data.tar.gz: 857627718bb9959b86576368d3380e09b5501f387a200e021785a04eb299ba1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7198fc96b3f58dbda4ef7a5c09f47581586b710f85908a7566d43452105bc7e9cd08228a6f65aa94784c561511d6d311d92e6616c1f00e603913a0b82bfce0c7
|
7
|
+
data.tar.gz: 0a356ecb0fef59b610333243e8ed320ef00c5da149fa3b885eaf9bdf92e8a40a20633b5107dcc350b6b4d2847b21b739c8691b5f9fa7211415350f429039babb
|
data/Gemfile.lock
CHANGED
data/RELEASE_NOTES.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# DaFunk
|
2
2
|
|
3
|
+
### 3.33.0 - 2021-02-08
|
4
|
+
|
5
|
+
- Added method Device::IO#get_format_or_touchscreen_action;
|
6
|
+
- Added support to images on ParamsDat#download, ParamsDat#update_app and ParamsDat#update_file;
|
7
|
+
- Return result of ParamsDat#update_apps call to the caller.
|
8
|
+
|
3
9
|
### 3.32.0 - 2021-01-04
|
4
10
|
|
5
11
|
- Remapped virtual keyboard to add support to new layout;
|
data/lib/da_funk/helper.rb
CHANGED
@@ -61,38 +61,77 @@ module DaFunk
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
def check_download_error(
|
65
|
-
value =
|
64
|
+
def check_download_error(download_ret, enable_txt_ui = true)
|
65
|
+
value = false
|
66
|
+
|
67
|
+
if download_ret == DaFunk::Transaction::Download::FILE_NOT_CHANGE
|
68
|
+
if enable_txt_ui
|
69
|
+
I18n.pt(:download_file_is_the_same, :args => [download_ret])
|
70
|
+
getc(1000)
|
71
|
+
end
|
72
|
+
value = true
|
73
|
+
elsif download_ret == DaFunk::Transaction::Download::SUCCESS
|
74
|
+
if enable_txt_ui
|
75
|
+
I18n.pt(:download_success, :args => [download_ret])
|
76
|
+
getc(1000)
|
77
|
+
end
|
78
|
+
value = true
|
79
|
+
end
|
80
|
+
value
|
81
|
+
end
|
82
|
+
|
83
|
+
def show_download_error(download_ret, enable_txt_ui = true)
|
66
84
|
ui = {}
|
67
85
|
|
68
|
-
case
|
86
|
+
case download_ret
|
69
87
|
when DaFunk::Transaction::Download::SERIAL_NUMBER_NOT_FOUND
|
88
|
+
unless enable_txt_ui
|
89
|
+
Device::Display.print_bitmap('./shared/config_fail.bmp')
|
90
|
+
getc(5000)
|
91
|
+
end
|
70
92
|
ui[:i18n] = :download_serial_number_not_found
|
71
|
-
|
93
|
+
ContextLog.info "[I] Download error, serial number not registered"
|
72
94
|
when DaFunk::Transaction::Download::FILE_NOT_FOUND
|
95
|
+
unless enable_txt_ui
|
96
|
+
Device::Display.print_bitmap('./shared/config_fail.bmp')
|
97
|
+
getc(5000)
|
98
|
+
end
|
73
99
|
ui[:i18n] = :download_file_not_found
|
74
|
-
|
75
|
-
when DaFunk::Transaction::Download::FILE_NOT_CHANGE
|
76
|
-
ui[:i18n] = :download_file_is_the_same
|
77
|
-
when DaFunk::Transaction::Download::SUCCESS
|
78
|
-
ui[:i18n] = :download_success
|
100
|
+
ContextLog.info "[I] Download error, file not found"
|
79
101
|
when DaFunk::Transaction::Download::COMMUNICATION_ERROR
|
102
|
+
unless enable_txt_ui
|
103
|
+
Device::Display.print_bitmap('./shared/network_system_error.bmp')
|
104
|
+
getc(5000)
|
105
|
+
end
|
80
106
|
ui[:i18n] = :download_communication_failure
|
81
|
-
|
107
|
+
ContextLog.info "[I] Download error, connection problem"
|
82
108
|
when DaFunk::Transaction::Download::MAPREDUCE_RESPONSE_ERROR
|
109
|
+
unless enable_txt_ui
|
110
|
+
Device::Display.print_bitmap('./shared/config_fail.bmp')
|
111
|
+
getc(5000)
|
112
|
+
end
|
83
113
|
ui[:i18n] = :download_encoding_error
|
84
|
-
|
114
|
+
ContextLog.info "[I] Download error, encoding problem"
|
85
115
|
when DaFunk::Transaction::Download::IO_ERROR
|
116
|
+
unless enable_txt_ui
|
117
|
+
Device::Display.print_bitmap('./shared/config_fail.bmp')
|
118
|
+
getc(5000)
|
119
|
+
end
|
86
120
|
ui[:i18n] = :download_io_error
|
87
|
-
|
121
|
+
ContextLog.info "[I] Download error, IO error"
|
88
122
|
else
|
123
|
+
unless enable_txt_ui
|
124
|
+
Device::Display.print_bitmap('./shared/network_system_error.bmp')
|
125
|
+
getc(5000)
|
126
|
+
end
|
89
127
|
ui[:i18n] = :download_communication_failure
|
90
|
-
|
128
|
+
ContextLog.info "[I] Download error, connection problem"
|
91
129
|
end
|
92
130
|
|
93
|
-
|
94
|
-
|
95
|
-
|
131
|
+
if enable_txt_ui
|
132
|
+
I18n.pt(ui[:i18n], :args => [download_ret])
|
133
|
+
getc(5000)
|
134
|
+
end
|
96
135
|
end
|
97
136
|
|
98
137
|
def try(tries, &block)
|
data/lib/da_funk/params_dat.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
module DaFunk
|
2
2
|
class ParamsDat
|
3
|
-
FILE_NAME
|
3
|
+
FILE_NAME = "./main/params.dat"
|
4
|
+
SEARCHING_IMAGE_PATH = './shared/searching_updates_app.bmp'
|
5
|
+
UPDATING_IMAGE_PATH = './shared/updating.bmp'
|
6
|
+
ATTACH_IMAGE_PATH = './shared/network_conectar_init.bmp'
|
7
|
+
CONNECTION_ERROR_IMAGE_PATH = './shared/network_system_error.bmp'
|
4
8
|
|
5
9
|
include DaFunk::Helper
|
6
10
|
|
@@ -117,31 +121,40 @@ module DaFunk
|
|
117
121
|
end
|
118
122
|
|
119
123
|
def self.download(enable_txt_ui = true)
|
124
|
+
ret = false
|
125
|
+
download_ret = false
|
126
|
+
Device::Display.print_bitmap(ATTACH_IMAGE_PATH) unless enable_txt_ui
|
120
127
|
if attach(attach_options(enable_txt_ui))
|
121
128
|
parse
|
122
|
-
|
129
|
+
try(3) do |attempt|
|
123
130
|
if enable_txt_ui
|
124
131
|
Device::Display.clear
|
125
132
|
I18n.pt(:downloading_content, :args => ["PARAMS", 1, 1])
|
133
|
+
getc(100)
|
126
134
|
end
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
getc(2000)
|
131
|
-
false
|
132
|
-
else
|
133
|
-
true
|
134
|
-
end
|
135
|
+
Device::Display.print_bitmap(SEARCHING_IMAGE_PATH) unless enable_txt_ui
|
136
|
+
download_ret = DaFunk::Transaction::Download.request_param_file(FILE_NAME)
|
137
|
+
ret = check_download_error(download_ret, enable_txt_ui)
|
135
138
|
end
|
139
|
+
show_download_error(download_ret, enable_txt_ui) unless ret
|
136
140
|
parse if ret
|
137
|
-
|
141
|
+
else
|
142
|
+
unless enable_txt_ui
|
143
|
+
Device::Display.print_bitmap(CONNECTION_ERROR_IMAGE_PATH)
|
144
|
+
getc(5000)
|
145
|
+
end
|
138
146
|
end
|
147
|
+
ret
|
139
148
|
end
|
140
149
|
|
141
150
|
def self.update_apps(force_params = false, force_crc = false, force = false, enable_txt_ui = true)
|
142
|
-
|
151
|
+
ret = true
|
152
|
+
if force_params || ! self.valid
|
153
|
+
ret = self.download(enable_txt_ui)
|
154
|
+
end
|
155
|
+
|
143
156
|
main_updated = nil
|
144
|
-
if self.valid
|
157
|
+
if self.valid && ret
|
145
158
|
apps_to_update = self.outdated_apps(force_crc, force)
|
146
159
|
size_apps = apps_to_update.size
|
147
160
|
apps_to_update.each_with_index do |app, index|
|
@@ -149,12 +162,15 @@ module DaFunk
|
|
149
162
|
main_updated ||= (ret && app.main_application?)
|
150
163
|
end
|
151
164
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
165
|
+
if ret
|
166
|
+
files_to_update = self.outdated_files(force_crc, force)
|
167
|
+
size_files = files_to_update.size
|
168
|
+
files_to_update.each_with_index do |file_, index|
|
169
|
+
ret = self.update_file(file_, index+1, size_files, force_crc || force, enable_txt_ui)
|
170
|
+
end
|
156
171
|
end
|
157
172
|
end
|
173
|
+
ret
|
158
174
|
ensure
|
159
175
|
self.restart if main_updated
|
160
176
|
end
|
@@ -199,34 +215,58 @@ module DaFunk
|
|
199
215
|
end
|
200
216
|
|
201
217
|
def self.update_app(application, index = 1, all = 1, force = false, enable_txt_ui = true)
|
218
|
+
ret = false
|
219
|
+
download_ret = false
|
220
|
+
Device::Display.print_bitmap(ATTACH_IMAGE_PATH) unless enable_txt_ui
|
202
221
|
if attach(attach_options(enable_txt_ui)) && application
|
203
222
|
try(3) do |attempt|
|
204
223
|
if enable_txt_ui
|
205
224
|
Device::Display.clear
|
206
225
|
I18n.pt(:downloading_content, :args => [I18n.t(:apps), index, all])
|
226
|
+
getc(100)
|
207
227
|
end
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
228
|
+
Device::Display.print_bitmap(UPDATING_IMAGE_PATH) unless enable_txt_ui
|
229
|
+
download_ret = application.download(force)
|
230
|
+
ret = check_download_error(download_ret, enable_txt_ui)
|
231
|
+
end
|
232
|
+
show_download_error(download_ret, enable_txt_ui) unless ret
|
233
|
+
else
|
234
|
+
unless enable_txt_ui
|
235
|
+
Device::Display.print_bitmap(CONNECTION_ERROR_IMAGE_PATH)
|
236
|
+
getc(5000)
|
212
237
|
end
|
213
238
|
end
|
239
|
+
ret
|
214
240
|
end
|
215
241
|
|
216
242
|
def self.update_file(file_parameter, index = 1, all = 1, force = false, enable_txt_ui = true)
|
243
|
+
ret = false
|
244
|
+
download_ret = false
|
245
|
+
Device::Display.print_bitmap(ATTACH_IMAGE_PATH) unless enable_txt_ui
|
217
246
|
if attach(attach_options(enable_txt_ui)) && file_parameter
|
218
247
|
try(3) do |attempt|
|
219
248
|
if enable_txt_ui
|
220
249
|
Device::Display.clear
|
221
250
|
I18n.pt(:downloading_content, :args => [I18n.t(:files), index, all])
|
251
|
+
getc(100)
|
252
|
+
end
|
253
|
+
Device::Display.print_bitmap(UPDATING_IMAGE_PATH) unless enable_txt_ui
|
254
|
+
download_ret = file_parameter.download(force)
|
255
|
+
ret = check_download_error(download_ret, enable_txt_ui)
|
256
|
+
if ret
|
257
|
+
file_parameter.unzip
|
258
|
+
getc(1000)
|
222
259
|
end
|
223
|
-
getc(100)
|
224
|
-
ret = check_download_error(file_parameter.download(force), enable_txt_ui)
|
225
|
-
file_parameter.unzip if ret
|
226
|
-
getc(1000)
|
227
260
|
ret
|
228
261
|
end
|
262
|
+
show_download_error(download_ret, enable_txt_ui) unless ret
|
263
|
+
else
|
264
|
+
unless enable_txt_ui
|
265
|
+
Device::Display.print_bitmap(CONNECTION_ERROR_IMAGE_PATH)
|
266
|
+
getc(5000)
|
267
|
+
end
|
229
268
|
end
|
269
|
+
ret
|
230
270
|
end
|
231
271
|
|
232
272
|
def self.apps
|
data/lib/da_funk/version.rb
CHANGED
data/lib/device/io.rb
CHANGED
@@ -161,6 +161,59 @@ class Device
|
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
164
|
+
def self.get_format_or_touchscreen_action(max, touch_map, options = {})
|
165
|
+
set_default_format_option(options)
|
166
|
+
key = text = options[:value] || ""
|
167
|
+
time = Time.now + (options[:timeout] || 30000) / 1000
|
168
|
+
ret = {}
|
169
|
+
touch_clear
|
170
|
+
Device::Display.clear options[:line]
|
171
|
+
Device::Display.print_line format(text, options), options[:line], options[:column]
|
172
|
+
loop do
|
173
|
+
line_x, line_y = getxy_stream(100)
|
174
|
+
if line_x && line_y
|
175
|
+
ret = parse_touchscreen(touch_map, line_x, line_y)
|
176
|
+
break(ret) if ret.include?(:touch_action)
|
177
|
+
else
|
178
|
+
key = getc(100)
|
179
|
+
if key == BACK
|
180
|
+
text = text[0..-2]
|
181
|
+
Device::Display.clear options[:line]
|
182
|
+
Device::Display.print_line format(text, options), options[:line], options[:column]
|
183
|
+
elsif options[:timeout_enabled] && time < Time.now
|
184
|
+
ret[:timeout] = Device::IO::KEY_TIMEOUT
|
185
|
+
break(ret)
|
186
|
+
elsif key == ENTER
|
187
|
+
ret[:text] = text
|
188
|
+
break(ret)
|
189
|
+
elsif key == CANCEL
|
190
|
+
ret[:cancel] = Device::IO::CANCEL
|
191
|
+
break(ret)
|
192
|
+
elsif key == F1 || key == DOWN || key == UP || key == ALPHA
|
193
|
+
change_next(text, check_mask_type(text, options))
|
194
|
+
next
|
195
|
+
elsif text.size >= max
|
196
|
+
next
|
197
|
+
elsif insert_key?(key, options)
|
198
|
+
text << key
|
199
|
+
Device::Display.clear options[:line]
|
200
|
+
Device::Display.print_line format(text, options), options[:line], options[:column]
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
def self.parse_touchscreen(touch_map, line_x, line_y)
|
207
|
+
ret = {}
|
208
|
+
touch_map.each do |key, value|
|
209
|
+
if value[:x].include?(line_x) && value[:y].include?(line_y)
|
210
|
+
Device::Audio.beep(7, 60)
|
211
|
+
ret[:touch_action] = key
|
212
|
+
end
|
213
|
+
end
|
214
|
+
ret
|
215
|
+
end
|
216
|
+
|
164
217
|
def self.set_default_format_option(options)
|
165
218
|
options[:mode] ||= IO_INPUT_LETTERS
|
166
219
|
options[:line] ||= 2
|
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.33.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: 2021-
|
11
|
+
date: 2021-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|