da_funk 3.29.1 → 3.33.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 451f1a04625db6dbf5b6e90813c47a8419fbe68cfff6ba8c7ccbc233423e5253
4
- data.tar.gz: 0d4347d21f0bb1eaff18a4dab1d70d2b573ecb82ffd7da0a0b87bf0dd94bcf6c
3
+ metadata.gz: 8eeac1f3c7449183cfd65b190bd2ca9515f586eb55af7e70fa6ac38762a8ae80
4
+ data.tar.gz: be5906723b2ef951f592bf8434626f7cac9b20a01f699432132692e0a2df8428
5
5
  SHA512:
6
- metadata.gz: 103db5599eafffef2a1d29ebe0f82ed0bbccf358af999ec769f81153769d099e6f62e25acc9c49e5dde401b501f886e40b128a9634f1438f8d2d5bbc42ebbfba
7
- data.tar.gz: cf0561ec14063622c8a694eb2d5cc9b4eb37188c2edea91ce2eea6830c357dfa8646c8792fe956ad430356614da9006a155b77505301aca9fc191a813356227a
6
+ metadata.gz: 9667b789d09b2d1ccc41734b1112a243eec58e91504c85618f9177c4e007ab9ec59e857c99f867295794b5bba3d2c33c25e66e2061fa09b47ee2c3c7b2f929b5
7
+ data.tar.gz: 693e92596f8be1c74e338e2d3b6bebe20d9b4c9f190f4bee820e76046350039cd8317379a3e9b59101183a9525881110a6e8a94c4527d5601de36bb7c00fde77
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- da_funk (3.29.1)
4
+ da_funk (3.33.1)
5
5
  archive-zip (~> 0.5)
6
6
  bundler
7
7
  cloudwalk_handshake
data/RELEASE_NOTES.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # DaFunk
2
2
 
3
+ ### 3.33.1 - 2021-02-19
4
+
5
+ - Fixed argument being passed to hours2seconds method which was nil;
6
+
7
+ ### 3.33.0 - 2021-02-08
8
+
9
+ - Added method Device::IO#get_format_or_touchscreen_action;
10
+ - Added support to images on ParamsDat#download, ParamsDat#update_app and ParamsDat#update_file;
11
+ - Return result of ParamsDat#update_apps call to the caller.
12
+
13
+ ### 3.32.0 - 2021-01-04
14
+
15
+ - Remapped virtual keyboard to add support to new layout;
16
+ - Make timeout of virtual keyboard parametrized;
17
+ - Limit size of string to 20 on virtual keyboard;
18
+ - Refactoring status bar:
19
+ - Check if thread is paused which means communication it's being configured. In this case 'sem sinal' message should be displayed;
20
+ - Do not show media type an media icon if thread is paused;
21
+ - Removed thread pause from attach and scan calls, let the application that is doing the configuration take care of that;
22
+ - Move reload of metadata to communication thread;
23
+ - Added support to check network conn status from time to time, default is each 5 minutes.
24
+
25
+ ### 3.31.0 - 2020-11-27
26
+
27
+ - Added support to new battery view (Exact percentage);
28
+ - Added support to new main screen when there's a pending sale.
29
+
30
+ ### 3.30.0 - 2020-11-16
31
+
32
+ - Replace GPRS icon to 3G;
33
+ - Added new method main_image_format on Device::Display;
34
+ - Use main_image_format method to get the image name instead adapter;
35
+ - Added new class DaFunk::Transaction::Reversal.
36
+
3
37
  ### 3.29.1 - 2020-11-04
4
38
 
5
39
  - Fix battery charging status. When power supply is connected the SDK always returns 50% of battery, in this case it won't show the percentage until the SDK returns 100%.
data/Rakefile CHANGED
@@ -53,6 +53,7 @@ FILES = FileList[
53
53
  "lib/da_funk/application.rb",
54
54
  "lib/da_funk/transaction/iso.rb",
55
55
  "lib/da_funk/transaction/download.rb",
56
+ "lib/da_funk/transaction/reversal.rb",
56
57
  "lib/da_funk/notification_event.rb",
57
58
  "lib/da_funk/notification_callback.rb",
58
59
  "lib/da_funk/notification.rb",
@@ -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 Device::Network.connected?
11
- if primary_try?
12
- :primary_communication
13
- end
14
- else
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
- :attach_registration_fail
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
-
@@ -52,7 +52,7 @@ module DaFunk
52
52
  end
53
53
 
54
54
  unless config["timestamp"]
55
- config["timestamp"] = hours2seconds(option["interval"])
55
+ config["timestamp"] = hours2seconds(option[:hours])
56
56
  else
57
57
  if config["interval"]["hours"].to_s != option[:hours].to_s
58
58
  config["timestamp"] = hours2seconds(option[:hours])
@@ -61,38 +61,77 @@ module DaFunk
61
61
  end
62
62
  end
63
63
 
64
- def check_download_error(ret, enable_txt_ui = true)
65
- value = true
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 ret
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
- value = false
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
- value = false
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
- value = false
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
- value = false
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
- value = false
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
- value = false
128
+ ContextLog.info "[I] Download error, connection problem"
91
129
  end
92
130
 
93
- I18n.pt(ui[:i18n], :args => [ret]) if enable_txt_ui
94
-
95
- value
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)
@@ -1,31 +1,75 @@
1
+ #
2
+ # @file status_bar.rb
3
+ # @brief DaFunk status bar helper script.
4
+ # @platform N/A
5
+ #
6
+ # @copyright Copyright (c) 2016 CloudWalk, Inc.
7
+ #
8
+
1
9
  module DaFunk
2
10
  module Helper
11
+ # Status bar class definition.
3
12
  class StatusBar
4
- STATUS_TIMEOUT = 60
5
- SLOT_MEDIA = 0
6
- SLOT_SIGNAL_LEVEL = 1
7
- SLOT_UPDATE = 2
13
+ # Class macros and constants
14
+ STATUS_TIMEOUT = 60
15
+ SLOT_MEDIA = 0
16
+ SLOT_SIGNAL_LEVEL = 1
17
+ SLOT_UPDATE = 2
8
18
  SLOT_BATTERY_PERCENTUAL = 6
9
- SLOT_BATTERY_LEVEL = 7
10
- SLOT_MESSAGE_CONNECTION = {
11
- true => {
12
- :slot1 => 2,
13
- :slot2 => 3,
14
- :message1 => './shared/conectado_01.png',
15
- :message2 => './shared/conectado_02.png'
16
- },
17
- false => {
18
- :slot1 => 2,
19
- :slot2 => 3,
20
- :message1 => './shared/buscando_01.png',
21
- :message2 => './shared/buscando_02.png'
22
- }
19
+ SLOT_BATTERY_LEVEL = 7
20
+
21
+ # TODO: review the 'print_status_bar' API to reduce the number of files
22
+ # to eleven?
23
+ BATTERY_PERCENTAGE_IMAGES = [
24
+ './shared/1%.png', './shared/1%.png', './shared/2%.png',
25
+ './shared/3%.png', './shared/4%.png', './shared/5%.png',
26
+ './shared/6%.png', './shared/7%.png', './shared/8%.png',
27
+ './shared/9%.png', './shared/10%.png', './shared/11%.png',
28
+ './shared/12%.png', './shared/13%.png', './shared/14%.png',
29
+ './shared/15%.png', './shared/16%.png', './shared/17%.png',
30
+ './shared/18%.png', './shared/19%.png', './shared/20%.png',
31
+ './shared/21%.png', './shared/22%.png', './shared/23%.png',
32
+ './shared/24%.png', './shared/25%.png', './shared/26%.png',
33
+ './shared/27%.png', './shared/28%.png', './shared/29%.png',
34
+ './shared/30%.png', './shared/31%.png', './shared/32%.png',
35
+ './shared/33%.png', './shared/34%.png', './shared/35%.png',
36
+ './shared/36%.png', './shared/37%.png', './shared/38%.png',
37
+ './shared/39%.png', './shared/40%.png', './shared/41%.png',
38
+ './shared/42%.png', './shared/43%.png', './shared/44%.png',
39
+ './shared/45%.png', './shared/46%.png', './shared/47%.png',
40
+ './shared/48%.png', './shared/49%.png', './shared/50%.png',
41
+ './shared/51%.png', './shared/52%.png', './shared/53%.png',
42
+ './shared/54%.png', './shared/55%.png', './shared/56%.png',
43
+ './shared/57%.png', './shared/58%.png', './shared/59%.png',
44
+ './shared/60%.png', './shared/61%.png', './shared/62%.png',
45
+ './shared/63%.png', './shared/64%.png', './shared/65%.png',
46
+ './shared/66%.png', './shared/67%.png', './shared/68%.png',
47
+ './shared/69%.png', './shared/70%.png', './shared/71%.png',
48
+ './shared/72%.png', './shared/73%.png', './shared/74%.png',
49
+ './shared/75%.png', './shared/76%.png', './shared/77%.png',
50
+ './shared/78%.png', './shared/79%.png', './shared/80%.png',
51
+ './shared/81%.png', './shared/82%.png', './shared/83%.png',
52
+ './shared/84%.png', './shared/85%.png', './shared/86%.png',
53
+ './shared/87%.png', './shared/88%.png', './shared/89%.png',
54
+ './shared/90%.png', './shared/91%.png', './shared/92%.png',
55
+ './shared/93%.png', './shared/94%.png', './shared/95%.png',
56
+ './shared/96%.png', './shared/97%.png', './shared/98%.png',
57
+ './shared/99%.png', './shared/100%.png'
58
+ ].freeze
59
+
60
+ MEDIA_PATH = {
61
+ :gprs => './shared/3G.png',
62
+ :wifi => './shared/WIFI.png'
23
63
  }
24
64
 
65
+ BATTERY_CHARGING = [
66
+ "./shared/battery_charging.png",
67
+ "./shared/battery_charged.png"
68
+ ].freeze
69
+
25
70
  BATTERY_IMAGES = {
26
71
  0..4 => "./shared/battery0.png",
27
- 5..9 => "./shared/baterry5.png",
28
- 10..19 => "./shared/battery10.png",
72
+ 5..19 => "./shared/battery10.png",
29
73
  20..29 => "./shared/battery20.png",
30
74
  30..39 => "./shared/battery30.png",
31
75
  40..49 => "./shared/battery40.png",
@@ -34,48 +78,29 @@ module DaFunk
34
78
  70..79 => "./shared/battery70.png",
35
79
  80..89 => "./shared/battery80.png",
36
80
  90..99 => "./shared/battery90.png",
37
- 100..100 => "./shared/battery100.png",
38
- }
39
-
40
- BATTERY_CHARGE_IMAGES = {
41
- 50 => "./shared/battery0c.png",
42
- 100 => "./shared/battery100c.png"
43
- }
44
-
45
- BATTERY_PERCENTAGE_IMAGES = {
46
- 0..4 => "./shared/battery1_percent.png",
47
- 5..9 => "./shared/battery5_percent.png",
48
- 10..19 => "./shared/battery10_percent.png",
49
- 20..29 => "./shared/battery20_percent.png",
50
- 30..39 => "./shared/battery30_percent.png",
51
- 40..49 => "./shared/battery40_percent.png",
52
- 50..59 => "./shared/battery50_percent.png",
53
- 60..69 => "./shared/battery60_percent.png",
54
- 70..79 => "./shared/battery70_percent.png",
55
- 80..89 => "./shared/battery80_percent.png",
56
- 90..99 => "./shared/battery90_percent.png",
57
- 100..100 => "./shared/battery100_percent.png",
81
+ 100..100 => "./shared/battery100.png"
58
82
  }
59
83
 
60
84
  WIFI_IMAGES = {
61
- 0..0 => "./shared/wifi0.png",
62
- 1..25 => "./shared/wifi25.png",
63
- 26..50 => "./shared/wifi50.png",
64
- 59..75 => "./shared/wifi75.png",
65
- 76..200 => "./shared/wifi100.png"
85
+ 0..0 => "./shared/wifi0.png",
86
+ 1..25 => "./shared/wifi25.png",
87
+ 26..50 => "./shared/wifi50.png",
88
+ 59..75 => "./shared/wifi75.png",
89
+ 76..200 => "./shared/wifi100.png"
66
90
  }
67
91
 
68
92
  MOBILE_IMAGES = {
69
- 0..0 => "./shared/mobile0.png",
70
- 1..20 => "./shared/mobile20.png",
71
- 21..40 => "./shared/mobile40.png",
72
- 41..60 => "./shared/mobile60.png",
73
- 61..80 => "./shared/mobile80.png",
74
- 81..200 => "./shared/mobile100.png"
93
+ 0..0 => "./shared/mobile0.png",
94
+ 1..20 => "./shared/mobile20.png",
95
+ 21..40 => "./shared/mobile40.png",
96
+ 41..60 => "./shared/mobile60.png",
97
+ 61..80 => "./shared/mobile80.png",
98
+ 81..200 => "./shared/mobile100.png"
75
99
  }
76
100
 
77
101
  class << self
78
- attr_accessor :signal, :battery, :power, :managment, :connected
102
+ attr_accessor :current_signal, :current_message, :battery, :power, :managment
103
+ attr_accessor :current_media
79
104
  end
80
105
 
81
106
  def self.check
@@ -90,98 +115,127 @@ module DaFunk
90
115
  if File.exists?('./shared/system_update')
91
116
  PAX::Display.print_status_bar(SLOT_UPDATE, "./shared/system_update_download.png")
92
117
  PAX::Display.print_status_bar(3, nil)
93
- self.connected = false
94
118
  else
95
- change_message
119
+ self.change_message
96
120
  end
97
121
  end
98
122
 
99
123
  def self.change_message
100
- unless File.exists?('./shared/system_update')
101
- connected = Device::Network.connected?
102
-
103
- if connected != self.connected
104
- self.connected = connected
105
-
106
- slot_message_1 = SLOT_MESSAGE_CONNECTION[self.connected][:slot1]
107
- slot_message_2 = SLOT_MESSAGE_CONNECTION[self.connected][:slot2]
108
-
109
- message_1 = SLOT_MESSAGE_CONNECTION[self.connected][:message1]
110
- message_2 = SLOT_MESSAGE_CONNECTION[self.connected][:message2]
111
-
112
- Device::Display.print_status_bar(slot_message_1, message_1)
113
- Device::Display.print_status_bar(slot_message_2, message_2)
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')
114
141
  end
115
142
  end
116
143
  end
117
144
 
118
145
  def self.change_connection
119
- if Device::Network.connected?
120
- sig = Device::Network.signal
121
-
122
- if self.signal != sig
123
- self.signal = sig
124
-
125
- if Device::Network.gprs?
126
- Device::Display.print_status_bar(SLOT_MEDIA, "./shared/GPRS.png")
127
- Device::Display.print_status_bar(SLOT_SIGNAL_LEVEL,
128
- get_image_path(:gprs, self.signal))
129
- elsif Device::Network.wifi?
130
- Device::Display.print_status_bar(SLOT_MEDIA, "./shared/WIFI.png")
131
- Device::Display.print_status_bar(SLOT_SIGNAL_LEVEL,
132
- get_image_path(:wifi, self.signal))
133
- end
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))
134
162
  end
135
163
  else
136
164
  Device::Display.print_status_bar(SLOT_MEDIA, nil)
137
165
  Device::Display.print_status_bar(SLOT_SIGNAL_LEVEL, "./shared/searching.png")
166
+ self.current_media = nil
167
+ self.current_signal = nil
138
168
  end
139
169
  end
140
170
 
171
+ # Updates the battery slot whenever a capacity or power supply change is
172
+ # detected.
141
173
  def self.change_battery
142
- bat = Device::System.battery
143
- dock = Device::System.power_supply
174
+ capacity_type = Device::System.battery_capacity_type
175
+
176
+ capacity = Device::System.battery
177
+ charging = Device::System.power_supply
144
178
 
145
- if self.battery != bat || self.power != dock
146
- self.battery = bat
147
- self.power = dock
179
+ if self.battery != capacity || self.power != charging
148
180
 
149
- if self.power && self.battery == 50
150
- Device::Display.print_status_bar(SLOT_BATTERY_PERCENTUAL, nil)
181
+ if self.battery.nil? # basic integrity check
182
+ self.battery = capacity
183
+ elsif charging
184
+ capacity >= self.battery && self.battery = capacity
151
185
  else
152
- percentual = get_image_path(:battery_percentual, self.battery)
153
- Device::Display.print_status_bar(SLOT_BATTERY_PERCENTUAL, percentual)
186
+ capacity <= self.battery && self.battery = capacity
187
+ end
188
+
189
+ if self.power == charging && capacity != self.battery
190
+ return nil
154
191
  end
155
192
 
156
- if self.power
157
- Device::Display.print_status_bar(
158
- SLOT_BATTERY_LEVEL, get_image_path(:battery_charge, self.battery))
193
+ self.power = charging
194
+
195
+ rsc = self.get_image_path(self.power ? :battery_charge : :battery, self.battery)
196
+
197
+ Device::Display.print_status_bar(SLOT_BATTERY_LEVEL, rsc)
198
+
199
+ if capacity_type == 'percentage' || !self.power
200
+ rsc = self.get_image_path(:battery_percentual, self.battery)
159
201
  else
160
- Device::Display.print_status_bar(SLOT_BATTERY_LEVEL,
161
- get_image_path(:battery, self.battery))
202
+ rsc = nil
162
203
  end
204
+
205
+ Device::Display.print_status_bar(SLOT_BATTERY_PERCENTUAL, rsc)
163
206
  end
164
207
  end
165
208
 
209
+ # Searches for the correspondent image to 'type' and 'signal strength'.
166
210
  def self.get_image_path(type, sig)
167
211
  return if sig.nil?
168
212
  case type
169
213
  when :gprs
170
- MOBILE_IMAGES.each {|k,v| return v if k.include? sig }
214
+ MOBILE_IMAGES.each do |k, v|
215
+ return v if k.include? sig
216
+ end
171
217
  when :wifi
172
- WIFI_IMAGES.each {|k,v| return v if k.include? sig }
218
+ WIFI_IMAGES.each do |k, v|
219
+ return v if k.include? sig
220
+ end
173
221
  when :battery
174
- BATTERY_IMAGES.each {|k,v| return v if k.include? sig }
222
+ BATTERY_IMAGES.each do |k, v|
223
+ return v if k.include? sig
224
+ end
175
225
  when :battery_charge
176
- BATTERY_CHARGE_IMAGES[sig]
226
+ if sig < 100
227
+ BATTERY_CHARGING[0]
228
+ else
229
+ BATTERY_CHARGING[1]
230
+ end
177
231
  when :battery_percentual
178
- BATTERY_PERCENTAGE_IMAGES.each {|k,v| return v if k.include? sig }
232
+ BATTERY_PERCENTAGE_IMAGES[sig]
179
233
  else
180
234
  nil
181
235
  end
182
236
  end
183
237
 
184
- self.managment ||= true
238
+ self.managment ||= true
185
239
  def self.valid?
186
240
  if self.managment
187
241
  true
@@ -190,4 +244,3 @@ module DaFunk
190
244
  end
191
245
  end
192
246
  end
193
-
@@ -1,6 +1,10 @@
1
1
  module DaFunk
2
2
  class ParamsDat
3
- FILE_NAME = "./main/params.dat"
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
- ret = try(3) do |attempt|
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
- getc(100)
128
- ret = DaFunk::Transaction::Download.request_param_file(FILE_NAME)
129
- unless check_download_error(ret, enable_txt_ui)
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
- ret
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
- self.download(enable_txt_ui) if force_params || ! self.valid
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
- files_to_update = self.outdated_files(force_crc, force)
153
- size_files = files_to_update.size
154
- files_to_update.each_with_index do |file_, index|
155
- self.update_file(file_, index+1, size_files, force_crc || force, enable_txt_ui)
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
- getc(100)
209
- ret = check_download_error(application.download(force), enable_txt_ui)
210
- getc(1000)
211
- ret
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
@@ -31,7 +31,7 @@ module DaFunk
31
31
  @resources_out ||= @resources.pathmap("%{resources,#{File.join(root_path, "out")}}p")
32
32
  @tests_res_out ||= @tests_resources.pathmap("%{test/resources,out}p")
33
33
  @mruby ||= "cloudwalk run -b"
34
- @mrbc = get_mrbc_bin(@mrbc)
34
+ @mrbc = get_mrbc_bin(@mrbc)
35
35
 
36
36
  define
37
37
  end
@@ -44,14 +44,21 @@ module DaFunk
44
44
  end
45
45
  end
46
46
 
47
+ # Searches for a mrbc binary.
47
48
  def get_mrbc_bin(from_user)
48
- if (! system("type mrbc > /dev/null 2>&1 ")) && from_user
49
+ device = "/dev/null"
50
+
51
+ if %w[i386-mingw32 x64-mingw32].include?(RUBY_PLATFORM) && !ENV['SHELL']
52
+ device = "NUL" # Windows Command Prompt
53
+ end
54
+
55
+ if !system("type mrbc > #{device} 2>&1") && from_user
49
56
  from_user
50
- elsif system("type mrbc > /dev/null 2>&1 ")
57
+ elsif system("type mrbc > #{device} 2>&1")
51
58
  "env mrbc"
52
59
  elsif ENV["MRBC"]
53
60
  ENV["MRBC"]
54
- elsif system("type cloudwalk > /dev/null 2>&1 ")
61
+ elsif system("type cloudwalk > #{device} 2>&1")
55
62
  "env cloudwalk compile"
56
63
  else
57
64
  puts "$MRBC isn't set or mrbc/cloudwalk isn't on $PATH"
@@ -64,7 +71,7 @@ module DaFunk
64
71
  command_line = File.join(File.dirname(__FILE__), "..", "..", "utils", "command_line_platform.rb")
65
72
  command_line_obj = File.join(root_path, "out", "main", "command_line_platform.mrb")
66
73
  all_files = FileList["test/test_helper.rb"] + libs + files + [command_line] + [File.join(File.dirname(__FILE__), "..", "..", "utils", "test_run.rb")]
67
- if platform_call("#{mrbc} -g -o #{command_line_obj} #{command_line}") && platform_call("#{mrbc} -g -o #{test_out} #{all_files.uniq}")
74
+ if platform_call("#{@mrbc} -g -o #{command_line_obj} #{command_line}") && platform_call("#{@mrbc} -g -o #{test_out} #{all_files.uniq}")
68
75
  puts "cd #{File.dirname(out_path)}"
69
76
  FileUtils.cd File.dirname(out_path)
70
77
  platform_call("#{mruby} #{File.join(name, "test.mrb")}")
@@ -108,7 +115,7 @@ module DaFunk
108
115
 
109
116
  desc "Compile app to mrb and process resources"
110
117
  task :build => :resources do
111
- platform_call "#{mrbc} #{debug_flag} -o #{main_out} #{libs} "
118
+ platform_call "#{@mrbc} #{debug_flag} -o #{main_out} #{libs} "
112
119
  end
113
120
 
114
121
  desc "Compile, build and pack app and resources"
@@ -0,0 +1,13 @@
1
+ module DaFunk
2
+ class Transaction
3
+ class Reversal
4
+ def self.filename
5
+ DaFunk::ParamsDat.file['reversal_file_name'] || 'cw_reversal_transact.dat'
6
+ end
7
+
8
+ def self.exists?
9
+ File.exists? "./shared/#{filename}"
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,4 +1,4 @@
1
1
  module DaFunk
2
- VERSION="3.29.1"
2
+ VERSION="3.33.1"
3
3
  end
4
4
 
@@ -71,13 +71,23 @@ class Device
71
71
  end
72
72
 
73
73
  def self.main_image
74
- if adapter.respond_to?(:main_image) &&
75
- File.exists?("./shared/#{adapter.main_image}")
76
- adapter.main_image
74
+ file = main_image_format
75
+ if File.exists?("./shared/#{file}")
76
+ file
77
77
  else
78
78
  MAIN_BMP
79
79
  end
80
80
  end
81
+
82
+ private
83
+ def self.main_image_format
84
+ major, min, patch = Device.version.to_s.split('.').map { |v| v.to_i }
85
+ if DaFunk::Transaction::Reversal.exists? && major >= 8
86
+ "main_#{Device::System.model}_reversal.bmp"
87
+ else
88
+ "main_#{Device::System.model}.bmp"
89
+ end
90
+ end
81
91
  end
82
92
  end
83
93
 
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
@@ -159,9 +159,7 @@ class Device
159
159
  # Device::Setting.mode = selected[:mode]
160
160
  def self.scan
161
161
  if wifi?
162
- ThreadScheduler.pausing_communication do
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
- ThreadScheduler.pausing_communication do
196
- self.code = Device::Network.init(*self.config)
197
- self.code = Device::Network.connect
198
- Device::Network.connected? if self.code != SUCCESS
199
-
200
- hash = try_user(self.attach_timeout, options) do |process|
201
- Device::Network.connected?
202
- process[:ret] = self.code
203
- # TODO develop an interface to keep waiting communication module dial
204
- # based on platform returns
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
- end
218
- Context::ThreadPubSub.publish('communication_update')
219
- self.code
220
- end
204
+ self.code = hash[:ret]
221
205
 
222
- def self.load_metadata
223
- if Object.const_defined?(:CwMetadata)
224
- CwMetadata.load_variable if CwMetadata.respond_to?(:load_variable)
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
-
data/lib/device/system.rb CHANGED
@@ -45,6 +45,15 @@ class Device
45
45
  adapter.battery
46
46
  end
47
47
 
48
+ # Checks the type of the battery capacity return (percentage or scale).
49
+ def self.battery_capacity_type
50
+ begin
51
+ adapter.battery_capacity_type
52
+ rescue StandardError => exception
53
+ 'scale'
54
+ end
55
+ end
56
+
48
57
  def self.beep
49
58
  adapter.beep
50
59
  end
@@ -82,34 +82,76 @@ class Device
82
82
  ],
83
83
 
84
84
  keyboard_symbol_number: [
85
- { x: 0..35, y: 190..210, char: '(' },
86
- { x: 0..68, y: 190..210, char: ')' },
87
- { x: 0..104, y: 190..210, char: '1' },
88
- { x: 0..138, y: 190..210, char: '2' },
89
- { x: 0..169, y: 190..210, char: '3' },
90
- { x: 0..203, y: 190..210, char: '+' },
91
- { x: 0..239, y: 190..210, char: '-' },
92
- { x: 0..35, y: 220..245, char: '?' },
93
- { x: 0..68, y: 220..245, char: '$' },
94
- { x: 0..104, y: 220..245, char: '4' },
95
- { x: 0..138, y: 220..245, char: '5' },
96
- { x: 0..169, y: 220..245, char: '6' },
97
- { x: 0..203, y: 220..245, char: '*' },
98
- { x: 0..239, y: 220..245, char: '/' },
99
- { x: 0..35, y: 255..275, char: '!' },
100
- { x: 0..68, y: 255..275, char: ';' },
101
- { x: 0..104, y: 255..275, char: '7' },
102
- { x: 0..138, y: 255..275, char: '8' },
103
- { x: 0..169, y: 255..275, char: '9' },
104
- { x: 0..203, y: 255..275, char: '=' },
105
- { x: 0..239, y: 255..275, char: :erase },
106
- { x: 0..35, y: 290..315, char: :keyboard_capital },
107
- { x: 0..68, y: 290..315, char: '@' },
108
- { x: 0..104, y: 290..315, char: '%' },
109
- { x: 0..138, y: 290..315, char: '0' },
110
- { x: 0..169, y: 290..315, char: '#' },
111
- { x: 0..203, y: 290..315, char: '_' },
112
- { x: 0..239, y: 290..315, char: :enter }
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
- time = Time.now + (params[:timeout] || Device::IO.timeout) / 1000
121
- key = nil
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
- break(Device::IO::KEY_TIMEOUT) if Time.now > time
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 << key[:char] unless key[:char] == :enter
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.29.1
4
+ version: 3.33.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thiago Scalone
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-04 00:00:00.000000000 Z
11
+ date: 2021-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -179,6 +179,7 @@ files:
179
179
  - lib/da_funk/test.rb
180
180
  - lib/da_funk/transaction/download.rb
181
181
  - lib/da_funk/transaction/iso.rb
182
+ - lib/da_funk/transaction/reversal.rb
182
183
  - lib/da_funk/version.rb
183
184
  - lib/device.rb
184
185
  - lib/device/audio.rb
@@ -258,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
258
259
  - !ruby/object:Gem::Version
259
260
  version: '0'
260
261
  requirements: []
261
- rubygems_version: 3.0.6
262
+ rubygems_version: 3.1.2
262
263
  signing_key:
263
264
  specification_version: 4
264
265
  summary: MRuby Embedded System Framework