### TCP Server Setup and Listening Source: https://github.com/kenta-shimizu/secs4java8/blob/master/src/main/raspi-python/TcpIpSerialConverter/tcpip-serial-converter_next.txt Sets up a TCP server socket, binds it to an address, and listens for incoming connections. It reuses the address and starts a new thread for each accepted connection. ```python try: with socket.socket(address_family, socket.SOCK_STREAM) as server: server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) server.bind(address) str_server = str(server) print("server bind: %r" % str_server) server.listen(10) while not self.closed: sock, client_addr = server.accept() TcpIpSerialConverter._startThread(self._reading, (sock,)) except Exception as e: print("%r" % e) finally: print("server closed: %r" % str_server) if not self.closed: time.sleep(self.params.rebind) ``` -------------------------------- ### Main Execution Block Source: https://github.com/kenta-shimizu/secs4java8/blob/master/src/main/raspi-python/TcpIpSerialConverter/tcpip-serial-converter_next.txt Initializes the TcpIpSerialConverter with parameters obtained from command-line arguments and starts its main run loop. ```python if __name__ == '__main__': with TcpIpSerialConverter(_get_params()) as v: v.run() ``` -------------------------------- ### Create SECS-I (onTcpIp) Communicator Source: https://github.com/kenta-shimizu/secs4java8/blob/master/README.md Example for creating and opening a SECS-I communicator over TCP/IP in client mode. Configure socket address, device ID, master status, equipment status, timeouts, and retries. ```java /* SECS-I (onTcpIp) open example. This is connect/client type connection. This and 'Secs1OnTcpIpReceiverCommunicator' are a pair. */ Secs1OnTcpIpCommunicatorConfig config = new Secs1OnTcpIpCommunicatorConfig(); config.socketAddress(new InetSocketAddress("127.0.0.1", 10000)); config.deviceId(10); config.isMaster(true); config.isEquip(true); config.timeout().t1( 1.0F); config.timeout().t2(15.0F); config.timeout().t3(45.0F); config.timeout().t4(45.0F); config.retry(3); config.gem().clockType(ClockType.A16); SecsCommunicator secs1 = Secs1OnTcpIpCommunicator.newInstance(config); secs1.open(); ``` -------------------------------- ### Create SECS-II Message Source: https://github.com/kenta-shimizu/secs4java8/blob/master/README.md Example demonstrating how to construct a SECS-II message using the Secs2 class. Supports lists, binary, unsigned integers, and ASCII strings. ```java /* example */ Secs2 secs2 = Secs2.list( Secs2.binary((byte)0x81), Secs2.uint2(1001), Secs2.ascii("ON FIRE") ); ``` -------------------------------- ### Create SECS-I (onTcpIp) Receiver Communicator Source: https://github.com/kenta-shimizu/secs4java8/blob/master/README.md Example for creating and opening a SECS-I receiver communicator over TCP/IP in server mode. Configure socket address, device ID, master status, equipment status, timeouts, and retries. ```java /* SECS-I (onTcpIp) Receiver open example. This is bind/server type connection. This and 'Secs1OnTcpIpCommunicator' are a pair. */ Secs1OnTcpIpReceiverCommunicatorConfig config = new Secs1OnTcpIpReceiverCommunicatorConfig(); config.socketAddress(new InetSocketAddress("127.0.0.1", 10000)); config.deviceId(10); config.isMaster(false); config.isEquip(false); config.timeout().t1( 1.0F); config.timeout().t2(15.0F); config.timeout().t3(45.0F); config.timeout().t4(45.0F); config.retry(3); config.gem().clockType(ClockType.A16); SecsCommunicator secs1r = Secs1OnTcpIpReceiverCommunicator.newInstance(config); secs1r.open(); ``` -------------------------------- ### Send Various SECS/GEM Control Messages Source: https://github.com/kenta-shimizu/secs4java8/blob/master/README.md Examples of sending various control messages like S1F13, S1F15, S1F17, S5F2, S6F12, and S9F messages. ```java /* examples */ COMMACK commack = active.gem().s1f13(); OFLACK oflack = active.gem().s1f15(); ONLACK onlack = acitve.gem().s1f17(); passive.gem().s1f14(primaryMsg, COMMACK.OK); passive.gem().s1f16(primaryMsg); passive.gem().s1f18(primaryMsg, ONLACK.OK); active.gem().s5f2(primaryMsg, ACKC5.OK); active.gem().s6f12(primaryMsg, ACKC6.OK); passive.gem().s9f1(referenceMsg); passive.gem().s9f3(referenceMsg); passive.gem().s9f5(referenceMsg); passive.gem().s9f7(referenceMsg); passive.gem().s9f9(referenceMsg); passive.gem().s9f11(referenceMsg); Secs2 dataId = passive.gem().autoDataId(); ``` -------------------------------- ### Create HSMS-SS Active Communicator Source: https://github.com/kenta-shimizu/secs4java8/blob/master/README.md Example for creating and opening an HSMS-SS Active communicator. Configure connection mode, socket address, session ID, equipment status, timeouts, and link test interval. ```java /* HSMS-SS-Active open example */ HsmsSsCommunicatorConfig config = new HsmsSsCommunicatorConfig(); config.connectionMode(HsmsConnectionMode.ACTIVE); config.socketAddress(new InetSocketAddress("127.0.0.1", 5000)); config.sessionId(10); config.isEquip(false); config.timeout().t3(45.0F); config.timeout().t5(10.0F); config.timeout().t6( 5.0F); config.timeout().t8( 5.0F); config.linktest(120.0F); config.gem().clockType(ClockType.A16); SecsCommunicator active = HsmsSsCommunicator.newInstance(config); active.open(); ``` -------------------------------- ### Create HSMS-SS Passive Communicator Source: https://github.com/kenta-shimizu/secs4java8/blob/master/README.md Example for creating and opening an HSMS-SS Passive communicator. Configure connection mode, socket address, session ID, equipment status, and timeouts. ```java /* HSMS-SS-Passive open example */ HsmsSsCommunicatorConfig config = new HsmsSsCommunicatorConfig(); config.connectionMode(HsmsConnectionMode.PASSIVE); config.socketAddress(new InetSocketAddress("127.0.0.1", 5000)); config.sessionId(10); config.isEquip(true); config.timeout().t3(45.0F); config.timeout().t6( 5.0F); config.timeout().t7(10.0F); config.timeout().t8( 5.0F); config.gem().mdln("MDLN-A"); config.gem().softrev("000001"); config.gem().clockType(ClockType.A16); SecsCommunicator passive = HsmsSsCommunicator.newInstance(config); passive.open(); ``` -------------------------------- ### Thread Management Utility Source: https://github.com/kenta-shimizu/secs4java8/blob/master/src/main/raspi-python/TcpIpSerialConverter/tcpip-serial-converter_next.txt A class method to create and start a new daemon thread for a given function and arguments. Returns the created thread object. ```python @classmethod def _startThread(cls, func, args=()): th = threading.Thread(target=func, args=args, daemon=True) th.start() return th ``` -------------------------------- ### Send Primary Message and Receive Reply Source: https://github.com/kenta-shimizu/secs4java8/blob/master/README.md Example of sending a primary SECS message (S5F1) and receiving a reply. The send method is blocking and returns an Optional containing the reply if the W-Bit is true, or an empty Optional if false. A T3-Timeout will throw SecsWaitReplyMessageException. ```java /* Send S5F1 W. example */ Optional reply = passive.send( 5, 1, true, secs2 ); ``` -------------------------------- ### Get HSMS Session Instance Source: https://github.com/kenta-shimizu/secs4java8/blob/master/README-HSMS-GS.md Retrieve an HSMS session instance from an HsmsGsCommunicator using its session ID, or get a set of all active sessions. ```java /* from Session-ID */ HsmsSession session100 = passive.getHsmsSession(100); /* Session Set */ Set sessions = passive.getHsmsSessions(); ``` -------------------------------- ### waitUntilStartsWithAndGet Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/com/shimizukenta/secs/local/property/StringObservable.html Waits until the observable string starts with the provided prefix and returns the last observed value. ```APIDOC ## waitUntilStartsWithAndGet(java.lang.String prefix) ### Description Waiting until value is startsWith, and return last value. ### Method default java.lang.String ### Parameters #### Path Parameters - **prefix** (java.lang.String) - Description of the prefix parameter. ``` ```APIDOC ## waitUntilStartsWithAndGet(java.lang.String prefix, int toOffset) ### Description Waiting until value is startsWith, and return last value. ### Method default java.lang.String ### Parameters #### Path Parameters - **prefix** (java.lang.String) - Description of the prefix parameter. - **toOffset** (int) - Description of the toOffset parameter. ``` ```APIDOC ## waitUntilStartsWithAndGet(java.lang.String prefix, int toOffset, long timeout, java.util.concurrent.TimeUnit unit) ### Description Waiting until value is startsWith, and return last value. ### Method default java.lang.String ### Parameters #### Path Parameters - **prefix** (java.lang.String) - Description of the prefix parameter. - **toOffset** (int) - Description of the toOffset parameter. - **timeout** (long) - Description of the timeout parameter. - **unit** (java.util.concurrent.TimeUnit) - Description of the unit parameter. ``` -------------------------------- ### Secs1OnTcpIpCommunicator.open(Secs1OnTcpIpCommunicatorConfig) Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/index-all.html Creates a SECS-I-on-Tcp/IP instance and opens it. ```APIDOC ## Secs1OnTcpIpCommunicator.open(Secs1OnTcpIpCommunicatorConfig) ### Description Creates a SECS-I-on-Tcp/IP instance and opens it. ### Method Secs1OnTcpIpCommunicator open(Secs1OnTcpIpCommunicatorConfig config) ``` -------------------------------- ### Get Report Alias from Received Message Source: https://github.com/kenta-shimizu/secs4java8/blob/master/README.md Retrieve the Report-Alias from a received S6F11 or S6F13 message by parsing the RPTID. ```java Secs2 rptid = recvS6F11Msg.secs2().get(2, ...); /* Get RPTID SECS-II */ Optional op = evRptConf.getReport(rptid); Optional alias = op.flatMap(rpt -> rpt.alias()); /* Get Report-Alias */ ``` -------------------------------- ### Secs1OnTcpIpReceiverCommunicator.open(Secs1OnTcpIpReceiverCommunicatorConfig) Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/index-all.html Creates a SECS-I-on-Tcp/IP-Receiver instance and opens it. ```APIDOC ## Secs1OnTcpIpReceiverCommunicator.open(Secs1OnTcpIpReceiverCommunicatorConfig) ### Description Creates a SECS-I-on-Tcp/IP-Receiver instance and opens it. ### Method Secs1OnTcpIpReceiverCommunicator open(Secs1OnTcpIpReceiverCommunicatorConfig config) ``` -------------------------------- ### Get Event Alias from Received Message Source: https://github.com/kenta-shimizu/secs4java8/blob/master/README.md Retrieve the Event-Alias from a received S6F11 or S6F13 message by parsing the CEID. ```java Secs2 ceid = recvS6F11Msg.secs2().get(1); /* Get CEID SECS-II */ Optional op = evRptConf.getCollectionEvent(ceid); Optional alias = op.flatMap(ev -> ev.alias()); /* Get Event-ALias */ ``` -------------------------------- ### Create Dynamic Event Report Configuration Instance Source: https://github.com/kenta-shimizu/secs4java8/blob/master/README.md Instantiate a DynamicEventReportConfig object to begin configuring dynamic event reports. ```java DynamicEventReportConfig evRptConf = active.gem().newDynamicEventReportConfig(); ``` -------------------------------- ### HsmsSsCommunicator.open(HsmsSsCommunicatorConfig) Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/index-all.html Creates a new HSMS-SS-Communicator instance and opens it. ```APIDOC ## HsmsSsCommunicator.open(HsmsSsCommunicatorConfig) ### Description Creates a new HSMS-SS-Communicator instance and opens it. ### Method HsmsSsCommunicator open(HsmsSsCommunicatorConfig config) ``` -------------------------------- ### Enum Utility Methods Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/com/shimizukenta/secs/hsms/HsmsMessageType.html Provides utility methods for working with the HsmsMessageType enum, including retrieving all values, finding a type by name, and getting byte codes. ```APIDOC ## Enum Utility Methods Provides utility methods for working with the HsmsMessageType enum, including retrieving all values, finding a type by name, and getting byte codes. ### values() - **Description**: Returns an array containing all of the constants of this enum type, in the order they are declared. - **Return**: An array containing all of the constants of this enum type, in the order they are declared. ### valueOf(String name) - **Description**: Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant (and will be case-sensitive). - **Parameters**: - `name` (String) - The name of the enum constant to return. - **Return**: The enum constant with the specified name. - **Throws**: - `java.lang.IllegalArgumentException` - If this enum type has no constant with the specified name. - `java.lang.NullPointerException` - If the argument is null. ### pType() - **Description**: Returns the p-Type byte code for this message type. - **Return**: The p-Type byte code. ### sType() - **Description**: Returns the s-Type byte code for this message type. - **Return**: The s-Type byte code. ### get(byte p, byte s) - **Description**: Returns the HSMS Message Type corresponding to the given p-Type and s-Type byte codes. - **Parameters**: - `p` (byte) - The p-Type byte code. - `s` (byte) - The s-Type byte code. - **Return**: The HSMS Message Type. ### get(HsmsMessage msg) - **Description**: Returns the HSMS Message Type from an HSMS Message object. - **Parameters**: - `msg` (HsmsMessage) - The HSMS Message object. - **Return**: The HSMS Message Type. ### supportPType(byte p) - **Description**: Returns true if the given p-Type byte code is supported, otherwise false. - **Parameters**: - `p` (byte) - The p-Type byte code to check. - **Return**: true if the p-Type is supported, false otherwise. ### supportPType(HsmsMessage msg) - **Description**: Returns true if the given HSMS Message supports the p-Type, otherwise false. - **Parameters**: - `msg` (HsmsMessage) - The HSMS message to check. - **Return**: true if the HSMS Message supports the p-Type, false otherwise. ### supportSType(byte s) - **Description**: Returns true if the given s-Type byte code is supported, otherwise false. - **Parameters**: - `s` (byte) - The s-Type byte code to check. - **Return**: true if the s-Type is supported, false otherwise. ``` -------------------------------- ### HsmsGsCommunicator.open(HsmsGsCommunicatorConfig) Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/index-all.html Creates a new HSMS-GS-Communicator instance and opens it. ```APIDOC ## HsmsGsCommunicator.open(HsmsGsCommunicatorConfig) ### Description Creates a new HSMS-GS-Communicator instance and opens it. ### Method HsmsGsCommunicator open(HsmsGsCommunicatorConfig config) ``` -------------------------------- ### S1F17 - Request ON-LINE Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/com/shimizukenta/secs/gem/Gem.html Requests the system to go online. ```APIDIDOCOC ## S1F17 - Request ON-LINE ### Description This message requests the system to transition to an online state. ### Return Type `java.util.Optional<[SecsMessage](../SecsMessage.html "com.shimizukenta.secs内のインタフェース")>` ``` -------------------------------- ### IntegerProperty Methods Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/com/shimizukenta/secs/local/property/IntegerProperty.html This section details the various methods available on the IntegerProperty class, including arithmetic operations, type checking, and conditional waiting. ```APIDOC ## IntegerProperty Methods ### Description Provides methods for integer manipulation, comparison, and asynchronous observation. ### Methods - `isInteger()`: Checks if the property holds an integer value. - `toInteger()`: Converts the property value to an integer. - `multiply(int value)`: Multiplies the current integer value by another integer. - `subtract(int value)`: Subtracts another integer from the current integer value. - `waitUntilEqualTo(int value)`: Waits until the property value equals the specified integer. - `waitUntilEqualTo(int value, long timeout, java.util.concurrent.TimeUnit unit)`: Waits until the property value equals the specified integer, with a timeout. - `waitUntilEqualTo(int value, com.shimizukenta.secs.local.property.TimeoutGettable gettable)`: Waits until the property value equals the specified integer, using a TimeoutGettable for timeout configuration. - `waitUntilGreaterThan(int value)`: Waits until the property value is greater than the specified integer. - `waitUntilGreaterThan(int value, long timeout, java.util.concurrent.TimeUnit unit)`: Waits until the property value is greater than the specified integer, with a timeout. - `waitUntilGreaterThan(int value, com.shimizukenta.secs.local.property.TimeoutGettable gettable)`: Waits until the property value is greater than the specified integer, using a TimeoutGettable for timeout configuration. - `waitUntilGreaterThanOrEqualTo(int value)`: Waits until the property value is greater than or equal to the specified integer. - `waitUntilGreaterThanOrEqualTo(int value, long timeout, java.util.concurrent.TimeUnit unit)`: Waits until the property value is greater than or equal to the specified integer, with a timeout. - `waitUntilGreaterThanOrEqualTo(int value, com.shimizukenta.secs.local.property.TimeoutGettable gettable)`: Waits until the property value is greater than or equal to the specified integer, using a TimeoutGettable for timeout configuration. - `waitUntilLessThan(int value)`: Waits until the property value is less than the specified integer. - `waitUntilLessThan(int value, long timeout, java.util.concurrent.TimeUnit unit)`: Waits until the property value is less than the specified integer, with a timeout. - `waitUntilLessThan(int value, com.shimizukenta.secs.local.property.TimeoutGettable gettable)`: Waits until the property value is less than the specified integer, using a TimeoutGettable for timeout configuration. - `waitUntilLessThanOrEqualTo(int value)`: Waits until the property value is less than or equal to the specified integer. - `waitUntilLessThanOrEqualTo(int value, long timeout, java.util.concurrent.TimeUnit unit)`: Waits until the property value is less than or equal to the specified integer, with a timeout. - `waitUntilLessThanOrEqualTo(int value, com.shimizukenta.secs.local.property.TimeoutGettable gettable)`: Waits until the property value is less than or equal to the specified integer, using a TimeoutGettable for timeout configuration. - `waitUntilNotEqualTo(int value)`: Waits until the property value is not equal to the specified integer. - `waitUntilNotEqualTo(int value, long timeout, java.util.concurrent.TimeUnit unit)`: Waits until the property value is not equal to the specified integer, with a timeout. - `waitUntilNotEqualTo(int value, com.shimizukenta.secs.local.property.TimeoutGettable gettable)`: Waits until the property value is not equal to the specified integer, using a TimeoutGettable for timeout configuration. - `waitUntilNotEqualToZero()`: Waits until the property value is not equal to zero. - `waitUntilNotEqualToZero(long timeout, java.util.concurrent.TimeUnit unit)`: Waits until the property value is not equal to zero, with a timeout. - `waitUntilNotEqualToZero(com.shimizukenta.secs.local.property.TimeoutGettable gettable)`: Waits until the property value is not equal to zero, using a TimeoutGettable for timeout configuration. ``` -------------------------------- ### Parse SECS-II Data Source: https://github.com/kenta-shimizu/secs4java8/blob/master/README.md Extract specific data types from a SECS-II object using provided get methods. Ensure the correct data type and index are used to avoid exceptions. Supported types include Byte, Int, and Ascii. ```java /* example Receive Message */ S5F1 W /* ALCD (0, 0) */ /* ALID (1, 0) */ /* ALTX (2) */ >. byte alcd = msg.secs2().getByte(0, 0); int alid = msg.secs2().getInt(1, 0); String altx = msg.secs2().getAscii(2); ``` -------------------------------- ### Constructors Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/com/shimizukenta/secs/hsms/HsmsMessageLengthBytesException.html Provides constructors for creating HsmsMessageLengthBytesException instances. ```APIDOC ## Constructors ### HsmsMessageLengthBytesException(long length) Constructor. * **Parameters**: * `length` (long) - the length size ### HsmsMessageLengthBytesException(String message, long length) Constructor. * **Parameters**: * `message` (String) - the message * `length` (long) - the length size ``` -------------------------------- ### Methods Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/com/shimizukenta/secs/hsms/HsmsMessageLengthBytesException.html Provides methods for interacting with HsmsMessageLengthBytesException instances. ```APIDOC ## Methods ### long length() Returns length size. * **Returns**: * (long) - length size ``` -------------------------------- ### Command-Line Argument Parsing Source: https://github.com/kenta-shimizu/secs4java8/blob/master/src/main/raspi-python/TcpIpSerialConverter/tcpip-serial-converter_next.txt Defines and parses command-line arguments for configuring the serial port (device, baudrate, etc.) and network connections (bind, connect, timeouts). ```python def _get_params(): parser = argparse.ArgumentParser() parser.add_argument("--device", default="/dev/ttyAMA0") parser.add_argument("--baudrate", type=int, default=9600, help="default 9600 bps") parser.add_argument("--bytesize", type=int, choices=[5, 6, 7, 8], default=8) parser.add_argument("--parity", default=serial.PARITY_NONE , choices=[ serial.PARITY_NONE , serial.PARITY_EVEN , serial.PARITY_ODD , serial.PARITY_MARK , serial.PARITY_SPACE] , help="[None, Even, Odd, Mark, Space]") parser.add_argument("--stopbits", type=int, choices=[1, 2], default=1) parser.add_argument("--xonxoff", action="store_const", const=True, default=None, help="set if True") parser.add_argument("--rtscts", action="store_const", const=True, default=None, help="set if True") parser.add_argument("--dsrdtr", action="store_const", const=True, default=None, help="set if True") parser.add_argument("--bind", action="append", default=[], help="format: aaa.bbb.ccc.ddd:eeeee") parser.add_argument("--connect", action="append", default=[], help="format: aaa.bbb.ccc.ddd:eeeee") parser.add_argument("--rebind", type=float, default=5.0, help="rebind seconds") parser.add_argument("--reconnect", type=float, default=5.0, help="reconnect seconds") return parser.parse_args() ``` -------------------------------- ### Secs2Item Methods Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/com/shimizukenta/secs/secs2/Secs2Item.html Provides methods for retrieving Secs2Item constants and their properties. ```APIDOC ## Secs2Item Methods This section describes the static and instance methods available for the `Secs2Item` enum. ### `values()` - **Description**: Returns an array containing all of the constants of this enum type, in the order they are declared. - **Return**: An array containing the constants of this enum in declared order. ### `valueOf(String name)` - **Description**: Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant (and/or the literal character or the string representation of the literal value). (Any superfluous whitespace characters are not permitted.) - **Parameters**: - `name` (String) - The name of the enum constant to return. - **Return**: The enum constant with the specified name. - **Throws**: - `java.lang.IllegalArgumentException` - If this enum type has no constant with the specified name. - `java.lang.NullPointerException` - If the argument is null. ### `code()` - **Description**: Returns the byte code representation of the Secs2Item. - **Return**: The byte code of the item. ### `size()` - **Description**: Returns the byte size of one item. For LIST items, this returns -1. - **Return**: The byte size of one item. ### `symbol()` - **Description**: Returns the SML item type symbol as a String. - **Return**: The SML-Item type String. ### `get(byte itemCode)` - **Description**: Retrieves a `Secs2Item` based on its byte code. - **Parameters**: - `itemCode` (byte) - The byte code of the item. - **Return**: The corresponding `Secs2Item`. ### `symbol(CharSequence symbol)` - **Description**: Retrieves a `Secs2Item` based on its SML-Item-type String. - **Parameters**: - `symbol` (CharSequence) - The symbol character sequence. - **Return**: The corresponding `Secs2Item`. ``` -------------------------------- ### send(sessionId, strm, func, wbit, secs2) Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/com/shimizukenta/secs/hsmsgs/HsmsGsCommunicator.html A shortcut method to send a SECS message with specified parameters and SECS-II data. It returns an Optional SecsMessage representing the reply, if any. ```APIDOC ## send(sessionId, strm, func, wbit, secs2) ### Description Sends a SECS message with the provided session ID, stream, function, W-bit, and SECS-II data. This is a shortcut method. ### Method ```java java.util.Optional send(int sessionId, int strm, int func, boolean wbit, Secs2 secs2) ``` ### Parameters * **sessionId** (int) - The Session-ID. * **strm** (int) - SECS-II-Stream-Number. * **func** (int) - SECS-II-Function-Number. * **wbit** (boolean) - SECS-II-WBit, set true if w-bit is 1. * **secs2** (Secs2) - SECS-II-data, Not accept null. ### Returns * Optional - Reply-Message if exist. ### Throws * SecsSendMessageException - if send failed. * SecsWaitReplyMessageException - if receive message failed, e.g. Timeout-T3. * SecsException - if SECS communicate failed. * java.lang.InterruptedException - if interrupted. ``` -------------------------------- ### FloatProperty Methods Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/com/shimizukenta/secs/local/property/FloatProperty.html This section details the various methods available on the FloatProperty class for interacting with and observing float values. ```APIDOC ## FloatProperty Methods This class provides methods for checking numerical properties, performing arithmetic operations, converting types, and setting up observable wait conditions for float values. ### Methods - **isDouble()**: Checks if the observable value is a double. - **isFloat()**: Checks if the observable value is a float. - **isInteger()**: Checks if the observable value is an integer. - **isLong()**: Checks if the observable value is a long. - **toDouble()**: Converts the observable value to a double. - **toFloat()**: Converts the observable value to a float. - **toInteger()**: Converts the observable value to an integer. - **toLong()**: Converts the observable value to a long. - **negate()**: Negates the observable value. - **multiply(double value)**: Multiplies the observable value by a double. - **multiply(float value)**: Multiplies the observable value by a float. - **multiply(int value)**: Multiplies the observable value by an int. - **multiply(long value)**: Multiplies the observable value by a long. - **multiply(NumberObservable value)**: Multiplies the observable value by another NumberObservable. - **subtract(double value)**: Subtracts a double from the observable value. - **subtract(float value)**: Subtracts a float from the observable value. - **subtract(int value)**: Subtracts an int from the observable value. - **subtract(long value)**: Subtracts a long from the observable value. - **subtract(NumberObservable value)**: Subtracts another NumberObservable from the observable value. - **computeIsNotEqualToZero()**: Computes if the observable value is not equal to zero. - **waitUntilEqualTo(double value)**: Waits until the observable value is equal to a double. - **waitUntilEqualTo(double value, long timeout, TimeUnit unit)**: Waits until the observable value is equal to a double with a specified timeout. - **waitUntilEqualTo(double value, TimeoutGettable timeout)**: Waits until the observable value is equal to a double with a specified TimeoutGettable. - **waitUntilEqualTo(float value)**: Waits until the observable value is equal to a float. - **waitUntilEqualTo(float value, long timeout, TimeUnit unit)**: Waits until the observable value is equal to a float with a specified timeout. - **waitUntilEqualTo(float value, TimeoutGettable timeout)**: Waits until the observable value is equal to a float with a specified TimeoutGettable. - **waitUntilEqualTo(int value)**: Waits until the observable value is equal to an int. - **waitUntilEqualTo(int value, long timeout, TimeUnit unit)**: Waits until the observable value is equal to an int with a specified timeout. - **waitUntilEqualTo(int value, TimeoutGettable timeout)**: Waits until the observable value is equal to an int with a specified TimeoutGettable. - **waitUntilEqualTo(long value)**: Waits until the observable value is equal to a long. - **waitUntilEqualTo(long value, long timeout, TimeUnit unit)**: Waits until the observable value is equal to a long with a specified timeout. - **waitUntilEqualTo(long value, TimeoutGettable timeout)**: Waits until the observable value is equal to a long with a specified TimeoutGettable. - **waitUntilEqualTo(NumberObservable value)**: Waits until the observable value is equal to another NumberObservable. - **waitUntilEqualTo(NumberObservable value, long timeout, TimeUnit unit)**: Waits until the observable value is equal to another NumberObservable with a specified timeout. - **waitUntilEqualTo(NumberObservable value, TimeoutGettable timeout)**: Waits until the observable value is equal to another NumberObservable with a specified TimeoutGettable. - **waitUntilEqualToZero()**: Waits until the observable value is equal to zero. - **waitUntilEqualToZero(long timeout, TimeUnit unit)**: Waits until the observable value is equal to zero with a specified timeout. - **waitUntilEqualToZero(TimeoutGettable timeout)**: Waits until the observable value is equal to zero with a specified TimeoutGettable. - **waitUntilGreaterThan(double value)**: Waits until the observable value is greater than a double. - **waitUntilGreaterThan(double value, long timeout, TimeUnit unit)**: Waits until the observable value is greater than a double with a specified timeout. - **waitUntilGreaterThan(double value, TimeoutGettable timeout)**: Waits until the observable value is greater than a double with a specified TimeoutGettable. - **waitUntilGreaterThan(float value)**: Waits until the observable value is greater than a float. - **waitUntilGreaterThan(float value, long timeout, TimeUnit unit)**: Waits until the observable value is greater than a float with a specified timeout. - **waitUntilGreaterThan(float value, TimeoutGettable timeout)**: Waits until the observable value is greater than a float with a specified TimeoutGettable. - **waitUntilGreaterThan(int value)**: Waits until the observable value is greater than an int. - **waitUntilGreaterThan(int value, long timeout, TimeUnit unit)**: Waits until the observable value is greater than an int with a specified timeout. - **waitUntilGreaterThan(int value, TimeoutGettable timeout)**: Waits until the observable value is greater than an int with a specified TimeoutGettable. - **waitUntilGreaterThan(long value)**: Waits until the observable value is greater than a long. - **waitUntilGreaterThan(long value, long timeout, TimeUnit unit)**: Waits until the observable value is greater than a long with a specified timeout. - **waitUntilGreaterThan(long value, TimeoutGettable timeout)**: Waits until the observable value is greater than a long with a specified TimeoutGettable. - **waitUntilGreaterThan(NumberObservable value)**: Waits until the observable value is greater than another NumberObservable. - **waitUntilGreaterThan(NumberObservable value, long timeout, TimeUnit unit)**: Waits until the observable value is greater than another NumberObservable with a specified timeout. - **waitUntilGreaterThan(NumberObservable value, TimeoutGettable timeout)**: Waits until the observable value is greater than another NumberObservable with a specified TimeoutGettable. - **waitUntilGreaterThanOrEqualTo(double value)**: Waits until the observable value is greater than or equal to a double. - **waitUntilGreaterThanOrEqualTo(double value, long timeout, TimeUnit unit)**: Waits until the observable value is greater than or equal to a double with a specified timeout. - **waitUntilGreaterThanOrEqualTo(double value, TimeoutGettable timeout)**: Waits until the observable value is greater than or equal to a double with a specified TimeoutGettable. ``` -------------------------------- ### s2f31Now() Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/com/shimizukenta/secs/gem/Gem.html Requests to set the current date and time. ```APIDOC ## s2f31Now() - Now Date and Time Set Request ### Description This message requests to set the current date and time. ### Return Type `java.util.Optional<[SecsMessage](../SecsMessage.html "com.shimizukenta.secs内のインタフェース")>` ``` -------------------------------- ### s2f28(SecsMessage primaryMsg, CMDA cmda) Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/com/shimizukenta/secs/gem/Gem.html Handles the Initiate Processing Acknowledge. ```APIDOC ## s2f28(SecsMessage primaryMsg, CMDA cmda) - Initiate Processing Acknowledge ### Description This method processes the acknowledgment for initiating processing. ### Parameters * `primaryMsg` ([SecsMessage](../SecsMessage.html "com.shimizukenta.secs内のインタフェース")) - The primary SECS message. * `cmda` ([CMDA](CMDA.html "com.shimizukenta.secs.gem内の列挙型")) - The command acknowledgment status. ### Related Enumeration [TIACK](TIACK.html "com.shimizukenta.secs.gem内の列挙型") ``` -------------------------------- ### Add Define Report Configuration Source: https://github.com/kenta-shimizu/secs4java8/blob/master/README.md Configure a new dynamic report. Reports can be defined with or without an alias. The RPTID is auto-generated. ```java /* no ALias */ DynamicReport rptSimple = evRptConf.addDefineReport( Arrays.asList( Long.valueOf(1001L), /* VID-1 */ ... ) ); /* set Alias */ DynamicReport rptAlias = evRptConf.addDefineReport( "report-alias", /* Report-ALias */ Arrays.asList( Long.valueOf(2001L), /* VID-1 */ ... ) ); ``` -------------------------------- ### Execute Dynamic Event Report Scenarios Source: https://github.com/kenta-shimizu/secs4java8/blob/master/README.md Execute various scenarios to manage dynamic event reports, including disabling all, deleting all, defining, and enabling reports. ```java ERACK erack = evRptConf.s2f37DisableAll(); DRACK drack = evRptConf.s2f33DeleteAll(); DRACK drack = evRptConf.s2f33Define(); LRACK lrack = evRptConf.s2f35(); ERACK erack = evRptConf.s2f37Enable(); ``` -------------------------------- ### TCP Client Connection Source: https://github.com/kenta-shimizu/secs4java8/blob/master/src/main/raspi-python/TcpIpSerialConverter/tcpip-serial-converter_next.txt Establishes a TCP client socket connection to a specified address and initiates data reading. Includes error handling and reconnection logic with a delay. ```python def _open_connect(self, connect): address, address_family = TcpIpSerialConverter._parse_address(connect) while not self.closed: sock = None try: sock = socket.socket(address_family, socket.SOCK_STREAM) sock.connect(address) self._reading(sock) except Exception as e: print("%r" % e) if sock is not None: sock.close() if not self.closed: time.sleep(self.params.reconnect) ``` -------------------------------- ### send(sessionId, primaryMsg, strm, func, wbit, secs2) Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/com/shimizukenta/secs/hsmsgs/HsmsGsCommunicator.html A shortcut method to send a SECS message with a primary message, specified parameters, and SECS-II data. It returns an Optional SecsMessage representing the reply, if any. ```APIDOC ## send(sessionId, primaryMsg, strm, func, wbit, secs2) ### Description Sends a SECS message with the provided session ID, primary message, stream, function, W-bit, and SECS-II data. This is a shortcut method. ### Method ```java java.util.Optional send(int sessionId, SecsMessage primaryMsg, int strm, int func, boolean wbit, Secs2 secs2) ``` ### Parameters * **sessionId** (int) - The Session-ID. * **primaryMsg** (SecsMessage) - The primary message. * **strm** (int) - SECS-II-Stream-Number. * **func** (int) - SECS-II-Function-Number. * **wbit** (boolean) - SECS-II-WBit, set true if w-bit is 1. * **secs2** (Secs2) - SECS-II-data, Not accept null. ### Returns * Optional - Reply-Message if exist. ### Throws * SecsSendMessageException - if send failed. * SecsWaitReplyMessageException - if receive message failed, e.g. Timeout-T3. * SecsException - if SECS communicate failed. * java.lang.InterruptedException - if interrupted. ``` -------------------------------- ### Float Computation Methods Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/com/shimizukenta/secs/local/property/FloatCompution.html This section lists the available methods for performing float computations, including various 'waitUntil' operations. ```APIDOC ## FloatComputation This class provides methods for float computations, particularly for observable number values. ### Methods - **waitUntilGreaterThanOrEqualTo(float value)** Waits until the observable float value is greater than or equal to the specified value. - **waitUntilGreaterThanOrEqualTo(float value, long timeout, TimeUnit unit)** Waits until the observable float value is greater than or equal to the specified value, with a timeout. - **waitUntilGreaterThanOrEqualTo(float value, TimeoutGettable timeout)** Waits until the observable float value is greater than or equal to the specified value, using a TimeoutGettable for timeout configuration. - **waitUntilGreaterThanZero()** Waits until the observable float value is greater than zero. - **waitUntilGreaterThanZero(long timeout, TimeUnit unit)** Waits until the observable float value is greater than zero, with a timeout. - **waitUntilGreaterThanZero(TimeoutGettable timeout)** Waits until the observable float value is greater than zero, using a TimeoutGettable for timeout configuration. - **waitUntilLessThan(float value)** Waits until the observable float value is less than the specified value. - **waitUntilLessThan(float value, long timeout, TimeUnit unit)** Waits until the observable float value is less than the specified value, with a timeout. - **waitUntilLessThan(float value, TimeoutGettable timeout)** Waits until the observable float value is less than the specified value, using a TimeoutGettable for timeout configuration. - **waitUntilLessThanOrEqualTo(float value)** Waits until the observable float value is less than or equal to the specified value. - **waitUntilLessThanOrEqualTo(float value, long timeout, TimeUnit unit)** Waits until the observable float value is less than or equal to the specified value, with a timeout. - **waitUntilLessThanOrEqualTo(float value, TimeoutGettable timeout)** Waits until the observable float value is less than or equal to the specified value, using a TimeoutGettable for timeout configuration. ``` -------------------------------- ### isEqualTo (Object) Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/com/shimizukenta/secs/local/property/ComparativeCompution.html Creates a ComparativeCompution instance for the equal to comparison between two ObjectObservables. ```APIDOC ## isEqualTo ### Description Returns equal object ComparativeCompution instance. ### Method static ### Type Parameters - **T** - Type - **U** - Type ### Parameters #### Path Parameters - **a** (ObjectObservable) - the observer of a - **b** (ObjectObservable) - the observer of b ### Return Value - Object EqualTo ComparativeCompution. ``` -------------------------------- ### s2f37EnableAll - Enable All Collection-Event-Report Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/com/shimizukenta/secs/gem/Gem.html Enables all Collection-Event-Reports. ```APIDOC ## s2f37EnableAll ### Description Enables all Collection-Event-Reports. ### Method Not specified (likely internal method) ### Parameters None ### Response Returns an Optional SecsMessage. ``` -------------------------------- ### isEqualTo (String) Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/com/shimizukenta/secs/local/property/ComparativeCompution.html Creates a ComparativeCompution instance for the equal to comparison between two StringObservables. ```APIDOC ## isEqualTo ### Description Returns equal String ComparativeCompution instance. ### Method static ### Parameters #### Path Parameters - **a** (StringObservable) - the observer of a - **b** (StringObservable) - the observer of b ### Return Value - equal String ComparativeCompution instance. ``` -------------------------------- ### S1F14 - Establish Communications Request Acknowledge Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/com/shimizukenta/secs/gem/Gem.html Handles the acknowledgment for establishing communication. ```APIDOC ## S1F14 - Establish Communications Request Acknowledge ### Description This message acknowledges the establishment of communication. ### Related Enumeration [OFLACK](OFLACK.html "com.shimizukenta.secs.gem内の列挙型") ``` -------------------------------- ### Socket Address Configuration Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/com/shimizukenta/secs/secs1ontcpip/Secs1OnTcpIpReceiverCommunicatorConfig.html Configure the socket address for the communicator. The socket address cannot be null. ```APIDOC ## socketAddress (setter) ### Description Bind SocketAddress setter. Not accept `null`. ### Method public void socketAddress(java.net.SocketAddress socketAddress) ### Parameters #### Path Parameters - **socketAddress** (java.net.SocketAddress) - Required - the Bind SocketAddress ``` ```APIDOC ## socketAddress (getter) ### Description Bind SocketAddress getter. ### Method public ObjectProperty socketAddress() ### Returns Connect SocketAddress ``` -------------------------------- ### s2f37Enable - Enable Collection-Event-Report Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/com/shimizukenta/secs/gem/Gem.html Enables a Collection-Event-Report with a specified configuration. ```APIDOC ## s2f37Enable ### Description Enables a Collection-Event-Report with a specified configuration. ### Method Not specified (likely internal method) ### Parameters - **config** (DynamicEventReportConfig) - The configuration for the event report. ### Response No specific response documented. ``` -------------------------------- ### DoubleProperty Methods Source: https://github.com/kenta-shimizu/secs4java8/blob/master/docs/com/shimizukenta/secs/local/property/DoubleProperty.html This section details various methods available on the DoubleProperty class, including type checking, arithmetic operations, type conversions, and conditional waiting. ```APIDOC ## DoubleProperty Methods This class provides methods for interacting with double-precision floating-point properties. ### Methods - **`isDouble()`**: Checks if the property holds a double value. - **`isFloat()`**: Checks if the property holds a float value. - **`isInteger()`**: Checks if the property holds an integer value. - **`isLong()`**: Checks if the property holds a long value. - **`toDouble()`**: Converts the property to a double. - **`toFloat()`**: Converts the property to a float. - **`toInteger()`**: Converts the property to an integer. - **`toLong()`**: Converts the property to a long. - **`multiply(double)`**: Multiplies the property by a double. - **`multiply(float)`**: Multiplies the property by a float. - **`multiply(int)`**: Multiplies the property by an integer. - **`multiply(long)`**: Multiplies the property by a long. - **`multiply(NumberObservable)`**: Multiplies the property by another NumberObservable. - **`subtract(double)`**: Subtracts a double from the property. - **`subtract(float)`**: Subtracts a float from the property. - **`subtract(int)`**: Subtracts an integer from the property. - **`subtract(long)`**: Subtracts a long from the property. - **`subtract(NumberObservable)`**: Subtracts another NumberObservable from the property. - **`negate()`**: Negates the property value. - **`computeIsNotEqualToZero()`**: Computes if the property is not equal to zero. - **`waitUntilEqualTo(double)`**: Waits until the property is equal to a double. - **`waitUntilEqualTo(float)`**: Waits until the property is equal to a float. - **`waitUntilEqualTo(int)`**: Waits until the property is equal to an integer. - **`waitUntilEqualTo(long)`**: Waits until the property is equal to a long. - **`waitUntilEqualTo(NumberObservable)`**: Waits until the property is equal to another NumberObservable. - **`waitUntilEqualToZero()`**: Waits until the property is equal to zero. - **`waitUntilGreaterThan(double)`**: Waits until the property is greater than a double. - **`waitUntilGreaterThan(float)`**: Waits until the property is greater than a float. - **`waitUntilGreaterThan(int)`**: Waits until the property is greater than an integer. - **`waitUntilGreaterThan(long)`**: Waits until the property is greater than a long. - **`waitUntilGreaterThan(NumberObservable)`**: Waits until the property is greater than another NumberObservable. - **`waitUntilGreaterThanOrEqualTo(double)`**: Waits until the property is greater than or equal to a double. *Note: Overloads for waiting with timeout are also available for `waitUntilEqualTo` and `waitUntilGreaterThan` methods.* ```