Class: Interlnk::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/interlnk/client.rb

Defined Under Namespace

Classes: Drive, NoSuchDriveException

Instance Method Summary collapse

Constructor Details

#initialize(transport:, channel:, connection_info: nil) ⇒ Client

Returns a new instance of Client.



46
47
48
49
50
# File 'lib/interlnk/client.rb', line 46

def initialize(transport:, channel:, connection_info: nil)
  @transport = transport.new(connection_info: connection_info)
  @channel = channel.new(transport: @transport)
  @protocol = Protocol.new(channel: @channel)
end

Instance Method Details

#drivesObject



52
53
54
55
56
57
58
59
60
# File 'lib/interlnk/client.rb', line 52

def drives
  drives = {}
  @protocol.init_info.drive_map.each do |drive_number|
    drive = Drive.new(protocol: @protocol, drive_number: drive_number)
    drives[drive.drive_letter] = drive
  end

  drives
end

#idleObject



62
63
64
65
66
# File 'lib/interlnk/client.rb', line 62

def idle
  # exchange one set of idle packets
  # this keeps our connection from timing out
  @protocol.idle
end