Sha256: f6d1a15ace07df407a22ad9793ce0937d504a1f9f3e2b38a9162c7c660d920ac

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

require 'rubyserial'
require 'prologix_gpib/version'
require 'prologix_gpib/lan'
require 'prologix_gpib/usb'
require 'prologix_gpib/cli'

module PrologixGpib
  class UsbController
    include PrologixGpib::Usb
    include PrologixGpib::Usb::Commands
  end

  class LanController
    include PrologixGpib::Lan
  end

  # Ideally this class needs to handle finding all avaliable Prologix GPIB controllers (USB and Ethernet),
  # But for now it simply passes the Prologix USB device paths onto the controller class
  # No windows serial support just yet.
  class << self
    def new
      self
    end

    # Find first avaliable Prologix controller and return a valid controller object
    def open; end

    def usb_paths
      usb_controller_paths
    end

    private

    def usb_controller_paths
      path_str, dir =
        if RubySerial::ON_LINUX
          %w[ttyUSB /dev/]
        elsif RubySerial::ON_WINDOWS
          ['TODO: Implement find device for Windows', 'You lazy bugger']
        else
          %w[tty.usbserial /dev/]
        end

      Dir.glob("#{dir}#{path_str}*")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
prologix_gpib-0.4.4 lib/prologix_gpib.rb
prologix_gpib-0.4.3 lib/prologix_gpib.rb