mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-27 14:28:56 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@95442 c90b9560-bf6c-de11-be94-00142212c4b1
109 lines
2.5 KiB
XML
109 lines
2.5 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.2 $ -->
|
|
<!-- splitted from ./en/functions/dio.xml, last change in rev 1.1 -->
|
|
<refentry id="function.dio-tcsetattr">
|
|
<refnamediv>
|
|
<refname>dio_tcsetattr</refname>
|
|
<refpurpose>
|
|
Sets terminal attributes and baud rate for a serial port
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type></type><methodname>dio_tcsetattr</methodname>
|
|
<methodparam><type>resource</type><parameter>fd</parameter></methodparam>
|
|
<methodparam><type>array</type><parameter>options</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
The function <function>dio_tcsetattr</function> sets
|
|
the terminal attributes and baud rate of the open
|
|
<parameter>resource</parameter>. The currently available options are
|
|
<itemizedlist>
|
|
<listitem>
|
|
<para>
|
|
'baud' - baud rate of the port - can be 38400,19200,9600,4800,2400,1800,1200,600,300,200,150,134,110,75 or 50,
|
|
default value is 9600
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
'bits' - data bits - can be 8,7,6 or 5
|
|
default value is 8
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
'stop' - stop bits - can be 1 or 2
|
|
default value is 1
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
'parity' - can be 0,1 or 2
|
|
default value is 0
|
|
</para>
|
|
</listitem>
|
|
</itemizedlist>
|
|
<example>
|
|
<title>
|
|
Setting the baud rate on a serial port
|
|
</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
$fd = dio_open('/dev/ttyS0', O_RDWR | O_NOCTTY | O_NONBLOCK);
|
|
|
|
dio_fcntl($fd,F_SETFL, O_SYNC );
|
|
|
|
dio_tcsetattr($fd, array(
|
|
'baud' => 9600,
|
|
'bits' => 8,
|
|
'stop' =>1,
|
|
'parity' => 0
|
|
));
|
|
|
|
while (1) {
|
|
|
|
$data = dio_read($fd,256);
|
|
|
|
if ($data) {
|
|
echo $data;
|
|
}
|
|
}
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
|
|
</para>
|
|
<note>
|
|
<para>
|
|
This function was introduced in PHP 4.3.0.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|