41 bool _disposed =
false;
65 public event EventHandler<LeapEventArgs>
Init {
71 remove { _init -= value; }
74 private bool _hasInitialized =
false;
75 private EventHandler<LeapEventArgs> _init;
81 public event EventHandler<ConnectionEventArgs>
Connect {
87 remove { _connect -= value; }
90 private bool _hasConnected =
false;
91 private EventHandler<ConnectionEventArgs> _connect;
97 public event EventHandler<ConnectionLostEventArgs>
Disconnect {
136 public event EventHandler<DeviceEventArgs>
Device {
344 GC.SuppressFinalize(
this);
348 protected virtual void Dispose(
bool disposing) {
377 public Controller(
int connectionKey,
string serverNamespace =
null) {
379 _connection.
EventContext = SynchronizationContext.Current;
492 Frame(frame, history);
502 _connection.
Frames.Get(out trackingEvent, history);
503 toFill.CopyFrom(ref trackingEvent);
515 _connection.
Frames.Get(out trackingEvent, history);
524 return new Frame().CopyFrom(
Frame(history)).Transform(trs);
697 POLICY_BACKGROUND_FRAMES = (1 << 0),
701 POLICY_IMAGES = (1 << 1),
705 POLICY_OPTIMIZE_HMD = (1 << 2),
709 POLICY_ALLOW_PAUSE_RESUME = (1 << 3),
713 POLICY_MAP_POINTS = (1 << 7),
718 POLICY_OPTIMIZE_SCREENTOP = (1 << 8),
722 _hasInitialized =
true;
726 _hasConnected =
true;
730 _hasInitialized =
false;
731 _hasConnected =
false;
The Config class provides access to Leap Motion system configuration information.
Dispatched when the connection is established.
Dispatched when the connection is lost.
The Controller class is your main interface to the Leap Motion Controller.
EventHandler< PolicyEventArgs > PolicyChange
Dispatched when a policy changes.
virtual void OnDisconnect(object sender, ConnectionLostEventArgs eventArgs)
EventHandler< InternalFrameEventArgs > InternalFrameReady
Dispatched when an internal tracking frame is ready.
void StopConnection()
Stops the connection.
void TelemetryProfiling(ref LEAP_TELEMETRY_DATA telemetryData)
PolicyFlag
The supported controller policies.
virtual void OnInit(object sender, LeapEventArgs eventArgs)
void GetInterpolatedLeftRightTransform(Int64 time, Int64 sourceTime, int leftId, int rightId, out LeapTransform leftTransform, out LeapTransform rightTransform)
This is a special variant of GetInterpolatedFrameFromTime, for use with special features that only re...
Config Config
Returns a Config object, which you can use to query the Leap Motion system for configuration informat...
EventHandler< PointMappingChangeEventArgs > PointMappingChange
Dispatched when point mapping change events are generated by the service.
EventHandler< DeviceEventArgs > DeviceLost
Dispatched when a Leap Motion device is disconnected.
Action< EndProfilingForThreadArgs > EndProfilingForThread
Dispatched whenever a thread is finished profiling. The event is always dispatched from the thread it...
EventHandler< DistortionEventArgs > DistortionChange
Dispatched when the image distortion map changes. The distortion map can change when the Leap device ...
void GetInterpolatedHeadPose(ref LEAP_HEAD_POSE_EVENT toFill, Int64 time)
long FrameTimestamp(int history=0)
Returns the timestamp of a recent tracking frame. Use the optional history parameter to specify how m...
void StartConnection()
Starts the connection.
EventHandler< LogEventArgs > LogMessage
Dispatched when the system generates a loggable event.
void GetInterpolatedFrame(Frame toFill, Int64 time)
Fills the Frame with data taken at the specified time, interpolating the data between existing frames...
Action< EndProfilingBlockArgs > EndProfilingBlock
Dispatched whenever a thread ends a profiling block. The event is always dispatched from the thread i...
Action< BeginProfilingForThreadArgs > BeginProfilingForThread
Dispatched whenever a thread wants to start profiling for a custom thread. The event is always dispat...
virtual void Dispose(bool disposing)
void GetPointMapping(ref PointMapping pointMapping)
Controller()
Constructs a Controller object.
LEAP_HEAD_POSE_EVENT GetInterpolatedHeadPose(Int64 time)
Returns the Head pose at the specified time, interpolating the data between existing frames,...
long Now()
Returns a timestamp value as close as possible to the current time. Values are in microseconds,...
Action< BeginProfilingBlockArgs > BeginProfilingBlock
Dispatched whenever a thread enters a profiling block. The event is always dispatched from the thread...
void ClearPolicy(PolicyFlag policy)
Requests clearing a policy.
void SetPolicy(PolicyFlag policy)
Requests setting a policy.
bool IsServiceConnected
Reports whether your application has a connection to the Leap Motion daemon/service....
EventHandler< HeadPoseEventArgs > HeadPoseChange
Dispatched when a new HeadPose is available.
DeviceList Devices
The list of currently attached and recognized Leap Motion controller devices.
EventHandler< ConfigChangeEventArgs > ConfigChange
Dispatched when a configuration setting changes.
Frame GetInterpolatedFrame(Int64 time)
Returns the Frame at the specified time, interpolating the data between existing frames,...
bool IsConnected
Reports whether this Controller is connected to the Leap Motion service and the Leap Motion hardware ...
FailedDeviceList FailedDevices()
A list of any Leap Motion hardware devices that are physically connected to the client computer,...
EventHandler< ConnectionEventArgs > Connect
Dispatched when the connection to the service is established.
Frame Frame(int history=0)
In most cases you should get Frame objects using the LeapProvider.CurrentFrame property....
EventHandler< ConnectionLostEventArgs > Disconnect
Dispatched if the connection to the service is lost.
Frame GetTransformedFrame(LeapTransform trs, int history=0)
Returns the frame object with all hands transformed by the specified transform matrix.
EventHandler< DroppedFrameEventArgs > DroppedFrame
Dispatched when the service drops a tracking frame.
void Frame(Frame toFill, int history=0)
Identical to Frame(history) but instead of constructing a new frame and returning it,...
EventHandler< ImageEventArgs > ImageReady
Dispatched when an unrequested image is ready.
void GetInterpolatedFrameFromTime(Frame toFill, Int64 time, Int64 sourceTime)
EventHandler< LeapEventArgs > Init
Dispatched when the connection is initialized (but not necessarily connected).
EventHandler< DeviceFailureEventArgs > DeviceFailure
Dispatched when a Leap device fails to initialize.
bool IsPolicySet(PolicyFlag policy)
Gets the active setting for a specific policy.
EventHandler< FrameEventArgs > FrameReady
Dispatched when a tracking frame is ready.
Controller(int connectionKey, string serverNamespace=null)
Constructs a Controller object using the specified connection key.
SynchronizationContext EventContext
The SynchronizationContext used for dispatching events.
virtual void OnConnect(object sender, ConnectionEventArgs eventArgs)
The Device class represents a physically connected device.
The DeviceList class represents a list of Device objects.
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.
A generic object with no arguments beyond the event type.
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....
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)
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)
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.
EventHandler< DistortionEventArgs > LeapDistortionChange
EventHandler< PolicyEventArgs > LeapPolicyChange
void GetPointMapping(ref PointMapping pm)
EventHandler< InternalFrameEventArgs > LeapInternalFrame
void ClearPolicy(Controller.PolicyFlag policy)
EventHandler< PointMappingChangeEventArgs > LeapPointMappingChange
EventHandler< DeviceEventArgs > LeapDevice
FailedDeviceList FailedDevices
EventHandler< HeadPoseEventArgs > LeapHeadPoseChange
static UInt64 TelemetryGetNow()
LeapEvent
An enumeration defining the types of Leap Motion events.