This is an old revision of the document!
WMPRO, WMMINI FW >= 1.0 WMMEGA FW >= 2.0
Open the serial port at the specified baud rate with optional parameters
Attempt to open the serial port, and return the file handle for future operations
baud: Rate in bits per second
blocking: Optional, if set to 1 read operations will block until data is available
invert: Optional
parity: Optional
Upon success it returns a file handle which may be used together with the other file functions that require a handle such as fgets(), fwrite(), fclose() and feof()
If the attempt to open the serial port fails it will return 0
Open the serial port at 115200 baud in non-blocking mode:
<? $fp=fseropen(115200); if ($fp) { $res=fwrite($fp,"Hello from wattmon"); if ($res) { print("An error occurred while trying to write to the port"); } fclose($fp); } else { print("Serial open failed"); } ?>
Serial Port Programming - Some information on connecting and using the serial ports
f485open() - Open the RS-485 port as a stream
fsockopen() - Open an internet socket connection with optional timeout
fopen() - Open a file for reading or writing
fclose() - Close a file, stream or socket
feof() - Test if no more data is available in a file or stream
fgets() - Return a single line from a file or stream, with optional size limit
fread() - Return bytes from a file or stream
fwrite() - Write data to a file or stream