class Net::TTI::Capabilities

Public Class Methods

from_binary_string(string) click to toggle source
# File lib/net/tti/capabilities.rb, line 13
def self.from_binary_string(string)
  Capabilities.new( string.unpack("C*") )
end
from_byte_array(bytes) click to toggle source
# File lib/net/tti/capabilities.rb, line 9
def self.from_byte_array(bytes)
  Capabilities.new(bytes)
end
new(caps_bytes=[]) click to toggle source
# File lib/net/tti/capabilities.rb, line 5
def initialize(caps_bytes=[])
  @caps_bytes = caps_bytes
end

Public Instance Methods

[](index) click to toggle source
# File lib/net/tti/capabilities.rb, line 17
def [](index)
  @caps_bytes[index]
end
[]=(index, value) click to toggle source
# File lib/net/tti/capabilities.rb, line 21
def []=(index, value)
  @caps_bytes[index] = value
end
length() click to toggle source
# File lib/net/tti/capabilities.rb, line 25
def length
  @caps_bytes.length
end
to_binary_s() click to toggle source
# File lib/net/tti/capabilities.rb, line 29
def to_binary_s
  @caps_bytes.pack("C*")
end
to_hexified_s() click to toggle source

Returns hexified bytes, delimited by spaces e.g. [0x01,0x41,0x81,0xa1] -> “01 41 81 a1”

# File lib/net/tti/capabilities.rb, line 35
def to_hexified_s
  to_binary_s.scan(/../).join(" ")
end