lxi_rb 0.2.25 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +63 -58
- data/Gemfile.lock +1 -1
- data/README.md +8 -9
- data/cog.toml +2 -8
- data/lib/lxi/callbacks.rb +17 -0
- data/lib/lxi/constants.rb +0 -16
- data/lib/lxi/device.rb +6 -2
- data/lib/lxi/discovery.rb +26 -30
- data/lib/lxi/methods.rb +4 -7
- data/lib/lxi/version.rb +1 -1
- data/lib/lxi_rb.rb +5 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c70934f5b171989e8380256f7d44635ec56cfc77b0115878f5d2507c0f49ef4b
|
4
|
+
data.tar.gz: f9a006729e634c9e2e498ce4f8182194ed77f9067446079f3567172b9e7a18af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b8b0b5f0b002ee50cdedf0f4490e4eb328e68839d1e3d6e8e6ff09dd0f879abf5a57e83e282f1318497c476b109f591ef0f9a6ac5f48535d3a62afd492ff9fc
|
7
|
+
data.tar.gz: acd91c71df039a683b90b8c6f2b99e4ce506c122ea421e0c5fbf44a066f3c0aa1b160894828c816d559abf697952f716bb49a5ec54ae472765743941b5a5c8f2
|
data/CHANGELOG.md
CHANGED
@@ -1,71 +1,76 @@
|
|
1
|
-
|
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.25](https://github.com/robcarruthers/lxi_rb/compare/v0.2.24..v0.2.25) - 2023-05-08
|
7
|
-
#### Bug Fixes
|
8
|
-
- **(Changelog)** Fix someBug - ([4001a3a](https://github.com/robcarruthers/lxi_rb/commit/4001a3a6438cd080d9042ca5a03de454fc913a74)) - [@robcarruthers](https://github.com/robcarruthers)
|
9
|
-
- **(SomeBug)** Made changes - ([deaf163](https://github.com/robcarruthers/lxi_rb/commit/deaf163992682f53471b686f4f52ee237f4d7162)) - [@robcarruthers](https://github.com/robcarruthers)
|
10
|
-
#### Miscellaneous Chores
|
11
|
-
- **(cog)** Update config - ([de8d8a4](https://github.com/robcarruthers/lxi_rb/commit/de8d8a4d34a11cdf76c72c550f09ddde9ea1bca5)) - [@robcarruthers](https://github.com/robcarruthers)
|
1
|
+
# Changelog
|
12
2
|
|
13
|
-
|
14
|
-
|
15
|
-
## [v0.2.24](https://github.com/robcarruthers/lxi_rb/compare/v0.2.23..v0.2.24) - 2023-05-08
|
16
|
-
#### Miscellaneous Chores
|
17
|
-
- **(version)** v0.2.24 - ([0a4f0d3](https://github.com/robcarruthers/lxi_rb/commit/0a4f0d3a2df6bf5f688bcc466fde1523352ce73b)) - [@robcarruthers](https://github.com/robcarruthers)
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
|
18
5
|
|
19
6
|
- - -
|
20
|
-
|
21
|
-
## [v0.2.23](https://github.com/robcarruthers/lxi_rb/compare/v0.2.21..v0.2.23) - 2023-05-08
|
22
|
-
#### Bug Fixes
|
23
|
-
- **(Stuff)** Fix hard bug - ([e9b1b02](https://github.com/robcarruthers/lxi_rb/commit/e9b1b02e2f42edf0e9aa11f9c379199d6e33be2d)) - [@robcarruthers](https://github.com/robcarruthers)
|
24
|
-
|
25
|
-
- - -
|
26
|
-
|
27
|
-
## [v0.2.21](https://github.com/robcarruthers/lxi_rb/compare/v0.2.20..v0.2.21) - 2023-05-08
|
28
|
-
|
29
|
-
- - -
|
30
|
-
|
31
|
-
## [v0.2.18](https://github.com/robcarruthers/lxi_rb/compare/v0.2.16..v0.2.18) - 2023-05-08
|
7
|
+
## [v0.4.0](https://github.com/robcarruthers/lxi_rb/compare/v0.3.0..v0.4.0) - 2023-05-09
|
32
8
|
#### Features
|
33
|
-
- **(
|
34
|
-
####
|
35
|
-
- **(
|
9
|
+
- **(Device)** Add query - ([5fb904b](https://github.com/robcarruthers/lxi_rb/commit/5fb904b469eb92bd7df1bd18874b2743f51cae4e)) - [@robcarruthers](https://github.com/robcarruthers)
|
10
|
+
#### Refactoring
|
11
|
+
- **(LXI)** Update modules and mixins - ([c749759](https://github.com/robcarruthers/lxi_rb/commit/c7497595df2d08f1d9f4875b5c5a60f0dfe71ebd)) - [@robcarruthers](https://github.com/robcarruthers)
|
36
12
|
|
37
13
|
- - -
|
38
14
|
|
39
|
-
## [v0.
|
15
|
+
## [v0.3.0](https://github.com/robcarruthers/lxi_rb/compare/v0.2.26..v0.3.0) - 2023-05-08
|
40
16
|
#### Bug Fixes
|
41
|
-
- **(
|
17
|
+
- **(Cog)** Update config - ([bc97116](https://github.com/robcarruthers/lxi_rb/commit/bc97116f3c152a37b398ded210dc9dfcb9d48238)) - [@robcarruthers](https://github.com/robcarruthers)
|
42
18
|
#### Documentation
|
43
|
-
- **(
|
44
|
-
- **(Changelog)** Update - ([
|
45
|
-
- **(Changelog)**
|
46
|
-
- **(Changelog)**
|
47
|
-
- **(Changelog)** Update - ([
|
48
|
-
- **(Changelog)** Update
|
49
|
-
- **(Changelog)** Update - ([
|
50
|
-
- **(Changelog)**
|
51
|
-
- **(Changelog)**
|
52
|
-
- **(
|
53
|
-
- **(
|
54
|
-
-
|
19
|
+
- **(CHANGELOG)** Update - ([e0822c2](https://github.com/robcarruthers/lxi_rb/commit/e0822c2226cf975db88682598aa220ec2285bd2e)) - [@robcarruthers](https://github.com/robcarruthers)
|
20
|
+
- **(Changelog)** Update - ([9680045](https://github.com/robcarruthers/lxi_rb/commit/9680045f8382780a5bcfcbc682cb790aa9892347)) - [@robcarruthers](https://github.com/robcarruthers)
|
21
|
+
- **(Changelog)** Update - ([756462a](https://github.com/robcarruthers/lxi_rb/commit/756462ac4b65ef1f55d605b01d27d74c65e3981d)) - [@robcarruthers](https://github.com/robcarruthers)
|
22
|
+
- **(Changelog)** reset - ([3b38170](https://github.com/robcarruthers/lxi_rb/commit/3b38170a9bd415136f7118d401a0d93540c91f8a)) - [@robcarruthers](https://github.com/robcarruthers)
|
23
|
+
- **(Changelog)** Update cog config - ([50fa7c1](https://github.com/robcarruthers/lxi_rb/commit/50fa7c14c74c19c26aa7bd2b5466dae658d6ca8d)) - [@robcarruthers](https://github.com/robcarruthers)
|
24
|
+
- **(Changelog)** Update - ([1b08d37](https://github.com/robcarruthers/lxi_rb/commit/1b08d37713e2e3fca97c8781f868c37cd25e8952)) - [@robcarruthers](https://github.com/robcarruthers)
|
25
|
+
- **(Changelog)** Update cog config - ([15529e9](https://github.com/robcarruthers/lxi_rb/commit/15529e977df1d6c0edb838940880d7aa4b482a0d)) - [@robcarruthers](https://github.com/robcarruthers)
|
26
|
+
- **(Changelog)** Update - ([96ea3f8](https://github.com/robcarruthers/lxi_rb/commit/96ea3f83ca3b54a7213dd38d6ebea6d453b2c5c6)) - [@robcarruthers](https://github.com/robcarruthers)
|
27
|
+
- **(Changelog)** Add cog config - ([e518de8](https://github.com/robcarruthers/lxi_rb/commit/e518de82361494c4aeb3bffbadc33ef682808490)) - [@robcarruthers](https://github.com/robcarruthers)
|
28
|
+
- **(Changelog)** Update - ([c15ba50](https://github.com/robcarruthers/lxi_rb/commit/c15ba50f382fff01e6cd70ce6c43a923531b214b)) - [@robcarruthers](https://github.com/robcarruthers)
|
29
|
+
- **(Cog)** Update post bump hook - ([7030031](https://github.com/robcarruthers/lxi_rb/commit/703003167efbc201319208ea7d9ba26daa196871)) - [@robcarruthers](https://github.com/robcarruthers)
|
30
|
+
- **(changelog)** Update - ([17f007d](https://github.com/robcarruthers/lxi_rb/commit/17f007d72dd1ec2f6ecc1e9ce3d1443981d63599)) - [@robcarruthers](https://github.com/robcarruthers)
|
31
|
+
- **(changelog)** Updated - ([fa361f7](https://github.com/robcarruthers/lxi_rb/commit/fa361f7e8d2f1cdc5b80f6860d1bccd3c07e06af)) - [@robcarruthers](https://github.com/robcarruthers)
|
32
|
+
- update README - ([1f7334b](https://github.com/robcarruthers/lxi_rb/commit/1f7334bc73b4289464ac73f6010e97a979d9c5e5)) - [@robcarruthers](https://github.com/robcarruthers)
|
55
33
|
#### Features
|
56
|
-
- **(
|
57
|
-
- **(
|
58
|
-
- **(ffi)** Add search class method - ([8f7351f](https://github.com/robcarruthers/lxi_rb/commit/8f7351f9b541614a717a83d291d169b1fd8db356)) - [@robcarruthers](https://github.com/robcarruthers)
|
34
|
+
- **(device)** Init LXI Session - ([d326f6a](https://github.com/robcarruthers/lxi_rb/commit/d326f6a4c37f15a6b20ca3681fafa5e40588f81e)) - [@robcarruthers](https://github.com/robcarruthers)
|
35
|
+
- **(ffi)** Add search class method - ([2bfa417](https://github.com/robcarruthers/lxi_rb/commit/2bfa41703f810145a6d6dffb9dd18220577a43a0)) - [@robcarruthers](https://github.com/robcarruthers)
|
59
36
|
#### Miscellaneous Chores
|
60
|
-
- **(
|
61
|
-
- **(
|
62
|
-
- **(
|
63
|
-
-
|
37
|
+
- **(CHANGELOG)** Update - ([003969a](https://github.com/robcarruthers/lxi_rb/commit/003969a1588609e528e5e91405a02871c7a31eaa)) - [@robcarruthers](https://github.com/robcarruthers)
|
38
|
+
- **(Changelog)** Update - ([9a07697](https://github.com/robcarruthers/lxi_rb/commit/9a076972668e06728171eb68b92c37cd9364e85d)) - [@robcarruthers](https://github.com/robcarruthers)
|
39
|
+
- **(Cog)** Update config - ([46f4e5d](https://github.com/robcarruthers/lxi_rb/commit/46f4e5d0c177849b14a7068761bb5068895b5027)) - [@robcarruthers](https://github.com/robcarruthers)
|
40
|
+
- **(cog)** Update config - ([0c68f6e](https://github.com/robcarruthers/lxi_rb/commit/0c68f6e9c6928a9bf3e102314cb1adff5f7a8c14)) - [@robcarruthers](https://github.com/robcarruthers)
|
41
|
+
- **(version)** v0.2.26 - ([4dd447e](https://github.com/robcarruthers/lxi_rb/commit/4dd447e7d35a01345702885bdf005e71bfbf3397)) - [@robcarruthers](https://github.com/robcarruthers)
|
42
|
+
- **(version)** v0.2.26 - ([cad6630](https://github.com/robcarruthers/lxi_rb/commit/cad6630f80628ae312a0d8e902d044c38b8eede4)) - [@robcarruthers](https://github.com/robcarruthers)
|
43
|
+
- **(version)** v0.2.25 - ([d15ee42](https://github.com/robcarruthers/lxi_rb/commit/d15ee42773ed09712accdf3681619424b9b00d9e)) - [@robcarruthers](https://github.com/robcarruthers)
|
44
|
+
- **(version)** v0.2.24 - ([04e85c6](https://github.com/robcarruthers/lxi_rb/commit/04e85c60a14b211312524fae6a41d5242554df40)) - [@robcarruthers](https://github.com/robcarruthers)
|
45
|
+
- **(version)** v0.2.24 - ([4e0fab9](https://github.com/robcarruthers/lxi_rb/commit/4e0fab9c187f24017a34ae14197e2abe56d241ae)) - [@robcarruthers](https://github.com/robcarruthers)
|
46
|
+
- **(version)** v0.2.23 - ([0dcd256](https://github.com/robcarruthers/lxi_rb/commit/0dcd256aba7b7b58fd2ac7670aa17a22fc7716e5)) - [@robcarruthers](https://github.com/robcarruthers)
|
47
|
+
- **(version)** 0.2.23 - ([0251d2f](https://github.com/robcarruthers/lxi_rb/commit/0251d2ffa1e17bd4e1080d223a8cc63c0ff46294)) - [@robcarruthers](https://github.com/robcarruthers)
|
48
|
+
- **(version)** v0.2.21 - ([0a275c2](https://github.com/robcarruthers/lxi_rb/commit/0a275c2150b57009a18ec29e99c43bc83c103896)) - [@robcarruthers](https://github.com/robcarruthers)
|
49
|
+
- **(version)** v0.2.18 - ([78197b4](https://github.com/robcarruthers/lxi_rb/commit/78197b469e0bf83638d051db047b73352f036657)) - [@robcarruthers](https://github.com/robcarruthers)
|
50
|
+
- **(version)** v0.2.7 - ([c06b039](https://github.com/robcarruthers/lxi_rb/commit/c06b039f950e346c9231b51fa6e6c571013f957e)) - [@robcarruthers](https://github.com/robcarruthers)
|
51
|
+
- **(version)** v0.2.9 - ([4b4be3f](https://github.com/robcarruthers/lxi_rb/commit/4b4be3f40661a53e941028a870e0663e71c906bd)) - [@robcarruthers](https://github.com/robcarruthers)
|
52
|
+
- **(version)** v0.2.8 - ([c4ebe60](https://github.com/robcarruthers/lxi_rb/commit/c4ebe60da801e41a232498e4a72e6a0578bbefa7)) - [@robcarruthers](https://github.com/robcarruthers)
|
53
|
+
- **(version)** v0.2.7 - ([88a610f](https://github.com/robcarruthers/lxi_rb/commit/88a610ffe4e42b9d57527412355f235ee68702d5)) - [@robcarruthers](https://github.com/robcarruthers)
|
54
|
+
- **(version)** v0.2.4 - ([06f3f26](https://github.com/robcarruthers/lxi_rb/commit/06f3f267b7810388a32095c716c5d5a2e5ed8b40)) - [@robcarruthers](https://github.com/robcarruthers)
|
55
|
+
- **(version)** v0.2.2 - ([b702066](https://github.com/robcarruthers/lxi_rb/commit/b702066ffc2525228ec82c4d3adfc03a4f69a923)) - [@robcarruthers](https://github.com/robcarruthers)
|
56
|
+
- **(versions)** v0.2.3 - ([aa79284](https://github.com/robcarruthers/lxi_rb/commit/aa79284160fb8b4f2c1af27326d7a3b1836d82d2)) - [@robcarruthers](https://github.com/robcarruthers)
|
57
|
+
- v0.2.21 - ([5b453bf](https://github.com/robcarruthers/lxi_rb/commit/5b453bf91f65e3d8840afe6270edd37228e8325e)) - [@robcarruthers](https://github.com/robcarruthers)
|
58
|
+
- v0.2.16 - ([d8b986d](https://github.com/robcarruthers/lxi_rb/commit/d8b986d3817150abbfc4b3acea9c40ec2a70e08c)) - [@robcarruthers](https://github.com/robcarruthers)
|
59
|
+
- v0.2.15 - ([a2e9c15](https://github.com/robcarruthers/lxi_rb/commit/a2e9c15dc51f654ff6396cbbdebc4480828edc11)) - [@robcarruthers](https://github.com/robcarruthers)
|
60
|
+
- v0.2.14 - ([216e924](https://github.com/robcarruthers/lxi_rb/commit/216e924e0af400d636bd305022131f82a2b97618)) - [@robcarruthers](https://github.com/robcarruthers)
|
61
|
+
- v0.2.13 - ([7f9b690](https://github.com/robcarruthers/lxi_rb/commit/7f9b69023b091db2a2e8294c21715bd1bffea489)) - [@robcarruthers](https://github.com/robcarruthers)
|
62
|
+
- v0.2.12 - ([d4f9fe7](https://github.com/robcarruthers/lxi_rb/commit/d4f9fe7cfdb056ba695af59527fbbd221d9a8c61)) - [@robcarruthers](https://github.com/robcarruthers)
|
63
|
+
- v0.2.11 - ([4717558](https://github.com/robcarruthers/lxi_rb/commit/47175582f5b81ce09c36c64cd0c1e671f090d42d)) - [@robcarruthers](https://github.com/robcarruthers)
|
64
|
+
- v0.2.10 - ([c4334ed](https://github.com/robcarruthers/lxi_rb/commit/c4334edd1cb97b99be2b77e276a27d49fd390fa9)) - [@robcarruthers](https://github.com/robcarruthers)
|
65
|
+
- v0.2.9 - ([5a02c26](https://github.com/robcarruthers/lxi_rb/commit/5a02c26264ef7a9ec77580c0b0639e952a8a67e4)) - [@robcarruthers](https://github.com/robcarruthers)
|
66
|
+
- add github CI yml - ([6bb36d2](https://github.com/robcarruthers/lxi_rb/commit/6bb36d2aae7788866f2f247502b292340b57ac1b)) - [@robcarruthers](https://github.com/robcarruthers)
|
67
|
+
- Initial commit - ([d0d5941](https://github.com/robcarruthers/lxi_rb/commit/d0d594119d79afe36f62a44688c216bbc2510f79)) - [@robcarruthers](https://github.com/robcarruthers)
|
64
68
|
#### Refactoring
|
65
|
-
- **(
|
66
|
-
- **(
|
67
|
-
|
68
|
-
- **(
|
69
|
+
- **(Device)** add error checking - ([27455eb](https://github.com/robcarruthers/lxi_rb/commit/27455eb78b8782cc367b94fb385720817ee11985)) - [@robcarruthers](https://github.com/robcarruthers)
|
70
|
+
- **(Device)** refine usage - ([d07ff0a](https://github.com/robcarruthers/lxi_rb/commit/d07ff0a30a834342cc40ed98a45a0033b87e0488)) - [@robcarruthers](https://github.com/robcarruthers)
|
71
|
+
- **(Lxi_module)** Breakout into mixins - ([1eaa2d6](https://github.com/robcarruthers/lxi_rb/commit/1eaa2d6a7d364413dc57d6579bb08fdbc2d8554f)) - [@robcarruthers](https://github.com/robcarruthers)
|
72
|
+
- **(Rubocop)** fix offences - ([da04cdb](https://github.com/robcarruthers/lxi_rb/commit/da04cdb3e284afad7c3b4828369a9ff89f526589)) - [@robcarruthers](https://github.com/robcarruthers)
|
73
|
+
- **(ffi)** Remove comment - ([59985e6](https://github.com/robcarruthers/lxi_rb/commit/59985e61d5c8ba44c24338f793113987588677d9)) - [@robcarruthers](https://github.com/robcarruthers)
|
74
|
+
- **(ffi)** Refine code layout - ([1157a3d](https://github.com/robcarruthers/lxi_rb/commit/1157a3df2704f15f367985d1a2de602bc3f7e8d4)) - [@robcarruthers](https://github.com/robcarruthers)
|
69
75
|
#### Tests
|
70
|
-
- make default tests pass - ([
|
71
|
-
|
76
|
+
- make default tests pass - ([da68bff](https://github.com/robcarruthers/lxi_rb/commit/da68bff976bea886a99a0d31c35fd17df7b780f5)) - [@robcarruthers](https://github.com/robcarruthers)
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -17,22 +17,21 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
17
17
|
## Usage
|
18
18
|
|
19
19
|
```ruby
|
20
|
-
|
21
|
-
irb(main):001:0> require 'lxi_rb'
|
22
|
-
=> true
|
23
|
-
|
24
|
-
irb(main):002:0> Lxi.search
|
20
|
+
Lxi.search
|
25
21
|
Searching for LXI devices - please wait...
|
26
22
|
|
27
23
|
Broadcast: 127.0.0.1, lo0
|
28
24
|
Broadcast: 192.168.10.255, en0
|
29
25
|
Device: 192.168.10.21, Siglent Technologies,SDS1104X-E,SDSMMGKC6R0011,8.2.6.1.37R8
|
30
26
|
Device: 192.168.10.107, Siglent Technologies,SDM3055-SC,SDM35GBQ6R1882,1.01.01.25
|
31
|
-
=> nil
|
32
27
|
|
33
|
-
|
34
|
-
Siglent Technologies,
|
35
|
-
|
28
|
+
Lxi.discover_instruments
|
29
|
+
=> [{:address=>"192.168.10.107", :id=>"Siglent Technologies,SDM3055-SC,SDM35GBQ6R1882,1.01.01.25"}]
|
30
|
+
|
31
|
+
Lxi::Device.new('192.168.10.107', :vxi11) do |meter|
|
32
|
+
puts meter.query 'MEAS:VOLT:DC?'
|
33
|
+
end
|
34
|
+
=> -4.78767775E-04
|
36
35
|
```
|
37
36
|
|
38
37
|
## Development
|
data/cog.toml
CHANGED
@@ -1,14 +1,8 @@
|
|
1
1
|
from_latest_tag = true
|
2
2
|
ignore_merge_commits = false
|
3
3
|
branch_whitelist = []
|
4
|
-
pre_bump_hooks = [
|
5
|
-
|
6
|
-
"echo 'Bumping gem from {{latest}} to {{version}}'"
|
7
|
-
]
|
8
|
-
post_bump_hooks = [
|
9
|
-
"rake release",
|
10
|
-
"echo 'Releasing gem {{version}}'"
|
11
|
-
]
|
4
|
+
pre_bump_hooks = [ "bump set {{version}} -p 'chore(version):' -m 'v{{version}}'" ]
|
5
|
+
post_bump_hooks = [ "rake release" ]
|
12
6
|
pre_package_bump_hooks = []
|
13
7
|
post_package_bump_hooks = []
|
14
8
|
tag_prefix = "v"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Lxi
|
2
|
+
# VXI11 Discovery Callbacks
|
3
|
+
BroadcastCallback =
|
4
|
+
FFI::Function.new(:void, %i[pointer pointer]) do |address, interface|
|
5
|
+
puts "Broadcast: #{address.read_string}, #{interface.read_string}"
|
6
|
+
end
|
7
|
+
|
8
|
+
DeviceCallback =
|
9
|
+
FFI::Function.new(:void, %i[pointer pointer]) do |address, id|
|
10
|
+
puts "Device: #{address.read_string}, #{id.read_string}"
|
11
|
+
end
|
12
|
+
|
13
|
+
ServiceCallback =
|
14
|
+
FFI::Function.new(:void, %i[pointer pointer pointer int]) do |address, id, service, port|
|
15
|
+
puts "Service: #{address.read_string}, #{id.read_string}, #{service.read_string}, #{port}"
|
16
|
+
end
|
17
|
+
end
|
data/lib/lxi/constants.rb
CHANGED
@@ -2,20 +2,4 @@ module Lxi
|
|
2
2
|
# LXI Constants
|
3
3
|
LXI_OK = 0
|
4
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
5
|
end
|
data/lib/lxi/device.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
module Lxi
|
3
3
|
class Device
|
4
4
|
include FFI
|
5
|
-
include LxiMethods
|
6
5
|
|
7
6
|
attr_accessor :id, :address, :port, :name, :timeout, :protocol
|
8
7
|
|
@@ -20,7 +19,7 @@ module Lxi
|
|
20
19
|
end
|
21
20
|
|
22
21
|
def connect
|
23
|
-
init_lxi_session
|
22
|
+
Lxi.init_lxi_session
|
24
23
|
|
25
24
|
@id = Lxi.lxi_connect(@address, @port, @name, @timeout, @protocol)
|
26
25
|
raise Error, 'LXI Connection Error' if @id == LXI_ERROR
|
@@ -51,5 +50,10 @@ module Lxi
|
|
51
50
|
message.read_string
|
52
51
|
end
|
53
52
|
alias gets read
|
53
|
+
|
54
|
+
def query(message)
|
55
|
+
send message
|
56
|
+
read 10_000
|
57
|
+
end
|
54
58
|
end
|
55
59
|
end
|
data/lib/lxi/discovery.rb
CHANGED
@@ -1,38 +1,34 @@
|
|
1
1
|
module Lxi
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
sleep 0.1
|
20
|
-
devices
|
21
|
-
end
|
2
|
+
# Search for LXI-11 instruments on the network and return hash of instruments
|
3
|
+
def self.discover_instruments(timeout: 1000, type: :vxi11)
|
4
|
+
raise Error, 'LXI Library Initialisation Error' unless lxi_init == LXI_OK
|
5
|
+
|
6
|
+
devices = []
|
7
|
+
device_callback =
|
8
|
+
FFI::Function.new(:void, %i[pointer pointer]) do |address, id|
|
9
|
+
devices << { address: address.read_string, id: id.read_string }
|
10
|
+
end
|
11
|
+
|
12
|
+
info = FFIFunctions::LxiInfo.new
|
13
|
+
info[:device] = device_callback
|
14
|
+
|
15
|
+
lxi_discover_internal(info, timeout, type)
|
16
|
+
sleep 0.1
|
17
|
+
devices
|
18
|
+
end
|
22
19
|
|
23
|
-
|
24
|
-
|
25
|
-
|
20
|
+
# Discover LXI-11 devices on the LAN
|
21
|
+
def self.search(timeout: 1000, type: :vxi11)
|
22
|
+
Lxi.init_lxi_session
|
26
23
|
|
27
|
-
|
28
|
-
|
29
|
-
|
24
|
+
info = FFIFunctions::LxiInfo.new
|
25
|
+
info[:broadcast] = BroadcastCallback
|
26
|
+
info[:device] = DeviceCallback
|
30
27
|
|
31
|
-
|
28
|
+
puts "Searching for LXI devices - please wait...\n\n"
|
32
29
|
|
33
|
-
|
30
|
+
result = lxi_discover_internal(info, timeout, type)
|
34
31
|
|
35
|
-
|
36
|
-
end
|
32
|
+
puts "Error during discovery: #{result}" if result.negative?
|
37
33
|
end
|
38
34
|
end
|
data/lib/lxi/methods.rb
CHANGED
@@ -1,10 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Lxi
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
# Initialise the LXI library
|
6
|
-
def init_lxi_session
|
7
|
-
raise Error, 'LXI Library Initialisation Error' unless Lxi.lxi_init == LXI_OK
|
8
|
-
end
|
3
|
+
# Initialise the LXI library
|
4
|
+
def self.init_lxi_session
|
5
|
+
raise Error, 'LXI Library Initialisation Error' unless Lxi.lxi_init == LXI_OK
|
9
6
|
end
|
10
7
|
end
|
data/lib/lxi/version.rb
CHANGED
data/lib/lxi_rb.rb
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'lxi/version'
|
4
|
-
require_relative 'lxi/
|
5
|
-
require_relative 'lxi/
|
6
|
-
require_relative 'lxi/
|
4
|
+
require_relative 'lxi/functions'
|
5
|
+
require_relative 'lxi/methods'
|
6
|
+
require_relative 'lxi/constants'
|
7
|
+
require_relative 'lxi/callbacks'
|
8
|
+
require_relative 'lxi/discovery'
|
7
9
|
require_relative 'lxi/device'
|
8
10
|
|
9
11
|
module Lxi
|
10
12
|
extend FFIFunctions
|
11
|
-
include LxiMethods
|
12
13
|
|
13
14
|
class Error < StandardError
|
14
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.
|
4
|
+
version: 0.4.0
|
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-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -43,6 +43,7 @@ files:
|
|
43
43
|
- README.md
|
44
44
|
- Rakefile
|
45
45
|
- cog.toml
|
46
|
+
- lib/lxi/callbacks.rb
|
46
47
|
- lib/lxi/constants.rb
|
47
48
|
- lib/lxi/device.rb
|
48
49
|
- lib/lxi/discovery.rb
|