orion6_rep 0.2.6

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.
@@ -0,0 +1,118 @@
1
+ require 'orion6_rep'
2
+
3
+ module Orion6Rep
4
+ module Mockup
5
+ [:mock_detect_reps, :mock_time, :mock_employer, :mock_employees, :mock_ip,
6
+ :mock_serial_number, :mock_records, :mock_detection_data].each do |sym|
7
+ class_eval("@@#{sym} = nil unless defined? @@#{sym}; def self.#{sym}; @@#{sym}; end; def self.#{sym}=(obj); @@#{sym} = obj; end", __FILE__, __LINE__ + 1)
8
+ end
9
+
10
+ self.mock_employees = {}
11
+ self.mock_detection_data = {}
12
+
13
+ Orion6Rep::ClassMethods.module_eval do
14
+ def detect_reps
15
+ Orion6Rep::Mockup.mock_detection_data
16
+ end
17
+ end
18
+
19
+ Orion6Rep::InstanceMethods.module_eval do
20
+ def get_time
21
+ on_communication_success(__method__.to_sym) if respond_to?(:on_communication_success)
22
+ Orion6Rep::Mockup.mock_time
23
+ end
24
+
25
+ def set_time(time, start_dst = nil, end_dst = nil)
26
+ Orion6Rep::Mockup.mock_time = [time, start_dst, end_dst]
27
+ on_communication_success(__method__.to_sym) if respond_to?(:on_communication_success)
28
+ Orion6Rep::Mockup.mock_time
29
+ end
30
+
31
+ def get_employer
32
+ on_communication_success(__method__.to_sym) if respond_to?(:on_communication_success)
33
+ Orion6Rep::Mockup.mock_employer
34
+ end
35
+
36
+ def set_employer(employer_name, employer_location, document_type, document_number, cei_number)
37
+ Orion6Rep::Mockup.mock_employer = {:company_name => employer_name, :company_location => employer_location, :document_type => document_type, :document_number => document_number, :cei_number => cei_number}
38
+ on_communication_success(__method__.to_sym) if respond_to?(:on_communication_success)
39
+ Orion6Rep::Mockup.mock_employer
40
+ end
41
+
42
+ def get_employees_quantity
43
+ employees = Orion6Rep::Mockup.mock_employees
44
+ on_communication_success(__method__.to_sym) if respond_to?(:on_communication_success)
45
+ (employees.nil? || employees.empty?) ? 0 : employees.size
46
+ end
47
+
48
+ def get_employees(quantity = get_employees_quantity)
49
+ Orion6Rep::Mockup.mock_employees.keys.sort[0..quantity].collect do |registration|
50
+ employee = Orion6Rep::Mockup.mock_employees[registration]
51
+ on_communication_success(__method__.to_sym) if respond_to?(:on_communication_success)
52
+ {:registration => registration, :pis_number => employee[:pis_number], :name => employee[:name]}
53
+ end
54
+ end
55
+
56
+ def set_employee(operation_type, registration, pis_number, name)
57
+ case operation_type
58
+ when :add, :edit
59
+ data = Orion6Rep::Mockup.mock_employees[registration.to_i] = {:pis_number => pis_number, :name => name}
60
+ when :remove
61
+ data = Orion6Rep::Mockup.mock_employees.delete registration.to_i
62
+ else
63
+ raise "Unknown employee operation type received: #{operation_type.to_s}"
64
+ end
65
+ on_communication_success(__method__.to_sym) if respond_to?(:on_communication_success)
66
+ data
67
+ end
68
+
69
+ def change_ip(new_ip, interface = nil, rep_data = nil)
70
+ Orion6Rep::Mockup.mock_ip = new_ip
71
+ on_communication_success(__method__.to_sym) if respond_to?(:on_communication_success)
72
+ Orion6Rep::Mockup.mock_ip
73
+ end
74
+
75
+ def get_serial_number
76
+ on_communication_success(__method__.to_sym) if respond_to?(:on_communication_success)
77
+ Orion6Rep::Mockup.mock_serial_number
78
+ end
79
+
80
+ def get_record_id(datetime)
81
+ record = Orion6Rep::Mockup.mock_records.records.detect do |record|
82
+ record.respond_to?(:creation_time) && record.creation_time >= datetime
83
+ end
84
+ on_communication_success(__method__.to_sym) if respond_to?(:on_communication_success)
85
+ record ? record.line_id : nil
86
+ end
87
+
88
+ def get_records(first_id = nil)
89
+ (first_id = 1) if first_id.nil?
90
+ requested_id = first_id
91
+ parser = AfdParser.new(false)
92
+
93
+ Orion6Rep::Mockup.mock_records.records.each do |record|
94
+ next if(record.line_id < requested_id ||
95
+ record.class == AfdParser::Header ||
96
+ record.class == AfdParser::Trailer)
97
+ parser.parse_line(record.export, record.line_id)
98
+ end
99
+
100
+ afd_start_date = parser.first_creation_date
101
+ afd_end_date = parser.last_creation_date
102
+ employer = get_employer
103
+ serial_number = get_serial_number
104
+ parser.create_header(employer[:document_type], employer[:document_number],
105
+ employer[:cei_document], employer[:company_name],
106
+ serial_number, afd_start_date, afd_end_date, Time.now)
107
+ parser.create_trailer
108
+ return parser
109
+ end
110
+
111
+ def set_records(parser)
112
+ Orion6Rep::Mockup.mock_records = parser
113
+ on_communication_success(__method__.to_sym) if respond_to?(:on_communication_success)
114
+ Orion6Rep::Mockup.mock_records
115
+ end
116
+ end
117
+ end
118
+ end
@@ -0,0 +1,113 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Controle de Horas - Sistema para gestão de horas trabalhadas
3
+ # Copyright (C) 2009 O.S. Systems Softwares Ltda.
4
+
5
+ # This program is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU Affero General Public License as
7
+ # published by the Free Software Foundation, either version 3 of the
8
+ # License, or (at your option) any later version.
9
+
10
+ # This program is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU Affero General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU Affero General Public License
16
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ # Rua Clóvis Gularte Candiota 132, Pelotas-RS, Brasil.
19
+ # e-mail: contato@ossystems.com.br
20
+
21
+ module Orion6Rep
22
+ class MultiMessageCommand < Command
23
+ def execute
24
+ # calculate how many messages will be needed:
25
+ messages_quantity = get_field_quantity / get_field_size
26
+ message_remainder = get_field_quantity % get_field_size
27
+
28
+ payload = ""
29
+
30
+ @messages_sent = 0
31
+ messages_quantity.times do
32
+ command_data = generate_partial_message_header
33
+ payload += get_and_process_message(command_data)
34
+
35
+ # For some very obscure reason, on each received message the next
36
+ # command must increased by the size of the received payload.
37
+ # Go figure...
38
+ @command += payload.size
39
+ @messages_sent += 1
40
+ end
41
+
42
+ if message_remainder > 0
43
+ command_data = generate_remainder_header(message_remainder)
44
+ payload += get_and_process_message(command_data)
45
+ end
46
+
47
+ return get_data_from_response(payload)
48
+ end
49
+
50
+ private
51
+ MULTI_MESSAGE_COMMAND = 151
52
+
53
+ def get_equipment_number
54
+ @equipment_number
55
+ end
56
+
57
+ def get_host_address
58
+ @host_address
59
+ end
60
+
61
+ def get_tcp_port
62
+ @tcp_port
63
+ end
64
+
65
+ def get_tcp_port
66
+ @tcp_port
67
+ end
68
+
69
+ def generate_partial_message_header
70
+ header = [get_equipment_number^255] # TODO: find why this is needed
71
+ header << MULTI_MESSAGE_COMMAND
72
+ header << 0 # TODO: find why this is needed
73
+ header << 1 # TODO: find why this is needed
74
+ header << get_field_size
75
+ header << (get_command & 255) # first byte of command
76
+ header << divide_by_256(get_command) # second byte of command
77
+ header << crc_check(header)
78
+ header
79
+ end
80
+
81
+ def generate_remainder_header(message_remainder)
82
+ header = [get_equipment_number^255] # TODO: find why this is needed
83
+ header << MULTI_MESSAGE_COMMAND
84
+ header << 0 # TODO: find why this is needed
85
+ header << message_remainder
86
+ header << 1 # TODO: find why this is needed
87
+ header << (get_command & 255)
88
+ header << divide_by_256(get_command)
89
+ header << crc_check(header)
90
+ header
91
+ end
92
+
93
+ def generate_command_data
94
+ []
95
+ end
96
+
97
+ def first_message_sent?
98
+ @messages_sent && @messages_sent > 0
99
+ end
100
+
101
+ def get_and_process_message(command_data)
102
+ # now send it!
103
+ response = Communication.communicate(get_host_address, get_tcp_port, command_data, get_expected_response_size, get_timeout_time, get_max_attempts)
104
+
105
+ # check everything:
106
+ check_response_header(response)
107
+ check_response_payload(response)
108
+
109
+ # and then get and process the response payload:
110
+ get_response_payload(response)
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,79 @@
1
+ # Controle de Horas - Sistema para gestão de horas trabalhadas
2
+ # Copyright (C) 2009 O.S. Systems Softwares Ltda.
3
+
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU Affero General Public License as
6
+ # published by the Free Software Foundation, either version 3 of the
7
+ # License, or (at your option) any later version.
8
+
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU Affero General Public License for more details.
13
+
14
+ # You should have received a copy of the GNU Affero General Public License
15
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ # Rua Clóvis Gularte Candiota 132, Pelotas-RS, Brasil.
18
+ # e-mail: contato@ossystems.com.br
19
+
20
+ require "orion6_rep/command"
21
+
22
+ module Orion6Rep
23
+ class RecordIdGet < Command
24
+ def initialize(record_start_date_time, equipment_number, host_address, tcp_port = 3000)
25
+ @record_start_date_time = record_start_date_time
26
+ @equipment_number = equipment_number
27
+ @host_address = host_address
28
+ @tcp_port = tcp_port
29
+ @reponse_size = 16
30
+ end
31
+
32
+ private
33
+ GET_RECORD_ID_COMMAND = 0x86
34
+ UNKNOWN_CONSTANT = 0x72
35
+ RECORD_FIELD_SIZE = 0x01
36
+ RECORD_ID_FIELD_QUANTITY = 0x12
37
+
38
+ def get_command
39
+ GET_RECORD_ID_COMMAND
40
+ end
41
+
42
+ def get_unknown_constant
43
+ UNKNOWN_CONSTANT
44
+ end
45
+
46
+ def get_field_size
47
+ RECORD_FIELD_SIZE
48
+ end
49
+
50
+ def get_field_quantity
51
+ RECORD_ID_FIELD_QUANTITY
52
+ end
53
+
54
+ def generate_command_data
55
+ # TODO: find out what is the meaning of the data in the array below:
56
+ data = [0x02, 0x00, 0x0d, 0x93]
57
+
58
+ data += get_record_start_date_time
59
+ # unknown
60
+ data += [0x00, 0x03]
61
+ data << crc_check(data)
62
+ end
63
+
64
+ def get_record_start_date_time
65
+ @record_start_date_time.strftime("%d%m%Y%H%M").unpack("C*")
66
+ end
67
+
68
+ def get_data_from_response(payload)
69
+ # first byte is unknown, and the next two bytes are the size of the data,
70
+ # in big-endian:
71
+ data_size_raw = payload.unpack("xCC")
72
+ data_size = convert_to_integer_as_big_endian(data_size_raw)
73
+
74
+ # minus the crc check position:
75
+ data_size = data_size - crc_size
76
+ payload.unpack("x4A#{data_size}")[0].to_i
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,89 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Controle de Horas - Sistema para gestão de horas trabalhadas
3
+ # Copyright (C) 2009 O.S. Systems Softwares Ltda.
4
+
5
+ # This program is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU Affero General Public License as
7
+ # published by the Free Software Foundation, either version 3 of the
8
+ # License, or (at your option) any later version.
9
+
10
+ # This program is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU Affero General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU Affero General Public License
16
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ # Rua Clóvis Gularte Candiota 132, Pelotas-RS, Brasil.
19
+ # e-mail: contato@ossystems.com.br
20
+
21
+ require "orion6_rep/command"
22
+
23
+ module Orion6Rep
24
+ class RecordsGet < Command
25
+ def initialize(record_id, equipment_number, host_address, tcp_port = 3000)
26
+ @record_id = record_id
27
+ @equipment_number = equipment_number
28
+ @host_address = host_address
29
+ @tcp_port = tcp_port
30
+ end
31
+
32
+ private
33
+ GET_RECORDS_COMMAND = 0x86
34
+ UNKNOWN_CONSTANT = 0x72
35
+ RECORDS_FIELD_SIZE = 0x01
36
+ RECORDS_FIELD_QUANTITY = 0x0F
37
+ DATA_SIZE_LAST_POSITION = 11
38
+
39
+ def get_command
40
+ GET_RECORDS_COMMAND
41
+ end
42
+
43
+ def get_unknown_constant
44
+ UNKNOWN_CONSTANT
45
+ end
46
+
47
+ def get_field_size
48
+ RECORDS_FIELD_SIZE
49
+ end
50
+
51
+ def get_field_quantity
52
+ RECORDS_FIELD_QUANTITY
53
+ end
54
+
55
+ def get_expected_response_size
56
+ proc do |partial_data|
57
+ if partial_data.size >= DATA_SIZE_LAST_POSITION
58
+ data_size_array = partial_data[9..10]
59
+ detected_size = (data_size_array[0].ord*256 + data_size_array[1].ord) + 14
60
+ detected_size
61
+ else
62
+ DATA_SIZE_LAST_POSITION
63
+ end
64
+ end
65
+ end
66
+
67
+ def generate_command_data
68
+ internal_data = get_record_id
69
+ internal_data << crc_check(internal_data)
70
+ internal_data_size = internal_data.size
71
+
72
+ data = [0x02] # TODO: find out what this byte does
73
+ data << divide_by_256(internal_data_size)
74
+ data << (internal_data_size & 255)
75
+ data << 0x99 # TODO: find out what this byte does
76
+ data += internal_data
77
+ data << 0x03 # TODO: find out what this byte does
78
+ data << crc_check(data)
79
+ end
80
+
81
+ def get_record_id
82
+ @record_id.to_s.rjust(9, "0").unpack("C*")
83
+ end
84
+
85
+ def get_data_from_response(payload)
86
+ payload[6..-3]
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,3 @@
1
+ module Orion6Rep
2
+ VERSION = "0.2.6"
3
+ end
data/lib/orion6_rep.rb ADDED
@@ -0,0 +1,199 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Controle de Horas - Sistema para gestão de horas trabalhadas
3
+ # Copyright (C) 2009 O.S. Systems Softwares Ltda.
4
+
5
+ # This program is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU Affero General Public License as
7
+ # published by the Free Software Foundation, either version 3 of the
8
+ # License, or (at your option) any later version.
9
+
10
+ # This program is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU Affero General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU Affero General Public License
16
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ # Rua Clóvis Gularte Candiota 132, Pelotas-RS, Brasil.
19
+ # e-mail: contato@ossystems.com.br
20
+
21
+ require "orion6_rep/clock_time/get"
22
+ require "orion6_rep/clock_time/set"
23
+ require "orion6_rep/employer_get"
24
+ require "orion6_rep/employer_set"
25
+ require "orion6_rep/employee_get"
26
+ require "orion6_rep/employee_quantity_get"
27
+ require "orion6_rep/employee_set"
28
+ require "orion6_rep/get_serial_number"
29
+ require "orion6_rep/record_id_get"
30
+ require "orion6_rep/records_get"
31
+ require "orion6_rep/detect_reps"
32
+ require "orion6_rep/change_ip"
33
+ require "afd_parser"
34
+
35
+ module Orion6Rep
36
+ class << self
37
+ def included(base)
38
+ return if base.included_modules.include?(InstanceMethods)
39
+ base.extend(ClassMethods)
40
+ base.send(:include, InstanceMethods)
41
+ end
42
+ end
43
+
44
+ module ClassMethods
45
+ def detect_reps
46
+ command = Orion6Rep::DetectReps.new
47
+ command.execute
48
+ runtime = Time.now
49
+ previous_response = nil
50
+ response = {}
51
+ while runtime + 5 > Time.now do
52
+ response = command.pool
53
+ sleep(0.2) if previous_response == response
54
+ previous_response = response
55
+ end
56
+ return response
57
+ end
58
+ end
59
+
60
+ module InstanceMethods
61
+ def get_time
62
+ command = Orion6Rep::ClockTime::Get.new(self.number, self.ip, self.tcp_port)
63
+ response = command.execute
64
+ on_communication_success(__method__.to_sym) if respond_to?(:on_communication_success)
65
+ return response
66
+ end
67
+
68
+ def set_time(time, start_dst = nil, end_dst = nil)
69
+ command = Orion6Rep::ClockTime::Set.new(time, start_dst, end_dst, self.number, self.ip, self.tcp_port)
70
+ response = command.execute
71
+ on_communication_success(__method__.to_sym) if respond_to?(:on_communication_success)
72
+ return response
73
+ end
74
+
75
+ def get_employer
76
+ command = Orion6Rep::EmployerGet.new(self.number, self.ip, self.tcp_port)
77
+ response = command.execute
78
+ on_communication_success(__method__.to_sym) if respond_to?(:on_communication_success)
79
+ return response
80
+ end
81
+
82
+ def set_employer(employer_name, employer_location, document_type, document_number, cei_number)
83
+ command = Orion6Rep::EmployerSet.new(employer_name, employer_location, document_type, document_number, cei_number, self.number, self.ip, self.tcp_port)
84
+ response = command.execute
85
+ on_communication_success(__method__.to_sym) if respond_to?(:on_communication_success)
86
+ return response
87
+ end
88
+
89
+ def get_employees_quantity
90
+ command = Orion6Rep::EmployeeQuantityGet.new(self.number, self.ip, self.tcp_port)
91
+ response = command.execute
92
+ on_communication_success(__method__.to_sym) if respond_to?(:on_communication_success)
93
+ return response
94
+ end
95
+
96
+ def get_employees(quantity = nil)
97
+ employees_quantity = quantity.nil? ? get_employees_quantity : quantity
98
+ employees = []
99
+ call_id = 1
100
+ while employees_quantity > 0
101
+ # 11 is the max number of employees retrieved in one call
102
+ call_quantity = employees_quantity > 11 ? 11 : employees_quantity
103
+ command = Orion6Rep::EmployeeGet.new(call_id, call_quantity, self.number, self.ip, self.tcp_port)
104
+ employees += command.execute
105
+ employees_quantity -= call_quantity
106
+ call_id += call_quantity
107
+ end
108
+ on_communication_success(__method__.to_sym) if respond_to?(:on_communication_success)
109
+ return employees
110
+ end
111
+
112
+ def set_employee(operation_type, registration, pis_number, name)
113
+ command = Orion6Rep::EmployeeSet.new(operation_type, registration, pis_number, name, self.number, self.ip, self.tcp_port)
114
+ response = command.execute
115
+ on_communication_success(__method__.to_sym) if respond_to?(:on_communication_success)
116
+ return response
117
+ end
118
+
119
+ def change_ip(new_ip, interface = nil, rep_data = nil)
120
+ if interface.nil? or rep_data.nil?
121
+ data = get_data_from_detection(self.ip)
122
+ interface = data.first if interface.nil?
123
+ rep_data = data.last if rep_data.nil?
124
+ end
125
+ if interface.nil? || rep_data.nil?
126
+ raise "The specified IP address is not an Orion6 REP"
127
+ end
128
+ command = Orion6Rep::ChangeIp.new(interface, new_ip, rep_data)
129
+ response = command.execute
130
+ if response
131
+ on_communication_success(__method__.to_sym) if respond_to?(:on_communication_success)
132
+ return new_ip
133
+ end
134
+ end
135
+
136
+ def get_serial_number
137
+ command = Orion6Rep::GetSerialNumber.new(self.number, self.ip, self.tcp_port)
138
+ response = command.execute
139
+ on_communication_success(__method__.to_sym) if respond_to?(:on_communication_success)
140
+ return response
141
+ end
142
+
143
+ def get_record_id(datetime)
144
+ command = Orion6Rep::RecordIdGet.new(datetime, self.number, self.ip, self.tcp_port)
145
+ response = command.execute
146
+ on_communication_success(__method__.to_sym) if respond_to?(:on_communication_success)
147
+ return response
148
+ end
149
+
150
+ def get_records(first_id = nil)
151
+ if first_id.nil?
152
+ first_id = 1 # get all the records
153
+ end
154
+
155
+ id = first_id
156
+ parser = AfdParser.new(false)
157
+ records = []
158
+ while !id.nil?
159
+ command = Orion6Rep::RecordsGet.new(id, self.number, self.ip, self.tcp_port)
160
+ data = command.execute
161
+ record = nil
162
+ while data.size > 0
163
+ record = parser.parse_line(data, id)
164
+ size = record.class.size
165
+ data.slice!(0..(size-1))
166
+ records << record
167
+ id += 1
168
+ end
169
+
170
+ id = record.nil? ? nil : (record.line_id + 1)
171
+ end
172
+
173
+ afd_start_date = parser.first_creation_date
174
+ afd_end_date = parser.last_creation_date
175
+ employer = get_employer
176
+ serial_number = get_serial_number
177
+ parser.create_header(employer[:document_type], employer[:document_number],
178
+ employer[:cei_document], employer[:company_name],
179
+ serial_number, afd_start_date, afd_end_date, Time.now)
180
+ parser.create_trailer
181
+ return parser
182
+ end
183
+
184
+ private
185
+ def get_data_from_detection(ip)
186
+ response_data = self.class.detect_reps
187
+ response_data.each do |collected_interface, interface_data|
188
+ interface_data.each do |collected_ip, data|
189
+ if collected_ip == self.ip
190
+ interface = collected_interface
191
+ rep_data = data[:rep_data]
192
+ return [interface, rep_data]
193
+ end
194
+ end
195
+ end
196
+ return []
197
+ end
198
+ end
199
+ end
data/test/afd_file ADDED
@@ -0,0 +1,11 @@
1
+ 0000000001100000000067890000000009876RAZAO_SOCIAL 000040000700044032001201122022011210220111048
2
+ 0000000014280120111112280120111113
3
+ 0000000022270120111756108682040000172000000000000O.S. SYSTEMS SOFTWARES LTDA. PELOTAS - RS
4
+ 0000000035270120111759I111111111111TESTE 1 2 3
5
+ 0000000045080220111709I222222222222TESTE 2
6
+ 0000000055110220111719A222222222222TESTE 2
7
+ 0000000065110220111723E222222222222TESTE 2
8
+ 0000000073190220111814111111111111
9
+ 0000000083210220111133111111111111
10
+ 0000000093210220111134111111111111
11
+ 9999999990000000010000000030000000010000000049
@@ -0,0 +1,28 @@
1
+ # Controle de Horas - Sistema para gestão de horas trabalhadas
2
+ # Copyright (C) 2009 O.S. Systems Softwares Ltda.
3
+
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU Affero General Public License as
6
+ # published by the Free Software Foundation, either version 3 of the
7
+ # License, or (at your option) any later version.
8
+
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU Affero General Public License for more details.
13
+
14
+ # You should have received a copy of the GNU Affero General Public License
15
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ # Rua Clóvis Gularte Candiota 132, Pelotas-RS, Brasil.
18
+ # e-mail: contato@ossystems.com.br
19
+
20
+ require File.dirname(__FILE__) + '/../test_helper'
21
+
22
+ class DetectRepsTest < Test::Unit::TestCase
23
+ def test_detect_rep
24
+ puts "Detecting REPs in the network..."
25
+ detected_reps = TimeClock.detect_reps
26
+ puts "Received: " + detected_reps.inspect
27
+ end
28
+ end