|
16 | 16 | * @thanks Jim Wright for OSX cleanup/fixes. |
17 | 17 | * @copyright under GPL 2 licence |
18 | 18 | */ |
19 | | -class PhpSerial |
| 19 | +class SerialConnection |
20 | 20 | { |
21 | 21 | public $_device = null; |
22 | 22 | public $_winDevice = null; |
@@ -82,7 +82,7 @@ public function __construct() |
82 | 82 | * @param string $device the name of the device to be used |
83 | 83 | * @return bool |
84 | 84 | */ |
85 | | - public function deviceSet($device) |
| 85 | + public function setDevice($device) |
86 | 86 | { |
87 | 87 | if ($this->_dState !== SERIAL_DEVICE_OPENED) { |
88 | 88 | if ($this->_os === "linux") { |
@@ -180,7 +180,7 @@ public function deviceOpen($mode = "r+b") |
180 | 180 | * |
181 | 181 | * @return bool |
182 | 182 | */ |
183 | | - public function deviceClose() |
| 183 | + public function close() |
184 | 184 | { |
185 | 185 | if ($this->_dState !== SERIAL_DEVICE_OPENED) { |
186 | 186 | return true; |
@@ -214,7 +214,7 @@ public function deviceClose() |
214 | 214 | * @param int $rate the rate to set the port in |
215 | 215 | * @return bool |
216 | 216 | */ |
217 | | - public function confBaudRate($rate) |
| 217 | + public function setBaudRate($rate) |
218 | 218 | { |
219 | 219 | if ($this->_dState !== SERIAL_DEVICE_SET) { |
220 | 220 | trigger_error("Unable to set the baud rate : the device is " . |
@@ -280,7 +280,7 @@ public function confBaudRate($rate) |
280 | 280 | * @param string $parity one of the modes |
281 | 281 | * @return bool |
282 | 282 | */ |
283 | | - public function confParity($parity) |
| 283 | + public function setParity($parity) |
284 | 284 | { |
285 | 285 | if ($this->_dState !== SERIAL_DEVICE_SET) { |
286 | 286 | trigger_error( |
@@ -335,7 +335,7 @@ public function confParity($parity) |
335 | 335 | * @param int $int length of a character (5 <= length <= 8) |
336 | 336 | * @return bool |
337 | 337 | */ |
338 | | - public function confCharacterLength($int) |
| 338 | + public function setCharacterLength($int) |
339 | 339 | { |
340 | 340 | if ($this->_dState !== SERIAL_DEVICE_SET) { |
341 | 341 | trigger_error("Unable to set length of a character : the device " . |
@@ -388,7 +388,7 @@ public function confCharacterLength($int) |
388 | 388 | * some computers. |
389 | 389 | * @return bool |
390 | 390 | */ |
391 | | - public function confStopBits($length) |
| 391 | + public function setStopBits($length) |
392 | 392 | { |
393 | 393 | if ($this->_dState !== SERIAL_DEVICE_SET) { |
394 | 394 | trigger_error("Unable to set the length of a stop bit : the " . |
@@ -450,7 +450,7 @@ public function confStopBits($length) |
450 | 450 | * -> "xon/xoff" : use XON/XOFF protocol |
451 | 451 | * @return bool |
452 | 452 | */ |
453 | | - public function confFlowControl($mode) |
| 453 | + public function setFlowControl($mode) |
454 | 454 | { |
455 | 455 | if ($this->_dState !== SERIAL_DEVICE_SET) { |
456 | 456 | trigger_error("Unable to set flow control mode : the device is " . |
@@ -515,7 +515,7 @@ public function confFlowControl($mode) |
515 | 515 | * @param string $arg parameter value |
516 | 516 | * @return bool |
517 | 517 | */ |
518 | | - public function setSetserialFlag($param, $arg = "") |
| 518 | + public function setSetSerialFlag($param, $arg = "") |
519 | 519 | { |
520 | 520 | if (!$this->_ckOpened()) { |
521 | 521 | return false; |
@@ -552,9 +552,9 @@ public function setSetserialFlag($param, $arg = "") |
552 | 552 | * @param string $str string to be sent to the device |
553 | 553 | * @param float $waitForReply time to wait for the reply (in seconds) |
554 | 554 | */ |
555 | | - public function sendMessage($str, $waitForReply = 0.1) |
| 555 | + public function send($message, $waitForReply = 0.1) |
556 | 556 | { |
557 | | - $this->_buffer .= $str; |
| 557 | + $this->_buffer .= $message; |
558 | 558 |
|
559 | 559 | if ($this->autoFlush === true) { |
560 | 560 | $this->serialflush(); |
@@ -629,7 +629,7 @@ public function readPort($count = 0) |
629 | 629 | * |
630 | 630 | * @return bool |
631 | 631 | */ |
632 | | - public function serialflush() |
| 632 | + public function flush() |
633 | 633 | { |
634 | 634 | if (!$this->_ckOpened()) { |
635 | 635 | return false; |
|
0 commit comments