Skip to content

Commit 246a68d

Browse files
author
Bram Ceulemans
authored
Update SerialConnection.php
1 parent e061609 commit 246a68d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/SerialConnection.php

+12-12
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* @thanks Jim Wright for OSX cleanup/fixes.
1717
* @copyright under GPL 2 licence
1818
*/
19-
class PhpSerial
19+
class SerialConnection
2020
{
2121
public $_device = null;
2222
public $_winDevice = null;
@@ -82,7 +82,7 @@ public function __construct()
8282
* @param string $device the name of the device to be used
8383
* @return bool
8484
*/
85-
public function deviceSet($device)
85+
public function setDevice($device)
8686
{
8787
if ($this->_dState !== SERIAL_DEVICE_OPENED) {
8888
if ($this->_os === "linux") {
@@ -180,7 +180,7 @@ public function deviceOpen($mode = "r+b")
180180
*
181181
* @return bool
182182
*/
183-
public function deviceClose()
183+
public function close()
184184
{
185185
if ($this->_dState !== SERIAL_DEVICE_OPENED) {
186186
return true;
@@ -214,7 +214,7 @@ public function deviceClose()
214214
* @param int $rate the rate to set the port in
215215
* @return bool
216216
*/
217-
public function confBaudRate($rate)
217+
public function setBaudRate($rate)
218218
{
219219
if ($this->_dState !== SERIAL_DEVICE_SET) {
220220
trigger_error("Unable to set the baud rate : the device is " .
@@ -280,7 +280,7 @@ public function confBaudRate($rate)
280280
* @param string $parity one of the modes
281281
* @return bool
282282
*/
283-
public function confParity($parity)
283+
public function setParity($parity)
284284
{
285285
if ($this->_dState !== SERIAL_DEVICE_SET) {
286286
trigger_error(
@@ -335,7 +335,7 @@ public function confParity($parity)
335335
* @param int $int length of a character (5 <= length <= 8)
336336
* @return bool
337337
*/
338-
public function confCharacterLength($int)
338+
public function setCharacterLength($int)
339339
{
340340
if ($this->_dState !== SERIAL_DEVICE_SET) {
341341
trigger_error("Unable to set length of a character : the device " .
@@ -388,7 +388,7 @@ public function confCharacterLength($int)
388388
* some computers.
389389
* @return bool
390390
*/
391-
public function confStopBits($length)
391+
public function setStopBits($length)
392392
{
393393
if ($this->_dState !== SERIAL_DEVICE_SET) {
394394
trigger_error("Unable to set the length of a stop bit : the " .
@@ -450,7 +450,7 @@ public function confStopBits($length)
450450
* -> "xon/xoff" : use XON/XOFF protocol
451451
* @return bool
452452
*/
453-
public function confFlowControl($mode)
453+
public function setFlowControl($mode)
454454
{
455455
if ($this->_dState !== SERIAL_DEVICE_SET) {
456456
trigger_error("Unable to set flow control mode : the device is " .
@@ -515,7 +515,7 @@ public function confFlowControl($mode)
515515
* @param string $arg parameter value
516516
* @return bool
517517
*/
518-
public function setSetserialFlag($param, $arg = "")
518+
public function setSetSerialFlag($param, $arg = "")
519519
{
520520
if (!$this->_ckOpened()) {
521521
return false;
@@ -552,9 +552,9 @@ public function setSetserialFlag($param, $arg = "")
552552
* @param string $str string to be sent to the device
553553
* @param float $waitForReply time to wait for the reply (in seconds)
554554
*/
555-
public function sendMessage($str, $waitForReply = 0.1)
555+
public function send($message, $waitForReply = 0.1)
556556
{
557-
$this->_buffer .= $str;
557+
$this->_buffer .= $message;
558558

559559
if ($this->autoFlush === true) {
560560
$this->serialflush();
@@ -629,7 +629,7 @@ public function readPort($count = 0)
629629
*
630630
* @return bool
631631
*/
632-
public function serialflush()
632+
public function flush()
633633
{
634634
if (!$this->_ckOpened()) {
635635
return false;

0 commit comments

Comments
 (0)