OpenPort - method of object PmaComm
Open the serial/ethernet communication port of this object.
Boolean OpenPort(String sParam)
b = oComm.OpenPort(sParam)
|sParam||(String) Parameters for opening |
- for serial link: Only the port name is entered here.
For example "COM1".
- for Ethernet-client: The IP address and/or port number is entered.
Entries are in KeyVal format, for example "ipaddress:192.168.0.126;port:61682;". If any of the entries remain empty, then the previously entered value remains valid.
- for serial link: Port has been successfully opened.
- for Ethernet-client: The parameters has been set and connection will be opened during the next transfer.
- for serial link: Port hasn't been opened. Possible fault: Such port is not present on this computer or it is already used.
- for Ethernet-client: Because this method doesn't create a connection, false is return only if for bad input parameters.
This method cannot be used for the PmaComm
object that contains PmaCommMsg
object of the Slave
for serial link
: The default setting of the serial communication port is defined in the "Serial port
" configurator in parameters of the serial link. If it is necessary to change dynamically the serial link port, then it is possible to set Not set
in its parameters and than by the OpenPort
methods change the port.
For serial link each PmaComm object object must have defined another communication port. For example, if one PmaComm object communicates through COM1, then next PmaComm object can communicate for example through COM2 (COM3,..) but it mustn't communicate through COM1.
for Ethernet-client: The method only adds new connection parameters into the object. The following transfer will close existing connection and open new connection.
for serial link: Algorithm called after the request for sending 1 message (by PmaCommMsg
object) through COM1
for Ethernet-client: Sets the IP address and port. The next calling of the Run
method will close previous connection and open new connection.