da_funk 0.7.0 → 0.7.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
  SHA1:
3
- metadata.gz: 4ec3525c8b86df99abedcdc53570b5566932e225
4
- data.tar.gz: e9a9f6add66d948a31ccf63353a8b104a3b5f508
3
+ metadata.gz: e011410f7d6c3f3c8b9577722564f315c70c8fc7
4
+ data.tar.gz: 6d35d3fd04134b622af6d0bfe6a4b53fd2dca217
5
5
  SHA512:
6
- metadata.gz: dd7f60bf1c62851bc4ce07cb0fcf7f8b1d2e7ee9657a5184e686a9593a58a41629e870371393c6bb776e2d945898385663cfcdcaba462bbf2f9f793f77a18a72
7
- data.tar.gz: 053fbb6613d76a2d8125b012597e49ba61d7b5ba100cc7eb1f26b74f5971e1a892da9b5d369c4c371a43c77a57ade4db9e16a540efe2ba5a953d2ee7d9c366e3
6
+ metadata.gz: a1f83fd2f73f612efcc05b3fc9c81d3035e8c0e24dbc183e2ee15a37d439d9d7a1110a41754447c166d8d080f3a6109e031fcbb709811458348b3456099d5138
7
+ data.tar.gz: 6ffdc543b460d457ed686544b596f32432b833ac2f304d4e2a7be7fa3d9441c25aa9cb82db5cb548daa829360e4a0cf2dde11ec9754bdc00225ca78ed0e9c5f4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- da_funk (0.7.0)
4
+ da_funk (0.7.1)
5
5
  bundler (~> 1.7)
6
6
  cloudwalk_handshake (~> 0.5)
7
7
  posxml_parser (~> 0.6)
@@ -13,7 +13,7 @@ GEM
13
13
  specs:
14
14
  cloudwalk_handshake (0.5.4)
15
15
  funky-simplehttp (0.4.4)
16
- posxml_parser (0.7.7)
16
+ posxml_parser (0.7.10)
17
17
  rake (10.5.0)
18
18
  yard (0.8.7.6)
19
19
 
data/RELEASE_NOTES.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # DaFunk
2
2
 
3
+ ### 0.7.1 - 2016-03-30 - Small changes
4
+
5
+ - Refactoring Application to calculate crc on the end of download to check integrity.
6
+ - During attaching process define network_configured = 1 if attached successfully.
7
+ - Fix crc generation on download file if crc didn’t come.
8
+ - Update posxml_parser to version 0.7.10.
9
+
3
10
  ### 0.7.0 - 2016-03-10 - EventListener and EventHandler
4
11
 
5
12
  - Implemented method each for FileDb.
@@ -1,4 +1,4 @@
1
1
  module DaFunk
2
- VERSION="0.7.0"
2
+ VERSION="0.7.1"
3
3
  end
4
4
 
@@ -37,7 +37,12 @@ class Device
37
37
  else
38
38
  ret = Device::Transaction::Download::FILE_NOT_CHANGE
39
39
  end
40
- @crc_local = @crc if ret == Device::Transaction::Download::SUCCESS
40
+ if ret == Device::Transaction::Download::SUCCESS
41
+ @crc_local = calculate_crc
42
+ if @crc_local != @crc
43
+ return Device::Transaction::Download::COMMUNICATION_ERROR
44
+ end
45
+ end
41
46
  ret
42
47
  rescue => e
43
48
  puts "ERROR #{e.message}"
@@ -61,15 +66,10 @@ class Device
61
66
 
62
67
  def outdated?
63
68
  return true unless File.exists?(file)
64
- unless @crc_local
65
- handle = File.open(file)
66
- @crc_local = Device::Crypto.crc16_hex(handle.read)
67
- end
69
+ @crc_local = calculate_crc unless @crc_local
68
70
  @crc_local != @crc
69
71
  rescue
70
72
  true
71
- ensure
72
- handle.close if handle
73
73
  end
74
74
 
75
75
  def execute(json = "")
@@ -90,6 +90,15 @@ class Device
90
90
 
91
91
  private
92
92
 
93
+ def calculate_crc
94
+ if exists?
95
+ handle = File.open(file)
96
+ Device::Crypto.crc16_hex(handle.read)
97
+ end
98
+ ensure
99
+ handle.close if handle
100
+ end
101
+
93
102
  def check_path(path)
94
103
  if posxml?
95
104
  "./shared/#{path}"
@@ -144,10 +144,12 @@ class Device
144
144
  while(ret == PROCESSING)
145
145
  ret = Device::Network.connected?
146
146
  end
147
- if ret == SUCCESS && (wifi? || ethernet?)
148
- Device::Network.dhcp_client(20000)
147
+ if ret == SUCCESS
148
+ Device::Network.dhcp_client(20000) if (wifi? || ethernet?)
149
+ Device::Setting.network_configured = 1
150
+ else
151
+ Device::Setting.network_configured = 0
149
152
  end
150
- Device::Setting.network_configured = 0 if ret != SUCCESS
151
153
  end
152
154
  ret
153
155
  end
@@ -20,7 +20,7 @@ class Device
20
20
  MAPREDUCE_RESPONSE_ERROR = -2
21
21
  IO_ERROR = -3
22
22
 
23
- def self.request_file(remote_path, local_path, crc = "")
23
+ def self.request_file(remote_path, local_path, crc = nil)
24
24
  download = Device::Transaction::Download.new(Device::System.serial, "", DaFunk::VERSION)
25
25
  download.perform(Device::Network.socket,
26
26
  Device::Setting.company_name,
@@ -77,7 +77,7 @@ class Device
77
77
  ei_encode_binary(@serial) # elemento binario serialterminal
78
78
  ei_encode_binary(@version) # elemento binario versao walk
79
79
  ei_encode_binary(remote_path) # elemento binario nomeaplicativo
80
- ei_encode_binary(crc) # elemento binario crc aplicativo
80
+ ei_encode_binary(@crc) # elemento binario crc aplicativo
81
81
  ei_encode_binary("") # elemento binario buffer do posxml
82
82
  ei_encode_binary(logical_number) # elemento binario numero do terminal
83
83
  ei_encode_binary(current_app) # elemento binario nome do aplicativo que esta sendo executado
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.7.0
4
+ version: 0.7.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: 2016-03-14 00:00:00.000000000 Z
11
+ date: 2016-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake