Continuous maintenance address http://52coding.com/leap-motion-architecture
Web https://developer.leapmotion.com/documentation/GetStarted/Leap_Architecture.html
Leap Motion Architecture
The Leap Motion somatosensory Controller supports the most popular desktop operating systems. The Leap Motion program acts as a service (in Windows) or a daemon (in Mac and Linux ). This program is connected to the Leap Motion somatosensory controller through the USB bus. Leap-based applications use the Leap Motion service to obtain Motion tracking data. The Leap Motion SDK provides two types of APIs to obtain Leap Motion data. These APIs allow you to develop Leap-based applications in multiple languages, including running JavaScript in a browser.
Note: The Leap Motion service/daemon communicates with the application through TCP port 127.0.0.1: 5905. This address-the port must not be blocked by the firewall or other programs.
Programming Interface
The Leap Motion SDK provides two types of APIs to obtain tracing data from the Leap Motion service. One is the native interface and the other is the web socket WebSocket. The native interface is a dynamic library that allows you to create new Leap applications. Web socket interfaces and JavaScript client libraries allow you to create Leap-based applications.
Application Interface of Leap Motion
The application interface is provided through the dynamic link library. This library connects to the Leap Motion service and provides tracing data for your program. You can directly link to the library in applications developed in C ++ and Objective-C, or bind a link to the Python language through Java, C.
Yes: Leap-based applications
1. the Leap Motion Service receives data from the Leap Motion Controller through the USB bus. It [this service] processes this information and sends it to the running Leap application. By default, the service only sends tracing data to foreground applications. However, applications can receive data from the backend through inquiry (the inquiry can be denied by the user ).
2. the Leap Motion Setting dialog box is independent of the service. It allows computer users to configure the installation of Leap Motion. In Windows, this configuration program is a Control Panel applet, while in Mac X, it is a menu bar.
3. The front-end Leap Motion application receives Motion tracking data from the service. A Leap application can be linked to the Leap Motion service through the native Leap Motion library. Your application can be directly connected to the native library through C ++ and Objective-C, or linked through the language packaging Library (Java, C #, and Python.
4. When a Leap application loses the OS focus, the Leap Motion service stops sending data to it. With the request license, the application can receive data in the background. When running in the background, it is configured by the foreground program.
Leap Motion web socket interface
The Leap Motion service runs on port 6437 of the local region using web socket (WebSocket. Web socket interfaces provide tracing data through JSON information. A local JavaScript library can accept JSON messages and use tracking data as common JavaScript objects.
: Leap Web Application
1. the Leap Motion Service provides web socket service and listens to http: // 127.0.0.1: 6437.
2. The Setting Dialog Box of Leap Motion allows you to start or Disable web socket service.
3. the server sends tracing data in JSON format. An application can return configuration information to the server.
4. The JavaScript library of the leap. js client should be used in Web applications. This library establishes a link with the server and accepts JSON information. APIS provided by a JavaScript library are similar to those provided by native APIs.
This interface is mainly used for Web applications, but can be used by any application that can establish web socket. This service complies with RFC6455.
Programming Language Support
The Leap Motion library is C ++ encoded. Leap Motion still uses SWIG, an open-source tool, to generate C #, Java and Python language binding. The binding generated by SWIG can translate the calling of the C ++ Leap Motion library by the binding language. Each SWIG binding uses two additional libraries. For JavaScript and web application development, Leap Motion provides a web socket service and a client JavaScript library.
When developing Leap applications and plug-ins, all required libraries, code, and header files are included in the Leap Motion SDK, except for the client JavaScript library of leap. js. You can use the Leap Motion development portal to download the Leap Motion SDK. SDK packages are provided for any supported operating systems. The JavaScript client library is independent and can be downloaded from LeapJS GitHub repository.
C ++
To develop a Leap Motion Controller Application Using C ++, you need to add the API header file in your program and link it to the Leap Motion library. According to the operating system, it may be libLeap. dylib, Leap. dll or libLeap. so.
Objective-C
The Objective-C application is provided by handwritten encapsulation code. To create an Objective-C Leap application, you need to include the C ++ header file in the program, and then encapsulate the header file and the Objective-C ++ code file. You can use the pure Objective-C class defined in the encapsulation. Link your program to libLeap. dylib and import the library under your application package.
C #
The C # class definition is provided by the independent libraries in the. NET 3.5 and. NET 4.0 environments respectively. For more information about your code, see LeapCSharp. NET3.5.dll or LeapCSharp. NET4.0.dll (all supported operating systems use libraries with the same name ). These libraries load libCSharp. dylib (Mac), LeapCSharp. dll (Windows), or libLeapCSharp. so (Linux ). The intermediate library loads libLeap. dylib, Leap. dll, or libLeap. so (depending on the system ).
Use the. NET3.5 library to develop Unity 3D games. The Leap Motion SDK provides a "Pro" version of the Unity development environment. Check the articles in the knowledge base and check whether the Unity editor of each version supports plug-ins for Leap application development.
Java
Leap. jar contains the Java class of Leap Motion. This code is loaded into libLeapJava. dylib (Mac), LeapJaval. dll (Windows), or libLeapJava. so (Linxu ). These libraries that contain native code can translate Java functions into basic Leap Motion APIs in libLeap. dylib, Leap. dll, or libLeap. so. The basic Leap Motion dynamic library can be loaded through the intermediate library.
Python
Leap. py contains the Python module, which can be used in your Python application. This module loads LeapPython. so (Mac and Linxu) or LeapPython. dll (Windows ). These libraries load libLeap. dylib, Leap. dll, or libLeap. so.
JavaScript
Leap Motion JavaScript has two important components. The first part is the web socket server provided by the Leap Motion service. This server allows web applications (or any program that can link to Web sockets) to obtain Leap Motion Tracking Information in JSON format. The second part is the JavaScript client library, Leap. js. Leap. js is an open-source JavaScript API that can accept JSON output from Web sockets and present it in a similar form physically and structurally to native Leap MotionAPI.
Other programming languages
The language binding versions created by other societies can be seen from the links.
Operating System Support
The Leap Motion program currently supports OS X 10.6 and Windows 7 +. There are also some alpha versions of the Linux SDK provided to developers.