public class YAPI extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
YAPI.CalibrationHandlerCallback |
static interface |
YAPI.DeviceArrivalCallback |
static interface |
YAPI.DeviceChangeCallback |
static interface |
YAPI.DeviceRemovalCallback |
static interface |
YAPI.HubDiscoveryCallback |
static interface |
YAPI.LogCallback |
| Constructor and Description |
|---|
YAPI() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
CheckLogicalName(String name)
Checks if a given string is valid as logical name for a module or a function.
|
static void |
EnableUSBHost(Object osContext)
This function is used only on Android.
|
static void |
FreeAPI()
Frees dynamically allocated memory blocks used by the Yoctopuce library.
|
static String |
GetAPIVersion()
Returns the version identifier for the Yoctopuce library in use.
|
static long |
GetTickCount()
Returns the current value of a monotone millisecond-based time counter.
|
static int |
HandleEvents()
Maintains the device-to-library communication channel.
|
static int |
InitAPI(int mode)
Initializes the Yoctopuce programming library explicitly.
|
static int |
PreregisterHub(String url)
Fault-tolerant alternative to RegisterHub().
|
static int |
PreregisterHubWebSocketCallback(Object session) |
static int |
PreregisterHubWebSocketCallback(Object session,
String user,
String pass) |
static void |
RegisterDeviceArrivalCallback(YAPI.DeviceArrivalCallback arrivalCallback)
Register a callback function, to be called each time
a device is plugged.
|
static void |
RegisterDeviceChangeCallback(YAPI.DeviceChangeCallback changeCallback) |
static void |
RegisterDeviceRemovalCallback(YAPI.DeviceRemovalCallback removalCallback)
Register a callback function, to be called each time
a device is unplugged.
|
static int |
RegisterHub(String url)
Setup the Yoctopuce library to use modules connected on a given machine.
|
static int |
RegisterHub(String url,
InputStream request,
OutputStream response) |
static void |
RegisterHubDiscoveryCallback(YAPI.HubDiscoveryCallback hubDiscoveryCallback)
Register a callback function, to be called each time an Network Hub send
an SSDP message.
|
static void |
RegisterLogFunction(YAPI.LogCallback logfun)
Registers a log callback function.
|
static void |
SetThreadSpecificMode() |
static void |
SetUSBPacketAckMs(int pktAckDelay)
Enables the acknowledge of every USB packet received by the Yoctopuce library.
|
static int |
Sleep(long ms_duration)
Pauses the execution flow for a specified duration.
|
static int |
TestHub(String url,
int mstimeout)
Test if the hub is reachable.
|
static int |
TriggerHubDiscovery()
Force a hub discovery, if a callback as been registered with yRegisterHubDiscoveryCallback it
will be called for each net work hub that will respond to the discovery.
|
static void |
UnregisterHub(String url)
Setup the Yoctopuce library to no more use modules connected on a previously
registered machine with RegisterHub.
|
static void |
UnregisterHubWebSocketCallback(Object session) |
static int |
UpdateDeviceList()
Triggers a (re)detection of connected Yoctopuce modules.
|
public static int DefaultCacheValidity
public static final String INVALID_STRING
public static final double INVALID_DOUBLE
public static final int INVALID_INT
public static final long INVALID_LONG
public static final int INVALID_UINT
public static final String YOCTO_API_VERSION_STR
public static final String YOCTO_API_BUILD_STR
public static final int YOCTO_API_VERSION_BCD
public static final int YOCTO_VENDORID
public static final int YOCTO_DEVID_FACTORYBOOT
public static final int YOCTO_DEVID_BOOTLOADER
public static final int HASH_BUF_SIZE
public static final int SUCCESS
public static final int NOT_INITIALIZED
public static final int INVALID_ARGUMENT
public static final int NOT_SUPPORTED
public static final int DEVICE_NOT_FOUND
public static final int VERSION_MISMATCH
public static final int DEVICE_BUSY
public static final int TIMEOUT
public static final int IO_ERROR
public static final int NO_MORE_DATA
public static final int EXHAUSTED
public static final int DOUBLE_ACCES
public static final int UNAUTHORIZED
public static final int RTC_NOT_READY
public static final int FILE_NOT_FOUND
public static final int YOCTO_MANUFACTURER_LEN
public static final int YOCTO_SERIAL_LEN
public static final int YOCTO_BASE_SERIAL_LEN
public static final int YOCTO_PRODUCTNAME_LEN
public static final int YOCTO_FIRMWARE_LEN
public static final int YOCTO_LOGICAL_LEN
public static final int YOCTO_FUNCTION_LEN
public static final int DETECT_NONE
public static final int DETECT_USB
public static final int DETECT_NET
public static final int RESEND_MISSING_PKT
public static final int DETECT_ALL
public static void SetThreadSpecificMode()
throws YAPI_Exception
YAPI_Exceptionpublic static void SetUSBPacketAckMs(int pktAckDelay)
pktAckDelay - : then number of milliseconds before the module
resend the last USB packet.public static String GetAPIVersion()
public static int InitAPI(int mode)
throws YAPI_Exception
mode - : an integer corresponding to the type of automatic
device detection to use. Possible values are
YAPI.DETECT_NONE, YAPI.DETECT_USB, YAPI.DETECT_NET,
and YAPI.DETECT_ALL.YAPI_Exception - on errorpublic static void FreeAPI()
public static int RegisterHub(String url) throws YAPI_Exception
url - : a string containing either "usb","callback" or the
root URL of the hub to monitorYAPI_Exception - on errorpublic static int RegisterHub(String url, InputStream request, OutputStream response) throws YAPI_Exception
YAPI_Exceptionpublic static int PreregisterHubWebSocketCallback(Object session) throws YAPI_Exception
YAPI_Exceptionpublic static int PreregisterHubWebSocketCallback(Object session, String user, String pass) throws YAPI_Exception
YAPI_Exceptionpublic static void UnregisterHubWebSocketCallback(Object session)
public static void EnableUSBHost(Object osContext) throws YAPI_Exception
osContext - : an object of class android.content.Context (or any subclass).YAPI_Exception - on errorpublic static int PreregisterHub(String url) throws YAPI_Exception
url - : a string containing either "usb","callback" or the
root URL of the hub to monitorYAPI_Exception - on errorpublic static void UnregisterHub(String url)
url - : a string containing either "usb" or the
root URL of the hub to monitorpublic static int TestHub(String url, int mstimeout) throws YAPI_Exception
url - : a string containing either "usb","callback" or the
root URL of the hub to monitormstimeout - : the number of millisecond available to test the connection.YAPI_Exceptionpublic static int UpdateDeviceList()
throws YAPI_Exception
YAPI_Exception - on errorpublic static int HandleEvents()
throws YAPI_Exception
YAPI_Exception - on errorpublic static int Sleep(long ms_duration)
throws YAPI_Exception
ms_duration - : an integer corresponding to the duration of the pause,
in milliseconds.YAPI_Exception - on errorpublic static int TriggerHubDiscovery()
throws YAPI_Exception
YAPI_Exception - on errorpublic static long GetTickCount()
public static boolean CheckLogicalName(String name)
name - : a string containing the name to check.public static void RegisterDeviceArrivalCallback(YAPI.DeviceArrivalCallback arrivalCallback)
arrivalCallback - : a procedure taking a YModule parameter, or null
to unregister a previously registered callback.public static void RegisterDeviceChangeCallback(YAPI.DeviceChangeCallback changeCallback)
public static void RegisterDeviceRemovalCallback(YAPI.DeviceRemovalCallback removalCallback)
removalCallback - : a procedure taking a YModule parameter, or null
to unregister a previously registered callback.public static void RegisterHubDiscoveryCallback(YAPI.HubDiscoveryCallback hubDiscoveryCallback)
hubDiscoveryCallback - : a procedure taking two string parameter, the serial
number and the hub URL. Use null to unregister a previously registered callback.public static void RegisterLogFunction(YAPI.LogCallback logfun)
logfun - : a procedure taking a string parameter, or null
to unregister a previously registered callback.Copyright © 2018. All rights reserved.