mirror of https://github.com/nirenjan/libx52.git
134 lines
12 KiB
HTML
134 lines
12 KiB
HTML
<!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.17"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>libx52: Integration</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="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="projectalign" style="padding-left: 0.5em;">
|
|
<div id="projectname">libx52
|
|
 <span id="projectnumber">0.2.3</span>
|
|
</div>
|
|
<div id="projectbrief">Saitek X52/X52Pro drivers for Linux/Unix</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.17 -->
|
|
<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>
|
|
<!-- 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><!-- top -->
|
|
<div class="PageDoc"><div class="header">
|
|
<div class="headertitle">
|
|
<div class="title">Integration </div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<div class="textblock"><p>libx52 performs all its operations with a device context pointer. The application must call <a class="el" href="group__libx52init.html#gaf9ae27c6e505bce8c4415a638033a4bd">libx52_init</a> before performing any operation, and must call <a class="el" href="group__libx52init.html#ga17fe14ab3f67706b2d35c6cce3cd670b">libx52_exit</a> prior to terminating.</p>
|
|
<p>Also, the application must call <a class="el" href="group__libx52dev.html#ga65998f1155fb093f45babfd0c2c138d9">libx52_connect</a> to ensure that it connects to a supported joystick. This function must be called after <a class="el" href="group__libx52init.html#gaf9ae27c6e505bce8c4415a638033a4bd">libx52_init</a></p>
|
|
<p><b>Example Initialization/Deinitialization Code</b></p>
|
|
<div class="fragment"><div class="line"><span class="preprocessor">#include <<a class="code" href="libx52_8h.html">libx52.h</a>></span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"><a class="code" href="group__libx52init.html#gaca59b8d8f249fed58a0ec3253328e131">libx52_device</a>* init_libx52(<span class="keywordtype">void</span>)</div>
|
|
<div class="line">{</div>
|
|
<div class="line"> <a class="code" href="group__libx52init.html#gaca59b8d8f249fed58a0ec3253328e131">libx52_device</a> *dev;</div>
|
|
<div class="line"> <span class="keywordtype">int</span> rc;</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="comment">// Initialize the libx52 library</span></div>
|
|
<div class="line"> rc = <a class="code" href="group__libx52init.html#gaf9ae27c6e505bce8c4415a638033a4bd">libx52_init</a>(&dev);</div>
|
|
<div class="line"> <span class="keywordflow">if</span> (rc != <a class="code" href="group__libx52misc.html#gga93b777d9cea6e733b63c222e6115ccb7a8c4729a9500f0b9032d874ca7942b708">LIBX52_SUCCESS</a>) {</div>
|
|
<div class="line"> fputs(<a class="code" href="group__libx52str.html#gaa29a1022b0c3eb4894ddfd4934c3cf0e">libx52_strerror</a>(rc), stderr);</div>
|
|
<div class="line"> <span class="keywordflow">return</span> NULL;</div>
|
|
<div class="line"> }</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="comment">// Connect to the supported joystick</span></div>
|
|
<div class="line"> rc = <a class="code" href="group__libx52dev.html#ga65998f1155fb093f45babfd0c2c138d9">libx52_connect</a>(dev);</div>
|
|
<div class="line"> <span class="keywordflow">if</span> (rc != <a class="code" href="group__libx52misc.html#gga93b777d9cea6e733b63c222e6115ccb7a8c4729a9500f0b9032d874ca7942b708">LIBX52_SUCCESS</a>) {</div>
|
|
<div class="line"> fputs(<a class="code" href="group__libx52str.html#gaa29a1022b0c3eb4894ddfd4934c3cf0e">libx52_strerror</a>(rc), stderr);</div>
|
|
<div class="line"> <span class="comment">// A failure usually just means that there is no joystick connected</span></div>
|
|
<div class="line"> <span class="comment">// Look at the return codes for more information.</span></div>
|
|
<div class="line"> }</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="keywordflow">return</span> dev;</div>
|
|
<div class="line">}</div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="comment">// Close the library and any associated devices</span></div>
|
|
<div class="line"><a class="code" href="group__libx52init.html#ga17fe14ab3f67706b2d35c6cce3cd670b">libx52_exit</a>(dev);</div>
|
|
</div><!-- fragment --><h1><a class="anchor" id="autotoc_md13"></a>
|
|
Joystick Updates</h1>
|
|
<p>Most libx52 functions to update the joystick state do not directly write to the connected joystick, but only update internal data structures within the device context. In order to actually update the joystick, the application must call <a class="el" href="group__libx52misc.html#ga5d1fdbcab1b1a6cf8a10c206f8e79f73">libx52_update</a>. This function writes the updates to the joystick and resets any internal state.</p>
|
|
<p><b>Example</b> </p>
|
|
<div class="fragment"><div class="line"><a class="code" href="group__libx52mfdled.html#ga4f2b73685a4eb307895e08a02903bb39">libx52_set_text</a>(dev, 0, <span class="stringliteral">" Saitek "</span>, 16);</div>
|
|
<div class="line"><a class="code" href="group__libx52mfdled.html#ga4f2b73685a4eb307895e08a02903bb39">libx52_set_text</a>(dev, 1, <span class="stringliteral">" X52 Flight "</span>, 16);</div>
|
|
<div class="line"><a class="code" href="group__libx52mfdled.html#ga4f2b73685a4eb307895e08a02903bb39">libx52_set_text</a>(dev, 2, <span class="stringliteral">" Control System "</span>, 16);</div>
|
|
<div class="line"><a class="code" href="group__libx52misc.html#ga5d1fdbcab1b1a6cf8a10c206f8e79f73">libx52_update</a>(dev);</div>
|
|
</div><!-- fragment --><h1><a class="anchor" id="autotoc_md14"></a>
|
|
Error handling</h1>
|
|
<p>Most libx52 functions return a standard <a class="el" href="group__libx52misc.html#ga93b777d9cea6e733b63c222e6115ccb7">libx52_error_code</a> integer value that indicates the status of the operation. As long as the operation succeeded, the function will return <a class="el" href="group__libx52misc.html#gga93b777d9cea6e733b63c222e6115ccb7a8c4729a9500f0b9032d874ca7942b708">LIBX52_SUCCESS</a>. Other values returned indicate a failure of some sort.</p>
|
|
<p><a class="el" href="group__libx52str.html#gaa29a1022b0c3eb4894ddfd4934c3cf0e">libx52_strerror</a> can convert the return code into a descriptive string that may be displayed to users.</p>
|
|
<h2><a class="anchor" id="autotoc_md15"></a>
|
|
Internationalization of error strings</h2>
|
|
<p><a class="el" href="group__libx52str.html#gaa29a1022b0c3eb4894ddfd4934c3cf0e">libx52_strerror</a> automatically handles internationalization. As long as your application sets up the locale correctly, and the error strings have been translated to that locale, the returned strings will correspond to the translated values for your locale. </p>
|
|
</div></div><!-- contents -->
|
|
</div><!-- PageDoc -->
|
|
<div class="ttc" id="agroup__libx52mfdled_html_ga4f2b73685a4eb307895e08a02903bb39"><div class="ttname"><a href="group__libx52mfdled.html#ga4f2b73685a4eb307895e08a02903bb39">libx52_set_text</a></div><div class="ttdeci">int libx52_set_text(libx52_device *x52, uint8_t line, const char *text, uint8_t length)</div><div class="ttdoc">Set the text on an MFD line.</div></div>
|
|
<div class="ttc" id="agroup__libx52init_html_ga17fe14ab3f67706b2d35c6cce3cd670b"><div class="ttname"><a href="group__libx52init.html#ga17fe14ab3f67706b2d35c6cce3cd670b">libx52_exit</a></div><div class="ttdeci">void libx52_exit(libx52_device *dev)</div><div class="ttdoc">Exit the library and free up any resources used.</div></div>
|
|
<div class="ttc" id="agroup__libx52dev_html_ga65998f1155fb093f45babfd0c2c138d9"><div class="ttname"><a href="group__libx52dev.html#ga65998f1155fb093f45babfd0c2c138d9">libx52_connect</a></div><div class="ttdeci">int libx52_connect(libx52_device *dev)</div><div class="ttdoc">Connect to the X52 device.</div></div>
|
|
<div class="ttc" id="alibx52_8h_html"><div class="ttname"><a href="libx52_8h.html">libx52.h</a></div><div class="ttdoc">Functions, structures and enumerations for the Saitek X52 MFD & LED driver library.</div></div>
|
|
<div class="ttc" id="agroup__libx52misc_html_ga5d1fdbcab1b1a6cf8a10c206f8e79f73"><div class="ttname"><a href="group__libx52misc.html#ga5d1fdbcab1b1a6cf8a10c206f8e79f73">libx52_update</a></div><div class="ttdeci">int libx52_update(libx52_device *x52)</div><div class="ttdoc">Update the X52.</div></div>
|
|
<div class="ttc" id="agroup__libx52init_html_gaca59b8d8f249fed58a0ec3253328e131"><div class="ttname"><a href="group__libx52init.html#gaca59b8d8f249fed58a0ec3253328e131">libx52_device</a></div><div class="ttdeci">struct libx52_device libx52_device</div><div class="ttdoc">Device context structure used by libx52.</div><div class="ttdef"><b>Definition:</b> libx52.h:46</div></div>
|
|
<div class="ttc" id="agroup__libx52misc_html_gga93b777d9cea6e733b63c222e6115ccb7a8c4729a9500f0b9032d874ca7942b708"><div class="ttname"><a href="group__libx52misc.html#gga93b777d9cea6e733b63c222e6115ccb7a8c4729a9500f0b9032d874ca7942b708">LIBX52_SUCCESS</a></div><div class="ttdeci">@ LIBX52_SUCCESS</div><div class="ttdef"><b>Definition:</b> libx52.h:165</div></div>
|
|
<div class="ttc" id="agroup__libx52init_html_gaf9ae27c6e505bce8c4415a638033a4bd"><div class="ttname"><a href="group__libx52init.html#gaf9ae27c6e505bce8c4415a638033a4bd">libx52_init</a></div><div class="ttdeci">int libx52_init(libx52_device **dev)</div><div class="ttdoc">Initialize the X52 library.</div></div>
|
|
<div class="ttc" id="agroup__libx52str_html_gaa29a1022b0c3eb4894ddfd4934c3cf0e"><div class="ttname"><a href="group__libx52str.html#gaa29a1022b0c3eb4894ddfd4934c3cf0e">libx52_strerror</a></div><div class="ttdeci">const char * libx52_strerror(libx52_error_code error)</div><div class="ttdoc">Return a string representation of the error code.</div></div>
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.17
|
|
</small></address>
|
|
</body>
|
|
</html>
|