com.shinolab.autd3-sdk 0.4.0 → 0.5.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 +1 -1
- package/Datagram.cs +24 -3
- package/Legacy.cs +348 -0
- package/Legacy.cs.meta +11 -0
- package/Link.cs +6 -0
- package/Native.cs +78 -2
- package/Plugins/linux-x64/libautd3capi.so +0 -0
- package/Plugins/osx-arm64/libautd3capi.dylib +0 -0
- package/Plugins/win-x64/autd3capi.dll +0 -0
- package/README.md +1 -35
- package/THIRD-PARTY-LICENSES.md +4 -4
- package/package.json +4 -4
package/Client.cs
CHANGED
|
@@ -267,7 +267,7 @@ namespace AUTD3
|
|
|
267
267
|
public int NumDevices => (int)NativeClient.autd3_client_num_devices(Handle);
|
|
268
268
|
|
|
269
269
|
|
|
270
|
-
public DatagramBuilder DatagramBuilder() => new DatagramBuilder(_geometry);
|
|
270
|
+
public DatagramBuilder DatagramBuilder() => new DatagramBuilder(_geometry, Handle);
|
|
271
271
|
|
|
272
272
|
|
|
273
273
|
|
package/Datagram.cs
CHANGED
|
@@ -14,9 +14,14 @@ namespace AUTD3
|
|
|
14
14
|
public uint MaxResyncRounds { get; }
|
|
15
15
|
public uint ResetResendCycles { get; }
|
|
16
16
|
public byte? RtPriority { get; }
|
|
17
|
+
public bool DisableRtPriority { get; }
|
|
17
18
|
public ulong? RtAffinity { get; }
|
|
18
19
|
public bool ValidateState { get; }
|
|
19
20
|
|
|
21
|
+
private const byte RtPriorityModeDefault = 0;
|
|
22
|
+
private const byte RtPriorityModeDisabled = 1;
|
|
23
|
+
private const byte RtPriorityModeExplicit = 2;
|
|
24
|
+
|
|
20
25
|
public ClientConfig() : this(lowLatency: false)
|
|
21
26
|
{
|
|
22
27
|
}
|
|
@@ -28,15 +33,21 @@ namespace AUTD3
|
|
|
28
33
|
uint maxResyncRounds = 8,
|
|
29
34
|
uint resetResendCycles = 2,
|
|
30
35
|
byte? rtPriority = null,
|
|
36
|
+
bool disableRtPriority = false,
|
|
31
37
|
ulong? rtAffinity = null,
|
|
32
38
|
bool validateState = true)
|
|
33
39
|
{
|
|
40
|
+
if (rtPriority.HasValue && disableRtPriority)
|
|
41
|
+
{
|
|
42
|
+
throw new ArgumentException("rtPriority and disableRtPriority are mutually exclusive");
|
|
43
|
+
}
|
|
34
44
|
LowLatency = lowLatency;
|
|
35
45
|
TimeoutCycles = timeoutCycles;
|
|
36
46
|
MaxInflight = maxInflight;
|
|
37
47
|
MaxResyncRounds = maxResyncRounds;
|
|
38
48
|
ResetResendCycles = resetResendCycles;
|
|
39
49
|
RtPriority = rtPriority;
|
|
50
|
+
DisableRtPriority = disableRtPriority;
|
|
40
51
|
RtAffinity = rtAffinity;
|
|
41
52
|
ValidateState = validateState;
|
|
42
53
|
}
|
|
@@ -49,7 +60,11 @@ namespace AUTD3
|
|
|
49
60
|
(UIntPtr)MaxInflight,
|
|
50
61
|
MaxResyncRounds,
|
|
51
62
|
ResetResendCycles,
|
|
52
|
-
RtPriority.HasValue
|
|
63
|
+
RtPriority.HasValue
|
|
64
|
+
? RtPriorityModeExplicit
|
|
65
|
+
: DisableRtPriority
|
|
66
|
+
? RtPriorityModeDisabled
|
|
67
|
+
: RtPriorityModeDefault,
|
|
53
68
|
RtPriority ?? 0,
|
|
54
69
|
RtAffinity.HasValue,
|
|
55
70
|
(UIntPtr)(RtAffinity ?? 0),
|
|
@@ -66,13 +81,19 @@ namespace AUTD3
|
|
|
66
81
|
{
|
|
67
82
|
private readonly Geometry _geometry;
|
|
68
83
|
private readonly int _numDevices;
|
|
84
|
+
private readonly IntPtr _client;
|
|
69
85
|
|
|
70
86
|
internal IntPtr Handle { get; private set; }
|
|
71
87
|
|
|
72
|
-
public DatagramBuilder(Geometry geometry)
|
|
88
|
+
public DatagramBuilder(Geometry geometry) : this(geometry, IntPtr.Zero)
|
|
89
|
+
{
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
internal DatagramBuilder(Geometry geometry, IntPtr client)
|
|
73
93
|
{
|
|
74
94
|
_geometry = geometry;
|
|
75
95
|
_numDevices = geometry.NumDevices;
|
|
96
|
+
_client = client;
|
|
76
97
|
Handle = NativeClient.autd3_datagram_builder_new(geometry.Handle);
|
|
77
98
|
if (Handle == IntPtr.Zero)
|
|
78
99
|
{
|
|
@@ -116,7 +137,7 @@ namespace AUTD3
|
|
|
116
137
|
public Frames Build()
|
|
117
138
|
{
|
|
118
139
|
var err = new byte[256];
|
|
119
|
-
var handle = NativeClient.autd3_datagram_builder_build(Handle, err, (UIntPtr)err.Length);
|
|
140
|
+
var handle = NativeClient.autd3_datagram_builder_build(Handle, _client, err, (UIntPtr)err.Length);
|
|
120
141
|
if (handle == IntPtr.Zero)
|
|
121
142
|
{
|
|
122
143
|
throw new Autd3Exception(NativeUtil.Utf8(err));
|
package/Legacy.cs
ADDED
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using System.Threading.Tasks;
|
|
5
|
+
|
|
6
|
+
namespace AUTD3.Legacy
|
|
7
|
+
{
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
public readonly struct LegacyClientConfig
|
|
11
|
+
{
|
|
12
|
+
public uint TimeoutCycles { get; }
|
|
13
|
+
public byte? RtPriority { get; }
|
|
14
|
+
public ulong? RtAffinity { get; }
|
|
15
|
+
|
|
16
|
+
public LegacyClientConfig() : this(timeoutCycles: 2000)
|
|
17
|
+
{
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public LegacyClientConfig(
|
|
21
|
+
uint timeoutCycles = 2000,
|
|
22
|
+
byte? rtPriority = null,
|
|
23
|
+
ulong? rtAffinity = null)
|
|
24
|
+
{
|
|
25
|
+
TimeoutCycles = timeoutCycles;
|
|
26
|
+
RtPriority = rtPriority;
|
|
27
|
+
RtAffinity = rtAffinity;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
internal IntPtr CreateHandle()
|
|
31
|
+
{
|
|
32
|
+
var handle = NativeLegacyClient.autd3_legacy_client_config_new(
|
|
33
|
+
TimeoutCycles,
|
|
34
|
+
RtPriority.HasValue,
|
|
35
|
+
RtPriority ?? 0,
|
|
36
|
+
RtAffinity.HasValue,
|
|
37
|
+
(UIntPtr)(RtAffinity ?? 0));
|
|
38
|
+
if (handle == IntPtr.Zero)
|
|
39
|
+
{
|
|
40
|
+
throw new Autd3Exception("failed to create legacy client config");
|
|
41
|
+
}
|
|
42
|
+
return handle;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public interface ILegacyCommand
|
|
47
|
+
{
|
|
48
|
+
internal IntPtr CreateOp();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public sealed class LegacyChangePatternBank : ILegacyCommand
|
|
52
|
+
{
|
|
53
|
+
private readonly byte _kind;
|
|
54
|
+
private readonly PatternBank _bank;
|
|
55
|
+
private readonly TransitionMode _transitionMode;
|
|
56
|
+
|
|
57
|
+
private LegacyChangePatternBank(byte kind, PatternBank bank, TransitionMode transitionMode)
|
|
58
|
+
{
|
|
59
|
+
_kind = kind;
|
|
60
|
+
_bank = bank;
|
|
61
|
+
_transitionMode = transitionMode;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public static LegacyChangePatternBank Pattern(PatternBank bank) =>
|
|
65
|
+
new LegacyChangePatternBank(0, bank, TransitionMode.Immediate);
|
|
66
|
+
|
|
67
|
+
public static LegacyChangePatternBank FociStm(PatternBank bank, TransitionMode? transitionMode = null) =>
|
|
68
|
+
new LegacyChangePatternBank(1, bank, transitionMode ?? TransitionMode.Immediate);
|
|
69
|
+
|
|
70
|
+
public static LegacyChangePatternBank PatternStm(PatternBank bank, TransitionMode? transitionMode = null) =>
|
|
71
|
+
new LegacyChangePatternBank(2, bank, transitionMode ?? TransitionMode.Immediate);
|
|
72
|
+
|
|
73
|
+
IntPtr ILegacyCommand.CreateOp() =>
|
|
74
|
+
NativeLegacyClient.autd3_legacy_op_change_segment(_kind, (byte)_bank, _transitionMode.Mode, _transitionMode.Value);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public sealed class LegacyDatagramBuilder : IDisposable
|
|
78
|
+
{
|
|
79
|
+
private readonly Geometry _geometry;
|
|
80
|
+
private readonly int _numDevices;
|
|
81
|
+
private readonly IntPtr _client;
|
|
82
|
+
|
|
83
|
+
internal IntPtr Handle { get; private set; }
|
|
84
|
+
|
|
85
|
+
public LegacyDatagramBuilder(Geometry geometry) : this(geometry, IntPtr.Zero)
|
|
86
|
+
{
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
internal LegacyDatagramBuilder(Geometry geometry, IntPtr client)
|
|
90
|
+
{
|
|
91
|
+
_geometry = geometry;
|
|
92
|
+
_numDevices = geometry.NumDevices;
|
|
93
|
+
_client = client;
|
|
94
|
+
Handle = NativeLegacyClient.autd3_legacy_datagram_builder_new(geometry.Handle);
|
|
95
|
+
if (Handle == IntPtr.Zero)
|
|
96
|
+
{
|
|
97
|
+
throw new Autd3Exception("failed to create legacy datagram builder");
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
public LegacyDatagramBuilder Push(ICommand command)
|
|
102
|
+
{
|
|
103
|
+
var op = command.CreateOp();
|
|
104
|
+
NativeLegacyClient.autd3_legacy_datagram_builder_push(Handle, op);
|
|
105
|
+
return this;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
public LegacyDatagramBuilder Push(ILegacyCommand command)
|
|
109
|
+
{
|
|
110
|
+
var op = command.CreateOp();
|
|
111
|
+
NativeLegacyClient.autd3_legacy_datagram_builder_push_legacy(Handle, op);
|
|
112
|
+
return this;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
public LegacyDatagramBuilder PushEach(Func<Device, ICommand?> factory)
|
|
116
|
+
{
|
|
117
|
+
var ops = new IntPtr[_numDevices];
|
|
118
|
+
try
|
|
119
|
+
{
|
|
120
|
+
for (var i = 0; i < _numDevices; i++)
|
|
121
|
+
{
|
|
122
|
+
var command = factory(_geometry[i]);
|
|
123
|
+
ops[i] = command == null ? IntPtr.Zero : command.CreateOp();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch
|
|
127
|
+
{
|
|
128
|
+
foreach (var op in ops)
|
|
129
|
+
{
|
|
130
|
+
if (op != IntPtr.Zero)
|
|
131
|
+
{
|
|
132
|
+
NativeClient.autd3_op_free(op);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
throw;
|
|
136
|
+
}
|
|
137
|
+
NativeLegacyClient.autd3_legacy_datagram_builder_push_each(Handle, ops, (UIntPtr)_numDevices);
|
|
138
|
+
return this;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
public LegacyFrames Build()
|
|
142
|
+
{
|
|
143
|
+
var err = new byte[256];
|
|
144
|
+
var handle = NativeLegacyClient.autd3_legacy_datagram_builder_build(Handle, _client, err, (UIntPtr)err.Length);
|
|
145
|
+
if (handle == IntPtr.Zero)
|
|
146
|
+
{
|
|
147
|
+
throw new Autd3Exception(NativeUtil.Utf8(err));
|
|
148
|
+
}
|
|
149
|
+
return new LegacyFrames(handle);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
public void Dispose()
|
|
153
|
+
{
|
|
154
|
+
if (Handle != IntPtr.Zero)
|
|
155
|
+
{
|
|
156
|
+
NativeLegacyClient.autd3_legacy_datagram_builder_free(Handle);
|
|
157
|
+
Handle = IntPtr.Zero;
|
|
158
|
+
}
|
|
159
|
+
GC.SuppressFinalize(this);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
~LegacyDatagramBuilder()
|
|
163
|
+
{
|
|
164
|
+
if (Handle != IntPtr.Zero)
|
|
165
|
+
{
|
|
166
|
+
NativeLegacyClient.autd3_legacy_datagram_builder_free(Handle);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
public readonly struct LegacyFrame
|
|
172
|
+
{
|
|
173
|
+
internal LegacyFrames Frames { get; }
|
|
174
|
+
internal long Index { get; }
|
|
175
|
+
|
|
176
|
+
internal LegacyFrame(LegacyFrames frames, long index)
|
|
177
|
+
{
|
|
178
|
+
Frames = frames;
|
|
179
|
+
Index = index;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
public sealed class LegacyFrames : IDisposable, IEnumerable<LegacyFrame>
|
|
184
|
+
{
|
|
185
|
+
internal IntPtr Handle { get; private set; }
|
|
186
|
+
|
|
187
|
+
internal LegacyFrames(IntPtr handle)
|
|
188
|
+
{
|
|
189
|
+
Handle = handle;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
public int Length => (int)NativeLegacyClient.autd3_legacy_frames_num_frames(Handle);
|
|
193
|
+
|
|
194
|
+
public LegacyFrame this[int index]
|
|
195
|
+
{
|
|
196
|
+
get
|
|
197
|
+
{
|
|
198
|
+
if (index < 0 || index >= Length)
|
|
199
|
+
{
|
|
200
|
+
throw new ArgumentOutOfRangeException(nameof(index));
|
|
201
|
+
}
|
|
202
|
+
return new LegacyFrame(this, index);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
public IEnumerator<LegacyFrame> GetEnumerator()
|
|
207
|
+
{
|
|
208
|
+
var count = Length;
|
|
209
|
+
for (long i = 0; i < count; i++)
|
|
210
|
+
{
|
|
211
|
+
yield return new LegacyFrame(this, i);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
|
216
|
+
|
|
217
|
+
public void Dispose()
|
|
218
|
+
{
|
|
219
|
+
if (Handle != IntPtr.Zero)
|
|
220
|
+
{
|
|
221
|
+
NativeLegacyClient.autd3_legacy_frames_free(Handle);
|
|
222
|
+
Handle = IntPtr.Zero;
|
|
223
|
+
}
|
|
224
|
+
GC.SuppressFinalize(this);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
~LegacyFrames()
|
|
228
|
+
{
|
|
229
|
+
if (Handle != IntPtr.Zero)
|
|
230
|
+
{
|
|
231
|
+
NativeLegacyClient.autd3_legacy_frames_free(Handle);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
public sealed class LegacyClient : IDisposable
|
|
237
|
+
{
|
|
238
|
+
internal IntPtr Handle { get; private set; }
|
|
239
|
+
|
|
240
|
+
private readonly Geometry _geometry;
|
|
241
|
+
|
|
242
|
+
private LegacyClient(IntPtr handle, Geometry geometry)
|
|
243
|
+
{
|
|
244
|
+
Handle = handle;
|
|
245
|
+
_geometry = geometry;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
public static async Task<LegacyClient> OpenAsync(Geometry geometry, ILegacyLink link, LegacyClientConfig config)
|
|
249
|
+
{
|
|
250
|
+
var opener = link.TakeLegacyOpener();
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
var configHandle = config.CreateHandle();
|
|
254
|
+
Task<IntPtr> task;
|
|
255
|
+
try
|
|
256
|
+
{
|
|
257
|
+
task = AsyncOps.InvokeAsync((cb, ud) =>
|
|
258
|
+
NativeLegacyClient.autd3_legacy_client_open(geometry.Handle, opener, configHandle, cb, ud));
|
|
259
|
+
}
|
|
260
|
+
finally
|
|
261
|
+
{
|
|
262
|
+
NativeLegacyClient.autd3_legacy_client_config_free(configHandle);
|
|
263
|
+
}
|
|
264
|
+
var value = await task.ConfigureAwait(false);
|
|
265
|
+
return new LegacyClient(value, geometry);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
public static async Task<(LegacyClient Client, Checker Checker)> OpenWithCheckerAsync(Geometry geometry, ILegacyLink link, LegacyClientConfig config)
|
|
269
|
+
{
|
|
270
|
+
var client = await OpenAsync(geometry, link, config).ConfigureAwait(false);
|
|
271
|
+
var checker = NativeLegacyClient.autd3_legacy_client_checker(client.Handle);
|
|
272
|
+
if (checker == IntPtr.Zero)
|
|
273
|
+
{
|
|
274
|
+
client.Dispose();
|
|
275
|
+
throw new Autd3Exception("failed to create checker");
|
|
276
|
+
}
|
|
277
|
+
return (client, new Checker(checker));
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
public int NumDevices => (int)NativeLegacyClient.autd3_legacy_client_num_devices(Handle);
|
|
281
|
+
|
|
282
|
+
public LegacyDatagramBuilder DatagramBuilder() => new LegacyDatagramBuilder(_geometry, Handle);
|
|
283
|
+
|
|
284
|
+
public Task SendCheckedAsync(LegacyFrame frame) =>
|
|
285
|
+
AsyncOps.InvokeAsync((cb, ud) =>
|
|
286
|
+
NativeLegacyClient.autd3_legacy_client_send_checked(Handle, frame.Frames.Handle, frame.Index, cb, ud));
|
|
287
|
+
|
|
288
|
+
public Task<byte[]> SendAsync(LegacyFrame frame) =>
|
|
289
|
+
Client.ReadByteArrayAsync((cb, ud) =>
|
|
290
|
+
NativeLegacyClient.autd3_legacy_client_send(Handle, frame.Frames.Handle, frame.Index, cb, ud));
|
|
291
|
+
|
|
292
|
+
public async Task<IReadOnlyList<string>> ReadFirmwareVersionAsync()
|
|
293
|
+
{
|
|
294
|
+
var array = await AsyncOps.InvokeAsync((cb, ud) =>
|
|
295
|
+
NativeLegacyClient.autd3_legacy_client_read_firmware_version(Handle, cb, ud)).ConfigureAwait(false);
|
|
296
|
+
try
|
|
297
|
+
{
|
|
298
|
+
var count = (int)NativeClient.autd3_string_array_len(array);
|
|
299
|
+
var versions = new List<string>(count);
|
|
300
|
+
for (var i = 0; i < count; i++)
|
|
301
|
+
{
|
|
302
|
+
versions.Add(NativeUtil.PtrToString(NativeClient.autd3_string_array_get(array, (UIntPtr)i)));
|
|
303
|
+
}
|
|
304
|
+
return versions;
|
|
305
|
+
}
|
|
306
|
+
finally
|
|
307
|
+
{
|
|
308
|
+
NativeClient.autd3_string_array_free(array);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
public async Task<IReadOnlyList<FpgaState>> ReadFpgaStateAsync()
|
|
313
|
+
{
|
|
314
|
+
var bytes = await Client.ReadByteArrayAsync((cb, ud) =>
|
|
315
|
+
NativeLegacyClient.autd3_legacy_client_read_fpga_state(Handle, cb, ud)).ConfigureAwait(false);
|
|
316
|
+
var states = new FpgaState[bytes.Length];
|
|
317
|
+
for (var i = 0; i < bytes.Length; i++)
|
|
318
|
+
{
|
|
319
|
+
states[i] = new FpgaState(bytes[i]);
|
|
320
|
+
}
|
|
321
|
+
return states;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
public Task StopAsync() =>
|
|
325
|
+
AsyncOps.InvokeAsync((cb, ud) => NativeLegacyClient.autd3_legacy_client_stop(Handle, cb, ud));
|
|
326
|
+
|
|
327
|
+
public Task CloseAsync() =>
|
|
328
|
+
AsyncOps.InvokeAsync((cb, ud) => NativeLegacyClient.autd3_legacy_client_close(Handle, cb, ud));
|
|
329
|
+
|
|
330
|
+
public void Dispose()
|
|
331
|
+
{
|
|
332
|
+
if (Handle != IntPtr.Zero)
|
|
333
|
+
{
|
|
334
|
+
NativeLegacyClient.autd3_legacy_client_free(Handle);
|
|
335
|
+
Handle = IntPtr.Zero;
|
|
336
|
+
}
|
|
337
|
+
GC.SuppressFinalize(this);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
~LegacyClient()
|
|
341
|
+
{
|
|
342
|
+
if (Handle != IntPtr.Zero)
|
|
343
|
+
{
|
|
344
|
+
NativeLegacyClient.autd3_legacy_client_free(Handle);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
package/Legacy.cs.meta
ADDED
package/Link.cs
CHANGED
package/Native.cs
CHANGED
|
@@ -19,7 +19,7 @@ namespace AUTD3
|
|
|
19
19
|
UIntPtr maxInflight,
|
|
20
20
|
uint maxResyncRounds,
|
|
21
21
|
uint resetResendCycles,
|
|
22
|
-
|
|
22
|
+
byte rtPriorityMode,
|
|
23
23
|
byte rtPriority,
|
|
24
24
|
[MarshalAs(UnmanagedType.I1)] bool hasRtAffinity,
|
|
25
25
|
UIntPtr rtAffinity,
|
|
@@ -44,7 +44,7 @@ namespace AUTD3
|
|
|
44
44
|
internal static extern void autd3_datagram_builder_free(IntPtr builder);
|
|
45
45
|
|
|
46
46
|
[DllImport(Lib)]
|
|
47
|
-
internal static extern IntPtr autd3_datagram_builder_build(IntPtr builder, byte[] outErr, UIntPtr outErrLen);
|
|
47
|
+
internal static extern IntPtr autd3_datagram_builder_build(IntPtr builder, IntPtr client, byte[] outErr, UIntPtr outErrLen);
|
|
48
48
|
|
|
49
49
|
[DllImport(Lib)]
|
|
50
50
|
internal static extern UIntPtr autd3_datagrams_num_frames(IntPtr datagrams);
|
|
@@ -135,4 +135,80 @@ namespace AUTD3
|
|
|
135
135
|
[DllImport(Lib)]
|
|
136
136
|
internal static extern void autd3_link_status_free(IntPtr status);
|
|
137
137
|
}
|
|
138
|
+
|
|
139
|
+
internal static class NativeLegacyClient
|
|
140
|
+
{
|
|
141
|
+
private const string Lib = "autd3capi";
|
|
142
|
+
|
|
143
|
+
[DllImport(Lib)]
|
|
144
|
+
internal static extern IntPtr autd3_legacy_client_config_new(
|
|
145
|
+
uint timeoutCycles,
|
|
146
|
+
[MarshalAs(UnmanagedType.I1)] bool hasRtPriority,
|
|
147
|
+
byte rtPriority,
|
|
148
|
+
[MarshalAs(UnmanagedType.I1)] bool hasRtAffinity,
|
|
149
|
+
UIntPtr rtAffinity);
|
|
150
|
+
|
|
151
|
+
[DllImport(Lib)]
|
|
152
|
+
internal static extern void autd3_legacy_client_config_free(IntPtr config);
|
|
153
|
+
|
|
154
|
+
[DllImport(Lib)]
|
|
155
|
+
internal static extern IntPtr autd3_legacy_datagram_builder_new(IntPtr geometry);
|
|
156
|
+
|
|
157
|
+
[DllImport(Lib)]
|
|
158
|
+
internal static extern void autd3_legacy_datagram_builder_push(IntPtr builder, IntPtr op);
|
|
159
|
+
|
|
160
|
+
[DllImport(Lib)]
|
|
161
|
+
internal static extern IntPtr autd3_legacy_op_change_segment(byte kind, byte bank, byte transitionMode, ulong transitionValue);
|
|
162
|
+
|
|
163
|
+
[DllImport(Lib)]
|
|
164
|
+
internal static extern void autd3_legacy_op_free(IntPtr op);
|
|
165
|
+
|
|
166
|
+
[DllImport(Lib)]
|
|
167
|
+
internal static extern void autd3_legacy_datagram_builder_push_legacy(IntPtr builder, IntPtr op);
|
|
168
|
+
|
|
169
|
+
[DllImport(Lib)]
|
|
170
|
+
internal static extern void autd3_legacy_datagram_builder_push_each(IntPtr builder, IntPtr[] ops, UIntPtr numDevices);
|
|
171
|
+
|
|
172
|
+
[DllImport(Lib)]
|
|
173
|
+
internal static extern void autd3_legacy_datagram_builder_free(IntPtr builder);
|
|
174
|
+
|
|
175
|
+
[DllImport(Lib)]
|
|
176
|
+
internal static extern IntPtr autd3_legacy_datagram_builder_build(IntPtr builder, IntPtr client, byte[] outErr, UIntPtr outErrLen);
|
|
177
|
+
|
|
178
|
+
[DllImport(Lib)]
|
|
179
|
+
internal static extern UIntPtr autd3_legacy_frames_num_frames(IntPtr frames);
|
|
180
|
+
|
|
181
|
+
[DllImport(Lib)]
|
|
182
|
+
internal static extern void autd3_legacy_frames_free(IntPtr frames);
|
|
183
|
+
|
|
184
|
+
[DllImport(Lib)]
|
|
185
|
+
internal static extern void autd3_legacy_client_open(IntPtr geometry, IntPtr link, IntPtr config, CompletionCallback cb, IntPtr userData);
|
|
186
|
+
|
|
187
|
+
[DllImport(Lib)]
|
|
188
|
+
internal static extern UIntPtr autd3_legacy_client_num_devices(IntPtr client);
|
|
189
|
+
|
|
190
|
+
[DllImport(Lib)]
|
|
191
|
+
internal static extern void autd3_legacy_client_send(IntPtr client, IntPtr frames, long frame, CompletionCallback cb, IntPtr userData);
|
|
192
|
+
|
|
193
|
+
[DllImport(Lib)]
|
|
194
|
+
internal static extern void autd3_legacy_client_send_checked(IntPtr client, IntPtr frames, long frame, CompletionCallback cb, IntPtr userData);
|
|
195
|
+
|
|
196
|
+
[DllImport(Lib)]
|
|
197
|
+
internal static extern void autd3_legacy_client_read_firmware_version(IntPtr client, CompletionCallback cb, IntPtr userData);
|
|
198
|
+
|
|
199
|
+
[DllImport(Lib)]
|
|
200
|
+
internal static extern void autd3_legacy_client_read_fpga_state(IntPtr client, CompletionCallback cb, IntPtr userData);
|
|
201
|
+
|
|
202
|
+
[DllImport(Lib)]
|
|
203
|
+
internal static extern IntPtr autd3_legacy_client_checker(IntPtr client);
|
|
204
|
+
|
|
205
|
+
[DllImport(Lib)]
|
|
206
|
+
internal static extern void autd3_legacy_client_stop(IntPtr client, CompletionCallback cb, IntPtr userData);
|
|
207
|
+
|
|
208
|
+
[DllImport(Lib)]
|
|
209
|
+
internal static extern void autd3_legacy_client_close(IntPtr client, CompletionCallback cb, IntPtr userData);
|
|
210
|
+
|
|
211
|
+
[DllImport(Lib)]
|
|
212
|
+
internal static extern void autd3_legacy_client_free(IntPtr client);
|
|
213
|
+
}
|
|
138
214
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/README.md
CHANGED
|
@@ -2,41 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The AUTD3 client: opening a link, sending datagrams and driving STM.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Add the scoped registry and the package to `Packages/manifest.json`; sibling
|
|
8
|
-
AUTD3 packages are resolved from the registry automatically.
|
|
9
|
-
|
|
10
|
-
```json
|
|
11
|
-
{
|
|
12
|
-
"scopedRegistries": [
|
|
13
|
-
{ "name": "npmjs", "url": "https://registry.npmjs.org", "scopes": ["com.shinolab"] }
|
|
14
|
-
],
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"com.shinolab.autd3-sdk": "0.1.0"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Packages served from `registry.npmjs.org` do **not** appear in the Package Manager's
|
|
22
|
-
*My Registries* tab, because npmjs does not implement the legacy `/-/all` route that
|
|
23
|
-
Unity's package listing relies on. Resolution is unaffected: edit the manifest as above,
|
|
24
|
-
or use **+ → Add package by name**.
|
|
25
|
-
|
|
26
|
-
The bundled `Focus Sine` sample additionally needs `com.shinolab.autd3-sdk.link.nop`.
|
|
27
|
-
|
|
28
|
-
## Platforms
|
|
29
|
-
|
|
30
|
-
Editor and Standalone builds on Windows (`win-x64`), Linux (`linux-x64`) and Apple
|
|
31
|
-
Silicon macOS (`osx-arm64`). Intel macOS is not shipped.
|
|
32
|
-
|
|
33
|
-
## Notes
|
|
34
|
-
|
|
35
|
-
Minimum Unity version is 6 (6000.x). The API speaks Unity's left-handed, metre frame;
|
|
36
|
-
conversion to the AUTD3 canonical frame happens at the binding boundary.
|
|
37
|
-
|
|
38
|
-
See the [Unity binding README](https://github.com/shinolab/autd3-sdk/blob/main/bindings/unity/README.md) for the
|
|
39
|
-
coordinate system, the full package list and local development with `file:` references.
|
|
5
|
+
See the [Unity binding README](https://github.com/shinolab/autd3-sdk/blob/main/bindings/unity/README.md) for more details.
|
|
40
6
|
|
|
41
7
|
## License
|
|
42
8
|
|
package/THIRD-PARTY-LICENSES.md
CHANGED
|
@@ -886,10 +886,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
886
886
|
|
|
887
887
|
Used by:
|
|
888
888
|
|
|
889
|
-
- autd3-ffi 0.
|
|
890
|
-
- autd3-ffi-abi 0.
|
|
891
|
-
- autd3-rs 0.
|
|
892
|
-
- autd3-rs-core 0.
|
|
889
|
+
- autd3-ffi 0.5.0 — https://github.com/shinolab/autd3-sdk
|
|
890
|
+
- autd3-ffi-abi 0.5.0 — https://github.com/shinolab/autd3-sdk
|
|
891
|
+
- autd3-rs 0.5.0 — https://github.com/shinolab/autd3-sdk
|
|
892
|
+
- autd3-rs-core 0.5.0 — https://github.com/shinolab/autd3-sdk
|
|
893
893
|
- autd3-cpu-wire 0.4.0 — https://github.com/shinolab/autd3-sdk
|
|
894
894
|
- chrono 0.4.45 — https://github.com/chronotope/chrono
|
|
895
895
|
- wide 1.5.0 — https://github.com/Lokathor/wide
|
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.
|
|
8
|
+
"version": "0.5.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.
|
|
19
|
-
"com.shinolab.autd3-sdk.pattern": "0.
|
|
20
|
-
"com.shinolab.autd3-sdk.modulation": "0.
|
|
18
|
+
"com.shinolab.autd3-sdk.core": "0.5.0",
|
|
19
|
+
"com.shinolab.autd3-sdk.pattern": "0.5.0",
|
|
20
|
+
"com.shinolab.autd3-sdk.modulation": "0.5.0"
|
|
21
21
|
},
|
|
22
22
|
"samples": [
|
|
23
23
|
{
|