19. 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.
19.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.
19.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
131
Summary of Contents for Yocto-GPS
Page 1: ...Yocto GPS User s guide...
Page 2: ......
Page 6: ...22 Characteristics 557 Blueprint 559 Index 561...
Page 10: ...4 www yoctopuce com...
Page 14: ...8 www yoctopuce com...
Page 18: ...12 www yoctopuce com...
Page 22: ...16 www yoctopuce com...
Page 38: ...32 www yoctopuce com...
Page 42: ...36 www yoctopuce com...
Page 54: ...48 www yoctopuce com...
Page 72: ...66 www yoctopuce com...
Page 92: ...86 www yoctopuce com...
Page 122: ...116 www yoctopuce com...
Page 132: ...126 www yoctopuce com...
Page 564: ...22 Characteristics 558 www yoctopuce com...
Page 565: ......
Page 566: ......