BayEOS-PHP
 All Data Structures Namespaces Files Functions Variables Pages
Public Member Functions | Data Fields
phpSerial Class Reference
Inheritance diagram for phpSerial:
BaySerial QLI XBee

Public Member Functions

 phpSerial ()
 
 deviceSet ($device)
 
 deviceOpen ($mode="r+b")
 
 deviceClose ()
 
 confBaudRate ($rate)
 
 confParity ($parity)
 
 confCharacterLength ($int)
 
 confStopBits ($length)
 
 confFlowControl ($mode)
 
 setSetserialFlag ($param, $arg="")
 
 sendMessage ($str, $waitForReply=0.1)
 
 readPort ($count=0)
 
 serialflush ()
 
 _ckOpened ()
 
 _ckClosed ()
 
 _exec ($cmd, &$out=null)
 

Data Fields

 $_device = null
 
 $_windevice = null
 
 $_dHandle = null
 
 $_dState = SERIAL_DEVICE_NOTSET
 
 $_buffer = ""
 
 $_os = ""
 
 $autoflush = true
 

Detailed Description

Serial port control class

THIS PROGRAM COMES WITH ABSOLUTELY NO WARANTIES ! USE IT AT YOUR OWN RISKS !

Changes added by Rizwan Kassim rizwa.nosp@m.nk@g.nosp@m.eekym.nosp@m.edia.nosp@m..com for OSX functionality default serial device for osx devices is /dev/tty.serial for machines with a built in serial device

Author
Rémy Sanchez thenu.nosp@m.x@gm.nosp@m.ail.c.nosp@m.om Aurélien Derouineau for finding how to open serial ports with windows Alec Avedisyan for help and testing with reading Jim Wright for OSX cleanup/fixes.

Definition at line 41 of file BayEOSSerialPHP.php.

Member Function Documentation

_ckClosed ( )

Definition at line 636 of file BayEOSSerialPHP.php.

_ckOpened ( )

Definition at line 625 of file BayEOSSerialPHP.php.

_exec (   $cmd,
$out = null 
)

Definition at line 647 of file BayEOSSerialPHP.php.

confBaudRate (   $rate)

Configure the Baud Rate Possible rates : 110, 150, 300, 600, 1200, 2400, 4800, 9600, 38400, 57600 and 115200. Note there was a paramter added from original class.

Parameters
int$ratethe rate to set the port in
Returns
bool

Definition at line 250 of file BayEOSSerialPHP.php.

confCharacterLength (   $int)

Sets the length of a character.

Parameters
int$intlength of a character (5 <= length <= 8)
Returns
bool

Definition at line 354 of file BayEOSSerialPHP.php.

confFlowControl (   $mode)

Configures the flow control

Parameters
string$modeSet the flow control mode. Availible modes : -> "none" : no flow control -> "rts/cts" : use RTS/CTS handshaking -> "xon/xoff" : use XON/XOFF protocol
Returns
bool

Definition at line 440 of file BayEOSSerialPHP.php.

confParity (   $parity)

Configure parity. Modes : odd, even, none

Parameters
string$parityone of the modes
Returns
bool

Definition at line 306 of file BayEOSSerialPHP.php.

confStopBits (   $length)

Sets the length of stop bits.

Parameters
float$lengththe length of a stop bit. It must be either 1, 1.5 or 2. 1.5 is not supported under linux and on some computers.
Returns
bool

Definition at line 395 of file BayEOSSerialPHP.php.

deviceClose ( )

Closes the device

Returns
bool

Definition at line 216 of file BayEOSSerialPHP.php.

deviceOpen (   $mode = "r+b")

Opens the device for reading and/or writing.

Parameters
string$modeOpening mode : same parameter as fopen()
Returns
bool

Definition at line 177 of file BayEOSSerialPHP.php.

deviceSet (   $device)

Device set function : used to set the device name/address. -> linux : use the device address, like /dev/ttyS0 -> osx : use the device address, like /dev/tty.serial -> windows : use the COMxx device name, like COM1 (can also be used with linux)

Parameters
string$devicethe name of the device to be used
Returns
bool

Definition at line 123 of file BayEOSSerialPHP.php.

phpSerial ( )

Constructor. Perform some checks about the OS and setserial

Returns
phpSerial

Definition at line 62 of file BayEOSSerialPHP.php.

readPort (   $count = 0)

Reads the port until no new datas are availible, then return the content.

Parameters
int$countnumber of characters to be read (will stop before if less characters are in the buffer)
Returns
string

Definition at line 540 of file BayEOSSerialPHP.php.

sendMessage (   $str,
  $waitForReply = 0.1 
)

Sends a string to the device

Parameters
string$strstring to be sent to the device
float$waitForReplytime to wait for the reply (in seconds)

Definition at line 524 of file BayEOSSerialPHP.php.

serialflush ( )

Flushes the output buffer Renamed from flush for osx compat. issues

Returns
bool

Definition at line 600 of file BayEOSSerialPHP.php.

setSetserialFlag (   $param,
  $arg = "" 
)

Sets a setserial parameter (cf man setserial) NO MORE USEFUL ! -> No longer supported -> Only use it if you need it

Parameters
string$paramparameter name
string$argparameter value
Returns
bool

Definition at line 488 of file BayEOSSerialPHP.php.

Field Documentation

$_buffer = ""

Definition at line 47 of file BayEOSSerialPHP.php.

$_device = null

Definition at line 43 of file BayEOSSerialPHP.php.

$_dHandle = null

Definition at line 45 of file BayEOSSerialPHP.php.

Definition at line 46 of file BayEOSSerialPHP.php.

$_os = ""

Definition at line 48 of file BayEOSSerialPHP.php.

$_windevice = null

Definition at line 44 of file BayEOSSerialPHP.php.

$autoflush = true

Definition at line 55 of file BayEOSSerialPHP.php.


The documentation for this class was generated from the following file: