21. High-level API Reference
YAPI
YAPI.RegisterHub()
yRegisterHub()
Setup the Yoctopuce library to use modules connected on a given machine.
js
function yRegisterHub(
url
,
errmsg
)
cpp
YRETCODE yRegisterHub( const string&
url
, string&
errmsg
)
m
+(YRETCODE) RegisterHub :(NSString *)
url
:(NSError**)
errmsg
pas
function yRegisterHub(
url
: string, var
errmsg
: string): integer
vb
function yRegisterHub( ByVal
url
As String,
ByRef
errmsg
As String) As Integer
cs
int RegisterHub( string
url
, ref string
errmsg
)
java
int RegisterHub( String
url
)
uwp
async Task<int> RegisterHub( string
url
)
py
def RegisterHub(
url
,
errmsg
=None)
php
function yRegisterHub(
$url
,
&$errmsg
)
es
function RegisterHub(
url
,
errmsg
)
The parameter will determine how the API will work. Use the following values:
usb: When the usb keyword is used, the API will work with devices connected directly to the USB bus.
Some programming languages such a Javascript, PHP, and Java don't provide direct access to USB
hardware, so usb will not work with these. In this case, use a VirtualHub or a networked YoctoHub (see
below).
x.x.x.x or hostname: The API will use the devices connected to the host with the given IP address or
hostname. That host can be a regular computer running a VirtualHub, or a networked YoctoHub such
as YoctoHub-Ethernet or YoctoHub-Wireless. If you want to use the VirtualHub running on you local
computer, use the IP address 127.0.0.1.
callback: that keyword make the API run in "HTTP Callback" mode. This a special mode allowing to
take control of Yoctopuce devices through a NAT filter when using a VirtualHub or a networked
YoctoHub. You only need to configure your hub to call your server script on a regular basis. This mode
is currently available for PHP and Node.JS only.
Be aware that only one application can use direct USB access at a given time on a machine. Multiple
access would cause conflicts while trying to access the USB modules. In particular, this means that you
must stop the VirtualHub software before starting an application that uses direct USB access. The
workaround for this limitation is to setup the library to use the VirtualHub rather than direct USB access.
If access control has been activated on the hub, virtual or not, you want to reach, the URL parameter
should look like:
http://username:password@address:port
You can call RegisterHub several times to connect to several machines.
Parameters :
url
a string containing either "usb","callback" or the root URL of the hub to monitor
errmsg
a string passed by reference to receive any error message.
Returns :
YAPI_SUCCESS
when the call succeeds.
www.yoctopuce.com
151
Содержание Yocto-RangeFinder
Страница 1: ...Yocto RangeFinder User s guide...
Страница 2: ......
Страница 18: ...12 www yoctopuce com...
Страница 26: ...20 www yoctopuce com...
Страница 42: ...36 www yoctopuce com...
Страница 70: ...gcc lyocto lm lpthread lusb 1 0 lstdc 10 Using Yocto RangeFinder with C 64 www yoctopuce com...
Страница 90: ...84 www yoctopuce com...
Страница 120: ...114 www yoctopuce com...
Страница 130: ...124 www yoctopuce com...
Страница 158: ...21 High level API Reference On failure throws an exception or returns a negative error code 152 www yoctopuce com...
Страница 484: ...478 www yoctopuce com...
Страница 488: ...482 www yoctopuce com...
Страница 490: ...23 Characteristics 484 www yoctopuce com...
Страница 491: ......
Страница 492: ......