Class: CodinRep::SetTime
Constant Summary
collapse
- COMMAND_CODE =
"016A".freeze
'REP008A'.freeze
Constants inherited
from Command
Command::COMMAND_PREFIX
Instance Method Summary
collapse
Methods inherited from Command
#execute, #generate_header, #get_max_attempts, #get_timeout_time, #should_close_connection?
Constructor Details
#initialize(time, *args) ⇒ SetTime
Returns a new instance of SetTime.
28
29
30
31
|
# File 'lib/codin_rep/set_time.rb', line 28
def initialize(time, *args)
super(*args)
@time = time
end
|
Instance Method Details
41
42
43
44
45
|
# File 'lib/codin_rep/set_time.rb', line 41
def
unless @response.match(/^#{EXPECTED_HEADER}/)
raise .new @response[0..6], 'set time',
end
end
|
#generate_command_payload ⇒ Object
33
34
35
|
# File 'lib/codin_rep/set_time.rb', line 33
def generate_command_payload
CodinRep::TimeUtil.pack @time
end
|
#get_data_from_response_payload ⇒ Object
51
52
53
54
55
56
57
58
59
|
# File 'lib/codin_rep/set_time.rb', line 51
def get_data_from_response_payload
new_time = nil
begin
new_time = CodinRep::TimeUtil.unpack @response_payload
rescue ArgumentError
raise MalformedResponsePayload.new 'set time'
end
return new_time
end
|
#get_expected_response_size ⇒ Object
37
38
39
|
# File 'lib/codin_rep/set_time.rb', line 37
def get_expected_response_size
14
end
|
#get_response_payload ⇒ Object
47
48
49
|
# File 'lib/codin_rep/set_time.rb', line 47
def get_response_payload
@response_payload = @response[7..-1]
end
|