Class: Reply
Direct Known Subclasses
Constant Summary collapse
- COMMAND_TYPE =
0x02
- SUCCESS =
0x00
- STATUS_MESSAGES =
{ SUCCESS => 'Success', # base error messages 0x81 => 'No more handles', 0x82 => 'No space', 0x83 => 'No more files', 0x84 => 'End of file expected', 0x85 => 'End of file', 0x86 => 'Not a linear file', 0x87 => 'File not found', 0x88 => 'Handle all ready closed', 0x89 => 'No linear space', 0x8A => 'Undefined error', 0x8B => 'File is busy', 0x8C => 'No write buffers', 0x8D => 'Append not possible', 0x8E => 'File is full', 0x8F => 'File exists', 0x90 => 'Module not found', 0x91 => 'Out of boundary', 0x92 => 'Illegal file name', 0x93 => 'Illegal handle', # command replies 0x20 => 'Pending communication transaction in progress', 0x40 => 'Specified mailbox queue is empty', 0xBD => 'Request failed (i.e., specified file not found)', 0xBE => 'Unknown command opcode', 0xBF => 'Insane packet', 0xC0 => 'Data contains out-of-range values', 0xDD => 'Communication bus error', 0xDE => 'No free memory in communication buffer', 0xDF => 'Specified channel/connection is not valid', 0xE0 => 'Specified channel/connection not configured or busy', 0xEC => 'No active program', 0xED => 'Illegal size specified', 0xEE => 'Illegal mailbox queue ID specified', 0xEF => 'Attempted to access invalid field of a structure', 0xF0 => 'Bad input or output specified', 0xFB => 'Insufficient memory available', 0xFF => 'Bad arguments' }
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
-
#message_bytes ⇒ Object
Returns the value of attribute message_bytes.
-
#status ⇒ Object
Returns the value of attribute status.
-
#status_description ⇒ Object
Returns the value of attribute status_description.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(bytes = nil) ⇒ Reply
constructor
A new instance of Reply.
- #message ⇒ Object
- #success? ⇒ Boolean
Methods inherited from Telegram
Constructor Details
#initialize(bytes = nil) ⇒ Reply
Returns a new instance of Reply.
51 52 53 54 55 56 57 58 |
# File 'lib/telegrams/reply.rb', line 51 def initialize(bytes=nil) validate_bytes(bytes) @type = bytes[0] @command = bytes[1] @status = bytes[2] @message_bytes = bytes[3..-1] set_status_description end |
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
49 50 51 |
# File 'lib/telegrams/reply.rb', line 49 def command @command end |
#message_bytes ⇒ Object
Returns the value of attribute message_bytes.
49 50 51 |
# File 'lib/telegrams/reply.rb', line 49 def @message_bytes end |
#status ⇒ Object
Returns the value of attribute status.
49 50 51 |
# File 'lib/telegrams/reply.rb', line 49 def status @status end |
#status_description ⇒ Object
Returns the value of attribute status_description.
49 50 51 |
# File 'lib/telegrams/reply.rb', line 49 def status_description @status_description end |
#type ⇒ Object
Returns the value of attribute type.
49 50 51 |
# File 'lib/telegrams/reply.rb', line 49 def type @type end |
Instance Method Details
#message ⇒ Object
66 67 68 69 |
# File 'lib/telegrams/reply.rb', line 66 def # override in subclasses to translate bytes to something meaningful end |
#success? ⇒ Boolean
61 62 63 |
# File 'lib/telegrams/reply.rb', line 61 def success? status == SUCCESS end |