lxi_rb 0.2.6 → 0.2.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.cz.toml +7 -0
- data/.vscode/settings.json +0 -0
- data/CHANGELOG.md +46 -16
- data/Gemfile.lock +1 -1
- data/Rakefile +1 -0
- data/cog.toml +26 -0
- data/lib/lxi/constants.rb +21 -0
- data/lib/lxi/device.rb +2 -0
- data/lib/lxi/discovery.rb +38 -0
- data/lib/lxi/functions.rb +34 -0
- data/lib/lxi/methods.rb +10 -0
- data/lib/lxi/version.rb +1 -1
- data/lib/lxi_rb.rb +6 -2
- metadata +9 -3
- data/lib/lxi/ffi.rb +0 -91
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a2d5028a0fea52868aca234aa718d1224af6eb885cec75f25326047deecf2ce
|
4
|
+
data.tar.gz: a4c56ba50ae93eee1e93084015dfe3b5cee85b8a72c0b983e53535ae6d671f4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 163b3f6f7721b8bf2a0123a81b0a945c5b219606d414aa036df1be75037a5f4e9fb39b2c609df77c5755ca5b9babbc332aa3565de37b1509c2696fc348f6b2ba
|
7
|
+
data.tar.gz: fa3dd7e0b992cf1c84a88c45af370a81f69ede9ae193e315769b0dd0094b38364d00583354b0a8f0ae8a5e079bc07a048085e24cddb646fb3ed1bddd570cdcc7
|
data/.cz.toml
ADDED
File without changes
|
data/CHANGELOG.md
CHANGED
@@ -1,17 +1,47 @@
|
|
1
|
-
## Unreleased (
|
1
|
+
## Unreleased ([addbdb8..76314bf](https://github.com/robcarruthers/lxi_rb/compare/addbdb8..76314bf))
|
2
|
+
#### Features
|
3
|
+
- **(Test)** Some great Feature - ([76314bf](https://github.com/robcarruthers/lxi_rb/commit/76314bf4ccd40d9df8efe11bb1fc6046299b0284)) - [@robcarruthers](https://github.com/robcarruthers)
|
4
|
+
|
5
|
+
- - -
|
6
|
+
## [v0.2.18](https://github.com/robcarruthers/lxi_rb/compare/v0.2.16..v0.2.18) - 2023-05-08
|
7
|
+
#### Features
|
8
|
+
- **(Test)** Some great Feature - ([76314bf](https://github.com/robcarruthers/lxi_rb/commit/76314bf4ccd40d9df8efe11bb1fc6046299b0284)) - [@robcarruthers](https://github.com/robcarruthers)
|
9
|
+
#### Miscellaneous Chores
|
10
|
+
- **(Changelog)** Update - ([8f7371b](https://github.com/robcarruthers/lxi_rb/commit/8f7371b5f2e0130476f5e173d5beb8aa32be7a6f)) - [@robcarruthers](https://github.com/robcarruthers)
|
11
|
+
|
12
|
+
- - -
|
13
|
+
|
14
|
+
|
15
|
+
## [v0.2.16](https://github.com/robcarruthers/lxi_rb/compare/1c313adf0923f740888c4a54550b855f3ed3c51a..v0.2.16) - 2023-05-08
|
16
|
+
#### Bug Fixes
|
17
|
+
- **(Testing)** Changed some file - ([a3f7a3a](https://github.com/robcarruthers/lxi_rb/commit/a3f7a3a01b385e6d8ebeb0d027beef7a79007f64)) - [@robcarruthers](https://github.com/robcarruthers)
|
18
|
+
#### Documentation
|
19
|
+
- **(Changelog)** Update - ([0351586](https://github.com/robcarruthers/lxi_rb/commit/03515867cc91da4d3939fc26723729845c1336e1)) - [@robcarruthers](https://github.com/robcarruthers)
|
20
|
+
- **(Changelog)** Update - ([4beb9d8](https://github.com/robcarruthers/lxi_rb/commit/4beb9d8dd1e95af30dc948fe81d79e7aa6262a7c)) - [@robcarruthers](https://github.com/robcarruthers)
|
21
|
+
- **(Changelog)** reset - ([13053e1](https://github.com/robcarruthers/lxi_rb/commit/13053e1abb88564a5deb87c2755199402c96714b)) - [@robcarruthers](https://github.com/robcarruthers)
|
22
|
+
- **(Changelog)** Update cog config - ([857a9e8](https://github.com/robcarruthers/lxi_rb/commit/857a9e8b7d5580fee7a5b15f4f46dad96bda3378)) - [@robcarruthers](https://github.com/robcarruthers)
|
23
|
+
- **(Changelog)** Update - ([9159d41](https://github.com/robcarruthers/lxi_rb/commit/9159d417ba38bee06d6676b563a1725f52569b5c)) - [@robcarruthers](https://github.com/robcarruthers)
|
24
|
+
- **(Changelog)** Update cog config - ([a38d66c](https://github.com/robcarruthers/lxi_rb/commit/a38d66c0af084d4389a1e37acda47348acf489bb)) - [@robcarruthers](https://github.com/robcarruthers)
|
25
|
+
- **(Changelog)** Update - ([0e53608](https://github.com/robcarruthers/lxi_rb/commit/0e536086b2f832d1e7e3a1660a017ba59d08b50f)) - [@robcarruthers](https://github.com/robcarruthers)
|
26
|
+
- **(Changelog)** Add cog config - ([df15cb2](https://github.com/robcarruthers/lxi_rb/commit/df15cb2ed5de101820bd827b8b68ea311eaf45d6)) - [@robcarruthers](https://github.com/robcarruthers)
|
27
|
+
- **(Changelog)** Update - ([5962f8d](https://github.com/robcarruthers/lxi_rb/commit/5962f8d7ffdb6378b7686005922793bde9011f92)) - [@robcarruthers](https://github.com/robcarruthers)
|
28
|
+
- **(Cog)** Update post bump hook - ([7c0d3d5](https://github.com/robcarruthers/lxi_rb/commit/7c0d3d58e8e18330f2172a1343ba9312c5da70ec)) - [@robcarruthers](https://github.com/robcarruthers)
|
29
|
+
- **(changelog)** Updated - ([556e501](https://github.com/robcarruthers/lxi_rb/commit/556e5011482c76dd3c0d1b8f9c57442e0e729296)) - [@robcarruthers](https://github.com/robcarruthers)
|
30
|
+
- update README - ([d107e6d](https://github.com/robcarruthers/lxi_rb/commit/d107e6d33df272debc3a1944a794d85f3c01826b)) - [@robcarruthers](https://github.com/robcarruthers)
|
31
|
+
#### Features
|
32
|
+
- **(NewFeature)** Add wonderful new feature - ([bf73cd1](https://github.com/robcarruthers/lxi_rb/commit/bf73cd148067492db8445376f9acafdd1b7e1680)) - [@robcarruthers](https://github.com/robcarruthers)
|
33
|
+
- **(device)** Init LXI Session - ([4880f26](https://github.com/robcarruthers/lxi_rb/commit/4880f2602b0a63713186a407ac4b3d2bd2dd4b10)) - [@robcarruthers](https://github.com/robcarruthers)
|
34
|
+
- **(ffi)** Add search class method - ([8f7351f](https://github.com/robcarruthers/lxi_rb/commit/8f7351f9b541614a717a83d291d169b1fd8db356)) - [@robcarruthers](https://github.com/robcarruthers)
|
35
|
+
#### Miscellaneous Chores
|
36
|
+
- **(version)** v0.2.9 - ([155886b](https://github.com/robcarruthers/lxi_rb/commit/155886bd9fc05400293b80732ac16b6f39cd65ee)) - [@robcarruthers](https://github.com/robcarruthers)
|
37
|
+
- **(version)** v0.2.8 - ([2d77322](https://github.com/robcarruthers/lxi_rb/commit/2d77322d6a137ba710b393cfcf718981bcca0f1e)) - [@robcarruthers](https://github.com/robcarruthers)
|
38
|
+
- **(version)** v0.2.7 - ([8b4b6c5](https://github.com/robcarruthers/lxi_rb/commit/8b4b6c59984f53921b17b6446550413d90b22b90)) - [@robcarruthers](https://github.com/robcarruthers)
|
39
|
+
- add github CI yml - ([145a3de](https://github.com/robcarruthers/lxi_rb/commit/145a3defba492d3985ea9ac4d4fba2a07259735e)) - [@robcarruthers](https://github.com/robcarruthers)
|
40
|
+
#### Refactoring
|
41
|
+
- **(Rubocop)** fix offences - ([c3e4d23](https://github.com/robcarruthers/lxi_rb/commit/c3e4d232b76466ca71af7418ed7863b6de99af8e)) - [@robcarruthers](https://github.com/robcarruthers)
|
42
|
+
- **(ffi)** Remove comment - ([5fab4bf](https://github.com/robcarruthers/lxi_rb/commit/5fab4bf68e0f4dc6deb0ae690e3fdbe84d5c0a0c)) - [@robcarruthers](https://github.com/robcarruthers)
|
43
|
+
#### Style
|
44
|
+
- **(Testing)** Some edits - ([7773b5e](https://github.com/robcarruthers/lxi_rb/commit/7773b5e256600e40146a67d7454c1e6aa7651755)) - [@robcarruthers](https://github.com/robcarruthers)
|
45
|
+
#### Tests
|
46
|
+
- make default tests pass - ([2a90b70](https://github.com/robcarruthers/lxi_rb/commit/2a90b70676c75ba90d94e1fc4d098f09b897978d)) - [@robcarruthers](https://github.com/robcarruthers)
|
2
47
|
|
3
|
-
### New feature:
|
4
|
-
|
5
|
-
- **device**: Init LXI Session([`4880f26`](https://github.com/robcarruthers/lxi_rb/commit/4880f2602b0a63713186a407ac4b3d2bd2dd4b10)) (by Rob Carruthers)
|
6
|
-
|
7
|
-
## v0.2.3 (2023-05-07)
|
8
|
-
|
9
|
-
## v0.2.1 (2023-05-07)
|
10
|
-
|
11
|
-
### New feature:
|
12
|
-
|
13
|
-
- **ffi**: Add search class method([`8f7351f`](https://github.com/robcarruthers/lxi_rb/commit/8f7351f9b541614a717a83d291d169b1fd8db356)) (by Rob Carruthers)
|
14
|
-
|
15
|
-
## v0.2.0 (2023-05-07)
|
16
|
-
|
17
|
-
## v0.1.0 (2023-05-07)
|
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
data/cog.toml
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
from_latest_tag = true
|
2
|
+
ignore_merge_commits = false
|
3
|
+
branch_whitelist = []
|
4
|
+
pre_bump_hooks = []
|
5
|
+
post_bump_hooks = [
|
6
|
+
"rake release"
|
7
|
+
]
|
8
|
+
pre_package_bump_hooks = []
|
9
|
+
post_package_bump_hooks = []
|
10
|
+
tag_prefix = "v"
|
11
|
+
|
12
|
+
[commit_types]
|
13
|
+
|
14
|
+
[changelog]
|
15
|
+
path = "CHANGELOG.md"
|
16
|
+
template = "remote"
|
17
|
+
remote = "github.com"
|
18
|
+
repository = "lxi_rb"
|
19
|
+
owner = "robcarruthers"
|
20
|
+
authors = [
|
21
|
+
{ signature = "Rob Carruthers", username = "robcarruthers" }
|
22
|
+
]
|
23
|
+
|
24
|
+
[bump_profiles]
|
25
|
+
|
26
|
+
[packages]
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Lxi
|
2
|
+
# LXI Constants
|
3
|
+
LXI_OK = 0
|
4
|
+
LXI_ERROR = -1
|
5
|
+
|
6
|
+
# VXI11 Discovery Callbacks
|
7
|
+
BroadcastCallback =
|
8
|
+
FFI::Function.new(:void, %i[pointer pointer]) do |address, interface|
|
9
|
+
puts "Broadcast: #{address.read_string}, #{interface.read_string}"
|
10
|
+
end
|
11
|
+
|
12
|
+
DeviceCallback =
|
13
|
+
FFI::Function.new(:void, %i[pointer pointer]) do |address, id|
|
14
|
+
puts "Device: #{address.read_string}, #{id.read_string}"
|
15
|
+
end
|
16
|
+
|
17
|
+
ServiceCallback =
|
18
|
+
FFI::Function.new(:void, %i[pointer pointer pointer int]) do |address, id, service, port|
|
19
|
+
puts "Service: #{address.read_string}, #{id.read_string}, #{service.read_string}, #{port}"
|
20
|
+
end
|
21
|
+
end
|
data/lib/lxi/device.rb
CHANGED
@@ -0,0 +1,38 @@
|
|
1
|
+
module Lxi
|
2
|
+
module Discovery
|
3
|
+
module_function
|
4
|
+
|
5
|
+
# Search for LXI-11 devices on the specified interface and return hash of devices
|
6
|
+
def devices(timeout: 1000, type: :vxi11)
|
7
|
+
raise Error, 'LXI Library Initialisation Error' unless lxi_init == LXI_OK
|
8
|
+
|
9
|
+
devices = []
|
10
|
+
device_callback =
|
11
|
+
FFI::Function.new(:void, %i[pointer pointer]) do |address, id|
|
12
|
+
devices << { address: address.read_string, id: id.read_string }
|
13
|
+
end
|
14
|
+
|
15
|
+
info = LxiInfo.new
|
16
|
+
info[:device] = device_callback
|
17
|
+
|
18
|
+
lxi_discover_internal(info, timeout, type)
|
19
|
+
sleep 0.1
|
20
|
+
devices
|
21
|
+
end
|
22
|
+
|
23
|
+
# Discover LXI-11 devices on the LAN
|
24
|
+
def discover_local(timeout: 1000, type: :vxi11)
|
25
|
+
Lxi.init_lxi_session
|
26
|
+
|
27
|
+
info = LxiInfo.new
|
28
|
+
info[:broadcast] = BroadcastCallback
|
29
|
+
info[:device] = DeviceCallback
|
30
|
+
|
31
|
+
puts "Searching for LXI devices - please wait...\n\n"
|
32
|
+
|
33
|
+
result = lxi_discover_internal(info, timeout, type)
|
34
|
+
|
35
|
+
puts "Error during discovery: #{result}" if result.negative?
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'ffi'
|
3
|
+
|
4
|
+
module Lxi
|
5
|
+
module FFIFunctions
|
6
|
+
extend FFI::Library
|
7
|
+
|
8
|
+
ffi_lib '/opt/homebrew/lib/liblxi.dylib'
|
9
|
+
ffi_lib_flags :now, :global
|
10
|
+
|
11
|
+
# Define liblxi structs
|
12
|
+
class LxiInfo < FFI::Struct
|
13
|
+
layout :broadcast,
|
14
|
+
callback(%i[pointer pointer], :void),
|
15
|
+
:device,
|
16
|
+
callback(%i[pointer pointer], :void),
|
17
|
+
:service,
|
18
|
+
callback(%i[pointer pointer pointer int], :void)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Define liblxi enums
|
22
|
+
enum :lxi_protocol_type, %i[vxi11 raw hyslip]
|
23
|
+
enum :lxi_discover_type, %i[vxi11 mdns]
|
24
|
+
|
25
|
+
# Expose liblxi functions
|
26
|
+
attach_function :lxi_init, [], :int
|
27
|
+
attach_function :lxi_discover_internal, :lxi_discover, [LxiInfo.ptr, :int, :lxi_discover_type], :int
|
28
|
+
attach_function :lxi_discover_if, [LxiInfo.ptr, :string, :int, :lxi_discover_type], :int
|
29
|
+
attach_function :lxi_connect, %i[string int string int lxi_protocol_type], :int
|
30
|
+
attach_function :lxi_send, %i[int string int int], :int
|
31
|
+
attach_function :lxi_receive, %i[int pointer int int], :int
|
32
|
+
attach_function :lxi_disconnect, [:int], :int
|
33
|
+
end
|
34
|
+
end
|
data/lib/lxi/methods.rb
ADDED
data/lib/lxi/version.rb
CHANGED
data/lib/lxi_rb.rb
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'lxi/version'
|
4
|
-
require_relative 'lxi/
|
4
|
+
require_relative 'lxi/ffi_functions'
|
5
|
+
require_relative 'lxi/lxi_methods'
|
6
|
+
require_relative 'lxi/lxi_constants'
|
5
7
|
require_relative 'lxi/device'
|
6
8
|
|
7
9
|
module Lxi
|
10
|
+
extend FFIFunctions
|
11
|
+
include LxiMethods
|
12
|
+
|
8
13
|
class Error < StandardError
|
9
14
|
end
|
10
|
-
# Your code goes here...
|
11
15
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lxi_rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Carruthers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -32,16 +32,22 @@ executables: []
|
|
32
32
|
extensions: []
|
33
33
|
extra_rdoc_files: []
|
34
34
|
files:
|
35
|
+
- ".cz.toml"
|
35
36
|
- ".streerc"
|
36
37
|
- ".tool-versions"
|
38
|
+
- ".vscode/settings.json"
|
37
39
|
- CHANGELOG.md
|
38
40
|
- Gemfile
|
39
41
|
- Gemfile.lock
|
40
42
|
- LICENSE.txt
|
41
43
|
- README.md
|
42
44
|
- Rakefile
|
45
|
+
- cog.toml
|
46
|
+
- lib/lxi/constants.rb
|
43
47
|
- lib/lxi/device.rb
|
44
|
-
- lib/lxi/
|
48
|
+
- lib/lxi/discovery.rb
|
49
|
+
- lib/lxi/functions.rb
|
50
|
+
- lib/lxi/methods.rb
|
45
51
|
- lib/lxi/version.rb
|
46
52
|
- lib/lxi_rb.rb
|
47
53
|
- sig/lxi_rb.rbs
|
data/lib/lxi/ffi.rb
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'ffi'
|
3
|
-
|
4
|
-
module Lxi
|
5
|
-
extend FFI::Library
|
6
|
-
|
7
|
-
ffi_lib '/opt/homebrew/lib/liblxi.dylib'
|
8
|
-
ffi_lib_flags :now, :global
|
9
|
-
|
10
|
-
# Define liblxi structs
|
11
|
-
class LxiInfo < FFI::Struct
|
12
|
-
layout :broadcast,
|
13
|
-
callback(%i[pointer pointer], :void),
|
14
|
-
:device,
|
15
|
-
callback(%i[pointer pointer], :void),
|
16
|
-
:service,
|
17
|
-
callback(%i[pointer pointer pointer int], :void)
|
18
|
-
end
|
19
|
-
|
20
|
-
# LXI Constants
|
21
|
-
LXI_OK = 0
|
22
|
-
LXI_ERROR = -1
|
23
|
-
|
24
|
-
# Define liblxi enums
|
25
|
-
enum :lxi_protocol_type, %i[vxi11 raw hyslip]
|
26
|
-
enum :lxi_discover_type, %i[vxi11 mdns]
|
27
|
-
|
28
|
-
# Expose liblxi functions
|
29
|
-
attach_function :lxi_init, [], :int
|
30
|
-
attach_function :lxi_discover_internal, :lxi_discover, [LxiInfo.ptr, :int, :lxi_discover_type], :int
|
31
|
-
attach_function :lxi_discover_if, [LxiInfo.ptr, :string, :int, :lxi_discover_type], :int
|
32
|
-
attach_function :lxi_connect, %i[string int string int lxi_protocol_type], :int
|
33
|
-
attach_function :lxi_send, %i[int string int int], :int
|
34
|
-
attach_function :lxi_receive, %i[int pointer int int], :int
|
35
|
-
attach_function :lxi_disconnect, [:int], :int
|
36
|
-
|
37
|
-
# VXI11 Discovery Callbacks
|
38
|
-
BroadcastCallback =
|
39
|
-
FFI::Function.new(:void, %i[pointer pointer]) do |address, interface|
|
40
|
-
puts "Broadcast: #{address.read_string}, #{interface.read_string}"
|
41
|
-
end
|
42
|
-
|
43
|
-
DeviceCallback =
|
44
|
-
FFI::Function.new(:void, %i[pointer pointer]) do |address, id|
|
45
|
-
puts "Device: #{address.read_string}, #{id.read_string}"
|
46
|
-
end
|
47
|
-
|
48
|
-
ServiceCallback =
|
49
|
-
FFI::Function.new(:void, %i[pointer pointer pointer int]) do |address, id, service, port|
|
50
|
-
puts "Service: #{address.read_string}, #{id.read_string}, #{service.read_string}, #{port}"
|
51
|
-
end
|
52
|
-
|
53
|
-
# Initialise the LXI library
|
54
|
-
def init_lxi_session
|
55
|
-
raise Error, 'LXI Library Initialisation Error' unless lxi_init == LXI_OK
|
56
|
-
end
|
57
|
-
|
58
|
-
# Search for LXI-11 devices on the specified interface and return hash of devices
|
59
|
-
def self.devices(timeout: 1000, type: :vxi11)
|
60
|
-
raise Error, 'LXI Library Initialisation Error' unless lxi_init == LXI_OK
|
61
|
-
|
62
|
-
devices = []
|
63
|
-
callback =
|
64
|
-
FFI::Function.new(:void, %i[pointer pointer]) do |address, id|
|
65
|
-
devices << { address: address.read_string, id: id.read_string }
|
66
|
-
end
|
67
|
-
|
68
|
-
info = LxiInfo.new
|
69
|
-
info[:broadcast] = BroadcastCallback
|
70
|
-
info[:device] = callback
|
71
|
-
|
72
|
-
lxi_discover_internal(info, timeout, type)
|
73
|
-
sleep 0.1
|
74
|
-
devices
|
75
|
-
end
|
76
|
-
|
77
|
-
# Discover LXI-11 devices on the LAN
|
78
|
-
def self.discover_local(timeout: 1000, type: :vxi11)
|
79
|
-
init_lxi_session
|
80
|
-
|
81
|
-
info = LxiInfo.new
|
82
|
-
info[:broadcast] = BroadcastCallback
|
83
|
-
info[:device] = DeviceCallback
|
84
|
-
|
85
|
-
puts "Searching for LXI devices - please wait...\n\n"
|
86
|
-
|
87
|
-
result = lxi_discover_internal(info, timeout, type)
|
88
|
-
|
89
|
-
puts "Error during discovery: #{result}" if result.negative?
|
90
|
-
end
|
91
|
-
end
|