Tanoda
LeapCTests.cs
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) Ultraleap, Inc. 2011-2020. *
3 * *
4 * Use subject to the terms of the Apache License 2.0 available at *
5 * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
6 * between Ultraleap and you, your company or other organization. *
7 ******************************************************************************/
8
9#if !UNITY_EDITOR_LINUX
10
11using System;
12using System.Threading;
13using System.Runtime.InteropServices;
14
15using NUnit.Framework;
16using LeapInternal;
17
18namespace Leap.LeapCSharp.Tests {
19
20 [TestFixture]
21 public class LeapCTests {
22
23 [Test]
24 public void TestNow() {
25 long start = LeapC.GetNow();
26 Thread.Sleep(1);
27
28 long stop = LeapC.GetNow();
29 long delta = stop - start;
30
31 Assert.Greater(delta, 200);
32 Assert.Less(delta, 1800);
33 }
34
35 [Test]
36 public void TestRebaserLifeCycle() {
37 IntPtr rebaser = IntPtr.Zero;
38 eLeapRS result = LeapC.CreateClockRebaser(out rebaser);
39 Assert.True(result == eLeapRS.eLeapRS_Success);
40 Assert.AreNotEqual(IntPtr.Zero, rebaser, "Handle no longer zero");
41
42 Int64 sysNow = DateTime.Now.Millisecond;
43 Int64 leapNow = LeapC.GetNow();
44 result = LeapC.UpdateRebase(rebaser, sysNow, leapNow);
45 Assert.True(result == eLeapRS.eLeapRS_Success);
46
47 Int64 rebasedTime;
48 result = LeapC.RebaseClock(rebaser, sysNow + 10, out rebasedTime);
49 Assert.True(result == eLeapRS.eLeapRS_Success);
50
51 Logger.Log("Rebased: " + rebasedTime);
53 }
54
55 [Test]
56 public void TestCreateConnection() {
57 eLeapRS result;
59 config.server_namespace = Marshal.StringToHGlobalAnsi("Leap Service");
60 config.flags = 0;
61 config.size = (uint)Marshal.SizeOf(config);
62 IntPtr connHandle = IntPtr.Zero;
63 result = LeapC.CreateConnection(ref config, out connHandle);
64 Assert.AreEqual(eLeapRS.eLeapRS_Success, result);
65 Assert.False(connHandle == IntPtr.Zero, "Configured connection failed.");
66
67 IntPtr defConn = IntPtr.Zero;
68 result = LeapC.CreateConnection(out defConn);
69 Assert.False(defConn == IntPtr.Zero, "Default config connection failed.");
70 Assert.AreEqual(eLeapRS.eLeapRS_Success, result);
71 Marshal.FreeHGlobal(config.server_namespace);
72 }
73
74 [Ignore("info.status is not returning true even though the result was returned "
75 + "as successful. See the commented-out assert at the bottom of the test.")]
76 [Test]
77 public void TestOpenConnection() {
78 IntPtr connHandle = IntPtr.Zero;
79 eLeapRS result = LeapC.CreateConnection(out connHandle);
80 Assert.AreEqual(eLeapRS.eLeapRS_Success, result);
81
82 result = LeapC.OpenConnection(connHandle);
83 Assert.AreEqual(eLeapRS.eLeapRS_Success, result);
84
86 info.size = (uint)Marshal.SizeOf(typeof(LEAP_CONNECTION_INFO));
87 result = LeapC.GetConnectionInfo(connHandle, ref info);
88 Assert.AreEqual(eLeapRS.eLeapRS_Success, result);
89
90 // Assert.AreEqual(eLeapConnectionStatus.eLeapConnectionStatus_Connected, info.status, "Status: " + info.status);
91 }
92
93 [Test]
94 public void TestGetConnectionInfo() {
95 IntPtr connHandle = IntPtr.Zero;
96 eLeapRS result;
98 info.status = eLeapConnectionStatus.eLeapConnectionStatus_HandshakeIncomplete;
99 info.size = (uint)Marshal.SizeOf(typeof(LEAP_CONNECTION_INFO));
100 result = LeapC.GetConnectionInfo(connHandle, ref info);
101 Assert.AreEqual(eLeapRS.eLeapRS_InvalidArgument, result);
102
104 result = LeapC.CreateConnection(ref config, out connHandle);
105 Assert.AreEqual(eLeapRS.eLeapRS_Success, result);
106
107 result = LeapC.GetConnectionInfo(connHandle, ref info);
108 Assert.AreEqual(eLeapRS.eLeapRS_Success, result);
109 Assert.AreEqual(eLeapConnectionStatus.eLeapConnectionStatus_NotConnected, info.status, "Not connected before OpenConnection");
110
111 result = LeapC.OpenConnection(connHandle);
112 Assert.AreEqual(eLeapRS.eLeapRS_Success, result);
113 int polls = 10;
114 for (int i = 1; i <= polls; i++) {
116 uint timeout = 1;
117 result = LeapC.PollConnection(connHandle, timeout, ref msg);
118 if (result == eLeapRS.eLeapRS_Success) break;
119 }
120
121 result = LeapC.GetConnectionInfo(connHandle, ref info);
122 Assert.AreEqual(eLeapRS.eLeapRS_Success, result);
123 Assert.AreEqual(eLeapConnectionStatus.eLeapConnectionStatus_Connected, info.status, "Connection info says we are connected");
124
125 }
126
127 [Test]
128 public void TestPollConnection() {
130 IntPtr connHandle = IntPtr.Zero;
131 eLeapRS result = LeapC.CreateConnection(ref config, out connHandle);
132 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Created connection");
133
134 result = LeapC.OpenConnection(connHandle);
135 Assert.AreEqual(eLeapRS.eLeapRS_Success, result);
136 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Opened connection");
137
138 int polls = 10;
139 for (int i = 1; i <= polls; i++) {
141 uint timeout = 1;
142 result = LeapC.PollConnection(connHandle, timeout, ref msg);
143 Console.WriteLine("Poll #" + i + " Msg type: " + msg.type + " result type: " + result);
144
145 Assert.True(result == eLeapRS.eLeapRS_Success || result == eLeapRS.eLeapRS_Timeout, "Poll #" + i + " of " + polls);
146 //Thread.Sleep (54);
147 }
148 }
149
150 [Test]
151 public void TestInterpolateFrames() {
153 IntPtr connHandle = IntPtr.Zero;
154 eLeapRS result = LeapC.CreateConnection(ref config, out connHandle);
155 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Created connection");
156
157 result = LeapC.OpenConnection(connHandle);
158 Assert.AreEqual(eLeapRS.eLeapRS_Success, result);
159
160 //Get 6 frames
161 int polls = 100;
162 int frameCount = 0;
163 LEAP_TRACKING_EVENT firstBefore = new LEAP_TRACKING_EVENT(); // Prevent
164 LEAP_TRACKING_EVENT first = new LEAP_TRACKING_EVENT(); // 'unassigned'
165 LEAP_TRACKING_EVENT firstAfter = new LEAP_TRACKING_EVENT(); // errors.
166 LEAP_TRACKING_EVENT tenthBefore;
168 LEAP_TRACKING_EVENT tenthAfter;
169 int selected = 5;
170 for (int i = 1; i <= polls; i++) {
172 uint timeout = 100;
173 result = LeapC.PollConnection(connHandle, timeout, ref msg);
174 if (msg.type == eLeapEventType.eLeapEventType_Tracking) {
175 if (frameCount == selected - 1)
176 StructMarshal<LEAP_TRACKING_EVENT>.PtrToStruct(msg.eventStructPtr, out firstBefore);
177 if (frameCount == selected)
178 StructMarshal<LEAP_TRACKING_EVENT>.PtrToStruct(msg.eventStructPtr, out first);
179 if (frameCount == selected + 1)
180 StructMarshal<LEAP_TRACKING_EVENT>.PtrToStruct(msg.eventStructPtr, out firstAfter);
181 if (frameCount == selected + 2)
182 StructMarshal<LEAP_TRACKING_EVENT>.PtrToStruct(msg.eventStructPtr, out tenthBefore);
183 if (frameCount == selected + 3)
184 StructMarshal<LEAP_TRACKING_EVENT>.PtrToStruct(msg.eventStructPtr, out tenth);
185 if (frameCount == selected + 4) {
186 StructMarshal<LEAP_TRACKING_EVENT>.PtrToStruct(msg.eventStructPtr, out tenthAfter);
187 break;
188 }
189 frameCount++;
190 }
191 }
192 //Int64 halfTime = (first.info.timestamp - firstBefore.info.timestamp)/2;
193 Int64 testTime = first.info.timestamp;// + halfTime;
194 UInt64 size;
195 Logger.Log("PrevF : " + firstBefore.info.timestamp);
196 Logger.Log("Test : " + testTime);
197 Logger.Log("NextF : " + firstAfter.info.timestamp);
198
199 result = LeapC.GetFrameSize(connHandle, testTime, out size);
200 Logger.Log("Size: " + size);
201 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Frame size call succeeded " + result.indexOf());
202
203 IntPtr trackingBuffer = Marshal.AllocHGlobal((Int32)size);
204 result = LeapC.InterpolateFrame(connHandle, testTime, trackingBuffer, size);
205 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Frame interpolation succeeded.");
206
207 LEAP_TRACKING_EVENT tracking_evt;
208 StructMarshal<LEAP_TRACKING_EVENT>.PtrToStruct(trackingBuffer, out tracking_evt);
209 Assert.AreEqual(first.info.frame_id, tracking_evt.info.frame_id, "Interpolated frame has ID");
210 Marshal.FreeHGlobal(trackingBuffer);
211
212 }
213
214 [Test]
215 public void TestGetDeviceList() {
216 IntPtr connHandle = IntPtr.Zero;
217 eLeapRS result = LeapC.CreateConnection(out connHandle);
218 Assert.AreEqual(eLeapRS.eLeapRS_Success, result);
219
220 result = LeapC.OpenConnection(connHandle);
221 Assert.AreEqual(eLeapRS.eLeapRS_Success, result);
222
223 //Wait for device event
225 uint timeout = 100;
226 int tries = 100;
227 for (int t = 0; t < tries; t++) {
228 result = LeapC.PollConnection(connHandle, timeout, ref msg);
229 if (msg.type == eLeapEventType.eLeapEventType_Device)
230 break;
231 }
232
233 //Get device count
234 UInt32 deviceCount = 0;
235 result = LeapC.GetDeviceCount(connHandle, out deviceCount);
236 Logger.Log("DC: " + deviceCount);
237 //Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Device count call successful");
238 Assert.Greater(deviceCount, 0, deviceCount + " devices exist");
239
240 UInt32 validDeviceHandles = deviceCount;
241 LEAP_DEVICE_REF[] deviceList = new LEAP_DEVICE_REF[deviceCount];
242 result = LeapC.GetDeviceList(connHandle, deviceList, out validDeviceHandles);
243 Assert.AreEqual(deviceCount, validDeviceHandles, validDeviceHandles + " existing devices are valid");
244 Logger.Log("VDHC: " + validDeviceHandles);
245
246 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Device list call successful");
247 }
248
249 [Test]
250 public void TestOpenDevice() {
251 IntPtr connHandle = IntPtr.Zero;
252 eLeapRS result = LeapC.CreateConnection(out connHandle);
253 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Connection created");
254
255 //Open connection
256 result = LeapC.OpenConnection(connHandle);
257 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Opened connection.");
258
259 //Wait for device event
261 uint timeout = 100;
262 int tries = 100;
263 for (int t = 0; t < tries; t++) {
264 result = LeapC.PollConnection(connHandle, timeout, ref msg);
265 if (msg.type == eLeapEventType.eLeapEventType_Device)
266 break;
267 }
268
269 //Get device count
270 UInt32 deviceCount = 0;
271 result = LeapC.GetDeviceCount(connHandle, out deviceCount);
272 Assert.True(eLeapRS.eLeapRS_Success == result || eLeapRS.eLeapRS_InsufficientBuffer == result, "Device count call successful ");
273 Assert.Greater(deviceCount, 0, "Devices exist");
274
275 UInt32 validDeviceHandles = deviceCount;
276 LEAP_DEVICE_REF[] deviceList = new LEAP_DEVICE_REF[deviceCount];
277 result = LeapC.GetDeviceList(connHandle, deviceList, out validDeviceHandles);
278 Assert.AreEqual(deviceCount, validDeviceHandles, "Existing devices are valid");
279
280 foreach (LEAP_DEVICE_REF deviceRef in deviceList) {
281 IntPtr device;
282 Logger.LogStruct(deviceRef);
283 result = LeapC.OpenDevice(deviceRef, out device);
284 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Call successful");
285 Assert.AreNotEqual(IntPtr.Zero, device, "Device handle not zero");
286 }
287 }
288
289 [Test]
290 public void TestGetDeviceInfo() {
291 IntPtr connHandle = IntPtr.Zero;
292 eLeapRS result = LeapC.CreateConnection(out connHandle);
293 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Connection created");
294
295 //Open connection
296 result = LeapC.OpenConnection(connHandle);
297 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Opened connection.");
298
299 //Wait for device event
301 uint timeout = 100;
302 int tries = 100;
303 for (int t = 0; t < tries; t++) {
304 result = LeapC.PollConnection(connHandle, timeout, ref msg);
305 if (msg.type == eLeapEventType.eLeapEventType_Device)
306 break;
307 }
308
309 //Get device count
310 UInt32 deviceCount = 0;
311 result = LeapC.GetDeviceCount(connHandle, out deviceCount);
312 Assert.True(eLeapRS.eLeapRS_Success == result || eLeapRS.eLeapRS_InsufficientBuffer == result, "Device count call successful ");
313 Assert.Greater(deviceCount, 0, "Devices exist");
314
315 UInt32 validDeviceHandles = deviceCount;
316 LEAP_DEVICE_REF[] deviceList = new LEAP_DEVICE_REF[deviceCount];
317 result = LeapC.GetDeviceList(connHandle, deviceList, out validDeviceHandles);
318 Assert.AreEqual(deviceCount, validDeviceHandles, "Existing devices are valid");
319
320 foreach (LEAP_DEVICE_REF deviceRef in deviceList) {
321 IntPtr device;
322 Logger.LogStruct(deviceRef);
323 result = LeapC.OpenDevice(deviceRef, out device);
324 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Call successful");
325 LEAP_DEVICE_INFO deviceInfo = new LEAP_DEVICE_INFO();
326 int defaultLength = 1;
327 deviceInfo.serial = Marshal.AllocCoTaskMem(defaultLength);
328 deviceInfo.size = (uint)Marshal.SizeOf(deviceInfo);
329 Logger.Log("DeviceInfo size: " + deviceInfo.size);
330 deviceInfo.serial_length = (uint)defaultLength;
331 Logger.LogStruct(deviceInfo, "Before: ");
332 result = LeapC.GetDeviceInfo(device, ref deviceInfo);
333 Assert.AreEqual(eLeapRS.eLeapRS_InsufficientBuffer, result, "not enough buffer");
334 if (deviceInfo.serial_length != (uint)defaultLength) {
335 deviceInfo.serial = Marshal.AllocCoTaskMem((int)deviceInfo.serial_length);
336 deviceInfo.size = (uint)Marshal.SizeOf(deviceInfo);
337 result = LeapC.GetDeviceInfo(device, ref deviceInfo);
338 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "2nd Call successful");
339 }
340 Logger.LogStruct(deviceInfo, "After: ");
341 string serialnumber = Marshal.PtrToStringAnsi(deviceInfo.serial);
342 Logger.Log(serialnumber);
343 }
344 }
345
346 [Test]
347 public void TestGetOneDeviceInfo() {
348 IntPtr connHandle = IntPtr.Zero;
349 eLeapRS result = LeapC.CreateConnection(out connHandle);
350 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Connection created");
351
352 //Open connection
353 result = LeapC.OpenConnection(connHandle);
354 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Opened connection.");
355
356 //Wait for device event
358 uint timeout = 100;
359 int tries = 100;
360 for (int t = 0; t < tries; t++) {
361 result = LeapC.PollConnection(connHandle, timeout, ref msg);
362 if (msg.type == eLeapEventType.eLeapEventType_Device)
363 break;
364 }
365
366 LEAP_DEVICE_EVENT device_evt;
367 StructMarshal<LEAP_DEVICE_EVENT>.PtrToStruct(msg.eventStructPtr, out device_evt);
368 IntPtr device;
369 result = LeapC.OpenDevice(device_evt.device, out device);
370 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Call successful");
371 LEAP_DEVICE_INFO deviceInfo = new LEAP_DEVICE_INFO();
372 int defaultLength = 1;
373 deviceInfo.serial = Marshal.AllocCoTaskMem(defaultLength);
374 deviceInfo.size = (uint)Marshal.SizeOf(deviceInfo);
375 Logger.Log("DeviceInfo size: " + deviceInfo.size);
376 deviceInfo.serial_length = (uint)defaultLength;
377 Logger.LogStruct(deviceInfo, "Before: ");
378 result = LeapC.GetDeviceInfo(device, ref deviceInfo);
379 Assert.AreEqual(eLeapRS.eLeapRS_InsufficientBuffer, result, "not enough buffer");
380 if (deviceInfo.serial_length != (uint)defaultLength) {
381 Marshal.FreeCoTaskMem(deviceInfo.serial);
382 deviceInfo.serial = Marshal.AllocCoTaskMem((int)deviceInfo.serial_length);
383 deviceInfo.size = (uint)Marshal.SizeOf(deviceInfo);
384 result = LeapC.GetDeviceInfo(device, ref deviceInfo);
385 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "2nd Call successful");
386 }
387 Logger.LogStruct(deviceInfo, "After: ");
388 string serialnumber = Marshal.PtrToStringAnsi(deviceInfo.serial);
389 Marshal.FreeCoTaskMem(deviceInfo.serial);
390 Logger.Log(serialnumber);
391 }
392
393 [Test]
394 public void TestSetPolicyFlags() {
395 IntPtr connHandle = IntPtr.Zero;
396 eLeapRS result = LeapC.CreateConnection(out connHandle);
397 Assert.AreEqual(eLeapRS.eLeapRS_Success, result);
398
399 result = LeapC.OpenConnection(connHandle);
400 Assert.AreEqual(eLeapRS.eLeapRS_Success, result);
401
402 //Wait for device event
404 uint timeout = 100;
405 int tries = 100;
406 for (int t = 0; t < tries; t++) {
407 result = LeapC.PollConnection(connHandle, timeout, ref msg);
408 if (msg.type == eLeapEventType.eLeapEventType_Device)
409 break;
410 }
411
412 UInt64 setFlags = 0;
413 UInt64 clearFlags = 0;
414 result = LeapC.SetPolicyFlags(connHandle, setFlags, clearFlags);
415 Logger.Log(result);
416 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "SetDevicePolicyFlags Call");
417 }
418
419 //public static extern eLeapRS LeapSetDeviceFlags (LEAP_DEVICE hDevice, UInt64 set, UInt64 clear, out UInt64* prior);
420 [Test]
421 public void TestSetDeviceFlags() {
423 IntPtr connHandle = IntPtr.Zero;
424 eLeapRS result = LeapC.CreateConnection(ref config, out connHandle);
425 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Connection created");
426
427 //Open connection
428 result = LeapC.OpenConnection(connHandle);
429 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Opened connection.");
430
431 //Wait for device event
433 uint timeout = 100;
434 int tries = 100;
435 for (int t = 0; t < tries; t++) {
436 result = LeapC.PollConnection(connHandle, timeout, ref msg);
437 if (msg.type == eLeapEventType.eLeapEventType_Device)
438 break;
439 }
440
441 //Get device count
442 UInt32 deviceCount = 0;
443 result = LeapC.GetDeviceCount(connHandle, out deviceCount);
444 Assert.AreEqual(eLeapRS.eLeapRS_InsufficientBuffer, result, "GetDeviceCount Call ");
445 Assert.Greater(deviceCount, 0, "Devices exist");
446
447 UInt32 validDeviceHandles = deviceCount;
448 LEAP_DEVICE_REF[] deviceList = new LEAP_DEVICE_REF[deviceCount];
449 result = LeapC.GetDeviceList(connHandle, deviceList, out validDeviceHandles);
450 Assert.AreEqual(deviceCount, validDeviceHandles, "Existing devices are valid");
451
452 foreach (LEAP_DEVICE_REF deviceRef in deviceList) {
453 IntPtr device;
454 result = LeapC.OpenDevice(deviceRef, out device);
455 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "OpenDevice Call successful");
456 //UInt64 setFlags = 0, clearFlags = 0, priorFlags = 0;
457 //result = LeapC.SetDeviceFlags(device, setFlags, clearFlags, out priorFlags);
458 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "SetDeviceFlags Call successful");
459 }
460 }
461
462 //public static extern void LeapCloseDevice (LEAP_DEVICE pDevice);
463 [Test]
464 public void TestCloseDevice() {
465 IntPtr connHandle = IntPtr.Zero;
466 eLeapRS result = LeapC.CreateConnection(out connHandle);
467 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Connection created");
468
469 //Open connection
470 result = LeapC.OpenConnection(connHandle);
471 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Opened connection.");
472
473 //Wait for device event
475 uint timeout = 100;
476 int tries = 100;
477 for (int t = 0; t < tries; t++) {
478 result = LeapC.PollConnection(connHandle, timeout, ref msg);
479 if (msg.type == eLeapEventType.eLeapEventType_Device)
480 break;
481 }
482
483 //Get device count
484 UInt32 deviceCount = 0;
485 result = LeapC.GetDeviceCount(connHandle, out deviceCount);
486 Assert.Greater(deviceCount, 0, "Devices exist: " + deviceCount);
487 // Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "GetDeviceCount Call successful");
488
489 UInt32 validDeviceHandles = deviceCount;
490 LEAP_DEVICE_REF[] deviceList = new LEAP_DEVICE_REF[deviceCount];
491 result = LeapC.GetDeviceList(connHandle, deviceList, out validDeviceHandles);
492 Assert.AreEqual(deviceCount, validDeviceHandles, "Existing devices are valid");
493
494 foreach (LEAP_DEVICE_REF deviceRef in deviceList) {
495 IntPtr device;
496 //Assert.True (false, "This test is blocked by a bug -- device handle always 0");
497 result = LeapC.OpenDevice(deviceRef, out device);
498 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "OpenDevice Call successful");
499 LeapC.CloseDevice(device); //TODO How to verify?
500 }
501 }
502
503 //public static extern void LeapDestroyConnection (LEAP_CONNECTION connection);
504 [Test]
505 public void TestDestroyConnection() {
507 IntPtr connHandle = IntPtr.Zero;
508 eLeapRS result = LeapC.CreateConnection(ref config, out connHandle);
509 Assert.AreEqual(eLeapRS.eLeapRS_Success, result);
510 Assert.False(connHandle == IntPtr.Zero, "configured connection failed.");
511 LeapC.DestroyConnection(connHandle); //TODO How to verify?
512 }
513
514 [Test]
516 IntPtr connHandle = IntPtr.Zero;
517 eLeapRS result = LeapC.CreateConnection(out connHandle);
518 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Connection created");
519
520 //Open connection
521 result = LeapC.OpenConnection(connHandle);
522 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Opened connection.");
523
524 //Wait for device event
526 uint timeout = 100;
527 int tries = 100;
528 for (int t = 0; t < tries; t++) {
529 result = LeapC.PollConnection(connHandle, timeout, ref msg);
530 if (msg.type == eLeapEventType.eLeapEventType_Device)
531 break;
532 }
533
534 UInt32 requestId = 1;
535 result = LeapC.SaveConfigValue(connHandle, "image_processing_auto_flip", false, out requestId);
536 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Config save requested");
538
539 timeout = 100;
540 int attempts = 1000;
541 for (int t = 0; t < attempts; t++) {
542 result = LeapC.PollConnection(connHandle, timeout, ref configMsg);
543 if (configMsg.type == eLeapEventType.eLeapEventType_ConfigChange)
544 break;
545 }
546 Assert.AreEqual(eLeapEventType.eLeapEventType_ConfigChange, configMsg.type);
548 StructMarshal<LEAP_CONFIG_CHANGE_EVENT>.PtrToStruct(configMsg.eventStructPtr, out response);
549 UInt32 ReturnedRequestID = response.requestId;
550 Assert.AreEqual(requestId, ReturnedRequestID, "Request ID is the same");
551 UnityEngine.Debug.Log("Response status: " + response.status);
552 Assert.True(response.status == true, "Save successful");
553
554 //read the value back
555 UInt32 requestID = 1;
556 result = LeapC.RequestConfigValue(connHandle, "image_processing_auto_flip", out requestID);
557 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Config value requested");
558 configMsg = new LEAP_CONNECTION_MESSAGE();
559
560 timeout = 100;
561 attempts = 1000;
562 for (int t = 0; t < attempts; t++) {
563 result = LeapC.PollConnection(connHandle, timeout, ref configMsg);
564 //Logger.Log ("Msg type: " + configMsg.type);
565 if (configMsg.type == eLeapEventType.eLeapEventType_ConfigResponse)
566 break;
567 }
568 Assert.AreEqual(eLeapEventType.eLeapEventType_ConfigResponse, configMsg.type);
569 LEAP_CONFIG_RESPONSE_EVENT set_response;
570 StructMarshal<LEAP_CONFIG_RESPONSE_EVENT>.PtrToStruct(configMsg.eventStructPtr, out set_response);
571 Logger.LogStruct(configMsg);
572 Logger.LogStruct(set_response);
573 Logger.LogStruct(set_response.value);
574 ReturnedRequestID = set_response.requestId;
575 Assert.AreEqual(requestID, ReturnedRequestID, "Request ID is the same");
576 Assert.AreEqual(eLeapValueType.eLeapValueType_Boolean, set_response.value.type, "Got a Boolean value");
577 Assert.False(set_response.value.boolValue == 0, "Auto-flip is disabled");
578
579 //Set to opposite boolean
580 result = LeapC.SaveConfigValue(connHandle, "image_processing_auto_flip", (set_response.value.boolValue == 0 ? true : false), out requestId);
581
582 //read the value back again
583 requestID = 2;
584 result = LeapC.RequestConfigValue(connHandle, "image_processing_auto_flip", out requestID);
585 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Config value requested");
586 configMsg = new LEAP_CONNECTION_MESSAGE();
587
588 timeout = 100;
589 attempts = 1000;
590 for (int t = 0; t < attempts; t++) {
591 result = LeapC.PollConnection(connHandle, timeout, ref configMsg);
592 //Logger.Log ("Msg type: " + configMsg.type);
593 if (configMsg.type == eLeapEventType.eLeapEventType_ConfigResponse)
594 break;
595 }
596 StructMarshal<LEAP_CONFIG_RESPONSE_EVENT>.PtrToStruct(configMsg.eventStructPtr, out set_response);
597 Logger.LogStruct(configMsg);
598 Logger.LogStruct(set_response);
599 Logger.LogStruct(set_response.value);
600 ReturnedRequestID = set_response.requestId;
601 Assert.AreEqual(requestID, ReturnedRequestID, "Request ID is the same");
602 Assert.AreEqual(eLeapValueType.eLeapValueType_Boolean, set_response.value.type, "Got a Boolean value");
603 Assert.True(set_response.value.boolValue == 1, "Auto-flip is enabled again");
604 }
605
606 [Ignore("There are no public-facing float config settings. (The LeapC gestures API is "
607 + "deprecated.")]
608 [Test]
609 public void TestReadFloatConfig() {
610 IntPtr connHandle = IntPtr.Zero;
611 eLeapRS result = LeapC.CreateConnection(out connHandle);
612 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Connection created");
613
614 //Open connection
615 result = LeapC.OpenConnection(connHandle);
616 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Opened connection.");
617
618 //Wait for device event
620 uint timeout = 100;
621 int tries = 100;
622 for (int t = 0; t < tries; t++) {
623 result = LeapC.PollConnection(connHandle, timeout, ref msg);
624 if (msg.type == eLeapEventType.eLeapEventType_Device)
625 break;
626 }
627 UInt32 requestID = 1;
628 result = LeapC.RequestConfigValue(connHandle, "Gesture.Swipe.MinVelocity", out requestID);
629 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Config value requested");
631
632 timeout = 10;
633 int attempts = 100;
634 for (int t = 0; t < attempts; t++) {
635 result = LeapC.PollConnection(connHandle, timeout, ref configMsg);
636 Logger.Log("Msg type: " + configMsg.type);
637 if (configMsg.type == eLeapEventType.eLeapEventType_ConfigResponse)
638 break;
639 }
641 StructMarshal<LEAP_CONFIG_RESPONSE_EVENT>.PtrToStruct(configMsg.eventStructPtr, out response);
642 UInt32 ReturnedRequestID = response.requestId;
643 Assert.AreEqual(requestID, ReturnedRequestID, "Request ID is the same");
644 Assert.AreEqual(eLeapValueType.eLeapValueType_Float, response.value.type, "Got a Float value");
645 Assert.True(response.value.floatValue != float.NaN, "Is a float");
646 Assert.AreEqual(1000, response.value.floatValue, "Swipe min velocity is 3mm, the default value");
647 }
648
649 [Ignore("LeapC does not document any float config settings to test this with.")]
650 [Test]
652 IntPtr connHandle = IntPtr.Zero;
653 eLeapRS result = LeapC.CreateConnection(out connHandle);
654 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Connection created");
655
656 //Open connection
657 result = LeapC.OpenConnection(connHandle);
658 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Opened connection.");
659
660 //Wait for device event
662 uint timeout = 100;
663 int tries = 100;
664 for (int t = 0; t < tries; t++) {
665 result = LeapC.PollConnection(connHandle, timeout, ref msg);
666 if (msg.type == eLeapEventType.eLeapEventType_Device)
667 break;
668 }
669
670 //Set to something
671 UInt32 requestID = 5;
672 result = LeapC.SaveConfigValue(connHandle, "tool_radius_filtering", 3.0f, out requestID);
673 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Config save requested");
675
676 timeout = 100;
677 int attempts = 1000;
678 for (int t = 0; t < attempts; t++) {
679 result = LeapC.PollConnection(connHandle, timeout, ref configMsg);
680 if (configMsg.type == eLeapEventType.eLeapEventType_ConfigChange)
681 break;
682 }
683 Assert.AreEqual(eLeapEventType.eLeapEventType_ConfigChange, configMsg.type);
685 StructMarshal<LEAP_CONFIG_CHANGE_EVENT>.PtrToStruct(configMsg.eventStructPtr, out change);
686 Assert.AreEqual(requestID, change.requestId, "Request ID is the same");
687 Assert.True(change.status == true, "Save successful");
688
689 //Read first
690 requestID = 1;
691 result = LeapC.RequestConfigValue(connHandle, "tool_radius_filtering", out requestID);
692 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Config value requested");
693 configMsg = new LEAP_CONNECTION_MESSAGE();
694
695 timeout = 10;
696 attempts = 100;
697 for (int t = 0; t < attempts; t++) {
698 result = LeapC.PollConnection(connHandle, timeout, ref configMsg);
699 Logger.Log("Msg type: " + configMsg.type);
700 if (configMsg.type == eLeapEventType.eLeapEventType_ConfigResponse)
701 break;
702 }
704 StructMarshal<LEAP_CONFIG_RESPONSE_EVENT>.PtrToStruct(configMsg.eventStructPtr, out response);
705 UInt32 ReturnedRequestID = response.requestId;
706 Assert.AreEqual(requestID, ReturnedRequestID, "Request ID is the same");
707 Assert.AreEqual(eLeapValueType.eLeapValueType_Float, response.value.type, "Got a Float value");
708 Assert.True(response.value.floatValue != float.NaN, "Is a float");
709 Assert.AreEqual(3, response.value.floatValue, "Keytap min distance is 3mm, the default value");
710
711 //Set to something else
712 requestID = 5;
713 result = LeapC.SaveConfigValue(connHandle, "tool_radius_filtering", 6.0f, out requestID);
714 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Config save requested");
715 configMsg = new LEAP_CONNECTION_MESSAGE();
716
717 timeout = 100;
718 attempts = 1000;
719 for (int t = 0; t < attempts; t++) {
720 result = LeapC.PollConnection(connHandle, timeout, ref configMsg);
721 if (configMsg.type == eLeapEventType.eLeapEventType_ConfigChange)
722 break;
723 }
724 Assert.AreEqual(eLeapEventType.eLeapEventType_ConfigChange, configMsg.type);
725 StructMarshal<LEAP_CONFIG_CHANGE_EVENT>.PtrToStruct(configMsg.eventStructPtr, out change);
726 Assert.AreEqual(requestID, change.requestId, "Request ID is the same");
727 Assert.True(change.status == true, "Save successful");
728
729 //Read again to verify write
730 requestID = 2;
731 result = LeapC.RequestConfigValue(connHandle, "tool_radius_filtering", out requestID);
732 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Config value requested");
733 configMsg = new LEAP_CONNECTION_MESSAGE();
734
735 timeout = 10;
736 attempts = 100;
737 for (int t = 0; t < attempts; t++) {
738 result = LeapC.PollConnection(connHandle, timeout, ref configMsg);
739 Logger.Log("Msg type: " + configMsg.type);
740 if (configMsg.type == eLeapEventType.eLeapEventType_ConfigResponse)
741 break;
742 }
743 StructMarshal<LEAP_CONFIG_RESPONSE_EVENT>.PtrToStruct(configMsg.eventStructPtr, out response);
744 ReturnedRequestID = response.requestId;
745 Assert.AreEqual(requestID, ReturnedRequestID, "Third Request ID is the same");
746 Assert.AreEqual(eLeapValueType.eLeapValueType_Float, response.value.type, "Got a Float value 2nd time, too");
747 Assert.True(response.value.floatValue != float.NaN, "Is a float");
748 Assert.AreEqual(6.0f, response.value.floatValue, "Keytap min distance is 6mm, the changed value");
749
750 }
751
752 [Ignore("LeapC appears to have a problem returning status: true for a successful "
753 + "config change event for images_mode.")]
754 [Test]
756 IntPtr connHandle = IntPtr.Zero;
757 eLeapRS result = LeapC.CreateConnection(out connHandle);
758 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Connection created");
759
760 //Open connection
761 result = LeapC.OpenConnection(connHandle);
762 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Opened connection.");
763
764 //Wait for device event
766 uint timeout = 100;
767 int tries = 100;
768 for (int t = 0; t < tries; t++) {
769 result = LeapC.PollConnection(connHandle, timeout, ref msg);
770 if (msg.type == eLeapEventType.eLeapEventType_Device)
771 break;
772 }
773
774 //Set to something
775 UInt32 requestID = 5;
776 result = LeapC.SaveConfigValue(connHandle, "images_mode", 1, out requestID);
777 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Config save requested");
779
780 timeout = 100;
781 int attempts = 1000;
782 for (int t = 0; t < attempts; t++) {
783 result = LeapC.PollConnection(connHandle, timeout, ref configMsg);
784 if (configMsg.type == eLeapEventType.eLeapEventType_ConfigChange)
785 break;
786 }
787 Assert.AreEqual(eLeapEventType.eLeapEventType_ConfigChange, configMsg.type);
789 StructMarshal<LEAP_CONFIG_CHANGE_EVENT>.PtrToStruct(configMsg.eventStructPtr, out change);
790 Assert.AreEqual(requestID, change.requestId, "Request ID is the same");
791 Assert.True(change.status == true, "Save successful");
792
793 //Read first
794 requestID = 1;
795 result = LeapC.RequestConfigValue(connHandle, "images_mode", out requestID);
796 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Config value requested");
797 configMsg = new LEAP_CONNECTION_MESSAGE();
798
799 timeout = 10;
800 attempts = 100;
801 for (int t = 0; t < attempts; t++) {
802 result = LeapC.PollConnection(connHandle, timeout, ref configMsg);
803 Logger.Log("Msg type: " + configMsg.type);
804 if (configMsg.type == eLeapEventType.eLeapEventType_ConfigResponse)
805 break;
806 }
808 StructMarshal<LEAP_CONFIG_RESPONSE_EVENT>.PtrToStruct(configMsg.eventStructPtr, out response);
809 UInt32 ReturnedRequestID = response.requestId;
810 Assert.AreEqual(requestID, ReturnedRequestID, "Request ID is the same");
811 Assert.AreEqual(eLeapValueType.eLeapValueType_Int32, response.value.type, "Got an Int32 value");
812 Assert.AreEqual(1, response.value.intValue, "images_mode should be 1");
813
814 // Set to something else.
815 requestID = 5;
816 result = LeapC.SaveConfigValue(connHandle, "images_mode", 2, out requestID);
817 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Config save requested");
818 configMsg = new LEAP_CONNECTION_MESSAGE();
819
820 timeout = 100;
821 attempts = 1000;
822 for (int t = 0; t < attempts; t++) {
823 result = LeapC.PollConnection(connHandle, timeout, ref configMsg);
824 if (configMsg.type == eLeapEventType.eLeapEventType_ConfigChange)
825 break;
826 }
827 Assert.AreEqual(eLeapEventType.eLeapEventType_ConfigChange, configMsg.type);
828 StructMarshal<LEAP_CONFIG_CHANGE_EVENT>.PtrToStruct(configMsg.eventStructPtr, out change);
829 Assert.AreEqual(requestID, change.requestId, "Request ID is the same");
830 Assert.True(change.status == true, "Save successful");
831
832 //Read again to verify write
833 requestID = 2;
834 result = LeapC.RequestConfigValue(connHandle, "images_mode", out requestID);
835 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Config value requested");
836 configMsg = new LEAP_CONNECTION_MESSAGE();
837
838 timeout = 10;
839 attempts = 100;
840 for (int t = 0; t < attempts; t++) {
841 result = LeapC.PollConnection(connHandle, timeout, ref configMsg);
842 Logger.Log("Msg type: " + configMsg.type);
843 if (configMsg.type == eLeapEventType.eLeapEventType_ConfigResponse)
844 break;
845 }
846 StructMarshal<LEAP_CONFIG_RESPONSE_EVENT>.PtrToStruct(configMsg.eventStructPtr, out response);
847 ReturnedRequestID = response.requestId;
848 Assert.AreEqual(requestID, ReturnedRequestID, "Request ID is the same");
849 Assert.AreEqual(eLeapValueType.eLeapValueType_Int32, response.value.type, "Got a Int32 value the second time, too");
850 Assert.AreEqual(2, response.value.intValue, "images_mode is 2, the changed value");
851 }
852
853 [Ignore("No known public settings return a string.")]
854 [Test]
856 IntPtr connHandle = IntPtr.Zero;
857 eLeapRS result = LeapC.CreateConnection(out connHandle);
858 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Connection created");
859
860 //Open connection
861 result = LeapC.OpenConnection(connHandle);
862 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Opened connection.");
863
864 //Wait for device event
866 uint timeout = 100;
867 int tries = 100;
868 for (int t = 0; t < tries; t++) {
869 result = LeapC.PollConnection(connHandle, timeout, ref msg);
870 if (msg.type == eLeapEventType.eLeapEventType_Device)
871 break;
872 }
873
874 UInt32 requestID = 1;
875 result = LeapC.RequestConfigValue(connHandle, "tracking_version", out requestID);
876 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Config value requested");
878
879 timeout = 10;
880 int attempts = 100;
881 for (int t = 0; t < attempts; t++) {
882 result = LeapC.PollConnection(connHandle, timeout, ref configMsg);
883 Logger.Log("Msg type: " + configMsg.type);
884 if (configMsg.type == eLeapEventType.eLeapEventType_ConfigResponse)
885 break;
886 }
888 StructMarshal<LEAP_CONFIG_RESPONSE_EVENT_WITH_REF_TYPE>.PtrToStruct(configMsg.eventStructPtr, out response);
889 UInt32 ReturnedRequestID = response.requestId;
890 Assert.AreEqual(requestID, ReturnedRequestID, "Request ID is the same");
891 Assert.AreEqual(eLeapValueType.eLeapValueType_String, response.value.type, "Got a String value");
892 Assert.AreEqual("v2", response.value.stringValue, "Got expected string");
893
894 }
895
896 [Ignore("No public config settings exist for strings.")]
897 [Test]
899 IntPtr connHandle = IntPtr.Zero;
900 eLeapRS result = LeapC.CreateConnection(out connHandle);
901 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Connection created");
902
903 //Open connection
904 result = LeapC.OpenConnection(connHandle);
905 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Opened connection.");
906
907 //Wait for device event
909 uint timeout = 100;
910 int tries = 100;
911 for (int t = 0; t < tries; t++) {
912 result = LeapC.PollConnection(connHandle, timeout, ref msg);
913 if (msg.type == eLeapEventType.eLeapEventType_Device)
914 break;
915 }
916 Assert.AreNotEqual(tries, 100, "PollConnection timed out trying to get "
917 + "a ConfigChange event.");
918
919 //Set to something
920 UInt32 requestID = 5;
921 result = LeapC.SaveConfigValue(connHandle, "tilt_axis", "y", out requestID);
922 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Config save requested");
924
925 timeout = 100;
926 int attempts = 1000;
927 for (int t = 0; t < attempts; t++) {
928 result = LeapC.PollConnection(connHandle, timeout, ref configMsg);
929 if (configMsg.type == eLeapEventType.eLeapEventType_ConfigChange)
930 break;
931 }
932 Assert.AreNotEqual(attempts, 1000, "PollConnection timed out trying to get "
933 + "a ConfigChange event.");
934 Assert.AreEqual(eLeapEventType.eLeapEventType_ConfigChange, configMsg.type);
936 StructMarshal<LEAP_CONFIG_CHANGE_EVENT>.PtrToStruct(configMsg.eventStructPtr, out change);
937 Assert.AreEqual(requestID, change.requestId, "Request ID is the same");
938 Assert.True(change.status == true, "Save successful");
939
940 //Read first
941 requestID = 1;
942 result = LeapC.RequestConfigValue(connHandle, "tilt_axis", out requestID);
943 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Config value requested");
944 configMsg = new LEAP_CONNECTION_MESSAGE();
945
946 timeout = 10;
947 attempts = 100;
948 for (int t = 0; t < attempts; t++) {
949 result = LeapC.PollConnection(connHandle, timeout, ref configMsg);
950 Logger.Log("Msg type: " + configMsg.type);
951 if (configMsg.type == eLeapEventType.eLeapEventType_ConfigResponse)
952 break;
953 }
954 Assert.AreNotEqual(attempts, 100, "PollConnection timed out trying to get "
955 + "a ConfigResponse event.");
957 StructMarshal<LEAP_CONFIG_RESPONSE_EVENT_WITH_REF_TYPE>.PtrToStruct(configMsg.eventStructPtr, out response);
958 UInt32 ReturnedRequestID = response.requestId;
959 Assert.AreEqual(requestID, ReturnedRequestID, "Request ID is the same");
960 Assert.AreEqual(eLeapValueType.eLeapValueType_String, response.value.type, "Got an String value");
961 Assert.AreEqual("y", response.value.stringValue, "Got y.");
962
963 //Set to something else
964 requestID = 5;
965 result = LeapC.SaveConfigValue(connHandle, "tilt_axis", "x", out requestID);
966 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Config save requested");
967 configMsg = new LEAP_CONNECTION_MESSAGE();
968
969 timeout = 100;
970 attempts = 1000;
971 for (int t = 0; t < attempts; t++) {
972 result = LeapC.PollConnection(connHandle, timeout, ref configMsg);
973 if (configMsg.type == eLeapEventType.eLeapEventType_ConfigChange)
974 break;
975 }
976 Assert.AreNotEqual(attempts, 1000, "PollConnection timed out trying to get "
977 + "a ConfigChange event.");
978 Assert.AreEqual(eLeapEventType.eLeapEventType_ConfigChange, configMsg.type);
979 StructMarshal<LEAP_CONFIG_CHANGE_EVENT>.PtrToStruct(configMsg.eventStructPtr, out change);
980 Assert.AreEqual(requestID, change.requestId, "Request ID is the same");
981 Assert.True(change.status == true, "Save successful");
982
983 //Read again to verify write
984 requestID = 2;
985 result = LeapC.RequestConfigValue(connHandle, "tilt_axis", out requestID);
986 Assert.AreEqual(eLeapRS.eLeapRS_Success, result, "Config value requested");
987 configMsg = new LEAP_CONNECTION_MESSAGE();
988
989 timeout = 10;
990 attempts = 100;
991 for (int t = 0; t < attempts; t++) {
992 result = LeapC.PollConnection(connHandle, timeout, ref configMsg);
993 Logger.Log("Msg type: " + configMsg.type);
994 if (configMsg.type == eLeapEventType.eLeapEventType_ConfigResponse)
995 break;
996 }
997 Assert.AreNotEqual(attempts, 100, "PollConnection timed out trying to get "
998 + "a ConfigResponse event.");
999 StructMarshal<LEAP_CONFIG_RESPONSE_EVENT_WITH_REF_TYPE>.PtrToStruct(configMsg.eventStructPtr, out response);
1000 ReturnedRequestID = response.requestId;
1001 Assert.AreEqual(requestID, ReturnedRequestID, "Request ID is the same");
1002 Assert.AreEqual(eLeapValueType.eLeapValueType_String, response.value.type, "Got a String value the second time, too");
1003 Assert.AreEqual("x", response.value.stringValue, "Got x");
1004 }
1005
1006 }
1007}
1008
1009#endif
static void CloseDevice(IntPtr pDevice)
static eLeapRS OpenConnection(IntPtr hConnection)
static eLeapRS UpdateRebase(IntPtr hClockRebaser, Int64 userClock, Int64 leapClock)
static eLeapRS CreateConnection(ref LEAP_CONNECTION_CONFIG pConfig, out IntPtr pConnection)
static eLeapRS GetDeviceInfo(IntPtr hDevice, ref LEAP_DEVICE_INFO info)
static eLeapRS InterpolateFrame(IntPtr hConnection, Int64 timestamp, IntPtr pEvent, UInt64 ncbEvent)
static eLeapRS PollConnection(IntPtr hConnection, UInt32 timeout, ref LEAP_CONNECTION_MESSAGE msg)
static eLeapRS RebaseClock(IntPtr hClockRebaser, Int64 userClock, out Int64 leapClock)
static eLeapRS GetDeviceList(IntPtr hConnection, [In, Out] LEAP_DEVICE_REF[] pArray, out UInt32 pnArray)
static eLeapRS DestroyClockRebaser(IntPtr hClockRebaser)
static long GetNow()
static eLeapRS RequestConfigValue(IntPtr hConnection, string name, out UInt32 request_id)
static void DestroyConnection(IntPtr connection)
static eLeapRS GetDeviceCount(IntPtr hConnection, out UInt32 deviceCount)
Definition: LeapC.cs:834
static eLeapRS GetConnectionInfo(IntPtr hConnection, ref LEAP_CONNECTION_INFO pInfo)
static eLeapRS OpenDevice(LEAP_DEVICE_REF rDevice, out IntPtr pDevice)
static eLeapRS SetPolicyFlags(IntPtr hConnection, UInt64 set, UInt64 clear)
static eLeapRS GetFrameSize(IntPtr hConnection, Int64 timestamp, out UInt64 pncbEvent)
static eLeapRS CreateClockRebaser(out IntPtr phClockRebaser)
eLeapConnectionStatus
Definition: LeapC.cs:14
eLeapValueType
Definition: LeapC.cs:222
eLeapEventType
Definition: LeapC.cs:347
LEAP_VARIANT_VALUE_TYPE value
Definition: LeapC.cs:764
eLeapConnectionStatus status
Definition: LeapC.cs:476
LEAP_DEVICE_REF device
Definition: LeapC.cs:507
LEAP_FRAME_HEADER info
Definition: LeapC.cs:526