Class: Adept::LowLevel::Device

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/adept/low_level/device.rb

Overview

Structure used by the Adept SDK to represent an adept device.

Instance Method Summary collapse

Instance Method Details

#to_hObject

Convert the given device record into a ruby hash.



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/adept/low_level/device.rb', line 26

def to_h
  result = Hash[members.zip(values)]

  #Convert the internal character arrays to ruby strings.
  result[:name] = result[:name].to_s
  result[:path] = result[:path].to_s

  #And convert the device's transport to a string.
  result[:transport] = DeviceManager::get_transport_name(result[:transport])

  #return the resultant hash
  result
end