Sha256: 130f7a240f09766bdf1c481d87abb18288a136a67d7b7790606637ddfa2955da
Contents?: true
Size: 1023 Bytes
Versions: 1
Compression:
Stored size: 1023 Bytes
Contents
# frozen_string_literal: true module Lxi # Search for LXI-11 instruments on the network and return hash of instruments def self.discover_instruments(timeout: 1000, type: :vxi11) raise Error, 'LXI Library Initialisation Error' unless lxi_init == LXI_OK devices = [] device_callback = FFI::Function.new(:void, %i[pointer pointer]) do |address, id| devices << { address: address.read_string, id: id.read_string } end info = FFIFunctions::LxiInfo.new info[:device] = device_callback lxi_discover_internal(info, timeout, type) sleep 0.1 devices end # Discover LXI-11 devices on the LAN def self.search(timeout: 1000, type: :vxi11) Lxi.init_lxi_session info = FFIFunctions::LxiInfo.new info[:broadcast] = BroadcastCallback info[:device] = DeviceCallback puts "Searching for LXI devices - please wait...\n\n" result = lxi_discover_internal(info, timeout, type) puts "Error during discovery: #{result}" if result.negative? end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lxi_rb-0.4.9 | lib/lxi/discovery.rb |