da_funk 0.15.0 → 0.16.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e1c080f65d9fe67fccf2c7c7b2690158bd55debd
4
- data.tar.gz: 870137e97051a0aa9622048a71a2d8f5fd32a903
3
+ metadata.gz: 48d7fbe5090df611791b473f79fdc69e88c71f1b
4
+ data.tar.gz: 9d5fc132303b0d48eeac689a45b3f7fb2321fae7
5
5
  SHA512:
6
- metadata.gz: f7f6cba4cdc56a392ce06e88ff34351133f07855027d4244a7ab1d5e6366afdc03465c6ce809cdb2ed12982a42304775c5a12257e61c6c74b069ae69d7d75664
7
- data.tar.gz: 1d0899ee151cd2d5457ea09e46753b1e71e3a223744228b31751068ded558a7f6afeafdcc14c884496cfb7116c6a69aefaa9d497b349bf0ac5f69b5d1b413335
6
+ metadata.gz: 647931fa3532bbb650dc3f5c6d97e0b98b939c277bc0beddf3bf2b163d78f3fbca07166034c350e89f80cad6cc01fc00f604ff1368237e5edb90c387c152c6f0
7
+ data.tar.gz: '094fcb787698b253651e808292bd09af426092f4aca09b0221b58f336dfa8dddb54bbb08c8f7b98c41f34d066a8e9e018041305392818d5cbfece24a46b68763'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- da_funk (0.15.0)
4
+ da_funk (0.16.0)
5
5
  archive-zip (~> 0.5)
6
6
  bundler (~> 1.7)
7
7
  cloudwalk_handshake (~> 0.6)
@@ -20,7 +20,7 @@ GEM
20
20
  funky-simplehttp (0.4.4)
21
21
  funky-tlv (0.2.3)
22
22
  io-like (0.3.0)
23
- posxml_parser (0.22.0)
23
+ posxml_parser (0.23.0)
24
24
  funky-emv (~> 0.3)
25
25
  rake (10.5.0)
26
26
  yard (0.9.9)
data/RELEASE_NOTES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # DaFunk
2
2
 
3
+ ### 0.16.0 - 2017-09-04
4
+
5
+ - Implement custom print at attach helper.
6
+
3
7
  ### 0.15.0 - 2017-08-30
4
8
 
5
9
  - Add task to setup(initialize) Network based in the current configuration.
@@ -14,25 +14,36 @@ module DaFunk
14
14
  string
15
15
  end
16
16
 
17
- def attach
17
+ # {
18
+ # :bmps => {
19
+ # :attach_connecting => "<path>",
20
+ # :attach_connected => "<path>",
21
+ # :attach_fail => "<path>",
22
+ # :attach_loop => ["<path1>", "<path2>", "<path3>", "<path4>"],
23
+ # }
24
+ # }
25
+ #
26
+ # {:print_last => true} || nil
27
+
28
+ def attach(options = {:print_last => true})
18
29
  if Device::Network.configured?
19
- print_last(I18n.t(:attach_connecting))
30
+ print_attach(:attach_connecting, options)
20
31
  unless Device::Network.connected?
21
- if Device::Network.attach == Device::Network::SUCCESS
32
+ if Device::Network.attach(options) == Device::Network::SUCCESS
22
33
  Device::Setting.network_configured = 1
23
- print_last(I18n.t(:attach_connected))
34
+ print_attach(:attach_connected, options)
24
35
  else
25
36
  Device::Setting.network_configured = 0 if Device::ParamsDat.file["connection_management"] != "1"
26
- print_last(I18n.t(:attach_fail, :args => [Device::Network.code.to_s]))
37
+ print_attach(:attach_fail, options.merge(:args => [Device::Network.code.to_s]))
27
38
  getc(4000)
28
39
  return false
29
40
  end
30
41
  else
31
- print_last(I18n.t(:attach_already_connected))
42
+ print_attach(:attach_already_connected, options)
32
43
  end
33
44
  true
34
45
  else
35
- print_last(I18n.t(:attach_device_not_configured))
46
+ print_attach(:attach_device_not_configured, options)
36
47
  getc(2000)
37
48
  false
38
49
  end
@@ -90,10 +101,16 @@ module DaFunk
90
101
  end
91
102
 
92
103
  # must send nonblock proc
93
- def try_user(timeout = Device::IO.timeout, &block)
104
+ def try_user(timeout = Device::IO.timeout, options = nil, &block)
94
105
  time = timeout != 0 ? Time.now + timeout / 1000 : Time.now
95
106
  processing = Hash.new(keep: true)
107
+ interation = 0
96
108
  while(processing[:keep] && processing[:key] != Device::IO::CANCEL) do
109
+ if options && options[:bmps] && files = options[:bmps][:attach_loop]
110
+ Device::Display.print_bitmap(files[interation])
111
+ max = files.size - 1
112
+ interation = (max >= interation) ? 0 : interation + 1
113
+ end
97
114
  if processing[:keep] = block.call(processing)
98
115
  processing[:key] = getc(300)
99
116
  end
@@ -293,6 +310,18 @@ module DaFunk
293
310
  puts("#{string}")
294
311
  end
295
312
  end
313
+
314
+ def print_attach(id, options = nil)
315
+ if options
316
+ if bmps = options[:bmps]
317
+ Device::Display.print_bitmap(bmps[id]) if bmps[id]
318
+ else
319
+ print_last(I18n.t(id, options)) if options[:print_last]
320
+ end
321
+ else
322
+ print_last(I18n.t(id))
323
+ end
324
+ end
296
325
  end
297
326
  end
298
327
 
@@ -1,4 +1,4 @@
1
1
  module DaFunk
2
- VERSION="0.15.0"
2
+ VERSION="0.16.0"
3
3
  end
4
4
 
@@ -144,14 +144,14 @@ class Device
144
144
  ret
145
145
  end
146
146
 
147
- def self.attach
147
+ def self.attach(options = nil)
148
148
  Device::Network.connected?
149
149
  if self.code != SUCCESS
150
150
  self.code = Device::Network.init(*self.config)
151
151
  self.code = Device::Network.connect
152
152
  Device::Network.connected? if self.code != SUCCESS
153
153
 
154
- hash = try_user do |process|
154
+ hash = try_user(Device::IO.timeout, options) do |process|
155
155
  Device::Network.connected?
156
156
  process[:ret] = self.code
157
157
  process[:ret] == PROCESSING # if true keep trying
data/out/da_funk.mrb CHANGED
Binary file
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: 0.15.0
4
+ version: 0.16.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: 2017-08-30 00:00:00.000000000 Z
11
+ date: 2017-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake