11 using System.Collections.
Generic;
12 using System.Runtime.InteropServices;
13 using System.Threading;
28 private static Dictionary<Key, Connection> connectionDictionary =
new Dictionary<Key, Connection>();
36 if (!
Connection.connectionDictionary.TryGetValue(connectionKey, out conn)) {
38 connectionDictionary.Add(connectionKey, conn);
44 private static long _handIdOffset;
45 private static long _handPositionOffset;
46 private static long _handOrientationOffset;
49 _handIdOffset = Marshal.OffsetOf(typeof(
LEAP_HAND),
"id").ToInt64();
51 long palmOffset = Marshal.OffsetOf(typeof(
LEAP_HAND),
"palm").ToInt64();
52 _handPositionOffset = Marshal.OffsetOf(typeof(
LEAP_PALM),
"position").ToInt64() + palmOffset;
53 _handOrientationOffset = Marshal.OffsetOf(typeof(
LEAP_PALM),
"orientation").ToInt64() + palmOffset;
64 private int _frameBufferLength = 60;
66 private IntPtr _leapConnection;
67 private bool _isRunning =
false;
68 private Thread _polster;
71 private UInt64 _requestedPolicies = 0;
72 private UInt64 _activePolicies = 0;
75 private Dictionary<uint, string> _configRequests =
new Dictionary<uint, string>();
80 private EventHandler<LeapEventArgs> _leapInit;
81 public event EventHandler<LeapEventArgs>
LeapInit {
84 if (_leapConnection != IntPtr.Zero)
87 remove { _leapInit -= value; }
90 private EventHandler<ConnectionEventArgs> _leapConnectionEvent;
93 _leapConnectionEvent += value;
97 remove { _leapConnectionEvent -= value; }
120 private bool _disposed =
false;
124 GC.SuppressFinalize(
this);
128 protected virtual void Dispose(
bool disposing) {
137 _leapConnection = IntPtr.Zero;
148 _leapConnection = IntPtr.Zero;
150 Frames =
new CircularObjectBuffer<LEAP_TRACKING_EVENT>(_frameBufferLength);
153 private LEAP_ALLOCATOR _pLeapAllocator =
new LEAP_ALLOCATOR();
160 if (_leapConnection == IntPtr.Zero) {
165 config.
size = (uint)Marshal.SizeOf(config);
172 if (result !=
eLeapRS.eLeapRS_Success || _leapConnection == IntPtr.Zero) {
173 reportAbnormalResults(
"LeapC CreateConnection call was ", result);
178 if (result !=
eLeapRS.eLeapRS_Success) {
179 reportAbnormalResults(
"LeapC OpenConnection call was ", result);
183 if (_pLeapAllocator.allocate ==
null) {
184 _pLeapAllocator.allocate = MemoryManager.Pin;
186 if (_pLeapAllocator.deallocate ==
null) {
187 _pLeapAllocator.deallocate = MemoryManager.Unpin;
192 AppDomain.CurrentDomain.DomainUnload += (arg1, arg2) =>
Dispose(
true);
194 _polster =
new Thread(
new ThreadStart(this.processMessages));
195 _polster.Name =
"LeapC Worker";
196 _polster.IsBackground =
true;
220 private void processMessages() {
222 const string HANDLE_EVENT_PROFILER_BLOCK =
"Handle Event";
223 bool hasBegunProfilingForThread =
false;
231 HANDLE_EVENT_PROFILER_BLOCK));
232 hasBegunProfilingForThread =
true;
235 LEAP_CONNECTION_MESSAGE _msg =
new LEAP_CONNECTION_MESSAGE();
237 result = LeapC.PollConnection(_leapConnection, timeout, ref _msg);
239 if (result !=
eLeapRS.eLeapRS_Success) {
240 reportAbnormalResults(
"LeapC PollConnection call was ", result);
253 LEAP_CONNECTION_EVENT connection_evt;
254 StructMarshal<LEAP_CONNECTION_EVENT>.PtrToStruct(_msg.eventStructPtr, out connection_evt);
255 handleConnection(ref connection_evt);
258 LEAP_CONNECTION_LOST_EVENT connection_lost_evt;
259 StructMarshal<LEAP_CONNECTION_LOST_EVENT>.PtrToStruct(_msg.eventStructPtr, out connection_lost_evt);
260 handleConnectionLost(ref connection_lost_evt);
264 LEAP_DEVICE_EVENT device_evt;
265 StructMarshal<LEAP_DEVICE_EVENT>.PtrToStruct(_msg.eventStructPtr, out device_evt);
266 handleDevice(ref device_evt);
272 LEAP_DEVICE_FAILURE_EVENT device_failure_evt;
273 StructMarshal<LEAP_DEVICE_FAILURE_EVENT>.PtrToStruct(_msg.eventStructPtr, out device_failure_evt);
274 handleFailedDevice(ref device_failure_evt);
278 LEAP_POLICY_EVENT policy_evt;
279 StructMarshal<LEAP_POLICY_EVENT>.PtrToStruct(_msg.eventStructPtr, out policy_evt);
280 handlePolicyChange(ref policy_evt);
284 LEAP_TRACKING_EVENT tracking_evt;
285 StructMarshal<LEAP_TRACKING_EVENT>.PtrToStruct(_msg.eventStructPtr, out tracking_evt);
286 handleTrackingMessage(ref tracking_evt);
289 LEAP_LOG_EVENT log_evt;
290 StructMarshal<LEAP_LOG_EVENT>.PtrToStruct(_msg.eventStructPtr, out log_evt);
291 reportLogMessage(ref log_evt);
294 LEAP_DEVICE_EVENT device_lost_evt;
295 StructMarshal<LEAP_DEVICE_EVENT>.PtrToStruct(_msg.eventStructPtr, out device_lost_evt);
296 handleLostDevice(ref device_lost_evt);
299 LEAP_CONFIG_CHANGE_EVENT config_change_evt;
300 StructMarshal<LEAP_CONFIG_CHANGE_EVENT>.PtrToStruct(_msg.eventStructPtr, out config_change_evt);
301 handleConfigChange(ref config_change_evt);
304 handleConfigResponse(ref _msg);
307 LEAP_DROPPED_FRAME_EVENT dropped_frame_evt;
308 StructMarshal<LEAP_DROPPED_FRAME_EVENT>.PtrToStruct(_msg.eventStructPtr, out dropped_frame_evt);
309 handleDroppedFrame(ref dropped_frame_evt);
312 LEAP_IMAGE_EVENT image_evt;
313 StructMarshal<LEAP_IMAGE_EVENT>.PtrToStruct(_msg.eventStructPtr, out image_evt);
314 handleImage(ref image_evt);
317 LEAP_POINT_MAPPING_CHANGE_EVENT point_mapping_change_evt;
318 StructMarshal<LEAP_POINT_MAPPING_CHANGE_EVENT>.PtrToStruct(_msg.eventStructPtr, out point_mapping_change_evt);
319 handlePointMappingChange(ref point_mapping_change_evt);
322 LEAP_HEAD_POSE_EVENT head_pose_event;
323 StructMarshal<LEAP_HEAD_POSE_EVENT>.PtrToStruct(_msg.eventStructPtr, out head_pose_event);
324 handleHeadPoseChange(ref head_pose_event);
327 LEAP_DEVICE_STATUS_CHANGE_EVENT status_evt;
328 StructMarshal<LEAP_DEVICE_STATUS_CHANGE_EVENT>.PtrToStruct(_msg.eventStructPtr, out status_evt);
329 handleDeviceStatusEvent(ref status_evt);
337 }
catch (Exception e) {
338 Logger.Log(
"Exception: " + e);
347 private void handleTrackingMessage(ref LEAP_TRACKING_EVENT trackingMsg) {
348 Frames.Put(ref trackingMsg);
351 LeapFrame.DispatchOnContext(
this,
EventContext,
new FrameEventArgs(
new Frame().CopyFrom(ref trackingMsg)));
358 reportAbnormalResults(
"LeapC get interpolated frame call was ", result);
364 IntPtr trackingBuffer = Marshal.AllocHGlobal((Int32)size);
366 reportAbnormalResults(
"LeapC get interpolated frame call was ", result);
367 if (result ==
eLeapRS.eLeapRS_Success) {
369 StructMarshal<LEAP_TRACKING_EVENT>.PtrToStruct(trackingBuffer, out tracking_evt);
370 toFill.CopyFrom(ref tracking_evt);
372 Marshal.FreeHGlobal(trackingBuffer);
377 IntPtr trackingBuffer = Marshal.AllocHGlobal((Int32)size);
379 reportAbnormalResults(
"LeapC get interpolated frame from time call was ", result);
380 if (result ==
eLeapRS.eLeapRS_Success) {
382 StructMarshal<LEAP_TRACKING_EVENT>.PtrToStruct(trackingBuffer, out tracking_evt);
383 toFill.CopyFrom(ref tracking_evt);
385 Marshal.FreeHGlobal(trackingBuffer);
396 reportAbnormalResults(
"LeapC get interpolated head pose call was ", result);
402 return headPoseEvent;
415 IntPtr trackingBuffer = Marshal.AllocHGlobal((Int32)size);
417 reportAbnormalResults(
"LeapC get interpolated frame from time call was ", result);
419 if (result ==
eLeapRS.eLeapRS_Success) {
421 StructMarshal<LEAP_TRACKING_EVENT>.PtrToStruct(trackingBuffer, out tracking_evt);
427 long handPtr = tracking_evt.
pHands.ToInt64();
428 long idPtr = handPtr + _handIdOffset;
429 long posPtr = handPtr + _handPositionOffset;
430 long rotPtr = handPtr + _handOrientationOffset;
431 int stride = StructMarshal<LEAP_HAND>.Size;
433 for (uint i = tracking_evt.
nHands; i-- != 0; idPtr += stride, posPtr += stride, rotPtr += stride) {
434 id = Marshal.ReadInt32(
new IntPtr(idPtr));
435 StructMarshal<LEAP_VECTOR>.PtrToStruct(
new IntPtr(posPtr), out position);
436 StructMarshal<LEAP_QUATERNION>.PtrToStruct(
new IntPtr(rotPtr), out orientation);
440 leftTransform = transform;
441 }
else if (
id == rightId) {
442 rightTransform = transform;
447 Marshal.FreeHGlobal(trackingBuffer);
451 if (_leapConnectionEvent !=
null) {
456 private void handleConnectionLost(ref LEAP_CONNECTION_LOST_EVENT connectionMsg) {
461 private void handleDeviceStatusEvent(ref LEAP_DEVICE_STATUS_CHANGE_EVENT statusEvent)
466 device.UpdateStatus(statusEvent.status);
470 private void handleDevice(ref LEAP_DEVICE_EVENT deviceMsg) {
471 IntPtr deviceHandle = deviceMsg.device.handle;
472 if (deviceHandle == IntPtr.Zero)
475 LEAP_DEVICE_INFO deviceInfo =
new LEAP_DEVICE_INFO();
479 result = LeapC.OpenDevice(deviceMsg.device, out device);
480 if (result !=
eLeapRS.eLeapRS_Success)
483 deviceInfo.serial = IntPtr.Zero;
484 deviceInfo.size = (uint)Marshal.SizeOf(deviceInfo);
485 result = LeapC.GetDeviceInfo(device, ref deviceInfo);
486 if (result !=
eLeapRS.eLeapRS_Success)
489 deviceInfo.serial = Marshal.AllocCoTaskMem((
int)deviceInfo.serial_length);
490 result = LeapC.GetDeviceInfo(device, ref deviceInfo);
492 if (result ==
eLeapRS.eLeapRS_Success) {
493 Device apiDevice =
new Device(deviceHandle,
497 deviceInfo.range / 1000.0f,
498 deviceInfo.baseline / 1000.0f,
499 (Device.DeviceType)deviceInfo.type,
501 Marshal.PtrToStringAnsi(deviceInfo.serial));
502 Marshal.FreeCoTaskMem(deviceInfo.serial);
511 private void handleLostDevice(ref LEAP_DEVICE_EVENT deviceMsg) {
514 _devices.Remove(lost);
522 private void handleFailedDevice(ref LEAP_DEVICE_FAILURE_EVENT deviceMsg) {
523 string failureMessage;
524 string failedSerialNumber =
"Unavailable";
525 switch (deviceMsg.status) {
527 failureMessage =
"Bad Calibration. Device failed because of a bad calibration record.";
530 failureMessage =
"Bad Control Interface. Device failed because of a USB control interface error.";
533 failureMessage =
"Bad Firmware. Device failed because of a firmware error.";
536 failureMessage =
"Bad Transport. Device failed because of a USB communication error.";
539 failureMessage =
"Device failed for an unknown reason";
543 if (failed !=
null) {
544 _devices.Remove(failed);
549 new DeviceFailureEventArgs((uint)deviceMsg.status, failureMessage, failedSerialNumber));
553 private void handleConfigChange(ref LEAP_CONFIG_CHANGE_EVENT configEvent) {
554 string config_key =
"";
555 _configRequests.TryGetValue(configEvent.requestId, out config_key);
556 if (config_key !=
null)
557 _configRequests.Remove(configEvent.requestId);
560 new ConfigChangeEventArgs(config_key, configEvent.status !=
false, configEvent.requestId));
564 private void handleConfigResponse(ref LEAP_CONNECTION_MESSAGE configMsg) {
565 LEAP_CONFIG_RESPONSE_EVENT config_response_evt;
566 StructMarshal<LEAP_CONFIG_RESPONSE_EVENT>.PtrToStruct(configMsg.eventStructPtr, out config_response_evt);
567 string config_key =
"";
568 _configRequests.TryGetValue(config_response_evt.requestId, out config_key);
569 if (config_key !=
null)
570 _configRequests.Remove(config_response_evt.requestId);
572 Config.ValueType dataType;
574 uint requestId = config_response_evt.requestId;
575 if (config_response_evt.value.type !=
eLeapValueType.eLeapValueType_String) {
576 switch (config_response_evt.value.type) {
578 dataType = Config.ValueType.TYPE_BOOLEAN;
579 value = config_response_evt.value.boolValue;
582 dataType = Config.ValueType.TYPE_INT32;
583 value = config_response_evt.value.intValue;
586 dataType = Config.ValueType.TYPE_FLOAT;
587 value = config_response_evt.value.floatValue;
590 dataType = Config.ValueType.TYPE_UNKNOWN;
591 value =
new object();
595 LEAP_CONFIG_RESPONSE_EVENT_WITH_REF_TYPE config_ref_value;
596 StructMarshal<LEAP_CONFIG_RESPONSE_EVENT_WITH_REF_TYPE>.PtrToStruct(configMsg.eventStructPtr, out config_ref_value);
597 dataType = Config.ValueType.TYPE_STRING;
598 value = config_ref_value.value.stringValue;
600 SetConfigResponseEventArgs args =
new SetConfigResponseEventArgs(config_key, dataType, value, requestId);
607 private void reportLogMessage(ref LEAP_LOG_EVENT logMsg) {
609 LeapLogEvent.DispatchOnContext(
this,
EventContext,
new LogEventArgs(publicSeverity(logMsg.severity), logMsg.timestamp, Marshal.PtrToStringAnsi(logMsg.message)));
614 switch (leapCSeverity) {
628 private void handlePointMappingChange(ref LEAP_POINT_MAPPING_CHANGE_EVENT pointMapping) {
634 private void handleDroppedFrame(ref LEAP_DROPPED_FRAME_EVENT droppedFrame) {
640 private void handleHeadPoseChange(ref LEAP_HEAD_POSE_EVENT headPose) {
646 private DistortionData createDistortionData(LEAP_IMAGE image,
Image.CameraType camera) {
647 DistortionData distortionData =
new DistortionData();
648 distortionData.Version = image.matrix_version;
649 distortionData.Width = LeapC.DistortionSize;
650 distortionData.Height = LeapC.DistortionSize;
654 distortionData.Data =
new float[(int)(distortionData.Width * distortionData.Height * 2)];
655 Marshal.Copy(image.distortionMatrix, distortionData.Data, 0, distortionData.Data.Length);
660 return distortionData;
663 private void handleImage(ref LEAP_IMAGE_EVENT imageMsg) {
666 if ((_currentLeftDistortionData.
Version != imageMsg.leftImage.matrix_version) || !_currentLeftDistortionData.
IsValid) {
667 _currentLeftDistortionData = createDistortionData(imageMsg.leftImage,
Image.CameraType.LEFT);
669 if ((_currentRightDistortionData.
Version != imageMsg.rightImage.matrix_version) || !_currentRightDistortionData.
IsValid) {
670 _currentRightDistortionData = createDistortionData(imageMsg.rightImage,
Image.CameraType.RIGHT);
672 ImageData leftImage =
new ImageData(
Image.CameraType.LEFT, imageMsg.leftImage, _currentLeftDistortionData);
673 ImageData rightImage =
new ImageData(
Image.CameraType.RIGHT, imageMsg.rightImage, _currentRightDistortionData);
674 Image stereoImage =
new Image(imageMsg.info.frame_id, imageMsg.info.timestamp, leftImage, rightImage);
679 private void handlePolicyChange(ref LEAP_POLICY_EVENT policyMsg) {
684 _activePolicies = policyMsg.current_policy;
686 if (_activePolicies != _requestedPolicies) {
694 UInt64 setFlags = (ulong)flagForPolicy(policy);
695 _requestedPolicies = _requestedPolicies | setFlags;
696 setFlags = _requestedPolicies;
697 UInt64 clearFlags = ~_requestedPolicies;
700 reportAbnormalResults(
"LeapC SetPolicyFlags call was ", result);
704 UInt64 clearFlags = (ulong)flagForPolicy(policy);
705 _requestedPolicies = _requestedPolicies & ~clearFlags;
707 reportAbnormalResults(
"LeapC SetPolicyFlags call was ", result);
711 switch (singlePolicy) {
747 UInt64 policyToCheck = (ulong)flagForPolicy(policy);
748 return (_activePolicies & policyToCheck) == policyToCheck;
754 reportAbnormalResults(
"LeapC RequestConfigValue call was ", result);
755 _configRequests[requestId] = config_key;
762 Type dataType = value.GetType();
763 if (dataType == typeof(
bool)) {
764 result =
LeapC.SaveConfigValue(_leapConnection, config_key, Convert.ToBoolean(value), out requestId);
765 }
else if (dataType == typeof(Int32)) {
766 result =
LeapC.SaveConfigValue(_leapConnection, config_key, Convert.ToInt32(value), out requestId);
767 }
else if (dataType == typeof(
float)) {
768 result =
LeapC.SaveConfigValue(_leapConnection, config_key, Convert.ToSingle(value), out requestId);
769 }
else if (dataType == typeof(
string)) {
770 result =
LeapC.SaveConfigValue(_leapConnection, config_key, Convert.ToString(value), out requestId);
772 throw new ArgumentException(
"Only boolean, Int32, float, and string types are supported.");
774 reportAbnormalResults(
"LeapC SaveConfigValue call was ", result);
775 _configRequests[requestId] = config_key;
786 if (_leapConnection == IntPtr.Zero)
790 pInfo.
size = (uint)Marshal.SizeOf(pInfo);
792 reportAbnormalResults(
"LeapC GetConnectionInfo call was ", result);
816 if (_devices ==
null) {
826 if (_failedDevices ==
null) {
830 return _failedDevices;
851 return new Vector(pixel.
x, pixel.
y, pixel.
z);
856 reportAbnormalResults(
"LeapC TelemetryProfiling call was ", result);
861 IntPtr buffer = IntPtr.Zero;
864 if (result ==
eLeapRS.eLeapRS_InsufficientBuffer) {
865 if (buffer != IntPtr.Zero)
866 Marshal.FreeHGlobal(buffer);
867 buffer = Marshal.AllocHGlobal((Int32)size);
870 reportAbnormalResults(
"LeapC get point mapping call was ", result);
871 if (result !=
eLeapRS.eLeapRS_Success) {
879 StructMarshal<LEAP_POINT_MAPPING>.PtrToStruct(buffer, out pmi);
880 Int32 nPoints = (Int32)pmi.
nPoints;
884 pm.points =
new Vector[nPoints];
885 pm.ids =
new UInt32[nPoints];
887 float[] points =
new float[3 * nPoints];
888 Int32[] ids =
new Int32[nPoints];
889 Marshal.Copy(pmi.
points, points, 0, 3 * nPoints);
890 Marshal.Copy(pmi.
ids, ids, 0, nPoints);
893 for (
int i = 0; i < nPoints; i++) {
894 pm.points[i].
x = points[j++];
895 pm.points[i].y = points[j++];
896 pm.points[i].z = points[j++];
897 pm.ids[i] = unchecked((UInt32)ids[i]);
899 Marshal.FreeHGlobal(buffer);
903 private void reportAbnormalResults(
string context,
eLeapRS result) {
904 if (result !=
eLeapRS.eLeapRS_Success &&
905 result != _lastResult) {
906 string msg = context +
" " + result;
914 _lastResult = result;
System.Drawing.Image Image
Dispatched when the connection is established.
The Controller class is your main interface to the Leap Motion Controller.
PolicyFlag
The supported controller policies.
The DeviceList class represents a list of Device objects.
Device FindDeviceByHandle(IntPtr deviceHandle)
For internal use only.
void AddOrUpdate(Device device)
For internal use only.
The DistortionData class contains the distortion map for correcting the lens distortion of an image.
UInt64 Version
An identifier assigned to the distortion map.
bool IsValid
Reports whether the distortion data is internally consistent.
The list of FailedDevice objects contains an entry for every failed Leap Motion hardware device conne...
The Frame class represents a set of hand and finger tracking data detected in a single frame.
The Image class represents a stereo image pair from the Leap Motion device.
A generic object with no arguments beyond the event type.
Dispatched when loggable events are generated by the service and the service connection code.
void GetInterpolatedLeftRightTransform(Int64 time, Int64 sourceTime, Int64 leftId, Int64 rightId, out LeapTransform leftTransform, out LeapTransform rightTransform)
SynchronizationContext EventContext
void TelemetryProfiling(ref LEAP_TELEMETRY_DATA telemetryData)
Action< EndProfilingBlockArgs > LeapEndProfilingBlock
bool IsServiceConnected
Reports whether your application has a connection to the Leap Motion daemon/service....
uint GetConfigValue(string config_key)
EventHandler< ConnectionLostEventArgs > LeapConnectionLost
Action< BeginProfilingForThreadArgs > LeapBeginProfilingForThread
Action< BeginProfilingBlockArgs > LeapBeginProfilingBlock
EventHandler< DeviceEventArgs > LeapDeviceLost
Action< EndProfilingForThreadArgs > LeapEndProfilingForThread
EventHandler< LogEventArgs > LeapLogEvent
EventHandler< LeapEventArgs > LeapInit
static Connection GetConnection(int connectionId=0)
void GetInterpolatedFrame(Frame toFill, Int64 time)
virtual void Dispose(bool disposing)
EventHandler< FrameEventArgs > LeapFrame
bool IsPolicySet(Controller.PolicyFlag policy)
Gets the active setting for a specific policy.
EventHandler< ConfigChangeEventArgs > LeapConfigChange
EventHandler< ConnectionEventArgs > LeapConnection
EventHandler< DroppedFrameEventArgs > LeapDroppedFrame
EventHandler< ImageEventArgs > LeapImage
void GetInterpolatedFrameFromTime(Frame toFill, Int64 time, Int64 sourceTime)
static Connection GetConnection(Key connectionKey)
EventHandler< SetConfigResponseEventArgs > LeapConfigResponse
EventHandler< DeviceFailureEventArgs > LeapDeviceFailure
void GetInterpolatedHeadPose(ref LEAP_HEAD_POSE_EVENT toFill, Int64 time)
CircularObjectBuffer< LEAP_TRACKING_EVENT > Frames
void SetPolicy(Controller.PolicyFlag policy)
DeviceList Devices
The list of currently attached and recognized Leap Motion controller devices.
LEAP_HEAD_POSE_EVENT GetInterpolatedHeadPose(Int64 time)
UInt64 GetInterpolatedFrameSize(Int64 time)
EventHandler< DistortionEventArgs > LeapDistortionChange
EventHandler< PolicyEventArgs > LeapPolicyChange
void GetPointMapping(ref PointMapping pm)
Vector RectilinearToPixel(Image.CameraType camera, Vector ray)
Vector PixelToRectilinear(Image.CameraType camera, Vector pixel)
EventHandler< InternalFrameEventArgs > LeapInternalFrame
void ClearPolicy(Controller.PolicyFlag policy)
EventHandler< PointMappingChangeEventArgs > LeapPointMappingChange
EventHandler< DeviceEventArgs > LeapDevice
uint SetConfigValue< T >(string config_key, T value)
FailedDeviceList FailedDevices
EventHandler< HeadPoseEventArgs > LeapHeadPoseChange
Frame GetInterpolatedFrame(Int64 time)
static eLeapRS OpenConnection(IntPtr hConnection)
static eLeapRS CreateConnection(ref LEAP_CONNECTION_CONFIG pConfig, out IntPtr pConnection)
static eLeapRS InterpolateFrame(IntPtr hConnection, Int64 timestamp, IntPtr pEvent, UInt64 ncbEvent)
static eLeapRS GetPointMapping(IntPtr hConnection, IntPtr pointMapping, ref ulong pSize)
static eLeapRS InterpolateHeadPose(IntPtr hConnection, Int64 timestamp, ref LEAP_HEAD_POSE_EVENT headPose)
static LEAP_VECTOR LeapRectilinearToPixel(IntPtr hConnection, eLeapPerspectiveType camera, LEAP_VECTOR rectilinear)
static eLeapRS LeapTelemetryProfiling(IntPtr hConnection, ref LEAP_TELEMETRY_DATA telemetryData)
static eLeapRS RequestConfigValue(IntPtr hConnection, string name, out UInt32 request_id)
static void DestroyConnection(IntPtr connection)
static LEAP_VECTOR LeapPixelToRectilinear(IntPtr hConnection, eLeapPerspectiveType camera, LEAP_VECTOR pixel)
static eLeapRS GetConnectionInfo(IntPtr hConnection, ref LEAP_CONNECTION_INFO pInfo)
static eLeapRS InterpolateFrameFromTime(IntPtr hConnection, Int64 timestamp, Int64 sourceTimestamp, IntPtr pEvent, UInt64 ncbEvent)
static eLeapRS SetPolicyFlags(IntPtr hConnection, UInt64 set, UInt64 clear)
static eLeapRS GetFrameSize(IntPtr hConnection, Int64 timestamp, out UInt64 pncbEvent)
static eLeapRS CloseConnection(IntPtr hConnection)
static eLeapRS SetAllocator(IntPtr hConnection, ref LEAP_ALLOCATOR pAllocator)
MessageSeverity
Reports whether the message is for a severe failure, a recoverable warning, or a status change.
LeapEvent
An enumeration defining the types of Leap Motion events.
The Vector struct represents a three-component mathematical vector or point such as a direction or po...
readonly string serverNamespace
Key(int connectionId, string serverNamespace=null)
readonly int connectionId
eLeapConnectionStatus status