22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/empp/empp_parser.rb', line 22
def self.()
sio = StringIO.new()
total_length = ''
sio.read(4, total_length)
total_length = BinData::Uint32be.read(total_length)
command_id = ''
sio.read(4, command_id)
command_id = BinData::Uint32be.read(command_id)
sequence_id = ''
sio.read(4, sequence_id)
sequence_id = BinData::Uint32be.read(sequence_id)
object = nil
case command_id
when Constants::EMPP_CONNECT_RESP
object = MsgConnectResp.new
when Constants::EMPP_ACTIVE_TEST_RESP
object = MsgActiveTestResp.new
when Constants::EMPP_SUBMIT_RESP
object = MsgSubmitResp.new
when Constants::EMPP_DELIVER
object = MsgDelivery.new
else
object = EmppBase.new
object.command_id = -1
end
object.total_length = total_length
object.sequence_id = sequence_id
object
end
|