
21. Using with unsupported languages
Yoctopuce modules can be driven from most common programming languages. New languages are
regularly added, depending on the interest expressed by Yoctopuce product users. Nevertheless,
some languages are not, and will never be, supported by Yoctopuce. There can be several reasons
for this: compilers which are not available anymore, unadapted environments, etc.
However, there are alternative methods to access Yoctopuce modules from an unsupported
programming language.
21.1. Command line
The easiest method to drive Yoctopuce modules from an unsupported programming language is to
use the command line API through system calls. The command line API is in fact made of a group of
small executables which are easy to call. Their output is also easy to analyze. As most programming
languages allow you to make system calls, the issue is solved with a few lines of code.
However, if the command line API is the easiest solution, it is neither the fastest nor the most
efficient. For each call, the executable must initialize its own API and make an inventory of USB
connected modules. This requires about one second per call.
21.2. VirtualHub and HTTP GET
The
VirtualHub
is available on almost all current platforms. It is generally used as a gateway to
provide access to Yoctopuce modules from languages which prevent direct access to hardware
layers of a computer (JavaScript, PHP, Java, ...).
In fact, the
VirtualHub
is a small web server able to route HTTP requests to Yoctopuce modules. This
means that if you can make an HTTP request from your programming language, you can drive
Yoctopuce modules, even if this language is not officially supported.
REST interface
At a low level, the modules are driven through a REST API. Thus, to control a module, you only need
to perform appropriate requests on the
VirtualHub
. By default, the
VirtualHub
HTTP port is 4444.
An important advantage of this technique is that preliminary tests are very easy to implement. You
only need a
VirtualHub
and a simple web browser. If you copy the following URL in your preferred
browser, while the
VirtualHub
is running, you obtain the list of the connected modules.
http://127.0.0.1:4444/api/services/whitePages.txt
www.yoctopuce.com
127
Содержание Yocto-Display
Страница 1: ...Yocto Display User Manual...
Страница 2: ......
Страница 40: ...34 www yoctopuce com...
Страница 52: ...46 www yoctopuce com...
Страница 84: ...78 www yoctopuce com...
Страница 92: ...86 www yoctopuce com...
Страница 130: ...124 www yoctopuce com...
Страница 158: ...22 High level API Reference 152 www yoctopuce com On failure throws an exception or returns a negative error code...
Страница 422: ...416 www yoctopuce com...
Страница 424: ...24 Characteristics 418 www yoctopuce com...