public class YSdi12Port extends YFunction
| Modifier and Type | Class and Description |
|---|---|
static interface |
YSdi12Port.TimedReportCallback
TimedReportCallback for Sdi12Port
|
static interface |
YSdi12Port.UpdateCallback
Deprecated UpdateCallback for Sdi12Port
|
| Modifier and Type | Field and Description |
|---|---|
protected String |
_command |
protected String |
_currentJob |
protected int |
_errCount |
protected int |
_eventPos |
protected int |
_jobMaxSize |
protected int |
_jobMaxTask |
protected String |
_lastMsg |
protected String |
_protocol |
protected byte[] |
_rxbuff |
protected int |
_rxbuffptr |
protected int |
_rxCount |
protected int |
_rxMsgCount |
protected int |
_rxptr |
protected String |
_serialMode |
protected String |
_startupJob |
protected int |
_txCount |
protected int |
_txMsgCount |
protected YSdi12Port.UpdateCallback |
_valueCallbackSdi12Port |
protected int |
_voltageLevel |
static String |
COMMAND_INVALID
invalid command value
|
static String |
CURRENTJOB_INVALID
invalid currentJob value
|
static int |
ERRCOUNT_INVALID
invalid errCount value
|
static int |
JOBMAXSIZE_INVALID
invalid jobMaxSize value
|
static int |
JOBMAXTASK_INVALID
invalid jobMaxTask value
|
static String |
LASTMSG_INVALID
invalid lastMsg value
|
static String |
PROTOCOL_INVALID
invalid protocol value
|
static int |
RXCOUNT_INVALID
invalid rxCount value
|
static int |
RXMSGCOUNT_INVALID
invalid rxMsgCount value
|
static String |
SERIALMODE_INVALID
invalid serialMode value
|
static String |
STARTUPJOB_INVALID
invalid startupJob value
|
static int |
TXCOUNT_INVALID
invalid txCount value
|
static int |
TXMSGCOUNT_INVALID
invalid txMsgCount value
|
static int |
VOLTAGELEVEL_INVALID |
static int |
VOLTAGELEVEL_OFF
invalid voltageLevel value
|
static int |
VOLTAGELEVEL_RS232 |
static int |
VOLTAGELEVEL_RS485 |
static int |
VOLTAGELEVEL_SDI12 |
static int |
VOLTAGELEVEL_TTL1V8 |
static int |
VOLTAGELEVEL_TTL3V |
static int |
VOLTAGELEVEL_TTL3VR |
static int |
VOLTAGELEVEL_TTL5V |
static int |
VOLTAGELEVEL_TTL5VR |
_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 |
YSdi12Port(String func) |
protected |
YSdi12Port(YAPIContext ctx,
String func) |
| Modifier and Type | Method and Description |
|---|---|
int |
_invokeValueCallback(String value) |
protected void |
_parseAttr(com.yoctopuce.YoctoAPI.YJSONObject json_val) |
YSdi12SensorInfo |
changeAddress(String oldAddress,
String newAddress)
Changes the address of the selected sensor, and returns the sensor information with the new address.
|
ArrayList<YSdi12SensorInfo> |
discoverAllSensors()
Sends a discovery command to the bus, and reads all sensors information reply.
|
YSdi12SensorInfo |
discoverSingleSensor()
Sends a discovery command to the bus, and reads the sensor information reply.
|
int |
end_tell() |
static YSdi12Port |
FindSdi12Port(String func)
Retrieves an SDI12 port for a given identifier.
|
static YSdi12Port |
FindSdi12PortInContext(YAPIContext yctx,
String func)
Retrieves an SDI12 port for a given identifier in a YAPI context.
|
static YSdi12Port |
FirstSdi12Port()
Starts the enumeration of SDI12 ports currently accessible.
|
static YSdi12Port |
FirstSdi12PortInContext(YAPIContext yctx)
Starts the enumeration of SDI12 ports currently accessible.
|
String |
get_command() |
String |
get_currentJob()
Returns the name of the job file currently in use.
|
int |
get_errCount()
Returns the total number of communication errors detected since last reset.
|
int |
get_jobMaxSize()
Returns maximum size allowed for job files.
|
int |
get_jobMaxTask()
Returns the maximum number of tasks in a job that the device can handle.
|
String |
get_lastMsg()
Returns the latest message fully received.
|
String |
get_protocol()
Returns the type of protocol used over the serial line, as a string.
|
int |
get_rxCount()
Returns the total number of bytes received since last reset.
|
int |
get_rxMsgCount()
Returns the total number of messages received since last reset.
|
String |
get_serialMode()
Returns the serial port communication parameters, as a string such as
"1200,7E1,Simplex".
|
String |
get_startupJob()
Returns the job file to use when the device is powered on.
|
int |
get_txCount()
Returns the total number of bytes transmitted since last reset.
|
int |
get_txMsgCount()
Returns the total number of messages send since last reset.
|
int |
get_voltageLevel()
Returns the voltage level used on the serial line.
|
String |
getCurrentJob()
Returns the name of the job file currently in use.
|
int |
getErrCount()
Returns the total number of communication errors detected since last reset.
|
int |
getJobMaxSize()
Returns maximum size allowed for job files.
|
int |
getJobMaxTask()
Returns the maximum number of tasks in a job that the device can handle.
|
String |
getLastMsg()
Returns the latest message fully received.
|
String |
getProtocol()
Returns the type of protocol used over the serial line, as a string.
|
int |
getRxCount()
Returns the total number of bytes received since last reset.
|
int |
getRxMsgCount()
Returns the total number of messages received since last reset.
|
YSdi12SensorInfo |
getSensorInformation(String sensorAddr)
Sends a information command to the bus, and reads sensors information selected.
|
String |
getSerialMode()
Returns the serial port communication parameters, as a string such as
"1200,7E1,Simplex".
|
String |
getStartupJob()
Returns the job file to use when the device is powered on.
|
int |
getTxCount()
Returns the total number of bytes transmitted since last reset.
|
int |
getTxMsgCount()
Returns the total number of messages send since last reset.
|
int |
getVoltageLevel()
Returns the voltage level used on the serial line.
|
YSdi12Port |
nextSdi12Port()
Continues the enumeration of SDI12 ports started using yFirstSdi12Port().
|
String |
queryHex(String hexString,
int maxWait)
Sends a binary message to the serial port, and reads the reply, if any.
|
String |
queryLine(String query,
int maxWait)
Sends a text line query to the serial port, and reads the reply, if any.
|
String |
querySdi12(String sensorAddr,
String cmd,
int maxWait)
Sends a SDI-12 query to the bus, and reads the sensor immediate reply.
|
int |
read_avail()
Returns the number of bytes available to read in the input buffer starting from the
current absolute stream position pointer of the API object.
|
int |
read_seek(int absPos)
Changes the current internal stream position to the specified value.
|
int |
read_tell()
Returns the current absolute stream position pointer of the API object.
|
ArrayList<Integer> |
readArray(int nChars)
Reads data from the receive buffer as a list of bytes, starting at current stream position.
|
byte[] |
readBin(int nChars)
Reads data from the receive buffer as a binary buffer, starting at current stream position.
|
int |
readByte()
Reads one byte from the receive buffer, starting at current stream position.
|
ArrayList<Double> |
readConcurrentMeasurements(String sensorAddr)
Sends a information command to the bus, and reads sensors information selected.
|
String |
readHex(int nBytes)
Reads data from the receive buffer as a hexadecimal string, starting at current stream position.
|
String |
readLine()
Reads a single line (or message) from the receive buffer, starting at current stream position.
|
ArrayList<String> |
readMessages(String pattern,
int maxWait)
Searches for incoming messages in the serial port receive buffer matching a given pattern,
starting at current position.
|
ArrayList<Double> |
readSensor(String sensorAddr,
String measCmd,
int maxWait)
Sends a mesurement command to the SDI-12 bus, and reads the sensor immediate reply.
|
String |
readStr(int nChars)
Reads data from the receive buffer as a string, starting at current stream position.
|
int |
registerValueCallback(YSdi12Port.UpdateCallback callback)
Registers the callback function that is invoked on every change of advertised value.
|
int |
requestConcurrentMeasurements(String sensorAddr)
Sends a information command to the bus, and reads sensors information selected.
|
int |
reset()
Clears the serial port buffer and resets counters to zero.
|
int |
selectJob(String jobfile)
Load and start processing the specified job file.
|
int |
sendCommand(String text) |
int |
set_command(String newval) |
int |
set_currentJob(String newval)
Selects a job file to run immediately.
|
int |
set_protocol(String newval)
Changes the type of protocol used over the serial line.
|
int |
set_serialMode(String newval)
Changes the serial port communication parameters, with a string such as
"1200,7E1,Simplex".
|
int |
set_startupJob(String newval)
Changes the job to use when the device is powered on.
|
int |
set_voltageLevel(int newval)
Changes the voltage type used on the serial line.
|
int |
setCurrentJob(String newval)
Selects a job file to run immediately.
|
int |
setProtocol(String newval)
Changes the type of protocol used over the serial line.
|
int |
setSerialMode(String newval)
Changes the serial port communication parameters, with a string such as
"1200,7E1,Simplex".
|
int |
setStartupJob(String newval)
Changes the job to use when the device is powered on.
|
int |
setVoltageLevel(int newval)
Changes the voltage type used on the serial line.
|
ArrayList<YSdi12SnoopingRecord> |
snoopMessages(int maxWait)
Retrieves messages (both direction) in the SDI12 port buffer, starting at current position.
|
ArrayList<YSdi12SnoopingRecord> |
snoopMessagesEx(int maxWait,
int maxMsg)
Retrieves messages (both direction) in the SDI12 port buffer, starting at current position.
|
int |
uploadJob(String jobfile,
String jsonDef)
Saves the job definition string (JSON data) into a job file.
|
int |
writeArray(ArrayList<Integer> byteList)
Sends a byte sequence (provided as a list of bytes) to the serial port.
|
int |
writeBin(byte[] buff)
Sends a binary buffer to the serial port, as is.
|
int |
writeByte(int code)
Sends a single byte to the serial port.
|
int |
writeHex(String hexString)
Sends a byte sequence (provided as a hexadecimal string) to the serial port.
|
int |
writeLine(String text)
Sends an ASCII string to the serial port, followed by a line break (CR LF).
|
int |
writeStr(String text)
Sends an ASCII string to the serial port, as is.
|
_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 int RXCOUNT_INVALID
public static final int TXCOUNT_INVALID
public static final int ERRCOUNT_INVALID
public static final int RXMSGCOUNT_INVALID
public static final int TXMSGCOUNT_INVALID
public static final String LASTMSG_INVALID
public static final String CURRENTJOB_INVALID
public static final String STARTUPJOB_INVALID
public static final int JOBMAXTASK_INVALID
public static final int JOBMAXSIZE_INVALID
public static final String COMMAND_INVALID
public static final String PROTOCOL_INVALID
public static final int VOLTAGELEVEL_OFF
public static final int VOLTAGELEVEL_TTL3V
public static final int VOLTAGELEVEL_TTL3VR
public static final int VOLTAGELEVEL_TTL5V
public static final int VOLTAGELEVEL_TTL5VR
public static final int VOLTAGELEVEL_RS232
public static final int VOLTAGELEVEL_RS485
public static final int VOLTAGELEVEL_TTL1V8
public static final int VOLTAGELEVEL_SDI12
public static final int VOLTAGELEVEL_INVALID
public static final String SERIALMODE_INVALID
protected int _rxCount
protected int _txCount
protected int _errCount
protected int _rxMsgCount
protected int _txMsgCount
protected String _lastMsg
protected String _currentJob
protected String _startupJob
protected int _jobMaxTask
protected int _jobMaxSize
protected String _command
protected String _protocol
protected int _voltageLevel
protected String _serialMode
protected YSdi12Port.UpdateCallback _valueCallbackSdi12Port
protected int _rxptr
protected byte[] _rxbuff
protected int _rxbuffptr
protected int _eventPos
protected YSdi12Port(YAPIContext ctx, String func)
func - : functionidprotected YSdi12Port(String func)
func - : functionidprotected void _parseAttr(com.yoctopuce.YoctoAPI.YJSONObject json_val)
throws Exception
_parseAttr in class YFunctionExceptionpublic int get_rxCount()
throws YAPI_Exception
YAPI_Exception - on errorpublic int getRxCount()
throws YAPI_Exception
YAPI_Exception - on errorpublic int get_txCount()
throws YAPI_Exception
YAPI_Exception - on errorpublic int getTxCount()
throws YAPI_Exception
YAPI_Exception - on errorpublic int get_errCount()
throws YAPI_Exception
YAPI_Exception - on errorpublic int getErrCount()
throws YAPI_Exception
YAPI_Exception - on errorpublic int get_rxMsgCount()
throws YAPI_Exception
YAPI_Exception - on errorpublic int getRxMsgCount()
throws YAPI_Exception
YAPI_Exception - on errorpublic int get_txMsgCount()
throws YAPI_Exception
YAPI_Exception - on errorpublic int getTxMsgCount()
throws YAPI_Exception
YAPI_Exception - on errorpublic String get_lastMsg() throws YAPI_Exception
YAPI_Exception - on errorpublic String getLastMsg() throws YAPI_Exception
YAPI_Exception - on errorpublic String get_currentJob() throws YAPI_Exception
YAPI_Exception - on errorpublic String getCurrentJob() throws YAPI_Exception
YAPI_Exception - on errorpublic int set_currentJob(String newval) throws YAPI_Exception
newval - : a stringYAPI_Exception - on errorpublic int setCurrentJob(String newval) throws YAPI_Exception
newval - : a stringYAPI_Exception - on errorpublic String get_startupJob() throws YAPI_Exception
YAPI_Exception - on errorpublic String getStartupJob() throws YAPI_Exception
YAPI_Exception - on errorpublic int set_startupJob(String newval) throws YAPI_Exception
newval - : a string corresponding to the job to use when the device is powered onYAPI_Exception - on errorpublic int setStartupJob(String newval) throws YAPI_Exception
newval - : a string corresponding to the job to use when the device is powered onYAPI_Exception - on errorpublic int get_jobMaxTask()
throws YAPI_Exception
YAPI_Exception - on errorpublic int getJobMaxTask()
throws YAPI_Exception
YAPI_Exception - on errorpublic int get_jobMaxSize()
throws YAPI_Exception
YAPI_Exception - on errorpublic int getJobMaxSize()
throws YAPI_Exception
YAPI_Exception - on errorpublic String get_command() throws YAPI_Exception
YAPI_Exceptionpublic int set_command(String newval) throws YAPI_Exception
YAPI_Exceptionpublic String get_protocol() throws YAPI_Exception
YAPI_Exception - on errorpublic String getProtocol() throws YAPI_Exception
YAPI_Exception - on errorpublic int set_protocol(String newval) throws YAPI_Exception
newval - : a string corresponding to the type of protocol used over the serial lineYAPI_Exception - on errorpublic int setProtocol(String newval) throws YAPI_Exception
newval - : a string corresponding to the type of protocol used over the serial lineYAPI_Exception - on errorpublic int get_voltageLevel()
throws YAPI_Exception
YAPI_Exception - on errorpublic int getVoltageLevel()
throws YAPI_Exception
YAPI_Exception - on errorpublic int set_voltageLevel(int newval)
throws YAPI_Exception
newval - : a value among YSdi12Port.VOLTAGELEVEL_OFF, YSdi12Port.VOLTAGELEVEL_TTL3V,
YSdi12Port.VOLTAGELEVEL_TTL3VR, YSdi12Port.VOLTAGELEVEL_TTL5V, YSdi12Port.VOLTAGELEVEL_TTL5VR,
YSdi12Port.VOLTAGELEVEL_RS232, YSdi12Port.VOLTAGELEVEL_RS485, YSdi12Port.VOLTAGELEVEL_TTL1V8 and
YSdi12Port.VOLTAGELEVEL_SDI12 corresponding to the voltage type used on the serial lineYAPI_Exception - on errorpublic int setVoltageLevel(int newval)
throws YAPI_Exception
newval - : a value among YSdi12Port.VOLTAGELEVEL_OFF, YSdi12Port.VOLTAGELEVEL_TTL3V,
YSdi12Port.VOLTAGELEVEL_TTL3VR, YSdi12Port.VOLTAGELEVEL_TTL5V, YSdi12Port.VOLTAGELEVEL_TTL5VR,
YSdi12Port.VOLTAGELEVEL_RS232, YSdi12Port.VOLTAGELEVEL_RS485, YSdi12Port.VOLTAGELEVEL_TTL1V8 and
YSdi12Port.VOLTAGELEVEL_SDI12 corresponding to the voltage type used on the serial lineYAPI_Exception - on errorpublic String get_serialMode() throws YAPI_Exception
YAPI_Exception - on errorpublic String getSerialMode() throws YAPI_Exception
YAPI_Exception - on errorpublic int set_serialMode(String newval) throws YAPI_Exception
newval - : a string corresponding to the serial port communication parameters, with a string such as
"1200,7E1,Simplex"YAPI_Exception - on errorpublic int setSerialMode(String newval) throws YAPI_Exception
newval - : a string corresponding to the serial port communication parameters, with a string such as
"1200,7E1,Simplex"YAPI_Exception - on errorpublic static YSdi12Port FindSdi12Port(String func)
func - : a string that uniquely characterizes the SDI12 port, for instance
MyDevice.sdi12Port.public static YSdi12Port FindSdi12PortInContext(YAPIContext yctx, String func)
yctx - : a YAPI contextfunc - : a string that uniquely characterizes the SDI12 port, for instance
MyDevice.sdi12Port.public int registerValueCallback(YSdi12Port.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 sendCommand(String text) throws YAPI_Exception
YAPI_Exceptionpublic String readLine() throws YAPI_Exception
YAPI_Exception - on errorpublic ArrayList<String> readMessages(String pattern, int maxWait) throws YAPI_Exception
pattern - : a limited regular expression describing the expected message format,
or an empty string if all messages should be returned (no filtering).
When using binary protocols, the format applies to the hexadecimal
representation of the message.maxWait - : the maximum number of milliseconds to wait for a message if none is found
in the receive buffer.YAPI_Exception - on errorpublic int read_seek(int absPos)
absPos - : the absolute position index for next read operations.public int read_tell()
public int read_avail()
throws YAPI_Exception
YAPI_Exceptionpublic int end_tell()
throws YAPI_Exception
YAPI_Exceptionpublic String queryLine(String query, int maxWait) throws YAPI_Exception
query - : the line query to send (without CR/LF)maxWait - : the maximum number of milliseconds to wait for a reply.YAPI_Exception - on errorpublic String queryHex(String hexString, int maxWait) throws YAPI_Exception
hexString - : the message to send, coded in hexadecimalmaxWait - : the maximum number of milliseconds to wait for a reply.YAPI_Exception - on errorpublic int uploadJob(String jobfile, String jsonDef) throws YAPI_Exception
jobfile - : name of the job file to save on the device filesystemjsonDef - : a string containing a JSON definition of the jobYAPI_Exception - on errorpublic int selectJob(String jobfile) throws YAPI_Exception
jobfile - : name of the job file (on the device filesystem)YAPI_Exception - on errorpublic int reset()
throws YAPI_Exception
YAPI_Exception - on errorpublic int writeByte(int code)
throws YAPI_Exception
code - : the byte to sendYAPI_Exception - on errorpublic int writeStr(String text) throws YAPI_Exception
text - : the text string to sendYAPI_Exception - on errorpublic int writeBin(byte[] buff)
throws YAPI_Exception
buff - : the binary buffer to sendYAPI_Exception - on errorpublic int writeArray(ArrayList<Integer> byteList) throws YAPI_Exception
byteList - : a list of byte codesYAPI_Exception - on errorpublic int writeHex(String hexString) throws YAPI_Exception
hexString - : a string of hexadecimal byte codesYAPI_Exception - on errorpublic int writeLine(String text) throws YAPI_Exception
text - : the text string to sendYAPI_Exception - on errorpublic int readByte()
throws YAPI_Exception
YAPI_Exception - on errorpublic String readStr(int nChars) throws YAPI_Exception
nChars - : the maximum number of characters to readYAPI_Exception - on errorpublic byte[] readBin(int nChars)
throws YAPI_Exception
nChars - : the maximum number of bytes to readYAPI_Exception - on errorpublic ArrayList<Integer> readArray(int nChars) throws YAPI_Exception
nChars - : the maximum number of bytes to readYAPI_Exception - on errorpublic String readHex(int nBytes) throws YAPI_Exception
nBytes - : the maximum number of bytes to readYAPI_Exception - on errorpublic String querySdi12(String sensorAddr, String cmd, int maxWait) throws YAPI_Exception
sensorAddr - : the sensor address, as a stringcmd - : the SDI12 query to send (without address and exclamation point)maxWait - : the maximum timeout to wait for a reply from sensor, in millisecondYAPI_Exception - on errorpublic YSdi12SensorInfo discoverSingleSensor() throws YAPI_Exception
YAPI_Exception - on errorpublic ArrayList<YSdi12SensorInfo> discoverAllSensors() throws YAPI_Exception
YAPI_Exception - on errorpublic ArrayList<Double> readSensor(String sensorAddr, String measCmd, int maxWait) throws YAPI_Exception
sensorAddr - : the sensor address, as a stringmeasCmd - : the SDI12 query to send (without address and exclamation point)maxWait - : the maximum timeout to wait for a reply from sensor, in millisecondYAPI_Exception - on errorpublic YSdi12SensorInfo changeAddress(String oldAddress, String newAddress) throws YAPI_Exception
oldAddress - : Actual sensor address, as a stringnewAddress - : New sensor address, as a stringYAPI_Exception - on errorpublic YSdi12SensorInfo getSensorInformation(String sensorAddr) throws YAPI_Exception
sensorAddr - : Sensor address, as a stringYAPI_Exception - on errorpublic ArrayList<Double> readConcurrentMeasurements(String sensorAddr) throws YAPI_Exception
sensorAddr - : Sensor address, as a stringYAPI_Exception - on errorpublic int requestConcurrentMeasurements(String sensorAddr) throws YAPI_Exception
sensorAddr - : Sensor address, as a stringYAPI_Exception - on errorpublic ArrayList<YSdi12SnoopingRecord> snoopMessagesEx(int maxWait, int maxMsg) throws YAPI_Exception
maxWait - : the maximum number of milliseconds to wait for a message if none is found
in the receive buffer.maxMsg - : the maximum number of messages to be returned by the function; up to 254.YAPI_Exception - on errorpublic ArrayList<YSdi12SnoopingRecord> snoopMessages(int maxWait) throws YAPI_Exception
maxWait - : the maximum number of milliseconds to wait for a message if none is found
in the receive buffer.YAPI_Exception - on errorpublic YSdi12Port nextSdi12Port()
public static YSdi12Port FirstSdi12Port()
public static YSdi12Port FirstSdi12PortInContext(YAPIContext yctx)
yctx - : a YAPI context.Copyright © 2026. All rights reserved.