com.shinolab.autd3-sdk 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Client.cs CHANGED
@@ -110,10 +110,14 @@ namespace AUTD3
110
110
  _handle = new CheckerHandle(handle);
111
111
  }
112
112
 
113
- public async Task<LinkStatus> CheckAsync()
113
+ public LinkStatus Check()
114
114
  {
115
- var status = await AsyncOps.InvokeAsync((cb, ud) =>
116
- NativeClient.autd3_checker_check(_handle, cb, ud)).ConfigureAwait(false);
115
+ var err = new byte[NativeAbi.ErrorBufferLength];
116
+ var status = NativeClient.autd3_checker_check(_handle, err, (UIntPtr)err.Length);
117
+ if (status == IntPtr.Zero)
118
+ {
119
+ throw new Autd3Exception(NativeUtil.Utf8(err));
120
+ }
117
121
  try
118
122
  {
119
123
  var count = (int)NativeClient.autd3_link_status_num_devices(status);
@@ -202,7 +206,7 @@ namespace AUTD3
202
206
  }
203
207
  }
204
208
 
205
- public sealed class Client : IDisposable
209
+ public sealed class Client : IDisposable, IAsyncDisposable
206
210
  {
207
211
  public const int MaxInflight = 127;
208
212
 
@@ -260,6 +264,8 @@ namespace AUTD3
260
264
 
261
265
  public int NumDevices => (int)NativeClient.autd3_client_num_devices(Handle);
262
266
 
267
+ public Geometry Geometry => _geometry;
268
+
263
269
  public DatagramBuilder DatagramBuilder() => new DatagramBuilder(_geometry, this);
264
270
 
265
271
  public Task SendCheckedAsync(Frame frame) =>
@@ -336,6 +342,36 @@ namespace AUTD3
336
342
  public Task CloseAsync() =>
337
343
  AsyncOps.InvokeAsync((cb, ud) => NativeClient.autd3_client_close(Handle, cb, ud));
338
344
 
339
- public void Dispose() => _handle.Dispose();
345
+ public void Dispose()
346
+ {
347
+ if (_handle.IsClosed)
348
+ {
349
+ return;
350
+ }
351
+ try
352
+ {
353
+ CloseAsync().GetAwaiter().GetResult();
354
+ }
355
+ finally
356
+ {
357
+ _handle.Dispose();
358
+ }
359
+ }
360
+
361
+ public async ValueTask DisposeAsync()
362
+ {
363
+ if (_handle.IsClosed)
364
+ {
365
+ return;
366
+ }
367
+ try
368
+ {
369
+ await CloseAsync().ConfigureAwait(false);
370
+ }
371
+ finally
372
+ {
373
+ _handle.Dispose();
374
+ }
375
+ }
340
376
  }
341
377
  }
package/Legacy.cs CHANGED
@@ -233,7 +233,7 @@ namespace AUTD3.Legacy
233
233
  public void Dispose() => _handle.Dispose();
234
234
  }
235
235
 
236
- public sealed class LegacyClient : IDisposable
236
+ public sealed class LegacyClient : IDisposable, IAsyncDisposable
237
237
  {
238
238
  private readonly LegacyClientHandle _handle;
239
239
  private readonly Geometry _geometry;
@@ -337,6 +337,36 @@ namespace AUTD3.Legacy
337
337
  public Task CloseAsync() =>
338
338
  AsyncOps.InvokeAsync((cb, ud) => NativeLegacyClient.autd3_legacy_client_close(Handle, cb, ud));
339
339
 
340
- public void Dispose() => _handle.Dispose();
340
+ public void Dispose()
341
+ {
342
+ if (_handle.IsClosed)
343
+ {
344
+ return;
345
+ }
346
+ try
347
+ {
348
+ CloseAsync().GetAwaiter().GetResult();
349
+ }
350
+ finally
351
+ {
352
+ _handle.Dispose();
353
+ }
354
+ }
355
+
356
+ public async ValueTask DisposeAsync()
357
+ {
358
+ if (_handle.IsClosed)
359
+ {
360
+ return;
361
+ }
362
+ try
363
+ {
364
+ await CloseAsync().ConfigureAwait(false);
365
+ }
366
+ finally
367
+ {
368
+ _handle.Dispose();
369
+ }
370
+ }
341
371
  }
342
372
  }
package/Native.cs CHANGED
@@ -145,7 +145,7 @@ namespace AUTD3
145
145
  internal static extern IntPtr autd3_client_checker(ClientHandle client);
146
146
 
147
147
  [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
148
- internal static extern void autd3_checker_check(CheckerHandle checker, CompletionCallback cb, IntPtr userData);
148
+ internal static extern IntPtr autd3_checker_check(CheckerHandle checker, byte[] err, UIntPtr errLen);
149
149
 
150
150
  [DllImport(Lib, CallingConvention = CallingConvention.Cdecl)]
151
151
  internal static extern void autd3_checker_free(IntPtr checker);
Binary file
Binary file
@@ -11,7 +11,7 @@ namespace AUTD3.Samples
11
11
  // Coordinates are in the Unity frame (metres, left-handed): a device emits along its
12
12
  // local -z, so the focus that the dotnet sample writes as new Vector3(0, 0, 150) is
13
13
  // new Vector3(0, 0, -0.15f) here.
14
- // The Nop link runs without hardware; swap it for new EtherCrab(...) on a real device.
14
+ // The Nop link runs without hardware; swap it for new Echocat(...) on a real device.
15
15
  public sealed class FocusSineSample : MonoBehaviour
16
16
  {
17
17
  private Client _client;
@@ -26,7 +26,7 @@ namespace AUTD3.Samples
26
26
  var target = _geometry.Center + new Vector3(0f, 0f, -0.15f);
27
27
  var wavelength = Pattern.Wavelength(340 * m / s);
28
28
  using var patterns = _geometry.PatternBuffer();
29
- Pattern.Focus(_geometry, target, wavelength, new FocusOption(), patterns);
29
+ Pattern.Focus(_geometry, target, wavelength, patterns);
30
30
 
31
31
  using var modulation = Modulation.ModulationBuffer();
32
32
  Modulation.Sine(200 * Hz, new SineOption(), modulation);
@@ -5,7 +5,7 @@ The following is a list of those components and the full text of their licenses.
5
5
 
6
6
  ## Overview
7
7
 
8
- - MIT License (54)
8
+ - MIT License (59)
9
9
  - Apache License 2.0 (3)
10
10
  - Unicode License v3 (1)
11
11
 
@@ -835,38 +835,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
835
835
 
836
836
  Used by:
837
837
 
838
- - tokio-macros 2.7.0 — https://github.com/tokio-rs/tokio
839
-
840
- ```
841
- MIT License
842
-
843
- Copyright (c) 2019 Yoshua Wuyts
844
- Copyright (c) Tokio Contributors
845
-
846
- Permission is hereby granted, free of charge, to any person obtaining a copy
847
- of this software and associated documentation files (the "Software"), to deal
848
- in the Software without restriction, including without limitation the rights
849
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
850
- copies of the Software, and to permit persons to whom the Software is
851
- furnished to do so, subject to the following conditions:
852
-
853
- The above copyright notice and this permission notice shall be included in all
854
- copies or substantial portions of the Software.
855
-
856
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
857
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
858
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
859
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
860
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
861
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
862
- SOFTWARE.
863
-
864
- ```
865
-
866
- ## MIT License
867
-
868
- Used by:
869
-
870
838
  - safe_arch 1.0.0 — https://github.com/Lokathor/safe_arch
871
839
 
872
840
  ```
@@ -886,9 +854,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
886
854
 
887
855
  Used by:
888
856
 
889
- - autd3-rs 0.7.0 — https://github.com/shinolab/autd3-sdk
890
- - autd3-rs-core 0.7.0 — https://github.com/shinolab/autd3-sdk
891
- - autd3-cpu-wire 0.6.0 — https://github.com/shinolab/autd3-sdk
857
+ - autd3-rs 0.9.0 — https://github.com/shinolab/autd3-sdk
858
+ - autd3-rs-core 0.9.0 — https://github.com/shinolab/autd3-sdk
859
+ - autd3-cpu-wire 0.9.0 — https://github.com/shinolab/autd3-sdk
892
860
 
893
861
  ```
894
862
  MIT License
@@ -919,8 +887,8 @@ SOFTWARE.
919
887
 
920
888
  Used by:
921
889
 
922
- - autd3-ffi 0.7.0 — https://github.com/shinolab/autd3-sdk
923
- - autd3-ffi-abi 0.7.0 — https://github.com/shinolab/autd3-sdk
890
+ - autd3-ffi 0.9.0 — https://github.com/shinolab/autd3-sdk
891
+ - autd3-ffi-abi 0.9.0 — https://github.com/shinolab/autd3-sdk
924
892
  - chrono 0.4.45 — https://github.com/chronotope/chrono
925
893
  - wide 1.5.0 — https://github.com/Lokathor/wide
926
894
  - winapi-i686-pc-windows-gnu 0.4.0 — https://github.com/retep998/winapi-rs
@@ -964,46 +932,21 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
964
932
 
965
933
  Used by:
966
934
 
967
- - tokio 1.53.0 — https://github.com/tokio-rs/tokio
968
-
969
- ```
970
- MIT License
971
-
972
- Copyright (c) Tokio Contributors
973
-
974
- Permission is hereby granted, free of charge, to any person obtaining a copy
975
- of this software and associated documentation files (the "Software"), to deal
976
- in the Software without restriction, including without limitation the rights
977
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
978
- copies of the Software, and to permit persons to whom the Software is
979
- furnished to do so, subject to the following conditions:
980
-
981
- The above copyright notice and this permission notice shall be included in all
982
- copies or substantial portions of the Software.
983
-
984
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
985
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
986
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
987
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
988
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
989
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
990
- SOFTWARE.
991
-
992
- ```
993
-
994
- ## MIT License
995
-
996
- Used by:
997
-
998
935
  - hermit-abi 0.5.2 — https://github.com/hermit-os/hermit-rs
936
+ - itoa 1.0.18 — https://github.com/dtolnay/itoa
999
937
  - pin-project-lite 0.2.17 — https://github.com/taiki-e/pin-project-lite
1000
938
  - proc-macro2 1.0.106 — https://github.com/dtolnay/proc-macro2
1001
939
  - quote 1.0.46 — https://github.com/dtolnay/quote
1002
940
  - rustversion 1.0.22 — https://github.com/dtolnay/rustversion
941
+ - serde 1.0.228 — https://github.com/serde-rs/serde
942
+ - serde_core 1.0.228 — https://github.com/serde-rs/serde
943
+ - serde_derive 1.0.228 — https://github.com/serde-rs/serde
944
+ - serde_json 1.0.150 — https://github.com/serde-rs/json
1003
945
  - syn 2.0.118 — https://github.com/dtolnay/syn
1004
946
  - thiserror-impl 2.0.18 — https://github.com/dtolnay/thiserror
1005
947
  - thiserror 2.0.18 — https://github.com/dtolnay/thiserror
1006
948
  - unicode-ident 1.0.24 — https://github.com/dtolnay/unicode-ident
949
+ - zmij 1.0.21 — https://github.com/dtolnay/zmij
1007
950
 
1008
951
  ```
1009
952
  Permission is hereby granted, free of charge, to any
@@ -1094,6 +1037,37 @@ SOFTWARE.
1094
1037
 
1095
1038
  ```
1096
1039
 
1040
+ ## MIT License
1041
+
1042
+ Used by:
1043
+
1044
+ - memchr 2.8.2 — https://github.com/BurntSushi/memchr
1045
+
1046
+ ```
1047
+ The MIT License (MIT)
1048
+
1049
+ Copyright (c) 2015 Andrew Gallant
1050
+
1051
+ Permission is hereby granted, free of charge, to any person obtaining a copy
1052
+ of this software and associated documentation files (the "Software"), to deal
1053
+ in the Software without restriction, including without limitation the rights
1054
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1055
+ copies of the Software, and to permit persons to whom the Software is
1056
+ furnished to do so, subject to the following conditions:
1057
+
1058
+ The above copyright notice and this permission notice shall be included in
1059
+ all copies or substantial portions of the Software.
1060
+
1061
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1062
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1063
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1064
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1065
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1066
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1067
+ THE SOFTWARE.
1068
+
1069
+ ```
1070
+
1097
1071
  ## Unicode License v3
1098
1072
 
1099
1073
  Used by:
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "git+https://github.com/shinolab/autd3-sdk.git",
6
6
  "directory": "bindings/unity/com.shinolab.autd3-sdk"
7
7
  },
8
- "version": "0.7.0",
8
+ "version": "0.9.0",
9
9
  "displayName": "AUTD3",
10
10
  "description": "AUTD3 client, datagrams and STM (Unity binding).",
11
11
  "unity": "6000.0",
@@ -15,9 +15,9 @@
15
15
  "url": "https://github.com/shinolab"
16
16
  },
17
17
  "dependencies": {
18
- "com.shinolab.autd3-sdk.core": "0.7.0",
19
- "com.shinolab.autd3-sdk.pattern": "0.7.0",
20
- "com.shinolab.autd3-sdk.modulation": "0.7.0"
18
+ "com.shinolab.autd3-sdk.core": "0.9.0",
19
+ "com.shinolab.autd3-sdk.pattern": "0.9.0",
20
+ "com.shinolab.autd3-sdk.modulation": "0.9.0"
21
21
  },
22
22
  "samples": [
23
23
  {