<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.15"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>LIRC libraries: Classes to receive keypresses</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtreedata.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ $(document).ready(initResizable); /* @license-end */</script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectlogo"><img alt="Logo" src="diode-2.gif"/></td> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">LIRC libraries </div> <div id="projectbrief">LinuxInfraredRemoteControl</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.15 --> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ var searchBox = new SearchBox("searchBox", "search",false,'Search'); /* @license-end */ </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); /* @license-end */</script> <div id="main-nav"></div> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ $(document).ready(function(){initNavTree('group__receiving.html','');}); /* @license-end */ </script> <div id="doc-content"> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div class="header"> <div class="summary"> <a href="#nested-classes">Classes</a> </div> <div class="headertitle"> <div class="title">Classes to receive keypresses<div class="ingroups"><a class="el" href="group__python__bindings.html">Python client bindings</a></div></div> </div> </div><!--header--> <div class="contents"> <p>Interface to read raw code strings like irw(1) or translated application strings like ircat(1). <a href="#details">More...</a></p> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a> Classes</h2></td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classlirc_1_1async__client_1_1AsyncConnection.html">lirc.async_client.AsyncConnection</a></td></tr> <tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Asynchronous read interface on top of an AbstractConnection. <a href="classlirc_1_1async__client_1_1AsyncConnection.html#details">More...</a><br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classlirc_1_1client_1_1AbstractConnection.html">lirc.client.AbstractConnection</a></td></tr> <tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Abstract interface for all connections. <a href="classlirc_1_1client_1_1AbstractConnection.html#details">More...</a><br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classlirc_1_1client_1_1RawConnection.html">lirc.client.RawConnection</a></td></tr> <tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Interface to receive code strings as described in lircd(8). <a href="classlirc_1_1client_1_1RawConnection.html#details">More...</a><br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classlirc_1_1client_1_1LircdConnection.html">lirc.client.LircdConnection</a></td></tr> <tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Interface to receive lircrc-translated keypresses. <a href="classlirc_1_1client_1_1LircdConnection.html#details">More...</a><br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <p>Interface to read raw code strings like irw(1) or translated application strings like ircat(1). </p> <p>Asynchronous interfaces to read lirc data on tóp of <a class="el" href="client_8py.html" title="Top-level python bindings for the lircd socket interface.">client.py</a>.</p> <h2>Reading raw data </h2> <p>Reading raw data direct from the lircd socket can be done with the <a class="el" href="classlirc_1_1client_1_1RawConnection.html" title="Interface to receive code strings as described in lircd(8).">RawConnection</a> object using something like </p><pre class="fragment"> from lirc import RawConnnection with RawConnection(socket_path) as conn: while True: keypress = conn.readline() ... do something with keypress </pre><p>The optional socket_path argument is the path to the lircd socket. Refer to <a class="el" href="group__python__bindings.html#ga4388cda807053ce0d28104333898065e" title="Get default value for the lircd socket path, using (falling priority):">get_default_socket_path()</a> for defaults if omitted.</p> <p>See also the <a class="el" href="irw_8py-example.html">irw.py</a> example.</p> <h2>Reading lircrc-translated data. </h2> <p>Reading application strings translated with lircrc can be achieved using </p><pre class="fragment"> from lirc import LircdConnection with LircdConnection(program, lircrc_path, socket_path) as conn: while True: string = conn.readline() ... do domething with string </pre><p>The arguments:</p><ul> <li>program: Program identifier as described in ircat(1).</li> <li>lircrc_path: Path to lircrc file. See <a class="el" href="group__python__bindings.html#gabe5c8bd83f2de80db6dca3a0d11182e0" title="Get default path to the lircrc file according to (falling priority):">get_default_lircrc_path()</a> for defaults if omitted.</li> <li>socket_path: See <a class="el" href="classlirc_1_1client_1_1RawConnection.html" title="Interface to receive code strings as described in lircd(8).">RawConnection</a> above.</li> </ul> <p>See also the <a class="el" href="ircat_8py-example.html">ircat.py</a> example</p> <h2>Asynchronous read </h2> <p>Asynchronous read of raw data direct from the lircd socket can be done with the <a class="el" href="classlirc_1_1client_1_1RawConnection.html" title="Interface to receive code strings as described in lircd(8).">RawConnection</a> class using something like: </p><pre class="fragment"> import asyncio from lirc import RawConnection, AsyncConnection async def main(raw_conn, loop): async with AsyncConnection(raw_conn, loop) as conn: async for keypress in conn: print(keypress) if __name__ == "__main__": socket_path = ..... loop = asyncio.get_event_loop() with RawConnection(socket_path) as raw_conn: loop.run_until_complete(main(raw_conn, loop)) loop.close() </pre><p>Using a <a class="el" href="classlirc_1_1client_1_1LircdConnection.html" title="Interface to receive lircrc-translated keypresses.">LircdConnection</a> with translated values works the same way. The API is unstable. </p> </div><!-- contents --> </div><!-- doc-content --> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="footer">Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.15 </li> </ul> </div> </body> </html>