public class YMicroPython extends YFunction
| Modifier and Type | Class and Description |
|---|---|
static interface |
YMicroPython.TimedReportCallback
TimedReportCallback for MicroPython
|
static interface |
YMicroPython.UpdateCallback
Deprecated UpdateCallback for MicroPython
|
static interface |
YMicroPython.YMicroPythonLogCallback
Specialized event Callback for MicroPython
|
| Modifier and Type | Field and Description |
|---|---|
protected String |
_command |
protected String |
_currentScript |
protected int |
_debugMode |
protected int |
_heapFrag |
protected int |
_heapUsage |
protected boolean |
_isFirstCb |
protected String |
_lastMsg |
protected YMicroPython.YMicroPythonLogCallback |
_logCallback |
protected int |
_logPos |
protected int |
_prevCbPos |
protected String |
_prevPartialLog |
protected int |
_stackUsage |
protected double |
_startupDelay |
protected String |
_startupScript |
protected YMicroPython.UpdateCallback |
_valueCallbackMicroPython |
protected int |
_xheapUsage |
static String |
COMMAND_INVALID
invalid command value
|
static String |
CURRENTSCRIPT_INVALID
invalid currentScript value
|
static int |
DEBUGMODE_INVALID |
static int |
DEBUGMODE_OFF
invalid debugMode value
|
static int |
DEBUGMODE_ON |
static int |
HEAPFRAG_INVALID
invalid heapFrag value
|
static int |
HEAPUSAGE_INVALID
invalid heapUsage value
|
static String |
LASTMSG_INVALID
invalid lastMsg value
|
static int |
STACKUSAGE_INVALID
invalid stackUsage value
|
static double |
STARTUPDELAY_INVALID
invalid startupDelay value
|
static String |
STARTUPSCRIPT_INVALID
invalid startupScript value
|
static int |
XHEAPUSAGE_INVALID
invalid xheapUsage value
|
_advertisedValue, _cacheExpiration, _className, _dataStreams, _func, _funId, _hwId, _lastErrorMsg, _lastErrorType, _logicalName, _serial, _userData, _valueCallbackFunction, _yapi, ADVERTISEDVALUE_INVALID, FUNCTIONDESCRIPTOR_INVALID, LOGICALNAME_INVALID| Modifier | Constructor and Description |
|---|---|
protected |
YMicroPython(String func) |
protected |
YMicroPython(YAPIContext ctx,
String func) |
| Modifier and Type | Method and Description |
|---|---|
int |
_internalEventHandler(String cbVal) |
int |
_invokeValueCallback(String value) |
protected void |
_parseAttr(com.yoctopuce.YoctoAPI.YJSONObject json_val) |
int |
clearLogs()
Clears MicroPython interpreter console log buffer.
|
int |
eval(String codeName,
String mpyCode)
Submit MicroPython code for execution in the interpreter.
|
static YMicroPython |
FindMicroPython(String func)
Retrieves a MicroPython interpreter for a given identifier.
|
static YMicroPython |
FindMicroPythonInContext(YAPIContext yctx,
String func)
Retrieves a MicroPython interpreter for a given identifier in a YAPI context.
|
static YMicroPython |
FirstMicroPython()
Starts the enumeration of MicroPython interpreters currently accessible.
|
static YMicroPython |
FirstMicroPythonInContext(YAPIContext yctx)
Starts the enumeration of MicroPython interpreters currently accessible.
|
String |
get_command() |
String |
get_currentScript()
Returns the name of currently active script, if any.
|
int |
get_debugMode()
Returns the activation state of MicroPython debugging interface.
|
int |
get_heapFrag()
Returns the fragmentation ratio of MicroPython main memory,
as observed at the end of the last garbage collection.
|
int |
get_heapUsage()
Returns the percentage of MicroPython main memory in use,
as observed at the end of the last garbage collection.
|
String |
get_lastLogs()
Returns a string with last logs of the MicroPython interpreter.
|
String |
get_lastMsg()
Returns the last message produced by a python script.
|
YMicroPython.YMicroPythonLogCallback |
get_logCallback() |
int |
get_stackUsage()
Returns the maximum percentage of MicroPython call stack in use,
as observed at the end of the last garbage collection.
|
double |
get_startupDelay()
Returns the wait time before running the startup script on power on,
measured in seconds.
|
String |
get_startupScript()
Returns the name of the script to run when the device is powered on.
|
int |
get_xheapUsage()
Returns the percentage of MicroPython external memory in use,
as observed at the end of the last garbage collection.
|
String |
getCurrentScript()
Returns the name of currently active script, if any.
|
int |
getDebugMode()
Returns the activation state of MicroPython debugging interface.
|
int |
getHeapFrag()
Returns the fragmentation ratio of MicroPython main memory,
as observed at the end of the last garbage collection.
|
int |
getHeapUsage()
Returns the percentage of MicroPython main memory in use,
as observed at the end of the last garbage collection.
|
String |
getLastMsg()
Returns the last message produced by a python script.
|
int |
getStackUsage()
Returns the maximum percentage of MicroPython call stack in use,
as observed at the end of the last garbage collection.
|
double |
getStartupDelay()
Returns the wait time before running the startup script on power on,
measured in seconds.
|
String |
getStartupScript()
Returns the name of the script to run when the device is powered on.
|
int |
getXheapUsage()
Returns the percentage of MicroPython external memory in use,
as observed at the end of the last garbage collection.
|
YMicroPython |
nextMicroPython()
Continues the enumeration of MicroPython interpreters started using yFirstMicroPython().
|
int |
registerLogCallback(YMicroPython.YMicroPythonLogCallback callback)
Registers a device log callback function.
|
int |
registerValueCallback(YMicroPython.UpdateCallback callback)
Registers the callback function that is invoked on every change of advertised value.
|
int |
reset()
Stops current execution, and reset the MicroPython interpreter to initial state.
|
int |
set_command(String newval) |
int |
set_currentScript(String newval)
Stops current running script, and/or selects a script to run immediately in a
fresh new environment.
|
int |
set_debugMode(int newval)
Changes the activation state of MicroPython debugging interface.
|
int |
set_startupDelay(double newval)
Changes the wait time before running the startup script on power on, between 0.1
second and 25 seconds.
|
int |
set_startupScript(String newval)
Changes the script to run when the device is powered on.
|
int |
setCurrentScript(String newval)
Stops current running script, and/or selects a script to run immediately in a
fresh new environment.
|
int |
setDebugMode(int newval)
Changes the activation state of MicroPython debugging interface.
|
int |
setStartupDelay(double newval)
Changes the wait time before running the startup script on power on, between 0.1
second and 25 seconds.
|
int |
setStartupScript(String newval)
Changes the script to run when the device is powered on.
|
_AddToCache, _clearDataStreamCache, _decode_json_int, _decode_json_string, _download, _escapeAttr, _FindFromCache, _FindFromCacheInContext, _get_json_path_struct, _get_json_path, _is_valid_pass, _json_get_array, _json_get_key, _json_get_string, _parse, _parserHelper, _setAttr, _throw, _UpdateTimedReportCallbackList, _UpdateValueCallbackList, _upload, _upload, _uploadEx, clearCache, describe, errMessage, errorMessage, errorType, errType, FindFunction, FindFunctionInContext, FirstFunction, FirstFunctionInContext, functionDescriptor, get_advertisedValue, get_errorMessage, get_errorType, get_friendlyName, get_functionDescriptor, get_functionId, get_hardwareId, get_logicalName, get_module, get_serialNumber, get_userData, getAdvertisedValue, getErrorMessage, getErrorType, getFriendlyName, getFunctionDescriptor, getFunctionId, getHardwareId, getLogicalName, getModule, getUserData, isOnline, isReadOnly, load, loadAttribute, module, muteValueCallbacks, nextFunction, registerValueCallback, set_advertisedValue, set_logicalName, set_userData, setLogicalName, setUserData, toString, unmuteValueCallbacks, userDatapublic static final String LASTMSG_INVALID
public static final int HEAPUSAGE_INVALID
public static final int HEAPFRAG_INVALID
public static final int XHEAPUSAGE_INVALID
public static final int STACKUSAGE_INVALID
public static final String CURRENTSCRIPT_INVALID
public static final String STARTUPSCRIPT_INVALID
public static final double STARTUPDELAY_INVALID
public static final int DEBUGMODE_OFF
public static final int DEBUGMODE_ON
public static final int DEBUGMODE_INVALID
public static final String COMMAND_INVALID
protected String _lastMsg
protected int _heapUsage
protected int _heapFrag
protected int _xheapUsage
protected int _stackUsage
protected String _currentScript
protected String _startupScript
protected double _startupDelay
protected int _debugMode
protected String _command
protected YMicroPython.UpdateCallback _valueCallbackMicroPython
protected YMicroPython.YMicroPythonLogCallback _logCallback
protected boolean _isFirstCb
protected int _prevCbPos
protected int _logPos
protected String _prevPartialLog
protected YMicroPython(YAPIContext ctx, String func)
func - : functionidprotected YMicroPython(String func)
func - : functionidprotected void _parseAttr(com.yoctopuce.YoctoAPI.YJSONObject json_val)
throws Exception
_parseAttr in class YFunctionExceptionpublic String get_lastMsg() throws YAPI_Exception
YAPI_Exception - on errorpublic String getLastMsg() throws YAPI_Exception
YAPI_Exception - on errorpublic int get_heapUsage()
throws YAPI_Exception
YAPI_Exception - on errorpublic int getHeapUsage()
throws YAPI_Exception
YAPI_Exception - on errorpublic int get_heapFrag()
throws YAPI_Exception
YAPI_Exception - on errorpublic int getHeapFrag()
throws YAPI_Exception
YAPI_Exception - on errorpublic int get_xheapUsage()
throws YAPI_Exception
YAPI_Exception - on errorpublic int getXheapUsage()
throws YAPI_Exception
YAPI_Exception - on errorpublic int get_stackUsage()
throws YAPI_Exception
YAPI_Exception - on errorpublic int getStackUsage()
throws YAPI_Exception
YAPI_Exception - on errorpublic String get_currentScript() throws YAPI_Exception
YAPI_Exception - on errorpublic String getCurrentScript() throws YAPI_Exception
YAPI_Exception - on errorpublic int set_currentScript(String newval) throws YAPI_Exception
newval - : a stringYAPI_Exception - on errorpublic int setCurrentScript(String newval) throws YAPI_Exception
newval - : a stringYAPI_Exception - on errorpublic String get_startupScript() throws YAPI_Exception
YAPI_Exception - on errorpublic String getStartupScript() throws YAPI_Exception
YAPI_Exception - on errorpublic int set_startupScript(String newval) throws YAPI_Exception
newval - : a string corresponding to the script to run when the device is powered onYAPI_Exception - on errorpublic int setStartupScript(String newval) throws YAPI_Exception
newval - : a string corresponding to the script to run when the device is powered onYAPI_Exception - on errorpublic int set_startupDelay(double newval)
throws YAPI_Exception
newval - : a floating point number corresponding to the wait time before running the startup
script on power on, between 0.1
second and 25 secondsYAPI_Exception - on errorpublic int setStartupDelay(double newval)
throws YAPI_Exception
newval - : a floating point number corresponding to the wait time before running the startup
script on power on, between 0.1
second and 25 secondsYAPI_Exception - on errorpublic double get_startupDelay()
throws YAPI_Exception
YAPI_Exception - on errorpublic double getStartupDelay()
throws YAPI_Exception
YAPI_Exception - on errorpublic int get_debugMode()
throws YAPI_Exception
YAPI_Exception - on errorpublic int getDebugMode()
throws YAPI_Exception
YAPI_Exception - on errorpublic int set_debugMode(int newval)
throws YAPI_Exception
newval - : either YMicroPython.DEBUGMODE_OFF or YMicroPython.DEBUGMODE_ON, according to the
activation state of MicroPython debugging interfaceYAPI_Exception - on errorpublic int setDebugMode(int newval)
throws YAPI_Exception
newval - : either YMicroPython.DEBUGMODE_OFF or YMicroPython.DEBUGMODE_ON, according to the
activation state of MicroPython debugging interfaceYAPI_Exception - on errorpublic String get_command() throws YAPI_Exception
YAPI_Exceptionpublic int set_command(String newval) throws YAPI_Exception
YAPI_Exceptionpublic static YMicroPython FindMicroPython(String func)
func - : a string that uniquely characterizes the MicroPython interpreter, for instance
MyDevice.microPython.public static YMicroPython FindMicroPythonInContext(YAPIContext yctx, String func)
yctx - : a YAPI contextfunc - : a string that uniquely characterizes the MicroPython interpreter, for instance
MyDevice.microPython.public int registerValueCallback(YMicroPython.UpdateCallback callback)
callback - : the callback function to call, or a null pointer. The callback function should take two
arguments: the function object of which the value has changed, and the character string describing
the new advertised value.public int _invokeValueCallback(String value)
_invokeValueCallback in class YFunctionpublic int eval(String codeName, String mpyCode) throws YAPI_Exception
codeName - : name of the code file (used for error reporting only)mpyCode - : MicroPython code to compile and executeYAPI_Exception - on errorpublic int reset()
throws YAPI_Exception
YAPI_Exception - on errorpublic int clearLogs()
throws YAPI_Exception
YAPI_Exception - on errorpublic String get_lastLogs() throws YAPI_Exception
YAPI_Exception - on errorpublic int registerLogCallback(YMicroPython.YMicroPythonLogCallback callback) throws YAPI_Exception
callback - : the callback function to invoke, or a null pointer.
The callback function should take two arguments:
the module object that emitted the log message,
and the character string containing the log.YAPI_Exception - on errorpublic YMicroPython.YMicroPythonLogCallback get_logCallback()
public int _internalEventHandler(String cbVal) throws YAPI_Exception
YAPI_Exceptionpublic YMicroPython nextMicroPython()
public static YMicroPython FirstMicroPython()
public static YMicroPython FirstMicroPythonInContext(YAPIContext yctx)
yctx - : a YAPI context.Copyright © 2026. All rights reserved.