#include <Leap.h>
The Listener class defines a set of callback functions that you can override in a subclass to respond to events dispatched by the Controller object.
To handle Leap Motion events, create an instance of a Listener subclass and assign it to the Controller instance. The Controller calls the relevant Listener callback function when an event occurs, passing in a reference to itself. You do not have to implement callbacks for events you do not want to handle.
The Controller object calls these Listener functions from a thread created by the Leap Motion library, not the thread used to create or set the Listener instance.
LEAP_EXPORT Leap::Listener::Listener | ( | ) | [inline] |
virtual LEAP_EXPORT Leap::Listener::~Listener | ( | ) | [inline, virtual] |
def Leap::Listener::__init__ | ( | self | ) |
def Leap::Listener::__disown__ | ( | self | ) |
def Leap::Listener::on_connect | ( | self, | |
arg0 | |||
) |
Reimplemented in leap_interface.LeapInterface.
def Leap::Listener::on_device_change | ( | self, | |
arg0 | |||
) |
def Leap::Listener::on_disconnect | ( | self, | |
arg0 | |||
) |
Reimplemented in leap_interface.LeapInterface.
def Leap::Listener::on_exit | ( | self, | |
arg0 | |||
) |
Reimplemented in leap_interface.LeapInterface.
def Leap::Listener::on_focus_gained | ( | self, | |
arg0 | |||
) |
def Leap::Listener::on_focus_lost | ( | self, | |
arg0 | |||
) |
def Leap::Listener::on_frame | ( | self, | |
arg0 | |||
) |
Reimplemented in leap_interface.LeapInterface.
def Leap::Listener::on_images | ( | self, | |
arg0 | |||
) |
def Leap::Listener::on_init | ( | self, | |
arg0 | |||
) |
Reimplemented in leap_interface.LeapInterface.
def Leap::Listener::on_service_connect | ( | self, | |
arg0 | |||
) |
def Leap::Listener::on_service_disconnect | ( | self, | |
arg0 | |||
) |
virtual LEAP_EXPORT void Leap::Listener::onConnect | ( | const Controller & | ) | [inline, virtual] |
Called when the Controller object connects to the Leap Motion software and the Leap Motion hardware device is plugged in, or when this Listener object is added to a Controller that is already connected.
When this callback is invoked, Controller::isServiceConnected is true, Controller::devices() is not empty, and, for at least one of the Device objects in the list, Device::isStreaming() is true.
controller | The Controller object invoking this callback function. |
Reimplemented in CameraListener, CameraListener, HandsListener, and LeapListener.
virtual LEAP_EXPORT void Leap::Listener::onDeviceChange | ( | const Controller & | ) | [inline, virtual] |
Called when a Leap Motion controller plugged in, unplugged, or the device changes state.
State changes include changes in frame rate and entering or leaving "robust" mode. Note that there is currently no way to query whether a device is in robust mode. You can use Frame::currentFramerate() to get the framerate.
controller | The Controller object invoking this callback function. |
Reimplemented in CameraListener, CameraListener, and HandsListener.
virtual LEAP_EXPORT void Leap::Listener::onDisconnect | ( | const Controller & | ) | [inline, virtual] |
Called when the Controller object disconnects from the Leap Motion software or the Leap Motion hardware is unplugged. The controller can disconnect when the Leap Motion device is unplugged, the user shuts the Leap Motion software down, or the Leap Motion software encounters an unrecoverable error.
Note: When you launch a Leap-enabled application in a debugger, the Leap Motion library does not disconnect from the application. This is to allow you to step through code without losing the connection because of time outs.
controller | The Controller object invoking this callback function. |
Reimplemented in CameraListener, CameraListener, HandsListener, and LeapListener.
virtual LEAP_EXPORT void Leap::Listener::onExit | ( | const Controller & | ) | [inline, virtual] |
Called when this Listener object is removed from the Controller or the Controller instance is destroyed.
controller | The Controller object invoking this callback function. |
Reimplemented in CameraListener, CameraListener, HandsListener, and LeapListener.
virtual LEAP_EXPORT void Leap::Listener::onFocusGained | ( | const Controller & | ) | [inline, virtual] |
Called when this application becomes the foreground application.
Only the foreground application receives tracking data from the Leap Motion Controller. This function is only called when the controller object is in a connected state.
controller | The Controller object invoking this callback function. |
Reimplemented in CameraListener, CameraListener, and HandsListener.
virtual LEAP_EXPORT void Leap::Listener::onFocusLost | ( | const Controller & | ) | [inline, virtual] |
Called when this application loses the foreground focus.
Only the foreground application receives tracking data from the Leap Motion Controller. This function is only called when the controller object is in a connected state.
controller | The Controller object invoking this callback function. |
Reimplemented in CameraListener, CameraListener, and HandsListener.
virtual LEAP_EXPORT void Leap::Listener::onFrame | ( | const Controller & | ) | [inline, virtual] |
Called when a new frame of hand and finger tracking data is available. Access the new frame data using the Controller::frame() function.
Note, the Controller skips any pending onFrame events while your onFrame handler executes. If your implementation takes too long to return, one or more frames can be skipped. The Controller still inserts the skipped frames into the frame history. You can access recent frames by setting the history parameter when calling the Controller::frame() function. You can determine if any pending onFrame events were skipped by comparing the ID of the most recent frame with the ID of the last received frame.
controller | The Controller object invoking this callback function. |
Reimplemented in CameraListener, CameraListener, HandsListener, and LeapListener.
virtual LEAP_EXPORT void Leap::Listener::onImages | ( | const Controller & | ) | [inline, virtual] |
Called when new images are available. Access the new frame data using the Controller::images() function.
controller | The Controller object invoking this callback function. |
virtual LEAP_EXPORT void Leap::Listener::onInit | ( | const Controller & | ) | [inline, virtual] |
Called once, when this Listener object is newly added to a Controller.
controller | The Controller object invoking this callback function. |
Reimplemented in CameraListener, CameraListener, HandsListener, and LeapListener.
virtual LEAP_EXPORT void Leap::Listener::onServiceConnect | ( | const Controller & | ) | [inline, virtual] |
Called when the Leap Motion daemon/service connects to your application Controller.
controller | The Controller object invoking this callback function. |
Reimplemented in CameraListener, CameraListener, and HandsListener.
virtual LEAP_EXPORT void Leap::Listener::onServiceDisconnect | ( | const Controller & | ) | [inline, virtual] |
Called if the Leap Motion daemon/service disconnects from your application Controller.
Normally, this callback is not invoked. It is only called if some external event or problem shuts down the service or otherwise interrupts the connection.
controller | The Controller object invoking this callback function. |
Reimplemented in CameraListener, CameraListener, and HandsListener.
Leap::Listener::__class__ [private] |
Leap::Listener::__del__ = lambdaself:None [static, private] |
tuple Leap::Listener::__getattr__ = lambdaself,name:_swig_getattr(self, Listener, name) [static, private] |
Leap::Listener::__repr__ = _swig_repr [static, private] |
tuple Leap::Listener::__setattr__ = lambdaself,name,value:_swig_setattr(self, Listener, name, value) [static, private] |
Leap::Listener::__swig_destroy__ = LeapPython.delete_Listener [static, private] |
dictionary Leap::Listener::__swig_getmethods__ = {} [static, private] |
dictionary Leap::Listener::__swig_setmethods__ = {} [static, private] |