diff --git a/docs/__pycache__/process.cpython-34.pyc b/docs/__pycache__/process.cpython-34.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f6453596cb0878a9a77d0d8b0d8eda219353b5d8 Binary files /dev/null and b/docs/__pycache__/process.cpython-34.pyc differ diff --git a/docs/_build/doctrees/EV3.doctree b/docs/_build/doctrees/EV3.doctree index 2e39e1100a61f0dfe0400888f762b21a8b510302..b63640ed0376901f36ab88621c7cf705e9d96947 100644 Binary files a/docs/_build/doctrees/EV3.doctree and b/docs/_build/doctrees/EV3.doctree differ diff --git a/docs/_build/doctrees/Motor.doctree b/docs/_build/doctrees/Motor.doctree index 3aa7d5f18da7da47d12b05e78564d07c4bb9eaf8..d2c25aa5b334227b782ed108af262833996d6d2c 100644 Binary files a/docs/_build/doctrees/Motor.doctree and b/docs/_build/doctrees/Motor.doctree differ diff --git a/docs/_build/doctrees/asd.doctree b/docs/_build/doctrees/asd.doctree new file mode 100644 index 0000000000000000000000000000000000000000..53aa4497320979052b586b7bee1da5be2f77c15e Binary files /dev/null and b/docs/_build/doctrees/asd.doctree differ diff --git a/docs/_build/doctrees/btBrickIO.doctree b/docs/_build/doctrees/btBrickIO.doctree new file mode 100644 index 0000000000000000000000000000000000000000..74ba22f6fe18f6c9be8d57ddd816dd69b82093bc Binary files /dev/null and b/docs/_build/doctrees/btBrickIO.doctree differ diff --git a/docs/_build/doctrees/environment.pickle b/docs/_build/doctrees/environment.pickle index 8a48fa465dce05674c054dd6d48c9b077a32c5c8..6b8e493c49b5b5e30c3e0dc44576b19e3dc5b875 100644 Binary files a/docs/_build/doctrees/environment.pickle and b/docs/_build/doctrees/environment.pickle differ diff --git a/docs/_build/doctrees/hid.doctree b/docs/_build/doctrees/hid.doctree new file mode 100644 index 0000000000000000000000000000000000000000..c82dc29f649259c36cd8030319836dde14128f93 Binary files /dev/null and b/docs/_build/doctrees/hid.doctree differ diff --git a/docs/_build/doctrees/index.doctree b/docs/_build/doctrees/index.doctree index f8184d261e3623d707fdaf3f8a432b79760f9af6..71c3da6d49bc8b22ff1d549cbeb05bb425aa5b02 100644 Binary files a/docs/_build/doctrees/index.doctree and b/docs/_build/doctrees/index.doctree differ diff --git a/docs/_build/doctrees/source.doctree b/docs/_build/doctrees/source.doctree index 394c9ec6b794d2351e4b5aae9af01b69ff1a133e..120fbe6336980b2a288beba0c012512468d8ef9f 100644 Binary files a/docs/_build/doctrees/source.doctree and b/docs/_build/doctrees/source.doctree differ diff --git a/docs/_build/doctrees/test.doctree b/docs/_build/doctrees/test.doctree new file mode 100644 index 0000000000000000000000000000000000000000..9f4d998babc5a66a3eea5e256010b5c666632ba6 Binary files /dev/null and b/docs/_build/doctrees/test.doctree differ diff --git a/docs/_build/doctrees/usbBrickIO.doctree b/docs/_build/doctrees/usbBrickIO.doctree new file mode 100644 index 0000000000000000000000000000000000000000..9e985aec95f348be9b34f7f920cb58c0f1c708b5 Binary files /dev/null and b/docs/_build/doctrees/usbBrickIO.doctree differ diff --git a/docs/_build/html/CommandLayer.html b/docs/_build/html/CommandLayer.html index bf7d3ed0ba69fc1ea81015933ea322d4faffe29f..b955febd72e324f0af4ed08999a2a6168f6a68b8 100644 --- a/docs/_build/html/CommandLayer.html +++ b/docs/_build/html/CommandLayer.html @@ -31,8 +31,6 @@ <link rel="index" title="Index" href="genindex.html" /> <link rel="search" title="Search" href="search.html" /> <link rel="top" title="Mindstorms EV3 Toolbox v0.4-rc.10 documentation" href="index.html" /> - <link rel="next" title="CommunicationLayer" href="CommunicationLayer.html" /> - <link rel="prev" title="Sensor" href="Sensor.html" /> <meta charset='utf-8'> <meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'> <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'> @@ -76,9 +74,10 @@ <li class="toctree-l1"><a class="reference internal" href="Motor.html">Motor</a></li> <li class="toctree-l1"><a class="reference internal" href="Sensor.html">Sensor</a></li> </ul> -<ul class="current"> -<li class="toctree-l1 current"><a class="current reference internal" href="#">CommandLayer</a></li> -<li class="toctree-l1"><a class="reference internal" href="CommunicationLayer.html">CommunicationLayer</a></li> +<ul> +<li class="toctree-l1"><a class="reference internal" href="hid.html">hidapi</a></li> +<li class="toctree-l1"><a class="reference internal" href="usbBrickIO.html">usbBrickIO</a></li> +<li class="toctree-l1"><a class="reference internal" href="btBrickIO.html">btBrickIO</a></li> </ul> </ul> </li> @@ -105,14 +104,6 @@ - <li> - <a href="Sensor.html" title="Previous Chapter: Sensor"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">« Sensor</span> - </a> - </li> - <li> - <a href="CommunicationLayer.html" title="Next Chapter: CommunicationLayer"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">Communication... »</span> - </a> - </li> diff --git a/docs/_build/html/CommunicationLayer.html b/docs/_build/html/CommunicationLayer.html index be22b64c95243c213bcd89b2f7795559fcd32d4e..72af7372394b377e3420219dbaac9c6ec0cad119 100644 --- a/docs/_build/html/CommunicationLayer.html +++ b/docs/_build/html/CommunicationLayer.html @@ -31,7 +31,6 @@ <link rel="index" title="Index" href="genindex.html" /> <link rel="search" title="Search" href="search.html" /> <link rel="top" title="Mindstorms EV3 Toolbox v0.4-rc.10 documentation" href="index.html" /> - <link rel="prev" title="CommandLayer" href="CommandLayer.html" /> <meta charset='utf-8'> <meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'> <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'> @@ -75,9 +74,10 @@ <li class="toctree-l1"><a class="reference internal" href="Motor.html">Motor</a></li> <li class="toctree-l1"><a class="reference internal" href="Sensor.html">Sensor</a></li> </ul> -<ul class="current"> -<li class="toctree-l1"><a class="reference internal" href="CommandLayer.html">CommandLayer</a></li> -<li class="toctree-l1 current"><a class="current reference internal" href="#">CommunicationLayer</a></li> +<ul> +<li class="toctree-l1"><a class="reference internal" href="hid.html">hidapi</a></li> +<li class="toctree-l1"><a class="reference internal" href="usbBrickIO.html">usbBrickIO</a></li> +<li class="toctree-l1"><a class="reference internal" href="btBrickIO.html">btBrickIO</a></li> </ul> </ul> </li> @@ -104,10 +104,6 @@ - <li> - <a href="CommandLayer.html" title="Previous Chapter: CommandLayer"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">« CommandLayer</span> - </a> - </li> diff --git a/docs/_build/html/EV3.html b/docs/_build/html/EV3.html index 7f30eca689a28b2a910b53e71062e018a8f89f4e..6e2a34b674cc843b0584a3772153dcca782b0560 100644 --- a/docs/_build/html/EV3.html +++ b/docs/_build/html/EV3.html @@ -77,8 +77,9 @@ <li class="toctree-l1"><a class="reference internal" href="Sensor.html">Sensor</a></li> </ul> <ul> -<li class="toctree-l1"><a class="reference internal" href="CommandLayer.html">CommandLayer</a></li> -<li class="toctree-l1"><a class="reference internal" href="CommunicationLayer.html">CommunicationLayer</a></li> +<li class="toctree-l1"><a class="reference internal" href="hid.html">hidapi</a></li> +<li class="toctree-l1"><a class="reference internal" href="usbBrickIO.html">usbBrickIO</a></li> +<li class="toctree-l1"><a class="reference internal" href="btBrickIO.html">btBrickIO</a></li> </ul> </ul> </li> @@ -315,7 +316,7 @@ b.disconnect(); % <br /></p> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>volume</strong> (<em>numeric in [0, 100]</em>) – in percent</li> <li><strong>frequency</strong> (<em>numeric in [250, 10000]</em>) – in Hertz</li> -<li><strong>duration</strong> (<em>numeric >0</em>) – in milliseconds</li> +<li><strong>duration</strong> (<em>numeric > 0</em>) – in milliseconds</li> </ul> </td> </tr> diff --git a/docs/_build/html/Motor.html b/docs/_build/html/Motor.html index 32b86f1ff907d8583ba74172acb8fe38122417c3..fef8e5c7289608c43f5c64d78ae595daa2dcb65f 100644 --- a/docs/_build/html/Motor.html +++ b/docs/_build/html/Motor.html @@ -77,8 +77,9 @@ <li class="toctree-l1"><a class="reference internal" href="Sensor.html">Sensor</a></li> </ul> <ul> -<li class="toctree-l1"><a class="reference internal" href="CommandLayer.html">CommandLayer</a></li> -<li class="toctree-l1"><a class="reference internal" href="CommunicationLayer.html">CommunicationLayer</a></li> +<li class="toctree-l1"><a class="reference internal" href="hid.html">hidapi</a></li> +<li class="toctree-l1"><a class="reference internal" href="usbBrickIO.html">usbBrickIO</a></li> +<li class="toctree-l1"><a class="reference internal" href="btBrickIO.html">btBrickIO</a></li> </ul> </ul> </li> diff --git a/docs/_build/html/Sensor.html b/docs/_build/html/Sensor.html index a22da31f2abfb12d57fd357ce576b87e896155c6..0b01eea7504ee09929d70cc236077225e870911a 100644 --- a/docs/_build/html/Sensor.html +++ b/docs/_build/html/Sensor.html @@ -31,7 +31,7 @@ <link rel="index" title="Index" href="genindex.html" /> <link rel="search" title="Search" href="search.html" /> <link rel="top" title="Mindstorms EV3 Toolbox v0.4-rc.10 documentation" href="index.html" /> - <link rel="next" title="CommandLayer" href="CommandLayer.html" /> + <link rel="next" title="hidapi" href="hid.html" /> <link rel="prev" title="Motor" href="Motor.html" /> <meta charset='utf-8'> <meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'> @@ -77,8 +77,9 @@ <li class="toctree-l1 current"><a class="current reference internal" href="#">Sensor</a></li> </ul> <ul> -<li class="toctree-l1"><a class="reference internal" href="CommandLayer.html">CommandLayer</a></li> -<li class="toctree-l1"><a class="reference internal" href="CommunicationLayer.html">CommunicationLayer</a></li> +<li class="toctree-l1"><a class="reference internal" href="hid.html">hidapi</a></li> +<li class="toctree-l1"><a class="reference internal" href="usbBrickIO.html">usbBrickIO</a></li> +<li class="toctree-l1"><a class="reference internal" href="btBrickIO.html">btBrickIO</a></li> </ul> </ul> </li> @@ -106,7 +107,7 @@ </a> </li> <li> - <a href="CommandLayer.html" title="Next Chapter: CommandLayer"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">CommandLayer »</span> + <a href="hid.html" title="Next Chapter: hidapi"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">hidapi »</span> </a> </li> diff --git a/docs/_build/html/_sources/asd.txt b/docs/_build/html/_sources/asd.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/docs/_build/html/_sources/btBrickIO.txt b/docs/_build/html/_sources/btBrickIO.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e076d50dc1c141aef7ed955e216f4b3a438723c --- /dev/null +++ b/docs/_build/html/_sources/btBrickIO.txt @@ -0,0 +1,10 @@ +.. automodule:: source + +.. |br| raw:: html + + <br /> +btBrickIO +========= + +.. autoclass:: btBrickIO + :members: open, close, read, write, setProperties diff --git a/docs/_build/html/_sources/hid.txt b/docs/_build/html/_sources/hid.txt new file mode 100644 index 0000000000000000000000000000000000000000..a81e179691da5a39122479c305bd02a5f82a5619 --- /dev/null +++ b/docs/_build/html/_sources/hid.txt @@ -0,0 +1,10 @@ +.. automodule:: source + +.. |br| raw:: html + + <br /> +hidapi +====== + +.. autoclass:: hidapi + :members: open, close, read, read_timeout, write, getHIDInfoString, setNonBlocking, init, exit, error, enumerate, getManufacturersString, getProductString, getSerialNumberString diff --git a/docs/_build/html/_sources/index.txt b/docs/_build/html/_sources/index.txt index a75f04ace42e9750f8f5f8213320a304c343fd57..157a890c15b3b897ca5e3259d9f5fbe22c3fe0fe 100644 --- a/docs/_build/html/_sources/index.txt +++ b/docs/_build/html/_sources/index.txt @@ -45,8 +45,9 @@ Toolbox documentation Advanced .. toctree:: - :maxdepth: 2 - - CommandLayer.rst - CommunicationLayer.rst - + :maxdepth: 3 + + hid + usbBrickIO + btBrickIO + diff --git a/docs/_build/html/_sources/test.txt b/docs/_build/html/_sources/test.txt new file mode 100644 index 0000000000000000000000000000000000000000..a81e179691da5a39122479c305bd02a5f82a5619 --- /dev/null +++ b/docs/_build/html/_sources/test.txt @@ -0,0 +1,10 @@ +.. automodule:: source + +.. |br| raw:: html + + <br /> +hidapi +====== + +.. autoclass:: hidapi + :members: open, close, read, read_timeout, write, getHIDInfoString, setNonBlocking, init, exit, error, enumerate, getManufacturersString, getProductString, getSerialNumberString diff --git a/docs/_build/html/_sources/usbBrickIO.txt b/docs/_build/html/_sources/usbBrickIO.txt new file mode 100644 index 0000000000000000000000000000000000000000..785bdc9777327560b7982902df1a9df17ffb2cc9 --- /dev/null +++ b/docs/_build/html/_sources/usbBrickIO.txt @@ -0,0 +1,10 @@ +.. automodule:: source + +.. |br| raw:: html + + <br /> +usbBrickIO +========== + +.. autoclass:: usbBrickIO + :members: open, close, read, write, setProperties diff --git a/docs/_build/html/asd.html b/docs/_build/html/asd.html new file mode 100644 index 0000000000000000000000000000000000000000..d0a257d4778fb87d4c0845ed7f956761a1cf8da5 --- /dev/null +++ b/docs/_build/html/asd.html @@ -0,0 +1,151 @@ +<!DOCTYPE html> + + +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + + <title><no title> — Mindstorms EV3 Toolbox v0.4-rc.10 documentation</title> + + <link rel="stylesheet" href="_static/basic.css" type="text/css" /> + <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> + <link rel="stylesheet" href="_static/bootswatch-3.3.6/readable/bootstrap.min.css" type="text/css" /> + <link rel="stylesheet" href="_static/bootstrap-sphinx.css" type="text/css" /> + + <script type="text/javascript"> + var DOCUMENTATION_OPTIONS = { + URL_ROOT: './', + VERSION: 'v0.4-rc.10', + COLLAPSE_INDEX: false, + FILE_SUFFIX: '.html', + HAS_SOURCE: true + }; + </script> + <script type="text/javascript" src="_static/jquery.js"></script> + <script type="text/javascript" src="_static/underscore.js"></script> + <script type="text/javascript" src="_static/doctools.js"></script> + <script type="text/javascript" src="_static/js/jquery-1.11.0.min.js"></script> + <script type="text/javascript" src="_static/js/jquery-fix.js"></script> + <script type="text/javascript" src="_static/bootstrap-3.3.6/js/bootstrap.min.js"></script> + <script type="text/javascript" src="_static/bootstrap-sphinx.js"></script> + <link rel="index" title="Index" href="genindex.html" /> + <link rel="search" title="Search" href="search.html" /> + <link rel="top" title="Mindstorms EV3 Toolbox v0.4-rc.10 documentation" href="index.html" /> +<meta charset='utf-8'> +<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'> +<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'> +<meta name="apple-mobile-web-app-capable" content="yes"> + + </head> + <body role="document"> + + <div id="navbar" class="navbar navbar-default navbar-fixed-top"> + <div class="container"> + <div class="navbar-header"> + <!-- .btn-navbar is used as the toggle for collapsed navbar content --> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="index.html"> + Mindstorms EV3 Toolbox</a> + <span class="navbar-text navbar-version pull-left"><b>v0.4</b></span> + </div> + + <div class="collapse navbar-collapse nav-collapse"> + <ul class="nav navbar-nav"> + + + <li class="dropdown globaltoc-container"> + <a role="button" + id="dLabelGlobalToc" + data-toggle="dropdown" + data-target="#" + href="index.html">Site <b class="caret"></b></a> + <ul class="dropdown-menu globaltoc" + role="menu" + aria-labelledby="dLabelGlobalToc"><ul> +<li class="toctree-l1"><a class="reference internal" href="readme.html">General</a></li> +<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li> +</ul> +<ul> +<li class="toctree-l1"><a class="reference internal" href="EV3.html">EV3</a></li> +<li class="toctree-l1"><a class="reference internal" href="Motor.html">Motor</a></li> +<li class="toctree-l1"><a class="reference internal" href="Sensor.html">Sensor</a></li> +</ul> +<ul> +<li class="toctree-l1"><a class="reference internal" href="usbBrickIO.html">usbBrickIO</a></li> +<li class="toctree-l1"><a class="reference internal" href="btBrickIO.html">btBrickIO</a></li> +</ul> +</ul> +</li> + + <li class="dropdown"> + <a role="button" + id="dLabelLocalToc" + data-toggle="dropdown" + data-target="#" + href="#">Page <b class="caret"></b></a> + <ul class="dropdown-menu localtoc" + role="menu" + aria-labelledby="dLabelLocalToc"><ul class="simple"> +</ul> +</ul> +</li> + + + + + + + + + + + <li class="hidden-sm"> +<div id="sourcelink"> + <a href="_sources/asd.txt" + rel="nofollow">Source</a> +</div></li> + + </ul> + + + +<form class="navbar-form navbar-right" action="search.html" method="get"> + <div class="form-group"> + <input type="text" name="q" class="form-control" placeholder="Search" /> + </div> + <input type="hidden" name="check_keywords" value="yes" /> + <input type="hidden" name="area" value="default" /> +</form> + + </div> + </div> + </div> + +<div class="container"> + <div class="row"> + <div class="col-md-12 content"> + + + + </div> + + </div> +</div> +<footer class="footer"> + <div class="container"> + <p class="pull-right"> + <a href="#">Back to top</a> + + </p> + <p> + © Copyright 2016, LfB - RWTH Aachen.<br/> + Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.8.<br/> + </p> + </div> +</footer> + </body> +</html> \ No newline at end of file diff --git a/docs/_build/html/btBrickIO.html b/docs/_build/html/btBrickIO.html new file mode 100644 index 0000000000000000000000000000000000000000..d0f42928462ae8a40faeb5609cb4a918026b2872 --- /dev/null +++ b/docs/_build/html/btBrickIO.html @@ -0,0 +1,279 @@ +<!DOCTYPE html> + + +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + + <title>btBrickIO — Mindstorms EV3 Toolbox v0.4-rc.10 documentation</title> + + <link rel="stylesheet" href="_static/basic.css" type="text/css" /> + <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> + <link rel="stylesheet" href="_static/bootswatch-3.3.6/readable/bootstrap.min.css" type="text/css" /> + <link rel="stylesheet" href="_static/bootstrap-sphinx.css" type="text/css" /> + + <script type="text/javascript"> + var DOCUMENTATION_OPTIONS = { + URL_ROOT: './', + VERSION: 'v0.4-rc.10', + COLLAPSE_INDEX: false, + FILE_SUFFIX: '.html', + HAS_SOURCE: true + }; + </script> + <script type="text/javascript" src="_static/jquery.js"></script> + <script type="text/javascript" src="_static/underscore.js"></script> + <script type="text/javascript" src="_static/doctools.js"></script> + <script type="text/javascript" src="_static/js/jquery-1.11.0.min.js"></script> + <script type="text/javascript" src="_static/js/jquery-fix.js"></script> + <script type="text/javascript" src="_static/bootstrap-3.3.6/js/bootstrap.min.js"></script> + <script type="text/javascript" src="_static/bootstrap-sphinx.js"></script> + <link rel="index" title="Index" href="genindex.html" /> + <link rel="search" title="Search" href="search.html" /> + <link rel="top" title="Mindstorms EV3 Toolbox v0.4-rc.10 documentation" href="index.html" /> + <link rel="prev" title="usbBrickIO" href="usbBrickIO.html" /> +<meta charset='utf-8'> +<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'> +<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'> +<meta name="apple-mobile-web-app-capable" content="yes"> + + </head> + <body role="document"> + + <div id="navbar" class="navbar navbar-default navbar-fixed-top"> + <div class="container"> + <div class="navbar-header"> + <!-- .btn-navbar is used as the toggle for collapsed navbar content --> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="index.html"> + Mindstorms EV3 Toolbox</a> + <span class="navbar-text navbar-version pull-left"><b>v0.4</b></span> + </div> + + <div class="collapse navbar-collapse nav-collapse"> + <ul class="nav navbar-nav"> + + + <li class="dropdown globaltoc-container"> + <a role="button" + id="dLabelGlobalToc" + data-toggle="dropdown" + data-target="#" + href="index.html">Site <b class="caret"></b></a> + <ul class="dropdown-menu globaltoc" + role="menu" + aria-labelledby="dLabelGlobalToc"><ul> +<li class="toctree-l1"><a class="reference internal" href="readme.html">General</a></li> +<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li> +</ul> +<ul> +<li class="toctree-l1"><a class="reference internal" href="EV3.html">EV3</a></li> +<li class="toctree-l1"><a class="reference internal" href="Motor.html">Motor</a></li> +<li class="toctree-l1"><a class="reference internal" href="Sensor.html">Sensor</a></li> +</ul> +<ul class="current"> +<li class="toctree-l1"><a class="reference internal" href="hid.html">hidapi</a></li> +<li class="toctree-l1"><a class="reference internal" href="usbBrickIO.html">usbBrickIO</a></li> +<li class="toctree-l1 current"><a class="current reference internal" href="#">btBrickIO</a></li> +</ul> +</ul> +</li> + + <li class="dropdown"> + <a role="button" + id="dLabelLocalToc" + data-toggle="dropdown" + data-target="#" + href="#">Page <b class="caret"></b></a> + <ul class="dropdown-menu localtoc" + role="menu" + aria-labelledby="dLabelLocalToc"><ul> +<li><a class="reference internal" href="#">btBrickIO</a></li> +</ul> +</ul> +</li> + + + + + + <li> + <a href="usbBrickIO.html" title="Previous Chapter: usbBrickIO"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">« usbBrickIO</span> + </a> + </li> + + + + + + <li class="hidden-sm"> +<div id="sourcelink"> + <a href="_sources/btBrickIO.txt" + rel="nofollow">Source</a> +</div></li> + + </ul> + + + +<form class="navbar-form navbar-right" action="search.html" method="get"> + <div class="form-group"> + <input type="text" name="q" class="form-control" placeholder="Search" /> + </div> + <input type="hidden" name="check_keywords" value="yes" /> + <input type="hidden" name="area" value="default" /> +</form> + + </div> + </div> + </div> + +<div class="container"> + <div class="row"> + <div class="col-md-12 content"> + + <span class="target" id="module-source"></span><div class="section" id="btbrickio"> +<h1>btBrickIO<a class="headerlink" href="#btbrickio" title="Permalink to this headline">¶</a></h1> +<dl class="class"> +<dt id="source.btBrickIO"> +<em class="property">class </em><code class="descname">btBrickIO</code><span class="sig-paren">(</span><em>varargin</em><span class="sig-paren">)</span><a class="headerlink" href="#source.btBrickIO" title="Permalink to this definition">¶</a></dt> +<dd><p>Bluetooth interface between MATLAB and the brick</p> +<p class="rubric">Notes</p> +<ul> +<li><p class="first">Connects to the bluetooth module on the host through a serial +connection. Hence be sure that a serial connection to the bluetooth +module can be made. Also be sure that the bluetooth module has been paired +to the brick before trying to connect.</p> +</li> +<li><dl class="first docutils"> +<dt>Usage is OS-dependent:</dt> +<dd><ul class="first last simple"> +<li>Windows: the deviceName- & channel-properties are needed for connection. The implementation is based on the Instrument Control toolbox.</li> +<li>Linux (and potentially Mac): serialPort-property is needed for connection. The implementation is based on MATLAB's serial port implementation.</li> +</ul> +</dd> +</dl> +</li> +<li><p class="first">For general information, see also <code class="xref mat mat-class docutils literal"><span class="pre">BrickIO</span></code>.</p> +</li> +</ul> +<dl class="attribute"> +<dt id="source.btBrickIO.debug"> +<code class="descname">debug</code><a class="headerlink" href="#source.btBrickIO.debug" title="Permalink to this definition">¶</a></dt> +<dd><p><em>bool</em> – If true, each open/close/read/write-call will be shown in the console. +Defaults to false.</p> +</dd></dl> + +<dl class="attribute"> +<dt id="source.btBrickIO.serialPort"> +<code class="descname">serialPort</code><a class="headerlink" href="#source.btBrickIO.serialPort" title="Permalink to this definition">¶</a></dt> +<dd><p><em>string</em> – Path to the serial-port object. Only needed when using MATLAB's +serial class (i.e. on linux/mac). Defaults to '/dev/rfcomm0'.</p> +</dd></dl> + +<dl class="attribute"> +<dt id="source.btBrickIO.deviceName"> +<code class="descname">deviceName</code><a class="headerlink" href="#source.btBrickIO.deviceName" title="Permalink to this definition">¶</a></dt> +<dd><p><em>string</em> – Name of the BT-device = the brick. Only needed when using the +Instrument Control toolbox (i.e. on windows). Defaults to 'EV3'.</p> +</dd></dl> + +<dl class="attribute"> +<dt id="source.btBrickIO.channel"> +<code class="descname">channel</code><a class="headerlink" href="#source.btBrickIO.channel" title="Permalink to this definition">¶</a></dt> +<dd><p><em>numeric > 0</em> – BT-channel of the connected BT-device. Only needed when using +the Instrument Control toolbox (i.e. on windows). Defaults to 1.</p> +</dd></dl> + +<dl class="attribute"> +<dt id="source.btBrickIO.timeOut"> +<code class="descname">timeOut</code><a class="headerlink" href="#source.btBrickIO.timeOut" title="Permalink to this definition">¶</a></dt> +<dd><p><em>numeric >= 0</em> – seconds after which a timeout-error occurs if no packet could be +read. Defaults to 10.</p> +</dd></dl> + +<dl class="attribute"> +<dt id="source.btBrickIO.backend"> +<code class="descname">backend</code><a class="headerlink" href="#source.btBrickIO.backend" title="Permalink to this definition">¶</a></dt> +<dd><p><em>'serial'|'instrumentControl'</em> – Backend this implementation is based on. Is +automatically chosen depending on the OS. Defaults to 'serial' on linux/mac +systems, and to 'instrumentControl' on windows systems.</p> +</dd></dl> + +<p class="rubric">Examples</p> +<p>% Connecting on windows <br /> +commHandle = btBrickIO('deviceName', 'MyEV3', 'channel', 1); % <br /> +% Connecting on windows using MATLABs default serial port implementation for testing <br /> +commHandle = btBrickIO('deviceName', 'MyEV3', 'channel', 1, 'backend', 'serial'); % <br /> +% Connecting on mac/linux <br /> +commHandle = btBrickIO('serPort', '/dev/rfcomm0'); % <br /></p> +<dl class="method"> +<dt id="source.btBrickIO.close"> +<code class="descname">close</code><span class="sig-paren">(</span><em>brickIO</em><span class="sig-paren">)</span><a class="headerlink" href="#source.btBrickIO.close" title="Permalink to this definition">¶</a></dt> +<dd><p>Closes the bluetooth connection the brick using fclose.</p> +</dd></dl> + +<dl class="method"> +<dt id="source.btBrickIO.open"> +<code class="descname">open</code><span class="sig-paren">(</span><em>brickIO</em><span class="sig-paren">)</span><a class="headerlink" href="#source.btBrickIO.open" title="Permalink to this definition">¶</a></dt> +<dd><p>Opens the bluetooth connection to the brick using fopen.</p> +</dd></dl> + +<dl class="method"> +<dt id="source.btBrickIO.read"> +<code class="descname">read</code><span class="sig-paren">(</span><em>brickIO</em><span class="sig-paren">)</span><a class="headerlink" href="#source.btBrickIO.read" title="Permalink to this definition">¶</a></dt> +<dd><p>Reads data from the brick through bluetooth via fread and returns the data in uint8 format.</p> +</dd></dl> + +<dl class="method"> +<dt id="source.btBrickIO.setProperties"> +<code class="descname">setProperties</code><span class="sig-paren">(</span><em>brickIO</em>, <em>varargin</em><span class="sig-paren">)</span><a class="headerlink" href="#source.btBrickIO.setProperties" title="Permalink to this definition">¶</a></dt> +<dd><p>Sets multiple btBrickIO properties at once using MATLAB's inputParser.</p> +<p>The syntax is as follows: commHandle.setProperties('propertyName1', +propertyValue1, 'propertyName2', propertyValue2, ...). Valid, optional properties +are: debug, serPort, deviceName, channel, timeout.</p> +<p>See also BTBRICKIO.DEBUG, BTBRICKIO.SERIALPORT, BTBRICKIO.DEVICENAME, +BTBRICKIO.CHANNEL, BTBRICKIO.TIMEOUT</p> +</dd></dl> + +<dl class="method"> +<dt id="source.btBrickIO.write"> +<code class="descname">write</code><span class="sig-paren">(</span><em>brickIO</em>, <em>wmsg</em><span class="sig-paren">)</span><a class="headerlink" href="#source.btBrickIO.write" title="Permalink to this definition">¶</a></dt> +<dd><p>Writes data to the brick through bluetooth via fwrite.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>wmsg</strong> (<em>uint8 array</em>) – Data to be written to the brick via bluetooth</td> +</tr> +</tbody> +</table> +</dd></dl> + +</dd></dl> + +</div> + + + </div> + + </div> +</div> +<footer class="footer"> + <div class="container"> + <p class="pull-right"> + <a href="#">Back to top</a> + + </p> + <p> + © Copyright 2016, LfB - RWTH Aachen.<br/> + Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.8.<br/> + </p> + </div> +</footer> + </body> +</html> \ No newline at end of file diff --git a/docs/_build/html/examples.html b/docs/_build/html/examples.html index b12382444dbc5e559f2b636110bcd7445f787e69..e3923d5ea81c24d428ff44d7588a4fcb485dc1aa 100644 --- a/docs/_build/html/examples.html +++ b/docs/_build/html/examples.html @@ -79,6 +79,8 @@ <ul> <li class="toctree-l1"><a class="reference internal" href="CommandLayer.html">CommandLayer</a></li> <li class="toctree-l1"><a class="reference internal" href="CommunicationLayer.html">CommunicationLayer</a></li> +<li class="toctree-l1"><a class="reference internal" href="usbBrickIO.html">usbBrickIO</a></li> +<li class="toctree-l1"><a class="reference internal" href="btBrickIO.html">btBrickIO</a></li> </ul> </ul> </li> diff --git a/docs/_build/html/genindex.html b/docs/_build/html/genindex.html index f905277e3d9ad00cc2b6f9e9c489b60dc4347ac4..823964d32ed6f43943cf41957c512931dade0dbf 100644 --- a/docs/_build/html/genindex.html +++ b/docs/_build/html/genindex.html @@ -76,8 +76,9 @@ <li class="toctree-l1"><a class="reference internal" href="Sensor.html">Sensor</a></li> </ul> <ul> -<li class="toctree-l1"><a class="reference internal" href="CommandLayer.html">CommandLayer</a></li> -<li class="toctree-l1"><a class="reference internal" href="CommunicationLayer.html">CommunicationLayer</a></li> +<li class="toctree-l1"><a class="reference internal" href="hid.html">hidapi</a></li> +<li class="toctree-l1"><a class="reference internal" href="usbBrickIO.html">usbBrickIO</a></li> +<li class="toctree-l1"><a class="reference internal" href="btBrickIO.html">btBrickIO</a></li> </ul> </ul> </li> @@ -132,13 +133,18 @@ | <a href="#C"><strong>C</strong></a> | <a href="#D"><strong>D</strong></a> | <a href="#E"><strong>E</strong></a> + | <a href="#G"><strong>G</strong></a> + | <a href="#H"><strong>H</strong></a> | <a href="#I"><strong>I</strong></a> | <a href="#L"><strong>L</strong></a> | <a href="#M"><strong>M</strong></a> + | <a href="#N"><strong>N</strong></a> + | <a href="#O"><strong>O</strong></a> | <a href="#P"><strong>P</strong></a> | <a href="#R"><strong>R</strong></a> | <a href="#S"><strong>S</strong></a> | <a href="#T"><strong>T</strong></a> + | <a href="#U"><strong>U</strong></a> | <a href="#V"><strong>V</strong></a> | <a href="#W"><strong>W</strong></a> @@ -147,6 +153,10 @@ <table style="width: 100%" class="indextable genindextable"><tr> <td style="width: 33%" valign="top"><dl> + <dt><a href="btBrickIO.html#source.btBrickIO.backend">backend (source.btBrickIO attribute)</a> + </dt> + + <dt><a href="EV3.html#source.EV3.batteryMode">batteryMode (source.EV3 attribute)</a>, <a href="source.html#source.EV3.batteryMode">[1]</a> </dt> @@ -164,6 +174,10 @@ <dt><a href="Motor.html#source.Motor.brakeMode">brakeMode (source.Motor attribute)</a> </dt> + + <dt><a href="btBrickIO.html#source.btBrickIO">btBrickIO (class in source)</a> + </dt> + </dl></td> </tr></table> @@ -171,12 +185,30 @@ <table style="width: 100%" class="indextable genindextable"><tr> <td style="width: 33%" valign="top"><dl> - <dt><a href="EV3.html#source.EV3.connect">connect() (source.EV3 method)</a>, <a href="source.html#source.EV3.connect">[1]</a> + <dt><a href="btBrickIO.html#source.btBrickIO.channel">channel (source.btBrickIO attribute)</a> </dt> + + <dt><a href="btBrickIO.html#source.btBrickIO.close">close() (source.btBrickIO method)</a> + </dt> + + <dd><dl> + + <dt><a href="hid.html#source.hidapi.close">(source.hidapi method)</a> + </dt> + + + <dt><a href="usbBrickIO.html#source.usbBrickIO.close">(source.usbBrickIO method)</a> + </dt> + + </dl></dd> </dl></td> <td style="width: 33%" valign="top"><dl> + <dt><a href="EV3.html#source.EV3.connect">connect() (source.EV3 method)</a>, <a href="source.html#source.EV3.connect">[1]</a> + </dt> + + <dt><a href="Motor.html#source.Motor.currentSpeed">currentSpeed (source.Motor attribute)</a> </dt> @@ -187,11 +219,15 @@ <table style="width: 100%" class="indextable genindextable"><tr> <td style="width: 33%" valign="top"><dl> - <dt><a href="EV3.html#source.EV3.debug">debug (source.EV3 attribute)</a>, <a href="source.html#source.EV3.debug">[1]</a> + <dt><a href="btBrickIO.html#source.btBrickIO.debug">debug (source.btBrickIO attribute)</a> </dt> <dd><dl> + <dt><a href="EV3.html#source.EV3.debug">(source.EV3 attribute)</a>, <a href="source.html#source.EV3.debug">[1]</a> + </dt> + + <dt><a href="Motor.html#source.Motor.debug">(source.Motor attribute)</a> </dt> @@ -199,10 +235,18 @@ <dt><a href="Sensor.html#source.Sensor.debug">(source.Sensor attribute)</a> </dt> + + <dt><a href="usbBrickIO.html#source.usbBrickIO.debug">(source.usbBrickIO attribute)</a> + </dt> + </dl></dd> </dl></td> <td style="width: 33%" valign="top"><dl> + <dt><a href="btBrickIO.html#source.btBrickIO.deviceName">deviceName (source.btBrickIO attribute)</a> + </dt> + + <dt><a href="EV3.html#source.EV3.disconnect">disconnect() (source.EV3 method)</a>, <a href="source.html#source.EV3.disconnect">[1]</a> </dt> @@ -213,9 +257,63 @@ <table style="width: 100%" class="indextable genindextable"><tr> <td style="width: 33%" valign="top"><dl> + <dt><a href="hid.html#source.hidapi.enumerate">enumerate() (source.hidapi method)</a> + </dt> + + + <dt><a href="hid.html#source.hidapi.error">error() (source.hidapi method)</a> + </dt> + + </dl></td> + <td style="width: 33%" valign="top"><dl> + <dt><a href="EV3.html#source.EV3">EV3 (class in source)</a>, <a href="source.html#source.EV3">[1]</a> </dt> + + <dt><a href="hid.html#source.hidapi.exit">exit() (source.hidapi method)</a> + </dt> + + </dl></td> +</tr></table> + +<h2 id="G">G</h2> +<table style="width: 100%" class="indextable genindextable"><tr> + <td style="width: 33%" valign="top"><dl> + + <dt><a href="hid.html#source.hidapi.getHIDInfoString">getHIDInfoString() (source.hidapi method)</a> + </dt> + + + <dt><a href="hid.html#source.hidapi.getManufacturersString">getManufacturersString() (source.hidapi method)</a> + </dt> + + </dl></td> + <td style="width: 33%" valign="top"><dl> + + <dt><a href="hid.html#source.hidapi.getProductString">getProductString() (source.hidapi method)</a> + </dt> + + + <dt><a href="hid.html#source.hidapi.getSerialNumberString">getSerialNumberString() (source.hidapi method)</a> + </dt> + + </dl></td> +</tr></table> + +<h2 id="H">H</h2> +<table style="width: 100%" class="indextable genindextable"><tr> + <td style="width: 33%" valign="top"><dl> + + <dt><a href="hid.html#source.hidapi.handle">handle (source.hidapi attribute)</a> + </dt> + + </dl></td> + <td style="width: 33%" valign="top"><dl> + + <dt><a href="hid.html#source.hidapi">hidapi (class in source)</a> + </dt> + </dl></td> </tr></table> @@ -223,6 +321,10 @@ <table style="width: 100%" class="indextable genindextable"><tr> <td style="width: 33%" valign="top"><dl> + <dt><a href="hid.html#source.hidapi.init">init() (source.hidapi method)</a> + </dt> + + <dt><a href="Motor.html#source.Motor.internalReset">internalReset() (source.Motor method)</a> </dt> @@ -287,6 +389,54 @@ </dl></td> </tr></table> +<h2 id="N">N</h2> +<table style="width: 100%" class="indextable genindextable"><tr> + <td style="width: 33%" valign="top"><dl> + + <dt><a href="hid.html#source.hidapi.nReadBuffer">nReadBuffer (source.hidapi attribute)</a> + </dt> + + <dd><dl> + + <dt><a href="usbBrickIO.html#source.usbBrickIO.nReadBuffer">(source.usbBrickIO attribute)</a> + </dt> + + </dl></dd> + </dl></td> + <td style="width: 33%" valign="top"><dl> + + <dt><a href="hid.html#source.hidapi.nWriteBuffer">nWriteBuffer (source.hidapi attribute)</a> + </dt> + + <dd><dl> + + <dt><a href="usbBrickIO.html#source.usbBrickIO.nWriteBuffer">(source.usbBrickIO attribute)</a> + </dt> + + </dl></dd> + </dl></td> +</tr></table> + +<h2 id="O">O</h2> +<table style="width: 100%" class="indextable genindextable"><tr> + <td style="width: 33%" valign="top"><dl> + + <dt><a href="btBrickIO.html#source.btBrickIO.open">open() (source.btBrickIO method)</a> + </dt> + + <dd><dl> + + <dt><a href="hid.html#source.hidapi.open">(source.hidapi method)</a> + </dt> + + + <dt><a href="usbBrickIO.html#source.usbBrickIO.open">(source.usbBrickIO method)</a> + </dt> + + </dl></dd> + </dl></td> +</tr></table> + <h2 id="P">P</h2> <table style="width: 100%" class="indextable genindextable"><tr> <td style="width: 33%" valign="top"><dl> @@ -294,12 +444,22 @@ <dt><a href="EV3.html#source.EV3.playTone">playTone() (source.EV3 method)</a>, <a href="source.html#source.EV3.playTone">[1]</a> </dt> + + <dt><a href="Motor.html#source.Motor.power">power (source.Motor attribute)</a> + </dt> + </dl></td> <td style="width: 33%" valign="top"><dl> - <dt><a href="Motor.html#source.Motor.power">power (source.Motor attribute)</a> + <dt><a href="hid.html#source.hidapi.productID">productID (source.hidapi attribute)</a> + </dt> + + <dd><dl> + + <dt><a href="usbBrickIO.html#source.usbBrickIO.productID">(source.usbBrickIO attribute)</a> </dt> + </dl></dd> </dl></td> </tr></table> @@ -307,12 +467,30 @@ <table style="width: 100%" class="indextable genindextable"><tr> <td style="width: 33%" valign="top"><dl> - <dt><a href="Sensor.html#source.Sensor.reset">reset() (source.Sensor method)</a> + <dt><a href="btBrickIO.html#source.btBrickIO.read">read() (source.btBrickIO method)</a> </dt> + <dd><dl> + + <dt><a href="hid.html#source.hidapi.read">(source.hidapi method)</a> + </dt> + + + <dt><a href="usbBrickIO.html#source.usbBrickIO.read">(source.usbBrickIO method)</a> + </dt> + + </dl></dd> </dl></td> <td style="width: 33%" valign="top"><dl> + <dt><a href="hid.html#source.hidapi.read_timeout">read_timeout() (source.hidapi method)</a> + </dt> + + + <dt><a href="Sensor.html#source.Sensor.reset">reset() (source.Sensor method)</a> + </dt> + + <dt><a href="Motor.html#source.Motor.resetTachoCount">resetTachoCount() (source.Motor method)</a> </dt> @@ -343,15 +521,27 @@ </dt> + <dt><a href="btBrickIO.html#source.btBrickIO.serialPort">serialPort (source.btBrickIO attribute)</a> + </dt> + + <dt><a href="Motor.html#source.Motor.setBrake">setBrake() (source.Motor method)</a> </dt> - <dt><a href="EV3.html#source.EV3.setProperties">setProperties() (source.EV3 method)</a>, <a href="source.html#source.EV3.setProperties">[1]</a> + <dt><a href="hid.html#source.hidapi.setNonBlocking">setNonBlocking() (source.hidapi method)</a> + </dt> + + + <dt><a href="btBrickIO.html#source.btBrickIO.setProperties">setProperties() (source.btBrickIO method)</a> </dt> <dd><dl> + <dt><a href="EV3.html#source.EV3.setProperties">(source.EV3 method)</a>, <a href="source.html#source.EV3.setProperties">[1]</a> + </dt> + + <dt><a href="Motor.html#source.Motor.setProperties">(source.Motor method)</a> </dt> @@ -359,10 +549,22 @@ <dt><a href="Sensor.html#source.Sensor.setProperties">(source.Sensor method)</a> </dt> + + <dt><a href="usbBrickIO.html#source.usbBrickIO.setProperties">(source.usbBrickIO method)</a> + </dt> + </dl></dd> </dl></td> <td style="width: 33%" valign="top"><dl> + <dt><a href="hid.html#source.hidapi.sheader">sheader (source.hidapi attribute)</a> + </dt> + + + <dt><a href="hid.html#source.hidapi.slib">slib (source.hidapi attribute)</a> + </dt> + + <dt><a href="Motor.html#source.Motor.smoothStart">smoothStart (source.Motor attribute)</a> </dt> @@ -371,7 +573,7 @@ </dt> - <dt><a href="CommandLayer.html#module-source">source (module)</a>, <a href="CommunicationLayer.html#module-source">[1]</a>, <a href="EV3.html#module-source">[2]</a>, <a href="Motor.html#module-source">[3]</a>, <a href="Sensor.html#module-source">[4]</a>, <a href="source.html#module-source">[5]</a> + <dt><a href="CommandLayer.html#module-source">source (module)</a>, <a href="CommunicationLayer.html#module-source">[1]</a>, <a href="EV3.html#module-source">[2]</a>, <a href="Motor.html#module-source">[3]</a>, <a href="Sensor.html#module-source">[4]</a>, <a href="btBrickIO.html#module-source">[5]</a>, <a href="hid.html#module-source">[6]</a>, <a href="source.html#module-source">[7]</a>, <a href="usbBrickIO.html#module-source">[8]</a> </dt> @@ -413,12 +615,22 @@ </dt> - <dt><a href="EV3.html#source.EV3.tonePlayed">tonePlayed() (source.EV3 method)</a>, <a href="source.html#source.EV3.tonePlayed">[1]</a> + <dt><a href="btBrickIO.html#source.btBrickIO.timeOut">timeOut (source.btBrickIO attribute)</a> </dt> + <dd><dl> + + <dt><a href="usbBrickIO.html#source.usbBrickIO.timeOut">(source.usbBrickIO attribute)</a> + </dt> + + </dl></dd> </dl></td> <td style="width: 33%" valign="top"><dl> + <dt><a href="EV3.html#source.EV3.tonePlayed">tonePlayed() (source.EV3 method)</a>, <a href="source.html#source.EV3.tonePlayed">[1]</a> + </dt> + + <dt><a href="Motor.html#source.Motor.type">type (source.Motor attribute)</a> </dt> @@ -431,6 +643,16 @@ </dl></td> </tr></table> +<h2 id="U">U</h2> +<table style="width: 100%" class="indextable genindextable"><tr> + <td style="width: 33%" valign="top"><dl> + + <dt><a href="usbBrickIO.html#source.usbBrickIO">usbBrickIO (class in source)</a> + </dt> + + </dl></td> +</tr></table> + <h2 id="V">V</h2> <table style="width: 100%" class="indextable genindextable"><tr> <td style="width: 33%" valign="top"><dl> @@ -439,6 +661,18 @@ </dt> </dl></td> + <td style="width: 33%" valign="top"><dl> + + <dt><a href="hid.html#source.hidapi.vendorID">vendorID (source.hidapi attribute)</a> + </dt> + + <dd><dl> + + <dt><a href="usbBrickIO.html#source.usbBrickIO.vendorID">(source.usbBrickIO attribute)</a> + </dt> + + </dl></dd> + </dl></td> </tr></table> <h2 id="W">W</h2> @@ -448,6 +682,20 @@ <dt><a href="Motor.html#source.Motor.waitFor">waitFor() (source.Motor method)</a> </dt> + + <dt><a href="btBrickIO.html#source.btBrickIO.write">write() (source.btBrickIO method)</a> + </dt> + + <dd><dl> + + <dt><a href="hid.html#source.hidapi.write">(source.hidapi method)</a> + </dt> + + + <dt><a href="usbBrickIO.html#source.usbBrickIO.write">(source.usbBrickIO method)</a> + </dt> + + </dl></dd> </dl></td> </tr></table> diff --git a/docs/_build/html/hid.html b/docs/_build/html/hid.html new file mode 100644 index 0000000000000000000000000000000000000000..702479f45ee7c7bf1863b281c7a1900bdb854550 --- /dev/null +++ b/docs/_build/html/hid.html @@ -0,0 +1,445 @@ +<!DOCTYPE html> + + +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + + <title>hidapi — Mindstorms EV3 Toolbox v0.4-rc.10 documentation</title> + + <link rel="stylesheet" href="_static/basic.css" type="text/css" /> + <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> + <link rel="stylesheet" href="_static/bootswatch-3.3.6/readable/bootstrap.min.css" type="text/css" /> + <link rel="stylesheet" href="_static/bootstrap-sphinx.css" type="text/css" /> + + <script type="text/javascript"> + var DOCUMENTATION_OPTIONS = { + URL_ROOT: './', + VERSION: 'v0.4-rc.10', + COLLAPSE_INDEX: false, + FILE_SUFFIX: '.html', + HAS_SOURCE: true + }; + </script> + <script type="text/javascript" src="_static/jquery.js"></script> + <script type="text/javascript" src="_static/underscore.js"></script> + <script type="text/javascript" src="_static/doctools.js"></script> + <script type="text/javascript" src="_static/js/jquery-1.11.0.min.js"></script> + <script type="text/javascript" src="_static/js/jquery-fix.js"></script> + <script type="text/javascript" src="_static/bootstrap-3.3.6/js/bootstrap.min.js"></script> + <script type="text/javascript" src="_static/bootstrap-sphinx.js"></script> + <link rel="index" title="Index" href="genindex.html" /> + <link rel="search" title="Search" href="search.html" /> + <link rel="top" title="Mindstorms EV3 Toolbox v0.4-rc.10 documentation" href="index.html" /> + <link rel="next" title="usbBrickIO" href="usbBrickIO.html" /> + <link rel="prev" title="Sensor" href="Sensor.html" /> +<meta charset='utf-8'> +<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'> +<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'> +<meta name="apple-mobile-web-app-capable" content="yes"> + + </head> + <body role="document"> + + <div id="navbar" class="navbar navbar-default navbar-fixed-top"> + <div class="container"> + <div class="navbar-header"> + <!-- .btn-navbar is used as the toggle for collapsed navbar content --> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="index.html"> + Mindstorms EV3 Toolbox</a> + <span class="navbar-text navbar-version pull-left"><b>v0.4</b></span> + </div> + + <div class="collapse navbar-collapse nav-collapse"> + <ul class="nav navbar-nav"> + + + <li class="dropdown globaltoc-container"> + <a role="button" + id="dLabelGlobalToc" + data-toggle="dropdown" + data-target="#" + href="index.html">Site <b class="caret"></b></a> + <ul class="dropdown-menu globaltoc" + role="menu" + aria-labelledby="dLabelGlobalToc"><ul> +<li class="toctree-l1"><a class="reference internal" href="readme.html">General</a></li> +<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li> +</ul> +<ul> +<li class="toctree-l1"><a class="reference internal" href="EV3.html">EV3</a></li> +<li class="toctree-l1"><a class="reference internal" href="Motor.html">Motor</a></li> +<li class="toctree-l1"><a class="reference internal" href="Sensor.html">Sensor</a></li> +</ul> +<ul class="current"> +<li class="toctree-l1 current"><a class="current reference internal" href="#">hidapi</a></li> +<li class="toctree-l1"><a class="reference internal" href="usbBrickIO.html">usbBrickIO</a></li> +<li class="toctree-l1"><a class="reference internal" href="btBrickIO.html">btBrickIO</a></li> +</ul> +</ul> +</li> + + <li class="dropdown"> + <a role="button" + id="dLabelLocalToc" + data-toggle="dropdown" + data-target="#" + href="#">Page <b class="caret"></b></a> + <ul class="dropdown-menu localtoc" + role="menu" + aria-labelledby="dLabelLocalToc"><ul> +<li><a class="reference internal" href="#">hidapi</a></li> +</ul> +</ul> +</li> + + + + + + <li> + <a href="Sensor.html" title="Previous Chapter: Sensor"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">« Sensor</span> + </a> + </li> + <li> + <a href="usbBrickIO.html" title="Next Chapter: usbBrickIO"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">usbBrickIO »</span> + </a> + </li> + + + + + + <li class="hidden-sm"> +<div id="sourcelink"> + <a href="_sources/hid.txt" + rel="nofollow">Source</a> +</div></li> + + </ul> + + + +<form class="navbar-form navbar-right" action="search.html" method="get"> + <div class="form-group"> + <input type="text" name="q" class="form-control" placeholder="Search" /> + </div> + <input type="hidden" name="check_keywords" value="yes" /> + <input type="hidden" name="area" value="default" /> +</form> + + </div> + </div> + </div> + +<div class="container"> + <div class="row"> + <div class="col-md-12 content"> + + <span class="target" id="module-source"></span><div class="section" id="hidapi"> +<h1>hidapi<a class="headerlink" href="#hidapi" title="Permalink to this headline">¶</a></h1> +<dl class="class"> +<dt id="source.hidapi"> +<em class="property">class </em><code class="descclassname">source.</code><code class="descname">hidapi</code><span class="sig-paren">(</span><em>vendorID</em>, <em>productID</em>, <em>nReadBuffer</em>, <em>nWriteBuffer</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi" title="Permalink to this definition">¶</a></dt> +<dd><p>Interface to the hidapi library</p> +<p class="rubric">Notes</p> +<ul class="simple"> +<li>Developed from the hidapi available at <a class="reference external" href="http://www.signal11.us/oss/hidapi/">http://www.signal11.us/oss/hidapi/</a>.</li> +<li>Windows: hidapi.dll needed.</li> +<li>Mac: hidapi.dylib needed. In addition, Xcode has to be installed.</li> +<li>Linux: hidapi has to be compiled on host-system.</li> +</ul> +<dl class="attribute"> +<dt id="source.hidapi.handle"> +<code class="descname">handle</code><a class="headerlink" href="#source.hidapi.handle" title="Permalink to this definition">¶</a></dt> +<dd></dd></dl> + +<dl class="attribute"> +<dt id="source.hidapi.vendorID"> +<code class="descname">vendorID</code><a class="headerlink" href="#source.hidapi.vendorID" title="Permalink to this definition">¶</a></dt> +<dd><p><em>numeric</em> – Vendor-ID of the USB device.</p> +</dd></dl> + +<dl class="attribute"> +<dt id="source.hidapi.productID"> +<code class="descname">productID</code><a class="headerlink" href="#source.hidapi.productID" title="Permalink to this definition">¶</a></dt> +<dd><p><em>numeric</em> – Product-ID of the USB device.</p> +</dd></dl> + +<dl class="attribute"> +<dt id="source.hidapi.nReadBuffer"> +<code class="descname">nReadBuffer</code><a class="headerlink" href="#source.hidapi.nReadBuffer" title="Permalink to this definition">¶</a></dt> +<dd><p><em>numeric</em> – Read-buffer size in bytes.</p> +</dd></dl> + +<dl class="attribute"> +<dt id="source.hidapi.nWriteBuffer"> +<code class="descname">nWriteBuffer</code><a class="headerlink" href="#source.hidapi.nWriteBuffer" title="Permalink to this definition">¶</a></dt> +<dd><p><em>numeric</em> – Write-buffer size in bytes. Needs to be 1 Byte bigger than +actual packet.</p> +</dd></dl> + +<dl class="attribute"> +<dt id="source.hidapi.slib"> +<code class="descname">slib</code><a class="headerlink" href="#source.hidapi.slib" title="Permalink to this definition">¶</a></dt> +<dd><p><em>string</em> – Name of shared library file (without file extension). Defaults to +‘hidapi’.</p> +</dd></dl> + +<dl class="attribute"> +<dt id="source.hidapi.sheader"> +<code class="descname">sheader</code><a class="headerlink" href="#source.hidapi.sheader" title="Permalink to this definition">¶</a></dt> +<dd><p><em>string</em> – Name of shared library header. Defaults to ‘hidapi.h’.</p> +</dd></dl> + +<p class="rubric">Example</p> +<p>hidHandle = hidapi(1684,0005,1024,1025); %|br|</p> +<dl class="method"> +<dt id="source.hidapi.close"> +<code class="descname">close</code><span class="sig-paren">(</span><em>hid</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.close" title="Permalink to this definition">¶</a></dt> +<dd><p>Close the connection to a hid device.</p> +<dl class="docutils"> +<dt>Throws:</dt> +<dd>InvalidHandle: Handle to USB-device not valid</dd> +</dl> +<p class="rubric">Notes</p> +<ul class="simple"> +<li>Gets called automatically when deleting the hidapi instance.</li> +</ul> +<ol class="upperroman simple" start="2001"> +<li>Check if pointer is (unexpectedly) already invalidated</li> +</ol> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.enumerate"> +<code class="descname">enumerate</code><span class="sig-paren">(</span><em>hid</em>, <em>vendorID</em>, <em>productID</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.enumerate" title="Permalink to this definition">¶</a></dt> +<dd><p>Enumerates the info about the hid device with the given vendorID and productID +and returns a string with the returned hid information.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> +<li><strong>vendorID</strong> (<em>numeric</em>) – Vendor-ID of the USB device in decimal.</li> +<li><strong>productID</strong> (<em>numeric</em>) – Product-ID of the USB device in decimal.</li> +</ul> +</td> +</tr> +</tbody> +</table> +<p class="rubric">Notes</p> +<ul class="simple"> +<li>Using a vendorID and productID of (0,0) will enumerate all connected hid +devices.</li> +<li>MATLAB does not have the hid_device_infoPtr struct so some of the returned +information will need to be resized and cast into uint8 or chars.</li> +</ul> +<p>Enumerate the hid devices</p> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.error"> +<code class="descname">error</code><span class="sig-paren">(</span><em>hid</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.error" title="Permalink to this definition">¶</a></dt> +<dd><p>Return the hid device error string if a function produced an error.</p> +<dl class="docutils"> +<dt>Throws:</dt> +<dd>InvalidHandle: Handle to USB-device not valid</dd> +</dl> +<p class="rubric">Notes</p> +<ul class="simple"> +<li>This function must be called explicitly if you think an error was generated +from the hid device.</li> +</ul> +<ol class="upperroman simple" start="2001"> +<li>Check if pointer is (unexpectedly) already invalidated</li> +</ol> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.exit"> +<code class="descname">exit</code><span class="sig-paren">(</span><em>hid</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.exit" title="Permalink to this definition">¶</a></dt> +<dd><p>hidapi.exit Exit hidapi</p> +<p>hid.exit() exits the hidapi library.</p> +<dl class="docutils"> +<dt>Throws:</dt> +<dd>CommError: Error during communication with device</dd> +</dl> +<p>Notes:: +- You should not have to call this function directly.</p> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.getHIDInfoString"> +<code class="descname">getHIDInfoString</code><span class="sig-paren">(</span><em>hid</em>, <em>info</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.getHIDInfoString" title="Permalink to this definition">¶</a></dt> +<dd><p>Get the corresponding hid info from the hid device.</p> +<dl class="docutils"> +<dt>Throws:</dt> +<dd>CommError: Error during communication with device +InvalidHandle: Handle to USB-device not valid</dd> +</dl> +<p class="rubric">Notes</p> +<ul class="simple"> +<li>Info is the hid information string.</li> +</ul> +<p>See also HIDAPI.GETMANUFACTURERSSTRING, HIDAPI.GETPRODUCTSTRING, +HIDAPI.GETSERIALNUMBERSTRING.</p> +<p>Read buffer nReadBuffer length</p> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.getManufacturersString"> +<code class="descname">getManufacturersString</code><span class="sig-paren">(</span><em>hid</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.getManufacturersString" title="Permalink to this definition">¶</a></dt> +<dd><p>Get manufacturers string from hid object using getHIDInfoString.</p> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.getProductString"> +<code class="descname">getProductString</code><span class="sig-paren">(</span><em>hid</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.getProductString" title="Permalink to this definition">¶</a></dt> +<dd><p>Get product string from hid object using getProductString.</p> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.getSerialNumberString"> +<code class="descname">getSerialNumberString</code><span class="sig-paren">(</span><em>hid</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.getSerialNumberString" title="Permalink to this definition">¶</a></dt> +<dd><p>Get serial number from hid object using getSerialNumberString.</p> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.init"> +<code class="descname">init</code><span class="sig-paren">(</span><em>hid</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.init" title="Permalink to this definition">¶</a></dt> +<dd><p>Inits the hidapi library.</p> +<dl class="docutils"> +<dt>Throws:</dt> +<dd>CommError: Error during communication with device</dd> +</dl> +<p class="rubric">Notes</p> +<ul class="simple"> +<li>This is called automatically in the library itself with the open function. You +should not have to call this function directly.</li> +</ul> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.open"> +<code class="descname">open</code><span class="sig-paren">(</span><em>hid</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.open" title="Permalink to this definition">¶</a></dt> +<dd><p>Open a connection with a hid device</p> +<dl class="docutils"> +<dt>Throws:</dt> +<dd>CommError: Error during communication with device</dd> +</dl> +<p class="rubric">Notes</p> +<ul class="simple"> +<li>Gets called automatically when creating an hidapi-object.</li> +<li>The pointer return value from this library call is always null so it is not +possible to know if the open was successful.</li> +<li>The final parameter to the open hidapi library call has different types +depending on OS. On windows it is uint16, on linux/mac int32.</li> +</ul> +<p>Create a null pointer for the hid_open function (depends on OS)</p> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.read"> +<code class="descname">read</code><span class="sig-paren">(</span><em>hid</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.read" title="Permalink to this definition">¶</a></dt> +<dd><p>Read from a hid device and returns the read bytes.</p> +<dl class="docutils"> +<dt>Throws:</dt> +<dd>CommError: Error during communication with device +InvalidHandle: Handle to USB-device not valid</dd> +</dl> +<p class="rubric">Notes</p> +<ul class="simple"> +<li>Will print an error if no data was read.</li> +</ul> +<p>Read buffer of nReadBuffer length</p> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.read_timeout"> +<code class="descname">read_timeout</code><span class="sig-paren">(</span><em>hid</em>, <em>timeOut</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.read_timeout" title="Permalink to this definition">¶</a></dt> +<dd><p>Read from a hid device with a timeout and return the read bytes.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>timeOut</strong> (<em>numeric >= 0</em>) – Milliseconds after which a timeout-error occurs if no +packet could be read.</td> +</tr> +</tbody> +</table> +<dl class="docutils"> +<dt>Throws:</dt> +<dd>CommError: Error during communication with device +InvalidHandle: Handle to USB-device not valid</dd> +</dl> +<p>Read buffer of nReadBuffer length</p> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.setNonBlocking"> +<code class="descname">setNonBlocking</code><span class="sig-paren">(</span><em>hid</em>, <em>nonblock</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.setNonBlocking" title="Permalink to this definition">¶</a></dt> +<dd><p>Set the non blocking flag on the hid device connection.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>nonblock</strong> (<em>numeric in {0,1}</em>) – 0 disables nonblocking, 1 enables nonblocking</td> +</tr> +</tbody> +</table> +<dl class="docutils"> +<dt>Throws:</dt> +<dd>CommError: Error during communication with device +InvalidHandle: Handle to USB-device not valid</dd> +</dl> +<ol class="upperroman simple" start="2001"> +<li>Check if pointer is (unexpectedly) already invalidated</li> +</ol> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.write"> +<code class="descname">write</code><span class="sig-paren">(</span><em>hid</em>, <em>wmsg</em>, <em>reportID</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.write" title="Permalink to this definition">¶</a></dt> +<dd><p>Write to a hid device.</p> +<dl class="docutils"> +<dt>Throws:</dt> +<dd>CommError: Error during communication with device +InvalidHandle: Handle to USB-device not valid</dd> +</dl> +<p class="rubric">Notes</p> +<ul class="simple"> +<li>Will print an error if there is a mismatch between the buffer size and the +reported number of bytes written.</li> +</ul> +<p>Append a 0 at the front for HID report ID</p> +</dd></dl> + +</dd></dl> + +</div> + + + </div> + + </div> +</div> +<footer class="footer"> + <div class="container"> + <p class="pull-right"> + <a href="#">Back to top</a> + + </p> + <p> + © Copyright 2016, LfB - RWTH Aachen.<br/> + Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.8.<br/> + </p> + </div> +</footer> + </body> +</html> \ No newline at end of file diff --git a/docs/_build/html/index.html b/docs/_build/html/index.html index 392a1f7fb1844dc2b44b4ece7648cd8c12d05788..405118001f2b56e232cdd231bc4f4fcfcc6ad12d 100644 --- a/docs/_build/html/index.html +++ b/docs/_build/html/index.html @@ -76,8 +76,9 @@ <li class="toctree-l1"><a class="reference internal" href="Sensor.html">Sensor</a></li> </ul> <ul> -<li class="toctree-l1"><a class="reference internal" href="CommandLayer.html">CommandLayer</a></li> -<li class="toctree-l1"><a class="reference internal" href="CommunicationLayer.html">CommunicationLayer</a></li> +<li class="toctree-l1"><a class="reference internal" href="hid.html">hidapi</a></li> +<li class="toctree-l1"><a class="reference internal" href="usbBrickIO.html">usbBrickIO</a></li> +<li class="toctree-l1"><a class="reference internal" href="btBrickIO.html">btBrickIO</a></li> </ul> </ul> </li> @@ -176,16 +177,9 @@ these are the classes you will mostly use.</p> <p>Advanced</p> <div class="toctree-wrapper compound"> <ul> -<li class="toctree-l1"><a class="reference internal" href="CommandLayer.html">CommandLayer</a><ul> -<li class="toctree-l2"><a class="reference internal" href="CommandLayer.html#command">Command</a></li> -<li class="toctree-l2"><a class="reference internal" href="CommandLayer.html#communicationinterface">CommunicationInterface</a></li> -</ul> -</li> -<li class="toctree-l1"><a class="reference internal" href="CommunicationLayer.html">CommunicationLayer</a><ul> -<li class="toctree-l2"><a class="reference internal" href="CommunicationLayer.html#usb">USB</a></li> -<li class="toctree-l2"><a class="reference internal" href="CommunicationLayer.html#bluetooth">Bluetooth</a></li> -</ul> -</li> +<li class="toctree-l1"><a class="reference internal" href="hid.html">hidapi</a></li> +<li class="toctree-l1"><a class="reference internal" href="usbBrickIO.html">usbBrickIO</a></li> +<li class="toctree-l1"><a class="reference internal" href="btBrickIO.html">btBrickIO</a></li> </ul> </div> </div> diff --git a/docs/_build/html/mat-modindex.html b/docs/_build/html/mat-modindex.html index b38672dbedf8ed662a43038f49129b4474587969..d739141b2137025ab7ef6339693a550b9b040ac9 100644 --- a/docs/_build/html/mat-modindex.html +++ b/docs/_build/html/mat-modindex.html @@ -82,8 +82,9 @@ <li class="toctree-l1"><a class="reference internal" href="Sensor.html">Sensor</a></li> </ul> <ul> -<li class="toctree-l1"><a class="reference internal" href="CommandLayer.html">CommandLayer</a></li> -<li class="toctree-l1"><a class="reference internal" href="CommunicationLayer.html">CommunicationLayer</a></li> +<li class="toctree-l1"><a class="reference internal" href="hid.html">hidapi</a></li> +<li class="toctree-l1"><a class="reference internal" href="usbBrickIO.html">usbBrickIO</a></li> +<li class="toctree-l1"><a class="reference internal" href="btBrickIO.html">btBrickIO</a></li> </ul> </ul> </li> @@ -144,7 +145,7 @@ <tr> <td></td> <td> - <a href="source.html#module-source"><code class="xref">source</code></a></td><td> + <a href="usbBrickIO.html#module-source"><code class="xref">source</code></a></td><td> <em></em></td></tr> </table> diff --git a/docs/_build/html/objects.inv b/docs/_build/html/objects.inv index a3c132e711636a4c8ed891ddfe8a5f13a89ed346..2e46e2abe484e5cc009c63b29e6cbbb90c1a4d8c 100644 Binary files a/docs/_build/html/objects.inv and b/docs/_build/html/objects.inv differ diff --git a/docs/_build/html/readme.html b/docs/_build/html/readme.html index 954c61500add5d65144d7234cc4d4db1c280da4e..bb4d3aae47a7a83557fb263d6be241f60162d095 100644 --- a/docs/_build/html/readme.html +++ b/docs/_build/html/readme.html @@ -79,6 +79,8 @@ <ul> <li class="toctree-l1"><a class="reference internal" href="CommandLayer.html">CommandLayer</a></li> <li class="toctree-l1"><a class="reference internal" href="CommunicationLayer.html">CommunicationLayer</a></li> +<li class="toctree-l1"><a class="reference internal" href="usbBrickIO.html">usbBrickIO</a></li> +<li class="toctree-l1"><a class="reference internal" href="btBrickIO.html">btBrickIO</a></li> </ul> </ul> </li> diff --git a/docs/_build/html/search.html b/docs/_build/html/search.html index 83cf5d5221404857bcf632782488a125ce1779df..f6c7e9d2014fc221bd5f2c37349eb0640623cee3 100644 --- a/docs/_build/html/search.html +++ b/docs/_build/html/search.html @@ -83,8 +83,9 @@ <li class="toctree-l1"><a class="reference internal" href="Sensor.html">Sensor</a></li> </ul> <ul> -<li class="toctree-l1"><a class="reference internal" href="CommandLayer.html">CommandLayer</a></li> -<li class="toctree-l1"><a class="reference internal" href="CommunicationLayer.html">CommunicationLayer</a></li> +<li class="toctree-l1"><a class="reference internal" href="hid.html">hidapi</a></li> +<li class="toctree-l1"><a class="reference internal" href="usbBrickIO.html">usbBrickIO</a></li> +<li class="toctree-l1"><a class="reference internal" href="btBrickIO.html">btBrickIO</a></li> </ul> </ul> </li> diff --git a/docs/_build/html/searchindex.js b/docs/_build/html/searchindex.js index 878cbbcafc4f55bbc943a5ad918e960e9018eae6..7daaf2b40bffa23d48082d746ba756c3cfca8445 100644 --- a/docs/_build/html/searchindex.js +++ b/docs/_build/html/searchindex.js @@ -1 +1 @@ -Search.setIndex({envversion:49,filenames:["CommandLayer","CommunicationLayer","EV3","Motor","Sensor","examples","index","readme","source"],objects:{"":{source:[8,0,1,""]},"source.EV3":{batteryMode:[8,2,1,""],batteryValue:[8,2,1,""],beep:[8,3,1,""],connect:[8,3,1,""],debug:[8,2,1,""],disconnect:[8,3,1,""],isConnected:[8,2,1,""],motorA:[8,2,1,""],motorB:[8,2,1,""],motorC:[8,2,1,""],motorD:[8,2,1,""],playTone:[8,3,1,""],sensor1:[8,2,1,""],sensor2:[8,2,1,""],sensor3:[8,2,1,""],sensor4:[8,2,1,""],setProperties:[8,3,1,""],stopAllMotors:[8,3,1,""],stopTone:[8,3,1,""],tonePlayed:[8,3,1,""]},"source.Motor":{brakeMode:[3,2,1,""],currentSpeed:[3,2,1,""],debug:[3,2,1,""],internalReset:[3,3,1,""],isRunning:[3,2,1,""],limitMode:[3,2,1,""],limitValue:[3,2,1,""],power:[3,2,1,""],resetTachoCount:[3,3,1,""],setBrake:[3,3,1,""],setProperties:[3,3,1,""],smoothStart:[3,2,1,""],smoothStop:[3,2,1,""],speedRegulation:[3,2,1,""],start:[3,3,1,""],stop:[3,3,1,""],syncedStart:[3,3,1,""],syncedStop:[3,3,1,""],tachoCount:[3,2,1,""],type:[3,2,1,""],waitFor:[3,3,1,""]},"source.Sensor":{debug:[4,2,1,""],mode:[4,2,1,""],reset:[4,3,1,""],setProperties:[4,3,1,""],type:[4,2,1,""],value:[4,2,1,""]},source:{EV3:[8,1,1,""],Motor:[3,1,1,""],Sensor:[4,1,1,""]}},objnames:{"0":["mat","module","MATLAB module"],"1":["mat","class","MATLAB class"],"2":["mat","attribute","MATLAB attribute"],"3":["mat","method","MATLAB method"]},objtypes:{"0":"mat:module","1":"mat:class","2":"mat:attribute","3":"mat:method"},terms:{"2nd":[2,3,4,8],"5000hz":[2,8],"abstract":6,"case":3,"catch":3,"class":[2,3,4,6,8],"default":4,"function":3,"long":3,"return":[2,3,8],"true":[2,3,8],"try":3,"while":6,aachen:6,abl:6,about:[2,3,4,8],acceler:[3,4],accelerationallax:4,access:6,accident:[2,8],act:3,action:3,actual:3,advanc:6,affect:3,after:3,afterward:3,again:3,all:[2,3,4,8],allow:4,alreadi:[],also:[2,3,4,8],alternatingli:[],ambient:4,angular:4,ani:3,announc:[2,3,4,8],anoth:3,apply:3,aren:3,argument:[2,3,4,8],around:3,automat:[2,3,4,8],avail:4,batteri:[2,8],batterymod:[2,3,8],batterymode:[2,8],batteryvalu:[2,8],been:[2,3,4,8],beep:[2,5,8],befor:[],behav:3,behaviour:6,better:3,between:3,bit:3,blue:4,bool:[2,3,4,8],both:3,brake:3,brakemod:3,brakemode:3,brick:[2,3,4,6,8],brickobject:[2,3,4,8],buggi:[],bump:4,c_output:3,call:[2,3,4,8],can:[3,4,6],car:3,central:[2,8],chang:3,charg:[2,8],check:3,clear:4,coast:3,code:4,col:4,color:4,com:[2,8],comm:[],comment:3,commun:[3,4,6],connect:[2,3,4,5,8],connectiontyp:[2,8],consist:[3,4],consol:[2,3,4,8],constantli:3,contain:[2,3,4,8],continu:3,contribut:[],control:[],conveni:[2,8],correctli:3,count:3,counter:3,cours:3,creat:[2,3,4,8],current:[2,3,4,8],currentspe:3,dba:4,debug:[2,3,4,8],defin:3,degre:[3,4],delet:[2,5,8],deliv:[2,8],depend:[2,3,4,8],design:6,destroi:[2,8],dev:[2,3,4,8],develop:6,devic:3,devicemod:4,devicetyp:[3,4],differ:[2,8],direct:3,directli:6,disconnect:[2,8],disp:[2,5,8],distcm:4,distin:4,document:6,doe:[2,3,8],doesn:[],don:[3,4],done:3,down:3,durat:[2,8],each:[2,3,4,8],eas:3,easili:6,either:[2,3,8],enabl:[2,8],equal:[2,3,8],error:[3,4],establish:[2,8],even:3,everytim:[3,4],exampl:[],execut:3,expect:[2,5,8],facilit:4,fals:3,far:3,feedback:[2,3,4,8],finish:3,firmwar:[2,3,8],first:[2,3,8],follow:[2,3,4,6,8],forward:3,four:3,frequenc:[2,8],from:[2,3,4,8],fun:[2,5,8],gener:[],germani:6,get:[2,3,6,8],given:[2,3,4,8],glanc:[2,8],goe:3,greater:3,green:4,gyro:4,happen:3,have:[2,3,8],heavi:3,here:3,hertz:[2,8],high:[2,3,4,6,8],highest:3,hold:3,how:3,htacceleromet:4,htcolor:4,htcompass:4,hysic:4,imag:[],immedi:[2,3,8],indic:3,individu:[3,4],infinit:3,infrare:4,input:[2,3,4,8],inputpars:[2,3,4,8],instal:6,installat:[],instanc:[3,4],instantan:[2,8],instead:[2,3,4,8],instruct:6,interfac:[2,8],intern:3,internalreset:3,interpret:3,intuit:6,isconnect:[2,8],isconnected:[2,8],isrun:3,iter:[],itself:[],keep:3,kind:3,lab:6,largemotor:4,last:3,later:[],layer:[3,4,6],lead:[],left:3,less:3,level:[2,3,4,6,8],licens:[],like:3,limit:3,limitmod:3,limitvalu:[2,3,5,8],listen:4,load:3,look:6,loop:3,low:[2,6,8],lower:3,mai:[2,3,4,8],mainli:4,make:3,mark:[2,3,4,8],master:3,matlab:[],mean:3,mediummotor:4,meet:6,messag:3,method:[2,3,4,8],millisecond:[2,3,8],mind:3,mode:[2,3,4,8],mostli:[3,6],motor:[],motora:[2,3,4,5,8],motorb:[2,3,8],motorc:[2,8],motord:[2,8],move:3,multipl:[2,3,4,8],name:[2,3,4,8],necessari:[2,8],need:[2,3,4,8],neg:3,next:3,none:4,note:[2,3,4,8],now:4,numer:[2,3,4,8],nxt:6,nxtcolor:4,nxtlight:4,nxtsound:4,nxttemperatur:4,nxttouch:4,nxtultrason:4,object:[2,3,4,8],off:[2,3,4,8],old:[],onc:[2,3,4,8],once:4,onli:[],only:[2,3,4,8],opcod:3,opposit:3,option:[2,3,4,8],optional:[2,3,4,8],other:[3,4],otherwis:3,output:[2,8],outputreadi:3,outputtest:[],packet:[2,3,8],paramet:[2,3,4,8],part:6,pass:[3,4],path:[2,8],paus:[2,8],percent:[2,3,8],percentag:[2,3,8],physic:[2,3,4,8],plai:[2,8],playton:[2,8],point:3,poll:3,port:[2,3,4,5,8],posit:3,possibl:[3,4],power:[2,3,4,5,8],preced:[2,3,4,8],pretti:3,previous:3,print:[2,8],probabl:3,program:3,properti:[2,3,4,8],prox:4,pull:3,push:4,rais:3,random:[2,5,8],rate:4,ratio:3,raw:4,reach:3,read:[2,3,4,6,8],reason:3,receiv:[2,3,8],red:4,reflect:4,regul:3,regular:3,releas:3,remot:4,repli:3,repres:[3,4],request:3,reset:[3,4],resetposit:3,resettachocount:3,respect:3,respons:3,result:3,rfcomm0:[2,3,4,8],rfcomm1:[2,8],rfcomm2:[2,8],right:[3,4],robot:[3,6],run:3,rwth:6,same:3,second:[2,8],secur:3,see:[2,3,4,8],seek:4,seem:[2,8],send:[2,3,6,8],sensor1:[2,4,5,8],sensor2:[2,8],sensor3:[2,8],sensor4:[2,8],sensor:[],sent:[2,8],serial:[2,8],serport:[2,3,4,8],set:[2,3,4,6,8],setbrak:3,setproperti:[2,3,4,5,8],setup:[2,8],sever:6,should:3,simplifi:6,slave:3,slow:3,slower:3,slowli:3,small:[2,8],smoothli:3,smoothstart:3,smoothstop:3,some:3,sometim:[],somewhat:3,sooner:[],sourc:[2,3,4,8],specifi:[3,4],speed:3,speedregul:3,spin:3,start:[2,3,5,6,8],state:3,statu:[2,3,8],still:3,stop:[2,3,8],stopallmotor:[2,8],stopton:[2,8],straight:3,string:[2,3,4,8],student:6,stuff:[2,3,8],sublay:[3,4],suppos:3,sync:3,syncedstart:3,syncedstop:3,synchron:3,syncmotor:3,syntax:[2,3,4,8],tacho:3,tachocount:3,tacholimit:3,take:[3,6],test:[2,3,8],than:3,them:[2,3,4,8],thi:[2,3,4,5,6,8],thoroughli:[2,8],time:3,timeout:3,tone:[2,8],toneplai:[2,8],too:3,toolbox:[],touch:4,tricki:3,turn:[2,3,4,8],turnratio:3,two:3,type:[2,3,4,8],ultrason:4,und:3,undefin:4,unexpect:[],unknown:4,until:3,use:3,user:[2,8],valu:[2,3,4,5,6,8],varargin:[2,3,4,8],variou:6,via:[2,3,4,6,8],view:[2,8],virtual:[2,8],voltag:[2,3,8],volum:[2,8],wai:6,waitfor:[2,3,5,8],want:6,wast:3,weird:3,what:[2,3,4,8],whatev:3,when:[2,3,4,8],which:[2,3,4,8],white:4,without:3,work:[2,3,4,8],workaround:3,would:[2,3,4,8],wrap:[],writable:[2,3,4,8],wrong:[2,8],yet:[2,8],you:[3,4,6],your:6},titles:["CommandLayer","CommunicationLayer","EV3","Motor","Sensor","Examples","MATLAB Toolbox for controlling Lego Mindstorms EV3","General","EV3"],titleterms:{bluetooth:1,command:0,commandlay:0,communicationinterfac:0,communicationlay:1,content:6,contribut:7,control:6,ev3:[2,6,8],exampl:5,gener:7,installat:7,lego:6,licens:7,matlab:6,mindstorm:6,motor:3,sensor:4,toolbox:6,usb:1}}) \ No newline at end of file +Search.setIndex({envversion:49,filenames:["CommandLayer","CommunicationLayer","EV3","Motor","Sensor","btBrickIO","examples","hid","index","readme","source","usbBrickIO"],objects:{"":{source:[11,0,1,""]},"source.EV3":{batteryMode:[10,2,1,""],batteryValue:[10,2,1,""],beep:[10,3,1,""],connect:[10,3,1,""],debug:[10,2,1,""],disconnect:[10,3,1,""],isConnected:[10,2,1,""],motorA:[10,2,1,""],motorB:[10,2,1,""],motorC:[10,2,1,""],motorD:[10,2,1,""],playTone:[10,3,1,""],sensor1:[10,2,1,""],sensor2:[10,2,1,""],sensor3:[10,2,1,""],sensor4:[10,2,1,""],setProperties:[10,3,1,""],stopAllMotors:[10,3,1,""],stopTone:[10,3,1,""],tonePlayed:[10,3,1,""]},"source.Motor":{brakeMode:[3,2,1,""],currentSpeed:[3,2,1,""],debug:[3,2,1,""],internalReset:[3,3,1,""],isRunning:[3,2,1,""],limitMode:[3,2,1,""],limitValue:[3,2,1,""],power:[3,2,1,""],resetTachoCount:[3,3,1,""],setBrake:[3,3,1,""],setProperties:[3,3,1,""],smoothStart:[3,2,1,""],smoothStop:[3,2,1,""],speedRegulation:[3,2,1,""],start:[3,3,1,""],stop:[3,3,1,""],syncedStart:[3,3,1,""],syncedStop:[3,3,1,""],tachoCount:[3,2,1,""],type:[3,2,1,""],waitFor:[3,3,1,""]},"source.Sensor":{debug:[4,2,1,""],mode:[4,2,1,""],reset:[4,3,1,""],setProperties:[4,3,1,""],type:[4,2,1,""],value:[4,2,1,""]},"source.btBrickIO":{backend:[5,2,1,""],channel:[5,2,1,""],close:[5,3,1,""],debug:[5,2,1,""],deviceName:[5,2,1,""],open:[5,3,1,""],read:[5,3,1,""],serialPort:[5,2,1,""],setProperties:[5,3,1,""],timeOut:[5,2,1,""],write:[5,3,1,""]},"source.hidapi":{close:[7,3,1,""],enumerate:[7,3,1,""],error:[7,3,1,""],exit:[7,3,1,""],getHIDInfoString:[7,3,1,""],getManufacturersString:[7,3,1,""],getProductString:[7,3,1,""],getSerialNumberString:[7,3,1,""],handle:[7,2,1,""],init:[7,3,1,""],nReadBuffer:[7,2,1,""],nWriteBuffer:[7,2,1,""],open:[7,3,1,""],productID:[7,2,1,""],read:[7,3,1,""],read_timeout:[7,3,1,""],setNonBlocking:[7,3,1,""],sheader:[7,2,1,""],slib:[7,2,1,""],vendorID:[7,2,1,""],write:[7,3,1,""]},"source.usbBrickIO":{close:[11,3,1,""],debug:[11,2,1,""],nReadBuffer:[11,2,1,""],nWriteBuffer:[11,2,1,""],open:[11,3,1,""],productID:[11,2,1,""],read:[11,3,1,""],setProperties:[11,3,1,""],timeOut:[11,2,1,""],vendorID:[11,2,1,""],write:[11,3,1,""]},source:{EV3:[10,1,1,""],Motor:[3,1,1,""],Sensor:[4,1,1,""],btBrickIO:[5,1,1,""],hidapi:[7,1,1,""],usbBrickIO:[11,1,1,""]}},objnames:{"0":["mat","module","MATLAB module"],"1":["mat","class","MATLAB class"],"2":["mat","attribute","MATLAB attribute"],"3":["mat","method","MATLAB method"]},objtypes:{"0":"mat:module","1":"mat:class","2":"mat:attribute","3":"mat:method"},terms:{"0x0005":11,"0x694":11,"2nd":[2,3,4,10],"5000hz":[2,10],"abstract":8,"byte":[7,11],"case":[3,11],"catch":3,"char":7,"class":[2,3,4,5,7,8,10,11],"default":[4,5,7,11],"final":7,"function":[3,7],"long":3,"null":7,"return":[2,3,5,7,10,11],"throw":7,"true":[2,3,5,10,11],"try":[3,5,11],"while":8,aachen:8,abl:8,about:[2,3,4,7,10],acceler:[3,4],accelerationallax:4,access:8,accident:[2,10],act:3,action:3,actual:[3,7,11],addit:7,advanc:8,affect:3,after:[3,5,7,11],afterward:3,again:3,all:[2,3,4,7,10,11],allow:4,alreadi:7,also:[2,3,4,5,7,10,11],alternatingli:[],alwai:[7,11],ambient:4,angular:4,ani:[3,11],announc:[2,3,4,10],anoth:3,append:7,apply:3,aren:3,argument:[2,3,4,10],around:3,arrai:[5,11],automat:[2,3,4,5,7,10],avail:[4,7],backend:5,base:5,batteri:[2,10],batterymod:[2,3,10],batterymode:[2,10],batteryvalu:[2,10],been:[2,3,4,5,10],beep:[2,6,10],befor:5,behav:3,behaviour:8,besid:11,better:3,between:[3,5,7,11],bigger:[7,11],bit:3,block:7,blue:4,bool:[2,3,4,5,10,11],both:3,brake:3,brakemod:3,brakemode:3,brick:[2,3,4,5,8,10,11],brickio:[5,11],brickobject:[2,3,4,10],buffer:[7,11],buggi:[],bump:4,c_output:3,call:[2,3,4,5,7,10,11],can:[3,4,5,8],car:3,cast:7,central:[2,10],chang:3,channel:5,charg:[2,10],check:[3,7],chosen:5,clear:4,close:[5,7,11],coast:3,code:4,col:4,color:4,com:[2,10],comm:[],comment:3,commerror:7,commhandl:[5,11],commun:[3,4,7,8],compil:7,connect:[2,3,4,5,6,7,10,11],connectiontyp:[2,10],consist:[3,4],consol:[2,3,4,5,10,11],constantli:3,constructor:11,contain:[2,3,4,10],continu:3,contribut:[],control:[],conveni:[2,10],correctli:3,correspond:7,could:[5,7,11],count:3,counter:3,cours:3,creat:[2,3,4,7,10],current:[2,3,4,10],currentspe:3,data:[5,7,11],dba:4,debug:[2,3,4,5,10,11],decim:7,defin:3,degre:[3,4],delet:[2,6,7,10],deliv:[2,10],depend:[2,3,4,5,7,10],design:8,destroi:[2,10],dev:[2,3,4,5,10],develop:[7,8],devic:[3,5,7,11],devicemod:4,devicenam:5,devicename:5,devicetyp:[3,4],differ:[2,7,10],direct:3,directli:[7,8],disabl:7,disconnect:[2,10],disp:[2,6,10],distcm:4,distin:4,dll:7,document:8,doe:[2,3,7,10,11],doesn:[],don:[3,4],done:3,down:3,durat:[2,10],dure:7,dylib:7,each:[2,3,4,5,10,11],eas:3,easili:8,either:[2,3,10],enabl:[2,7,10,11],enumer:7,equal:[2,3,10],error:[3,4,5,7,11],establish:[2,10],even:3,eventu:11,everytim:[3,4],exampl:[],execut:3,exit:7,expect:[2,6,10],explicitli:7,extens:7,facilit:4,fals:[3,5,11],far:3,fclose:5,feedback:[2,3,4,10],file:7,finish:3,firmwar:[2,3,10],first:[2,3,10],flag:7,follow:[2,3,4,5,8,10,11],fopen:5,format:[5,11],forward:3,four:3,fread:5,frequenc:[2,10],from:[2,3,4,5,7,10,11],front:7,fun:[2,6,10],fwrite:5,gener:[],germani:8,get:[2,3,7,8,10],gethidinfostr:7,getmanufacturersstr:7,getmanufacturersstring:7,getproductstr:7,getproductstring:7,getserialnumberstr:7,getserialnumberstring:7,given:[2,3,4,7,10],glanc:[2,10],goe:3,greater:3,green:4,gyro:4,handl:7,happen:3,have:[2,3,7,10],header:7,heavi:3,henc:5,here:3,hertz:[2,10],hid:[7,11],hid_device_infoptr:7,hid_open:7,hidapi:[],hidhandl:7,high:[2,3,4,8,10],highest:3,hold:3,host:[5,7],how:3,htacceleromet:4,htcolor:4,htcompass:4,http:7,hysic:4,imag:[],immedi:[2,3,10],implement:[5,11],indic:3,individu:[3,4],infinit:3,info:7,inform:[5,7],infrare:4,init:7,input:[2,3,4,10],inputpars:[2,3,4,5,10,11],instal:[7,8],installat:[],instanc:[3,4,7],instantan:[2,10],instead:[2,3,4,10],instruct:8,instrument:5,instrumentcontrol:5,int32:7,interfac:[2,5,7,10,11],intern:3,internalreset:3,interpret:3,intuit:8,invalid:7,invalidhandl:7,isconnect:[2,10],isconnected:[2,10],isrun:3,iter:[],itself:7,keep:3,kind:3,know:7,lab:8,largemotor:4,last:3,later:[],layer:[3,4,8],lead:[],left:3,length:7,less:3,level:[2,3,4,8,10],librari:[7,11],licens:[],like:3,limit:3,limitmod:3,limitvalu:[2,3,6,10],linux:[5,7],listen:4,load:3,look:8,loop:3,low:[2,8,10],lower:3,mac:[5,7],made:5,mai:[2,3,4,10],mainli:4,make:3,manufactur:7,mark:[2,3,4,10],master:3,matlab:[],maximum:11,mean:3,mediummotor:4,meet:8,messag:3,method:[2,3,4,10],millisecond:[2,3,7,10,11],mind:3,mismatch:7,mode:[2,3,4,10],modul:5,mostli:[3,8],motor:[],motora:[2,3,4,6,10],motorb:[2,3,10],motorc:[2,10],motord:[2,10],move:3,multipl:[2,3,4,5,10,11],must:7,myev3:5,name:[2,3,4,5,7,10],nearli:11,necessari:[2,10],need:[2,3,4,5,7,10,11],neg:3,next:3,non:7,nonblock:7,none:4,note:[2,3,4,5,7,10,11],now:4,nreadbuff:[7,11],nreadbuffer:11,number:7,numer:[2,3,4,5,7,10,11],nwritebuff:[7,11],nwritebuffer:11,nxt:8,nxtcolor:4,nxtlight:4,nxtsound:4,nxttemperatur:4,nxttouch:4,nxtultrason:4,object:[2,3,4,5,7,10],occur:[5,7,11],off:[2,3,4,10],old:[],onc:[2,3,4,5,10,11],once:4,onli:[],only:[2,3,4,5,10],opcod:3,open:[5,7,11],opposit:3,option:[2,3,4,5,10,11],optional:[2,3,4,10],oss:7,other:[3,4],otherwis:3,output:[2,10,11],outputreadi:3,outputtest:[],packet:[2,3,5,7,10,11],pair:5,paramet:[2,3,4,5,7,10,11],part:8,pass:[3,4],path:[2,5,10],paus:[2,10],percent:[2,3,10],percentag:[2,3,10],physic:[2,3,4,10],plai:[2,10],playton:[2,10],point:3,pointer:7,poll:3,port:[2,3,4,5,6,10],posit:3,possibl:[3,4,7],potenti:5,power:[2,3,4,6,10],preced:[2,3,4,10],pretti:3,previous:3,print:[2,7,10],probabl:3,produc:7,product:[7,11],productid:[7,11],program:3,properti:[2,3,4,5,10,11],propertyname1:[5,11],propertyname2:[5,11],propertyvalue1:[5,11],propertyvalue2:[5,11],prox:4,pull:3,push:4,rais:3,random:[2,6,10],rate:4,ratio:3,raw:4,reach:3,read:[2,3,4,5,7,8,10,11],read_timeout:7,reason:3,receiv:[2,3,10],red:4,reflect:4,regul:3,regular:3,releas:3,remot:4,repli:3,report:7,reportid:7,repres:[3,4],request:3,reset:[3,4],resetposit:3,resettachocount:3,resiz:7,respect:3,respons:3,result:3,rfcomm0:[2,3,4,5,10],rfcomm1:[2,10],rfcomm2:[2,10],right:[3,4],robot:[3,8],run:3,rwth:8,same:3,second:[2,5,10],secur:3,see:[2,3,4,5,7,10,11],seek:4,seem:[2,10],send:[2,3,8,10],sensor1:[2,4,6,10],sensor2:[2,10],sensor3:[2,10],sensor4:[2,10],sensor:[],sent:[2,10],serial:[2,5,7,10],serialport:5,serport:[2,3,4,5,10],set:[2,3,4,5,7,8,10,11],setbrak:3,setnonblock:7,setproperti:[2,3,4,5,6,10,11],setup:[2,10],sever:8,share:7,sheader:7,should:[3,7,11],shown:5,signal11:7,simplifi:8,size:[7,11],slave:3,slib:7,slow:3,slower:3,slowli:3,small:[2,10],smoothli:3,smoothstart:3,smoothstop:3,some:[3,7],sometim:[],somewhat:3,sooner:[],sourc:[2,3,4,5,7,10,11],specifi:[3,4],speed:3,speedregul:3,spin:3,start:[2,3,6,8,10],state:3,statu:[2,3,10],still:3,stop:[2,3,10],stopallmotor:[2,10],stopton:[2,10],straight:3,string:[2,3,4,5,7,10],struct:7,student:8,stuff:[2,3,10],sublay:[3,4],success:7,suppos:3,sure:5,sync:3,syncedstart:3,syncedstop:3,synchron:3,syncmotor:3,syntax:[2,3,4,5,10,11],system:[5,7],tacho:3,tachocount:3,tacholimit:3,take:[3,8],test:[2,3,5,10],than:[3,7,11],them:[2,3,4,10],thi:[2,3,4,5,6,7,8,10],think:7,thoroughli:[2,10],through:[5,11],time:3,timeout:[3,5,7,11],tone:[2,10],toneplai:[2,10],too:3,toolbox:[],touch:4,tricki:3,turn:[2,3,4,10],turnratio:3,two:3,type:[2,3,4,7,10],uint16:7,uint8:[5,7,11],ultrason:4,und:3,undefin:4,unexpect:[],unexpectedli:7,unknown:4,until:3,usage:5,usbbrickio:[],use:[3,11],user:[2,10],using:7,valid:[5,7,11],valu:[2,3,4,6,7,8,10],varargin:[2,3,4,5,10,11],variou:8,vendor:[7,11],vendorid:[7,11],via:[2,3,4,5,8,10,11],view:[2,10],virtual:[2,10],voltag:[2,3,10],volum:[2,10],wai:8,waitfor:[2,3,6,10],want:8,wast:3,weird:3,what:[2,3,4,10],whatev:3,when:[2,3,4,5,7,10,11],which:[2,3,4,5,7,10,11],white:4,window:[5,7],without:[3,7],wmsg:[5,7,11],work:[2,3,4,10,11],workaround:3,would:[2,3,4,10],wrap:[],writable:[2,3,4,10],write:[5,7,11],written:[5,7,11],wrong:[2,10],www:7,xcode:7,yet:[2,10],you:[3,4,7,8,11],your:8},titles:["CommandLayer","CommunicationLayer","EV3","Motor","Sensor","btBrickIO","Examples","hidapi","MATLAB Toolbox for controlling Lego Mindstorms EV3","General","EV3","usbBrickIO"],titleterms:{bluetooth:1,btbrickio:5,command:0,commandlay:0,communicationinterfac:0,communicationlay:1,content:8,contribut:9,control:8,ev3:[2,8,10],exampl:6,gener:9,hidapi:7,installat:9,lego:8,licens:9,matlab:8,mindstorm:8,motor:3,sensor:4,toolbox:8,usb:1,usbbrickio:11}}) \ No newline at end of file diff --git a/docs/_build/html/source.html b/docs/_build/html/source.html index 2a43839969e7b7b44e135e3994ee70b8436ae1e3..b165c7d86c9fbfadb7a6daa31726402defc1ac59 100644 --- a/docs/_build/html/source.html +++ b/docs/_build/html/source.html @@ -75,8 +75,9 @@ <li class="toctree-l1"><a class="reference internal" href="Sensor.html">Sensor</a></li> </ul> <ul> -<li class="toctree-l1"><a class="reference internal" href="CommandLayer.html">CommandLayer</a></li> -<li class="toctree-l1"><a class="reference internal" href="CommunicationLayer.html">CommunicationLayer</a></li> +<li class="toctree-l1"><a class="reference internal" href="hid.html">hidapi</a></li> +<li class="toctree-l1"><a class="reference internal" href="usbBrickIO.html">usbBrickIO</a></li> +<li class="toctree-l1"><a class="reference internal" href="btBrickIO.html">btBrickIO</a></li> </ul> </ul> </li> @@ -305,7 +306,7 @@ b.disconnect(); % <br /></p> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>volume</strong> (<em>numeric in [0, 100]</em>) – in percent</li> <li><strong>frequency</strong> (<em>numeric in [250, 10000]</em>) – in Hertz</li> -<li><strong>duration</strong> (<em>numeric >0</em>) – in milliseconds</li> +<li><strong>duration</strong> (<em>numeric > 0</em>) – in milliseconds</li> </ul> </td> </tr> diff --git a/docs/_build/html/test.html b/docs/_build/html/test.html new file mode 100644 index 0000000000000000000000000000000000000000..50e55fbfa85e2276a11515d77c10c6e88f409b75 --- /dev/null +++ b/docs/_build/html/test.html @@ -0,0 +1,445 @@ +<!DOCTYPE html> + + +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + + <title>hidapi — Mindstorms EV3 Toolbox v0.4-rc.10 documentation</title> + + <link rel="stylesheet" href="_static/basic.css" type="text/css" /> + <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> + <link rel="stylesheet" href="_static/bootswatch-3.3.6/readable/bootstrap.min.css" type="text/css" /> + <link rel="stylesheet" href="_static/bootstrap-sphinx.css" type="text/css" /> + + <script type="text/javascript"> + var DOCUMENTATION_OPTIONS = { + URL_ROOT: './', + VERSION: 'v0.4-rc.10', + COLLAPSE_INDEX: false, + FILE_SUFFIX: '.html', + HAS_SOURCE: true + }; + </script> + <script type="text/javascript" src="_static/jquery.js"></script> + <script type="text/javascript" src="_static/underscore.js"></script> + <script type="text/javascript" src="_static/doctools.js"></script> + <script type="text/javascript" src="_static/js/jquery-1.11.0.min.js"></script> + <script type="text/javascript" src="_static/js/jquery-fix.js"></script> + <script type="text/javascript" src="_static/bootstrap-3.3.6/js/bootstrap.min.js"></script> + <script type="text/javascript" src="_static/bootstrap-sphinx.js"></script> + <link rel="index" title="Index" href="genindex.html" /> + <link rel="search" title="Search" href="search.html" /> + <link rel="top" title="Mindstorms EV3 Toolbox v0.4-rc.10 documentation" href="index.html" /> + <link rel="next" title="usbBrickIO" href="usbBrickIO.html" /> + <link rel="prev" title="Sensor" href="Sensor.html" /> +<meta charset='utf-8'> +<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'> +<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'> +<meta name="apple-mobile-web-app-capable" content="yes"> + + </head> + <body role="document"> + + <div id="navbar" class="navbar navbar-default navbar-fixed-top"> + <div class="container"> + <div class="navbar-header"> + <!-- .btn-navbar is used as the toggle for collapsed navbar content --> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="index.html"> + Mindstorms EV3 Toolbox</a> + <span class="navbar-text navbar-version pull-left"><b>v0.4</b></span> + </div> + + <div class="collapse navbar-collapse nav-collapse"> + <ul class="nav navbar-nav"> + + + <li class="dropdown globaltoc-container"> + <a role="button" + id="dLabelGlobalToc" + data-toggle="dropdown" + data-target="#" + href="index.html">Site <b class="caret"></b></a> + <ul class="dropdown-menu globaltoc" + role="menu" + aria-labelledby="dLabelGlobalToc"><ul> +<li class="toctree-l1"><a class="reference internal" href="readme.html">General</a></li> +<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li> +</ul> +<ul> +<li class="toctree-l1"><a class="reference internal" href="EV3.html">EV3</a></li> +<li class="toctree-l1"><a class="reference internal" href="Motor.html">Motor</a></li> +<li class="toctree-l1"><a class="reference internal" href="Sensor.html">Sensor</a></li> +</ul> +<ul class="current"> +<li class="toctree-l1 current"><a class="current reference internal" href="#">hidapi</a></li> +<li class="toctree-l1"><a class="reference internal" href="usbBrickIO.html">usbBrickIO</a></li> +<li class="toctree-l1"><a class="reference internal" href="btBrickIO.html">btBrickIO</a></li> +</ul> +</ul> +</li> + + <li class="dropdown"> + <a role="button" + id="dLabelLocalToc" + data-toggle="dropdown" + data-target="#" + href="#">Page <b class="caret"></b></a> + <ul class="dropdown-menu localtoc" + role="menu" + aria-labelledby="dLabelLocalToc"><ul> +<li><a class="reference internal" href="#">hidapi</a></li> +</ul> +</ul> +</li> + + + + + + <li> + <a href="Sensor.html" title="Previous Chapter: Sensor"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">« Sensor</span> + </a> + </li> + <li> + <a href="usbBrickIO.html" title="Next Chapter: usbBrickIO"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">usbBrickIO »</span> + </a> + </li> + + + + + + <li class="hidden-sm"> +<div id="sourcelink"> + <a href="_sources/test.txt" + rel="nofollow">Source</a> +</div></li> + + </ul> + + + +<form class="navbar-form navbar-right" action="search.html" method="get"> + <div class="form-group"> + <input type="text" name="q" class="form-control" placeholder="Search" /> + </div> + <input type="hidden" name="check_keywords" value="yes" /> + <input type="hidden" name="area" value="default" /> +</form> + + </div> + </div> + </div> + +<div class="container"> + <div class="row"> + <div class="col-md-12 content"> + + <span class="target" id="module-source"></span><div class="section" id="hidapi"> +<h1>hidapi<a class="headerlink" href="#hidapi" title="Permalink to this headline">¶</a></h1> +<dl class="class"> +<dt id="source.hidapi"> +<em class="property">class </em><code class="descclassname">source.</code><code class="descname">hidapi</code><span class="sig-paren">(</span><em>vendorID</em>, <em>productID</em>, <em>nReadBuffer</em>, <em>nWriteBuffer</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi" title="Permalink to this definition">¶</a></dt> +<dd><p>Interface to the hidapi library</p> +<p class="rubric">Notes</p> +<ul class="simple"> +<li>Developed from the hidapi available at <a class="reference external" href="http://www.signal11.us/oss/hidapi/">http://www.signal11.us/oss/hidapi/</a>.</li> +<li>Windows: hidapi.dll needed.</li> +<li>Mac: hidapi.dylib needed. In addition, Xcode has to be installed.</li> +<li>Linux: hidapi has to be compiled on host-system.</li> +</ul> +<dl class="attribute"> +<dt id="source.hidapi.handle"> +<code class="descname">handle</code><a class="headerlink" href="#source.hidapi.handle" title="Permalink to this definition">¶</a></dt> +<dd></dd></dl> + +<dl class="attribute"> +<dt id="source.hidapi.vendorID"> +<code class="descname">vendorID</code><a class="headerlink" href="#source.hidapi.vendorID" title="Permalink to this definition">¶</a></dt> +<dd><p><em>numeric</em> – Vendor-ID of the USB device.</p> +</dd></dl> + +<dl class="attribute"> +<dt id="source.hidapi.productID"> +<code class="descname">productID</code><a class="headerlink" href="#source.hidapi.productID" title="Permalink to this definition">¶</a></dt> +<dd><p><em>numeric</em> – Product-ID of the USB device.</p> +</dd></dl> + +<dl class="attribute"> +<dt id="source.hidapi.nReadBuffer"> +<code class="descname">nReadBuffer</code><a class="headerlink" href="#source.hidapi.nReadBuffer" title="Permalink to this definition">¶</a></dt> +<dd><p><em>numeric</em> – Read-buffer size in bytes.</p> +</dd></dl> + +<dl class="attribute"> +<dt id="source.hidapi.nWriteBuffer"> +<code class="descname">nWriteBuffer</code><a class="headerlink" href="#source.hidapi.nWriteBuffer" title="Permalink to this definition">¶</a></dt> +<dd><p><em>numeric</em> – Write-buffer size in bytes. Needs to be 1 Byte bigger than +actual packet.</p> +</dd></dl> + +<dl class="attribute"> +<dt id="source.hidapi.slib"> +<code class="descname">slib</code><a class="headerlink" href="#source.hidapi.slib" title="Permalink to this definition">¶</a></dt> +<dd><p><em>string</em> – Name of shared library file (without file extension). Defaults to +‘hidapi’.</p> +</dd></dl> + +<dl class="attribute"> +<dt id="source.hidapi.sheader"> +<code class="descname">sheader</code><a class="headerlink" href="#source.hidapi.sheader" title="Permalink to this definition">¶</a></dt> +<dd><p><em>string</em> – Name of shared library header. Defaults to ‘hidapi.h’.</p> +</dd></dl> + +<p class="rubric">Example</p> +<p>hidHandle = hidapi(1684,0005,1024,1025); %|br|</p> +<dl class="method"> +<dt id="source.hidapi.close"> +<code class="descname">close</code><span class="sig-paren">(</span><em>hid</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.close" title="Permalink to this definition">¶</a></dt> +<dd><p>Close the connection to a hid device.</p> +<dl class="docutils"> +<dt>Throws:</dt> +<dd>InvalidHandle: Handle to USB-device not valid</dd> +</dl> +<p class="rubric">Notes</p> +<ul class="simple"> +<li>Gets called automatically when deleting the hidapi instance.</li> +</ul> +<ol class="upperroman simple" start="2001"> +<li>Check if pointer is (unexpectedly) already invalidated</li> +</ol> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.enumerate"> +<code class="descname">enumerate</code><span class="sig-paren">(</span><em>hid</em>, <em>vendorID</em>, <em>productID</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.enumerate" title="Permalink to this definition">¶</a></dt> +<dd><p>Enumerates the info about the hid device with the given vendorID and productID +and returns a string with the returned hid information.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> +<li><strong>vendorID</strong> (<em>numeric</em>) – Vendor-ID of the USB device in decimal.</li> +<li><strong>productID</strong> (<em>numeric</em>) – Product-ID of the USB device in decimal.</li> +</ul> +</td> +</tr> +</tbody> +</table> +<p class="rubric">Notes</p> +<ul class="simple"> +<li>Using a vendorID and productID of (0,0) will enumerate all connected hid +devices.</li> +<li>MATLAB does not have the hid_device_infoPtr struct so some of the returned +information will need to be resized and cast into uint8 or chars.</li> +</ul> +<p>Enumerate the hid devices</p> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.error"> +<code class="descname">error</code><span class="sig-paren">(</span><em>hid</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.error" title="Permalink to this definition">¶</a></dt> +<dd><p>Return the hid device error string if a function produced an error.</p> +<dl class="docutils"> +<dt>Throws:</dt> +<dd>InvalidHandle: Handle to USB-device not valid</dd> +</dl> +<p class="rubric">Notes</p> +<ul class="simple"> +<li>This function must be called explicitly if you think an error was generated +from the hid device.</li> +</ul> +<ol class="upperroman simple" start="2001"> +<li>Check if pointer is (unexpectedly) already invalidated</li> +</ol> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.exit"> +<code class="descname">exit</code><span class="sig-paren">(</span><em>hid</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.exit" title="Permalink to this definition">¶</a></dt> +<dd><p>hidapi.exit Exit hidapi</p> +<p>hid.exit() exits the hidapi library.</p> +<dl class="docutils"> +<dt>Throws:</dt> +<dd>CommError: Error during communication with device</dd> +</dl> +<p>Notes:: +- You should not have to call this function directly.</p> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.getHIDInfoString"> +<code class="descname">getHIDInfoString</code><span class="sig-paren">(</span><em>hid</em>, <em>info</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.getHIDInfoString" title="Permalink to this definition">¶</a></dt> +<dd><p>Get the corresponding hid info from the hid device.</p> +<dl class="docutils"> +<dt>Throws:</dt> +<dd>CommError: Error during communication with device +InvalidHandle: Handle to USB-device not valid</dd> +</dl> +<p class="rubric">Notes</p> +<ul class="simple"> +<li>Info is the hid information string.</li> +</ul> +<p>See also HIDAPI.GETMANUFACTURERSSTRING, HIDAPI.GETPRODUCTSTRING, +HIDAPI.GETSERIALNUMBERSTRING.</p> +<p>Read buffer nReadBuffer length</p> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.getManufacturersString"> +<code class="descname">getManufacturersString</code><span class="sig-paren">(</span><em>hid</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.getManufacturersString" title="Permalink to this definition">¶</a></dt> +<dd><p>Get manufacturers string from hid object using getHIDInfoString.</p> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.getProductString"> +<code class="descname">getProductString</code><span class="sig-paren">(</span><em>hid</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.getProductString" title="Permalink to this definition">¶</a></dt> +<dd><p>Get product string from hid object using getProductString.</p> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.getSerialNumberString"> +<code class="descname">getSerialNumberString</code><span class="sig-paren">(</span><em>hid</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.getSerialNumberString" title="Permalink to this definition">¶</a></dt> +<dd><p>Get serial number from hid object using getSerialNumberString.</p> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.init"> +<code class="descname">init</code><span class="sig-paren">(</span><em>hid</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.init" title="Permalink to this definition">¶</a></dt> +<dd><p>Inits the hidapi library.</p> +<dl class="docutils"> +<dt>Throws:</dt> +<dd>CommError: Error during communication with device</dd> +</dl> +<p class="rubric">Notes</p> +<ul class="simple"> +<li>This is called automatically in the library itself with the open function. You +should not have to call this function directly.</li> +</ul> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.open"> +<code class="descname">open</code><span class="sig-paren">(</span><em>hid</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.open" title="Permalink to this definition">¶</a></dt> +<dd><p>Open a connection with a hid device</p> +<dl class="docutils"> +<dt>Throws:</dt> +<dd>CommError: Error during communication with device</dd> +</dl> +<p class="rubric">Notes</p> +<ul class="simple"> +<li>Gets called automatically when creating an hidapi-object.</li> +<li>The pointer return value from this library call is always null so it is not +possible to know if the open was successful.</li> +<li>The final parameter to the open hidapi library call has different types +depending on OS. On windows it is uint16, on linux/mac int32.</li> +</ul> +<p>Create a null pointer for the hid_open function (depends on OS)</p> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.read"> +<code class="descname">read</code><span class="sig-paren">(</span><em>hid</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.read" title="Permalink to this definition">¶</a></dt> +<dd><p>Read from a hid device and returns the read bytes.</p> +<dl class="docutils"> +<dt>Throws:</dt> +<dd>CommError: Error during communication with device +InvalidHandle: Handle to USB-device not valid</dd> +</dl> +<p class="rubric">Notes</p> +<ul class="simple"> +<li>Will print an error if no data was read.</li> +</ul> +<p>Read buffer of nReadBuffer length</p> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.read_timeout"> +<code class="descname">read_timeout</code><span class="sig-paren">(</span><em>hid</em>, <em>timeOut</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.read_timeout" title="Permalink to this definition">¶</a></dt> +<dd><p>Read from a hid device with a timeout and return the read bytes.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>timeOut</strong> (<em>numeric >= 0</em>) – Milliseconds after which a timeout-error occurs if no +packet could be read.</td> +</tr> +</tbody> +</table> +<dl class="docutils"> +<dt>Throws:</dt> +<dd>CommError: Error during communication with device +InvalidHandle: Handle to USB-device not valid</dd> +</dl> +<p>Read buffer of nReadBuffer length</p> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.setNonBlocking"> +<code class="descname">setNonBlocking</code><span class="sig-paren">(</span><em>hid</em>, <em>nonblock</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.setNonBlocking" title="Permalink to this definition">¶</a></dt> +<dd><p>Set the non blocking flag on the hid device connection.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>nonblock</strong> (<em>numeric in {0,1}</em>) – 0 disables nonblocking, 1 enables nonblocking</td> +</tr> +</tbody> +</table> +<dl class="docutils"> +<dt>Throws:</dt> +<dd>CommError: Error during communication with device +InvalidHandle: Handle to USB-device not valid</dd> +</dl> +<ol class="upperroman simple" start="2001"> +<li>Check if pointer is (unexpectedly) already invalidated</li> +</ol> +</dd></dl> + +<dl class="method"> +<dt id="source.hidapi.write"> +<code class="descname">write</code><span class="sig-paren">(</span><em>hid</em>, <em>wmsg</em>, <em>reportID</em><span class="sig-paren">)</span><a class="headerlink" href="#source.hidapi.write" title="Permalink to this definition">¶</a></dt> +<dd><p>Write to a hid device.</p> +<dl class="docutils"> +<dt>Throws:</dt> +<dd>CommError: Error during communication with device +InvalidHandle: Handle to USB-device not valid</dd> +</dl> +<p class="rubric">Notes</p> +<ul class="simple"> +<li>Will print an error if there is a mismatch between the buffer size and the +reported number of bytes written.</li> +</ul> +<p>Append a 0 at the front for HID report ID</p> +</dd></dl> + +</dd></dl> + +</div> + + + </div> + + </div> +</div> +<footer class="footer"> + <div class="container"> + <p class="pull-right"> + <a href="#">Back to top</a> + + </p> + <p> + © Copyright 2016, LfB - RWTH Aachen.<br/> + Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.8.<br/> + </p> + </div> +</footer> + </body> +</html> \ No newline at end of file diff --git a/docs/_build/html/usbBrickIO.html b/docs/_build/html/usbBrickIO.html new file mode 100644 index 0000000000000000000000000000000000000000..9c62c7b092f2265c34a38b09a33cec1a6feaa7a4 --- /dev/null +++ b/docs/_build/html/usbBrickIO.html @@ -0,0 +1,266 @@ +<!DOCTYPE html> + + +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + + <title>usbBrickIO — Mindstorms EV3 Toolbox v0.4-rc.10 documentation</title> + + <link rel="stylesheet" href="_static/basic.css" type="text/css" /> + <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> + <link rel="stylesheet" href="_static/bootswatch-3.3.6/readable/bootstrap.min.css" type="text/css" /> + <link rel="stylesheet" href="_static/bootstrap-sphinx.css" type="text/css" /> + + <script type="text/javascript"> + var DOCUMENTATION_OPTIONS = { + URL_ROOT: './', + VERSION: 'v0.4-rc.10', + COLLAPSE_INDEX: false, + FILE_SUFFIX: '.html', + HAS_SOURCE: true + }; + </script> + <script type="text/javascript" src="_static/jquery.js"></script> + <script type="text/javascript" src="_static/underscore.js"></script> + <script type="text/javascript" src="_static/doctools.js"></script> + <script type="text/javascript" src="_static/js/jquery-1.11.0.min.js"></script> + <script type="text/javascript" src="_static/js/jquery-fix.js"></script> + <script type="text/javascript" src="_static/bootstrap-3.3.6/js/bootstrap.min.js"></script> + <script type="text/javascript" src="_static/bootstrap-sphinx.js"></script> + <link rel="index" title="Index" href="genindex.html" /> + <link rel="search" title="Search" href="search.html" /> + <link rel="top" title="Mindstorms EV3 Toolbox v0.4-rc.10 documentation" href="index.html" /> + <link rel="next" title="btBrickIO" href="btBrickIO.html" /> + <link rel="prev" title="hidapi" href="hid.html" /> +<meta charset='utf-8'> +<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'> +<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'> +<meta name="apple-mobile-web-app-capable" content="yes"> + + </head> + <body role="document"> + + <div id="navbar" class="navbar navbar-default navbar-fixed-top"> + <div class="container"> + <div class="navbar-header"> + <!-- .btn-navbar is used as the toggle for collapsed navbar content --> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="index.html"> + Mindstorms EV3 Toolbox</a> + <span class="navbar-text navbar-version pull-left"><b>v0.4</b></span> + </div> + + <div class="collapse navbar-collapse nav-collapse"> + <ul class="nav navbar-nav"> + + + <li class="dropdown globaltoc-container"> + <a role="button" + id="dLabelGlobalToc" + data-toggle="dropdown" + data-target="#" + href="index.html">Site <b class="caret"></b></a> + <ul class="dropdown-menu globaltoc" + role="menu" + aria-labelledby="dLabelGlobalToc"><ul> +<li class="toctree-l1"><a class="reference internal" href="readme.html">General</a></li> +<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li> +</ul> +<ul> +<li class="toctree-l1"><a class="reference internal" href="EV3.html">EV3</a></li> +<li class="toctree-l1"><a class="reference internal" href="Motor.html">Motor</a></li> +<li class="toctree-l1"><a class="reference internal" href="Sensor.html">Sensor</a></li> +</ul> +<ul class="current"> +<li class="toctree-l1"><a class="reference internal" href="hid.html">hidapi</a></li> +<li class="toctree-l1 current"><a class="current reference internal" href="#">usbBrickIO</a></li> +<li class="toctree-l1"><a class="reference internal" href="btBrickIO.html">btBrickIO</a></li> +</ul> +</ul> +</li> + + <li class="dropdown"> + <a role="button" + id="dLabelLocalToc" + data-toggle="dropdown" + data-target="#" + href="#">Page <b class="caret"></b></a> + <ul class="dropdown-menu localtoc" + role="menu" + aria-labelledby="dLabelLocalToc"><ul> +<li><a class="reference internal" href="#">usbBrickIO</a></li> +</ul> +</ul> +</li> + + + + + + <li> + <a href="hid.html" title="Previous Chapter: hidapi"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">« hidapi</span> + </a> + </li> + <li> + <a href="btBrickIO.html" title="Next Chapter: btBrickIO"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">btBrickIO »</span> + </a> + </li> + + + + + + <li class="hidden-sm"> +<div id="sourcelink"> + <a href="_sources/usbBrickIO.txt" + rel="nofollow">Source</a> +</div></li> + + </ul> + + + +<form class="navbar-form navbar-right" action="search.html" method="get"> + <div class="form-group"> + <input type="text" name="q" class="form-control" placeholder="Search" /> + </div> + <input type="hidden" name="check_keywords" value="yes" /> + <input type="hidden" name="area" value="default" /> +</form> + + </div> + </div> + </div> + +<div class="container"> + <div class="row"> + <div class="col-md-12 content"> + + <span class="target" id="module-source"></span><div class="section" id="usbbrickio"> +<h1>usbBrickIO<a class="headerlink" href="#usbbrickio" title="Permalink to this headline">¶</a></h1> +<dl class="class"> +<dt id="source.usbBrickIO"> +<em class="property">class </em><code class="descname">usbBrickIO</code><span class="sig-paren">(</span><em>varargin</em><span class="sig-paren">)</span><a class="headerlink" href="#source.usbBrickIO" title="Permalink to this definition">¶</a></dt> +<dd><p>USB interface between MATLAB and the brick</p> +<p class="rubric">Notes</p> +<ul class="simple"> +<li>Uses the hid library implementation in hidapi.m</li> +<li>The default parameters should always work when you try to connect to an EV3 brick, +so in nearly all use-cases, the constructor does not need any parameters (besides +'debug' eventually).</li> +</ul> +<dl class="attribute"> +<dt id="source.usbBrickIO.debug"> +<code class="descname">debug</code><a class="headerlink" href="#source.usbBrickIO.debug" title="Permalink to this definition">¶</a></dt> +<dd><p><em>bool</em> – If true, each open/close/read/write-call will be noted in the console. +Defaults to false.</p> +</dd></dl> + +<dl class="attribute"> +<dt id="source.usbBrickIO.vendorID"> +<code class="descname">vendorID</code><a class="headerlink" href="#source.usbBrickIO.vendorID" title="Permalink to this definition">¶</a></dt> +<dd><p><em>numeric</em> – Vendor-ID of the USB device. Defaults to 0x694 (EV3 vendor ID).</p> +</dd></dl> + +<dl class="attribute"> +<dt id="source.usbBrickIO.productID"> +<code class="descname">productID</code><a class="headerlink" href="#source.usbBrickIO.productID" title="Permalink to this definition">¶</a></dt> +<dd><p><em>numeric</em> – Product-ID of the USB device. Defaults to 0x0005 (EV3 product ID).</p> +</dd></dl> + +<dl class="attribute"> +<dt id="source.usbBrickIO.nReadBuffer"> +<code class="descname">nReadBuffer</code><a class="headerlink" href="#source.usbBrickIO.nReadBuffer" title="Permalink to this definition">¶</a></dt> +<dd><p><em>numeric</em> – Read-buffer size in bytes. Defaults to 1024.</p> +</dd></dl> + +<dl class="attribute"> +<dt id="source.usbBrickIO.nWriteBuffer"> +<code class="descname">nWriteBuffer</code><a class="headerlink" href="#source.usbBrickIO.nWriteBuffer" title="Permalink to this definition">¶</a></dt> +<dd><p><em>numeric</em> – Write-buffer size in bytes. Needs to be 1 Byte bigger than +actual packet. Defaults to 1025 (EV3 USB maximum packet size = 1024).</p> +</dd></dl> + +<dl class="attribute"> +<dt id="source.usbBrickIO.timeOut"> +<code class="descname">timeOut</code><a class="headerlink" href="#source.usbBrickIO.timeOut" title="Permalink to this definition">¶</a></dt> +<dd><p><em>numeric >= 0</em> – Milliseconds after which a timeout-error occurs if no packet could be +read. Defaults to 10000.</p> +</dd></dl> + +<p class="rubric">Examples</p> +<p>% Connecting via USB <br /> +commHandle = usbBrickIO(); % <br /> +% Connecting via USB with enabled debug output <br /> +commHandle = usbBrickIO('debug', true); % <br /></p> +<dl class="method"> +<dt id="source.usbBrickIO.close"> +<code class="descname">close</code><span class="sig-paren">(</span><em>brickIO</em><span class="sig-paren">)</span><a class="headerlink" href="#source.usbBrickIO.close" title="Permalink to this definition">¶</a></dt> +<dd><p>Closes the usb connection the brick through the hidapi interface.</p> +</dd></dl> + +<dl class="method"> +<dt id="source.usbBrickIO.open"> +<code class="descname">open</code><span class="sig-paren">(</span><em>brickIO</em><span class="sig-paren">)</span><a class="headerlink" href="#source.usbBrickIO.open" title="Permalink to this definition">¶</a></dt> +<dd><p>Opens the usb connection to the brick through the hidapi interface.</p> +</dd></dl> + +<dl class="method"> +<dt id="source.usbBrickIO.read"> +<code class="descname">read</code><span class="sig-paren">(</span><em>brickIO</em><span class="sig-paren">)</span><a class="headerlink" href="#source.usbBrickIO.read" title="Permalink to this definition">¶</a></dt> +<dd><p>Reads data from the brick through usb using the hidapi interface and returns the data in uint8 format.</p> +</dd></dl> + +<dl class="method"> +<dt id="source.usbBrickIO.setProperties"> +<code class="descname">setProperties</code><span class="sig-paren">(</span><em>brickIO</em>, <em>varargin</em><span class="sig-paren">)</span><a class="headerlink" href="#source.usbBrickIO.setProperties" title="Permalink to this definition">¶</a></dt> +<dd><p>Sets multiple usbBrickIO properties at once using MATLAB's inputParser.</p> +<p>The syntax is as follows: commHandle.setProperties('propertyName1', +propertyValue1, 'propertyName2', propertyValue2, ...). Valid, optional properties +are: debug, vendorID, productID, nReadBuffer, nWriteBuffer, timeOut.</p> +<p>See also USBBRICKIO.DEBUG, USBBRICKIO.VENDORID, USBBRICKIO.PRODUCTID, +USBBRICKIO.NREADBUFFER, USBBRICKIO.NWRITEBUFFER, USBBRICKIO.TIMEOUT</p> +</dd></dl> + +<dl class="method"> +<dt id="source.usbBrickIO.write"> +<code class="descname">write</code><span class="sig-paren">(</span><em>brickIO</em>, <em>wmsg</em><span class="sig-paren">)</span><a class="headerlink" href="#source.usbBrickIO.write" title="Permalink to this definition">¶</a></dt> +<dd><p>Writes data to the brick through usb using the hidapi interface.</p> +<table class="docutils field-list" frame="void" rules="none"> +<col class="field-name" /> +<col class="field-body" /> +<tbody valign="top"> +<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>wmsg</strong> (<em>uint8 array</em>) – Data to be written to the brick via usb</td> +</tr> +</tbody> +</table> +</dd></dl> + +</dd></dl> + +</div> + + + </div> + + </div> +</div> +<footer class="footer"> + <div class="container"> + <p class="pull-right"> + <a href="#">Back to top</a> + + </p> + <p> + © Copyright 2016, LfB - RWTH Aachen.<br/> + Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.8.<br/> + </p> + </div> +</footer> + </body> +</html> \ No newline at end of file diff --git a/docs/btBrickIO.rst b/docs/btBrickIO.rst new file mode 100644 index 0000000000000000000000000000000000000000..5e076d50dc1c141aef7ed955e216f4b3a438723c --- /dev/null +++ b/docs/btBrickIO.rst @@ -0,0 +1,10 @@ +.. automodule:: source + +.. |br| raw:: html + + <br /> +btBrickIO +========= + +.. autoclass:: btBrickIO + :members: open, close, read, write, setProperties diff --git a/docs/hid.rst b/docs/hid.rst new file mode 100644 index 0000000000000000000000000000000000000000..a81e179691da5a39122479c305bd02a5f82a5619 --- /dev/null +++ b/docs/hid.rst @@ -0,0 +1,10 @@ +.. automodule:: source + +.. |br| raw:: html + + <br /> +hidapi +====== + +.. autoclass:: hidapi + :members: open, close, read, read_timeout, write, getHIDInfoString, setNonBlocking, init, exit, error, enumerate, getManufacturersString, getProductString, getSerialNumberString diff --git a/docs/index.rst b/docs/index.rst index a75f04ace42e9750f8f5f8213320a304c343fd57..157a890c15b3b897ca5e3259d9f5fbe22c3fe0fe 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -45,8 +45,9 @@ Toolbox documentation Advanced .. toctree:: - :maxdepth: 2 - - CommandLayer.rst - CommunicationLayer.rst - + :maxdepth: 3 + + hid + usbBrickIO + btBrickIO + diff --git a/docs/process.py b/docs/process.py index 7704a4582f74a583fb34b0ce802101f9991c0a8b..4b8d5fc607cd613d5c99d3a349cd41cce49a9914 100644 --- a/docs/process.py +++ b/docs/process.py @@ -82,7 +82,7 @@ def postprocess(): postprocess_html_files() def postprocess_html_files(): - documented_classes = ['Motor', 'Sensor', 'EV3'] + documented_classes = ['Motor', 'Sensor', 'EV3', 'usbBrickIO', 'btBrickIO'] for file_name in documented_classes: current_file = os.path.abspath('_build/html/' + file_name + '.html') diff --git a/docs/usbBrickIO.rst b/docs/usbBrickIO.rst new file mode 100644 index 0000000000000000000000000000000000000000..785bdc9777327560b7982902df1a9df17ffb2cc9 --- /dev/null +++ b/docs/usbBrickIO.rst @@ -0,0 +1,10 @@ +.. automodule:: source + +.. |br| raw:: html + + <br /> +usbBrickIO +========== + +.. autoclass:: usbBrickIO + :members: open, close, read, write, setProperties diff --git a/source/BrickIO.m b/source/BrickIO.m index a5ee1129a0a23170da017785296ab079924794be..9b86316daaa464f2fc88338b02847c726145ecad 100755 --- a/source/BrickIO.m +++ b/source/BrickIO.m @@ -1,35 +1,36 @@ -%BrickIO Abstract class definition for brick input output -% -% Methods:: -% open Open the connection to the brick -% close Close the connection to the brick -% read Read data from the brick -% write Write data to the brick -% -% Notes:: -% - handle is the connection object -% - The read function should return a uint8 datatype -% - The write function should be given a uint8 datatype as a parameter - classdef BrickIO < MaskedHandle + % Abstract class definition for brick input output + % + % Notes: + % * The read/write-methods use uint8-arrays. + % * Instances of child-classes of BrickIO represent connection handles. The connection is + % opened when creating them and closed when deleting them. + % + % Methods: + % open: Open the connection to the brick + % close: Close the connection to the brick + % read: Read data from the brick + % write: Write data to the brick + % + properties (Abstract) - % time-out period (if 0, no time-out) + % timeOut: time-out period (if 0, no time-out) timeOut end - properties (Abstract, Access = 'protected') - % connection handle + properties (Abstract, Access = protected) + % handle: Connection handle to the device handle end methods (Abstract) - % open the brick connection + % Open the brick connection open(BrickIO) - % close the brick connection + % Close the brick connection close(BrickIO) - % read data from the brick + % Read data from the brick read(BrickIO) - % write data to the brick + % Write data to the brick write(BrickIO) end end \ No newline at end of file diff --git a/source/EV3.m b/source/EV3.m index 7ddac27cb16018951b46d7163ef2d60456804246..53abefb3b35fef18261fedc337d1b39cae479bd0 100755 --- a/source/EV3.m +++ b/source/EV3.m @@ -118,7 +118,7 @@ classdef EV3 < MaskedHandle % Sets properties of EV3-object and creates Motor- and Sensor-objects with default % parameters. % - % Arguments + % Arguments: % varargin: see setProperties(ev3, varargin). % % See also SETPROPERTIES / :meth:`setProperties(ev3, varargin)` diff --git a/source/btBrickIO.m b/source/btBrickIO.m index 0625c3f7cbf774fd26aca90f263b417975c9ed80..fb250d06c3eb8c375140590c67c3a54a0fcbca2c 100755 --- a/source/btBrickIO.m +++ b/source/btBrickIO.m @@ -7,86 +7,85 @@ classdef btBrickIO < BrickIO % module can be made. Also be sure that the bluetooth module has been paired % to the brick before trying to connect. % * Usage is OS-dependent: - % - % - Windows: the deviceName- & channel-properties are needed for connection. The - % implementation is based on the Instrument Control toolbox. - % - Linux (and potentially Mac): serialPort-property is needed for connection. The - % implementation is based on MATLAB's serial port implementation. + % * Windows: the deviceName- & channel-properties are needed for connection. The implementation is based on the Instrument Control toolbox. + % * Linux (and potentially Mac): serialPort-property is needed for connection. The implementation is based on MATLAB's serial port implementation. + % + % * For general information, see also :class:`BrickIO`. % % Attributes: - % debug (bool): If true, each open/close/read/write-call will be noted in the console. - % serialPort (string): Path to the serial-port object (default: '/dev/rfcomm0'). Only - % needed when using MATLAB's serial class (i.e. on linux/mac). - % deviceName (string): Name of the BT-device = the brick (default: 'EV3'). Only - % needed when using the Instrument Control toolbox (i.e. on windows). - % channel (numeric > 0): BT-channel of the connected BT-device (default: 1). Only - % needed when using the Instrument Control toolbox (i.e. on windows). + % debug (bool): If true, each open/close/read/write-call will be shown in the console. + % Defaults to false. + % serialPort (string): Path to the serial-port object. Only needed when using MATLAB's + % serial class (i.e. on linux/mac). Defaults to '/dev/rfcomm0'. + % deviceName (string): Name of the BT-device = the brick. Only needed when using the + % Instrument Control toolbox (i.e. on windows). Defaults to 'EV3'. + % channel (numeric > 0): BT-channel of the connected BT-device. Only needed when using + % the Instrument Control toolbox (i.e. on windows). Defaults to 1. % timeOut (numeric >= 0): seconds after which a timeout-error occurs if no packet could be - % read. + % read. Defaults to 10. % backend ('serial'|'instrumentControl'): Backend this implementation is based on. Is - % automatically chosend depending on the OS ('serial' for linux/mac, - % 'instrumentControl' for windows). + % automatically chosen depending on the OS. Defaults to 'serial' on linux/mac + % systems, and to 'instrumentControl' on windows systems. + % + % + % Examples: + % % Connecting on windows |br| + % commHandle = btBrickIO('deviceName', 'MyEV3', 'channel', 1); % |br| + % % Connecting on windows using MATLABs default serial port implementation for testing |br| + % commHandle = btBrickIO('deviceName', 'MyEV3', 'channel', 1, 'backend', 'serial'); % |br| + % % Connecting on mac/linux |br| + % commHandle = btBrickIO('serPort', '/dev/rfcomm0'); % |br| % properties % debug (bool): If true, each open/close/read/write-call will be noted in the console. + % Defaults to false. debug; - % Path to the serial-port object (default: '/dev/rfcomm0'). Only - % needed when using MATLAB's serial class (i.e. on linux/mac). + % serialPort (string): Path to the serial-port object. Defaults to '/dev/rfcomm0'. + % Only needed when using MATLAB's serial class (i.e. on linux/mac). serialPort; - % deviceName (string): Name of the BT-device = the brick (default: 'EV3'). Only - % needed when using the Instrument Control toolbox (i.e. on windows). + % deviceName (string): Name of the BT-device = the brick. Defaults to 'EV3'. + % Only needed when using the Instrument Control toolbox (i.e. on windows). deviceName; - % channel (numeric > 0): BT-channel of the connected BT-device (default: 1). Only - % needed when using the Instrument Control toolbox (i.e. on windows). + % channel (numeric > 0): BT-channel of the connected BT-device. Defaults to 1. + % Only needed when using the Instrument Control toolbox (i.e. on windows). channel; - % timeOut (numeric > 0): seconds after which a timeout-error occurs if no packet could be - % read. + % timeOut (numeric > 0): Seconds after which a timeout-error occurs if no packet could be read. + % Defaults to 10. timeOut; - % backend ('serial'|'instrumentControl'): Backend this implementation is based on. Is - % automatically chosend depending on the OS ('serial' for linux/mac, - % 'instrumentControl' for windows). + % backend ('serial'|'instrumentControl'): Backend this implementation is based on. + % Is automatically chosen depending on the OS. Defaults to 'serial' on linux/mac + % systems, and to 'instrumentControl' on windows systems. backend; end - properties (Access = 'protected') - % connection handle - handle + properties (Access = protected) + % handle: Connection handle to the device + handle; end methods - function brickIO = btBrickIO(brickIO, varargin) - %btBrickIO.btBrickIO Create a btBrickIO object + function brickIO = btBrickIO(varargin) + % Create a btBrickIO object % - % btbrick = btBrickIO(debug,serialPort) is an object which - % initialises and opens a bluetooth connection between MATLAB - % and the brick. - - p = inputParser(); - p.KeepUnmatched = 1; - - p.addOptional('debug', 0); - p.addOptional('serPort', '/dev/rfcomm0'); - p.addOptional('deviceName', 'EV3'); - p.addOptional('channel', 1); - p.addOptional('timeOut', 10); - if(ispc && license('test', 'instr_control_toolbox')) - p.addOptional('backend', 'instrumentControl'); - else - p.addOptional('backend', 'serial'); - end + % Arguments: + % varargin: Any number of property names as strings, each followed by the + % desired value. + % + % Examples: + % % Connecting on windows + % commHandle = btBrickIO('deviceName', 'MyEV3', 'channel', 1); + % % Connecting on windows using MATLABs default serial port implementation for testing + % commHandle = btBrickIO('deviceName', 'MyEV3', 'channel', 1, 'backend', 'serial'); + % % Connecting on mac/linux + % commHandle = btBrickIO('serPort', '/dev/rfcomm0'); + % + % See also BTBRICKIO.SETPROPERTIES - p.parse(varargin{:}); - - brickIO.debug = p.Results.debug; - brickIO.serialPort = p.Results.serPort; - brickIO.deviceName = p.Results.deviceName; - brickIO.channel = p.Results.channel; - brickIO.timeOut = p.Results.timeOut; - brickIO.backend = p.Results.backend; + brickIO.setProperties(varargin{:}); if brickIO.debug > 0 - fprintf('btBrickIO init\n'); + fprintf('(DEBUG) btBrickIO init\n'); end % Set the connection handle @@ -112,17 +111,15 @@ classdef btBrickIO < BrickIO end end - % Open the connection handle + % Open the connection brickIO.open; end function delete(brickIO) - %btBrickIO.delete Delete the btBrickIO object - % - % delete(brickIO) closes the bluetooth connection handle + % Delete the btBrickIO object and closes the connection if brickIO.debug > 0 - fprintf('btBrickIO delete\n'); + fprintf('(DEBUG) (BT delete\n'); end % Disconnect @@ -134,13 +131,10 @@ classdef btBrickIO < BrickIO end function open(brickIO) - %btBrickIO.open Open the btBrickIO object - % - % btBrickIO.open() opens the bluetooth connection to the brick - % using fopen. + % Opens the bluetooth connection to the brick using fopen. if brickIO.debug > 0 - fprintf('btBrickIO open\n'); + fprintf('(DEBUG) (BT open)\n'); end % Open the bt handle @@ -165,13 +159,10 @@ classdef btBrickIO < BrickIO end function close(brickIO) - %btBrickIO.close Close the btBrickIO object - % - % btBrickIO.close() closes the bluetooth connection the brick - % using fclose. + % Closes the bluetooth connection the brick using fclose. if brickIO.debug > 0 - fprintf('btBrickIO close\n'); + fprintf('(DEBUG) (BT close) \n'); end try @@ -189,13 +180,10 @@ classdef btBrickIO < BrickIO end function rmsg = read(brickIO) - %btBrickIO.read Read data from the btBrickIO object - % - % rmsg = btBrickIO.read() reads data from the brick through - % bluetooth via fread and returns the data in uint8 format. + % Reads data from the brick through bluetooth via fread and returns the data in uint8 format. if brickIO.debug > 0 - fprintf('btBrickIO read\n'); + fprintf('(DEBUG) (BT read) \n'); end try @@ -225,17 +213,13 @@ classdef btBrickIO < BrickIO end function write(brickIO,wmsg) - %btBrickIO.write Write data to the btBrickIO object - % - % btBrickIO.write(wmsg) writes data to the brick through - % bluetooth. + % Writes data to the brick through bluetooth via fwrite. % - % Notes:: - % - wmsg is the data to be written to the brick via bluetooth - % in uint8 format. + % Arguments: + % wmsg (uint8 array): Data to be written to the brick via bluetooth if brickIO.debug > 0 - fprintf('btBrickIO write\n'); + fprintf('(DEBUG) btBrickIO write\n'); end try @@ -284,5 +268,38 @@ classdef btBrickIO < BrickIO brickIO.backend = backend; end + function setProperties(brickIO, varargin) + % Sets multiple btBrickIO properties at once using MATLAB's inputParser. + % + % The syntax is as follows: commHandle.setProperties('propertyName1', + % propertyValue1, 'propertyName2', propertyValue2, ...). Valid, optional properties + % are: debug, serPort, deviceName, channel, timeout. + % + % See also BTBRICKIO.DEBUG, BTBRICKIO.SERIALPORT, BTBRICKIO.DEVICENAME, + % BTBRICKIO.CHANNEL, BTBRICKIO.TIMEOUT + + p = inputParser(); + p.KeepUnmatched = 1; + + p.addOptional('debug', false); + p.addOptional('serPort', '/dev/rfcomm0'); + p.addOptional('deviceName', 'EV3'); + p.addOptional('channel', 1); + p.addOptional('timeOut', 10); + if(ispc && license('test', 'instr_control_toolbox')) % Choose 'backend'-default depending on OS + p.addOptional('backend', 'instrumentControl'); + else + p.addOptional('backend', 'serial'); + end + + p.parse(varargin{:}); + + brickIO.debug = p.Results.debug; + brickIO.serialPort = p.Results.serPort; + brickIO.deviceName = p.Results.deviceName; + brickIO.channel = p.Results.channel; + brickIO.timeOut = p.Results.timeOut; + brickIO.backend = p.Results.backend; + end end end diff --git a/source/hidapi.m b/source/hidapi.m index 0815abd98b110b92bcfee2d168723c626611c596..a4a35a5bfb0d1b7486943ab7776f1bbc62176b38 100755 --- a/source/hidapi.m +++ b/source/hidapi.m @@ -1,92 +1,68 @@ -%hidpi Interface to the hidapi library -% -% Methods:: -% hidapi Constructor, loads the hidapi library -% delete Destructor, closes any open hid connection -% -% open Open the hid device with vendor and product ID -% close Close the hid device connection -% read Read data from the hid device -% write Write data to the hid device -% -% getHIDInfoString Get the relevant hid info from the hid device -% getManufacturersString Get the manufacturers string from the hid device -% getProductString Get the product string from the hid device -% getSerialNumberString Get the serial number from the hid device -% setNonBlocking Set non blocking hid read -% init Init the hidapi (executed in open by default) -% exit Exit the hidapi -% error Return the error string -% enumerate Enumerate the connected hid devices -% -% -% Example:: -% hid = hidapi(1,1684,0005,1024,1025) -% -% Notes:: -% - Developed from the hidapi available from http://www.signal11.us/oss/hidapi/ -% - Windows: need the hidapi.dll file -% - Mac: need the hidapi.dylib file. Will also need Xcode installed to run load library -% - Linux: will need to compile on host system and copy the resulting .so file - classdef hidapi < handle + % Interface to the hidapi library + % + % Notes: + % * Developed from the hidapi available at http://www.signal11.us/oss/hidapi/. + % * Windows: hidapi.dll needed. + % * Mac: hidapi.dylib needed. In addition, Xcode has to be installed. + % * Linux: hidapi has to be compiled on host-system. + % + % Attributes: + % handle (): + % vendorID (numeric): Vendor-ID of the USB device. + % productID (numeric): Product-ID of the USB device. + % nReadBuffer (numeric): Read-buffer size in bytes. + % nWriteBuffer (numeric): Write-buffer size in bytes. Needs to be 1 Byte bigger than + % actual packet. + % slib (string): Name of shared library file (without file extension). Defaults to + % 'hidapi'. + % sheader (string): Name of shared library header. Defaults to 'hidapi.h'. + % + % Example: + % hidHandle = hidapi(1684,0005,1024,1025); %|br| + % + properties - % connection handle + % handle: Connection handle to the device. handle - % debug input - debug = 0; - % vendor ID - vendorID = 0; - % product ID - productID = 0; - % read buffer size - nReadBuffer = 256; - % write buffer size - nWriteBuffer = 256; - % shared library + % vendorID (numeric): Vendor-ID of the USB device. + vendorID; + % productID (numeric): Product-ID of the USB device. + productID; + % nReadBuffer (numeric): Read-buffer size in bytes. + nReadBuffer; + % nWriteBuffer (numeric): Write-buffer size in bytes. + % Needs to be 1 Byte bigger than actual packet. + nWriteBuffer; + % slib (string): Name of shared library file (without file extension). Defaults to 'hidapi'. slib = 'hidapi'; - % shared library header + % sheader (string): Name of shared library header. Defaults to 'hidapi.h'. sheader = 'hidapi.h'; - end methods %% Constructor - function hid = hidapi(debug,vendorID,productID,nReadBuffer,nWriteBuffer) - %hidapi.hidapi Create a hidapi library interface object + function hid = hidapi(vendorID,productID,nReadBuffer,nWriteBuffer) + % Create a hidapi library interface object from the corresponding library % - % hid = hidapi(debug,vendorID,productID,nReadBuffer,nWriteButter) - % is an object which initialises the hidapi from the corresponding - % OS library. Other parameters are also initialised. Some OS - % checking is required in this function to load the correct - % library. + % Arguments: + % vendorID (numeric): Vendor-ID of the USB device in decimal. + % productID (numeric): Product-ID of the USB device in decimal. + % nReadBuffer (numeric): Read-buffer size in bytes. + % nWriteBuffer (numeric): Write-buffer size in bytes. Needs to be 1 Byte bigger than + % actual packet. % - % Throws:: - % LoadingLibraryError Could not load .dll/.dylib/.so-file of hidapi - % InvalidFileNameOrFileMissing Either file names given were wrong or the files - % are missing (thunk files, proto files, ...) + % Raises: + % LoadingLibraryError: Could not load .dll/.dylib/.so-file of hidapi. + % InvalidFileNameOrFileMissing: Either file names given were wrong or the files + % are missing (thunk files, proto files, ...). % - % Notes:: - % - debug is a flag specifying output printing (0 or 1). - % - vendorID is the vendor ID of the hid device (decimal not hex). - % - productID is the product ID of the hid device (decimal not hex). - % - nReadBuffer is the length of the read buffer. - % - nWriteBuffer is the length of the write buffer. - - hid.debug = debug; - - if hid.debug > 0 - fprintf('hidapi init\n'); - end - - if nargin > 1 - hid.vendorID = vendorID; - hid.productID = productID; - hid.nReadBuffer = nReadBuffer; - hid.nWriteBuffer = nWriteBuffer; - end + hid.vendorID = vendorID; + hid.productID = productID; + hid.nReadBuffer = nReadBuffer; + hid.nWriteBuffer = nWriteBuffer; % Disable warnings warning('off','MATLAB:loadlibrary:TypeNotFoundForStructure'); @@ -132,81 +108,37 @@ classdef hidapi < handle throw(exception); end + % Remove the library extension hid.slib = 'hidapiusb'; - if hid.debug > 0 - libfunctionsview('hidapiusb'); - end +% if hid.debug > 0 +% libfunctionsview('hidapiusb'); +% end end function delete(hid) - %hidapi.delete Delete hid object + % Close an open hid device connection and delete the object. % - % delete(hid) closes an open hid device connection. This function is called - % automatically when deleting. - % - % Notes:: - % - You cannot unloadlibrary in this function as the object is - % still present in the MATLAB work space. - - if hid.debug > 0 - fprintf('hidapi delete\n'); - end + % Notes: + % * You cannot unloadlibrary in this function as the object is still present + % in the MATLAB work space. Todo: Any alternative? end - %% Wrapper - - function str = getManufacturersString(hid) - %hidapi.getManufacturersString get manufacturers string from hid object - % - % hid.getManufacturersString() returns the manufacturers string - % from the hid device using getHIDInfoString. - - str = getHIDInfoString(hid,'hid_get_manufacturer_string'); - end - - function str = getProductString(hid) - %hidapi.getProductString get product string from hid object - % - % hid.getProductString() returns the product string from the - % hid device using getProductString. - - str = getHIDInfoString(hid,'hid_get_product_string'); - end - - function str = getSerialNumberString(hid) - %hidapi.getSerialNumberString get product string from hid object - % - % hid.getSerialNumberString() returns the serial number string - % from the hid device using getSerialNumberString. - - str = getHIDInfoString(hid,'hid_get_serial_number_string'); - end - - %% Wrapped HIDAPI-Functions + %% HIDAPI-Functions function open(hid) - %hidapi.open Open a hid object - % - % hid.open() opens a connection with a hid device with the - % initialised values of vendorID and productID from the hidapi - % constructor. + % Open a connection with a hid device % - % Throws:: - % CommError Error during communication with device + % Throws: + % CommError: Error during communication with device % - % Notes:: - % - The pointer return value from this library call is always - % null so it is not possible to know if the open was - % successful. - % - The final parameter to the open hidapi library call has - % different types depending on OS. In windows it is uint16 but - % linux/mac it is int32. - - if hid.debug > 0 - fprintf('hidapi open\n'); - end + % Notes: + % * Gets called automatically when creating an hidapi-object. + % * The pointer return value from this library call is always null so it is not + % possible to know if the open was successful. + % * The final parameter to the open hidapi library call has different types + % depending on OS. On windows it is uint16, on linux/mac int32. % Create a null pointer for the hid_open function (depends on OS) if (ispc == 1) @@ -228,18 +160,13 @@ classdef hidapi < handle end function close(hid) - %hidapi.close Close hid object - % - % hid.close() closes the connection to a hid device. Gets called automatically - % when deleting the hid instance. + % Close the connection to a hid device. % - % Throws:: - % InvalidHandle Handle to USB-device not valid + % Throws: + % InvalidHandle: Handle to USB-device not valid % - - if hid.debug > 0 - fprintf('hidapi close\n'); - end + % Notes: + % * Gets called automatically when deleting the hidapi instance. % (MMI) Check if pointer is (unexpectedly) already invalidated assert(isLibPointerValid(hid.handle)==1, ... @@ -253,24 +180,18 @@ classdef hidapi < handle hid.handle = []; end - % @ MMI + % Implemented @ MMI function rmsg = read_timeout(hid, timeOut) - %hidapi.read_timeout Read from hid object with a time-out + % Read from a hid device with a timeout and return the read bytes. % - % rmsg = hid.read_timeout() reads from a hid device and returns the - % read bytes. Will print an error if no data was read during the time-out period. + % Arguments: + % timeOut (numeric >= 0): Milliseconds after which a timeout-error occurs if no + % packet could be read. % - % Arguments:: - % timeOut time-out period in milliseconds + % Throws: + % CommError: Error during communication with device + % InvalidHandle: Handle to USB-device not valid % - % Throws:: - % CommError Error during communication with device - % InvalidHandle Handle to USB-device not valid - % - - if hid.debug > 0 - fprintf('hidapi read_timeout\n'); - end % Read buffer of nReadBuffer length buffer = zeros(1,hid.nReadBuffer); @@ -309,19 +230,15 @@ classdef hidapi < handle end function rmsg = read(hid) - %hidapi.read Read from hid object + % Read from a hid device and returns the read bytes. % - % rmsg = hid.read() reads from a hid device and returns the - % read bytes. Will print an error if no data was read. + % Throws: + % CommError: Error during communication with device + % InvalidHandle: Handle to USB-device not valid + % + % Notes: + % * Will print an error if no data was read. % - % Throws:: - % CommError Error during communication with device - % InvalidHandle Handle to USB-device not valid - % - - if hid.debug > 0 - fprintf('hidapi read\n'); - end % Read buffer of nReadBuffer length buffer = zeros(1,hid.nReadBuffer); @@ -360,21 +277,17 @@ classdef hidapi < handle end function write(hid,wmsg,reportID) - %hidapi.write Write to hid object + % Write to a hid device. % - % hid.write() writes to a hid device. Will print an error if - % there is a mismatch between the buffer size and the reported - % number of bytes written. + % Throws: + % CommError: Error during communication with device + % InvalidHandle: Handle to USB-device not valid % - % Throws:: - % CommError Error during communication with device - % InvalidHandle Handle to USB-device not valid + % Notes: + % * Will print an error if there is a mismatch between the buffer size and the + % reported number of bytes written. % - if hid.debug > 0 - fprintf('hidapi write\n'); - end - % Append a 0 at the front for HID report ID wmsg = [reportID wmsg]; @@ -384,7 +297,7 @@ classdef hidapi < handle % anything, and I would prefer sending short messages over long ones. % Further testing may be required, so for now I don't change a thing. % (MMI) Update:: Okay, so under Windows, this line IS necessary, as well as the - % fixed write-buffer size of 1025 bytes (== wMaxPacketSize+1; smaller packets fail; + % fixed write-buffer size of 1025 bytes for EV3 (== wMaxPacketSize+1; smaller packets fail; % bigger packets do get handled by the brick, but the second assertion below will fail). wmsg(end+(hid.nWriteBuffer-length(wmsg))) = 0; @@ -406,21 +319,19 @@ classdef hidapi < handle end function str = getHIDInfoString(hid,info) - %hidapi.getHIDInfoString get hid information from object + % Get the corresponding hid info from the hid device. % - % hid.getHIDInfoString(info) gets the corresponding hid info - % from the hid device + % Throws: + % CommError: Error during communication with device + % InvalidHandle: Handle to USB-device not valid % - % Throws:: - % CommError Error during communication with device - % InvalidHandle Handle to USB-device not valid + % Notes: + % * Info is the hid information string. + % + % See also HIDAPI.GETMANUFACTURERSSTRING, HIDAPI.GETPRODUCTSTRING, + % HIDAPI.GETSERIALNUMBERSTRING. % - % Notes:: - % - info is the hid information string. - if hid.debug > 0 - fprintf(['hidapi ' info '\n']); - end % Read buffer nReadBuffer length buffer = zeros(1,hid.nReadBuffer); % Create a libpointer (depends on OS) @@ -448,21 +359,15 @@ classdef hidapi < handle end function setNonBlocking(hid,nonblock) - %hidapi.setNonBlocking sets non blocking on the hid object + % Set the non blocking flag on the hid device connection. % - % hid.setNonBlocking(nonblock) sets the non blocking flag on - % the hid device connection. + % Arguments: + % nonblock (numeric in {0,1}): 0 disables nonblocking, 1 enables nonblocking % - % Throws:: - % CommError Error during communication with device - % InvalidHandle Handle to USB-device not valid + % Throws: + % CommError: Error during communication with device + % InvalidHandle: Handle to USB-device not valid % - % Notes:: - % nonblock - 0 disables nonblocking, 1 enables nonblocking - - if hid.debug > 0 - fprintf('hidapi setNonBlocking\n'); - end % (MMI) Check if pointer is (unexpectedly) already invalidated assert(isLibPointerValid(hid.handle)==1, ... @@ -479,20 +384,15 @@ classdef hidapi < handle end function init(hid) - %hidapi.init Init hidapi + % Inits the hidapi library. % - % hid.init() inits the hidapi library. This is called - % automatically in the library itself with the open function. + % Throws: + % CommError: Error during communication with device % - % Throws:: - % CommError Error during communication with device + % Notes: + % * This is called automatically in the library itself with the open function. You + % should not have to call this function directly. % - % Notes:: - % - You should not have to call this function directly. - - if hid.debug > 0 - fprintf('hidapi init\n'); - end warning([hid.slib, ':', 'RedundantCall'], ... 'The init-function gets called automatically when connecting!'); @@ -511,16 +411,12 @@ classdef hidapi < handle % % hid.exit() exits the hidapi library. % - % Throws:: - % CommError Error during communication with device + % Throws: + % CommError: Error during communication with device % % Notes:: % - You should not have to call this function directly. - if hid.debug > 0 - fprintf('hidapi exit\n'); - end - warning([hid.slib, ':', 'RedundantCall'], ... 'The exit-function gets called automatically when disconnecting!'); @@ -534,21 +430,15 @@ classdef hidapi < handle end function str = error(hid) - %hidapi.error Output the hid object error string + % Return the hid device error string if a function produced an error. % - % hid.error() returns the hid device error string if a function - % produced an error. + % Throws: + % InvalidHandle: Handle to USB-device not valid % - % Throws:: - % InvalidHandle Handle to USB-device not valid - % - % Notes:: - % - This function must be called explicitly if you think an - % error was generated from the hid device. - - if hid.debug > 0 - fprintf('hidapi error\n'); - end + % Notes: + % * This function must be called explicitly if you think an error was generated + % from the hid device. + % % (MMI) Check if pointer is (unexpectedly) already invalidated assert(isLibPointerValid(hid.handle)==1, ... @@ -559,34 +449,44 @@ classdef hidapi < handle end function str = enumerate(hid,vendorID,productID) - %hidapi.enumerate Enumerates the hid object + % Enumerates the info about the hid device with the given vendorID and productID + % and returns a string with the returned hid information. % - % str = hid.enumerate(vendorID,productID) enumerates the hid - % device with the given vendorID and productID and returns a - % string with the returned hid information. + % Arguments: + % vendorID (numeric): Vendor-ID of the USB device in decimal. + % productID (numeric): Product-ID of the USB device in decimal. + % + % Notes: + % * Using a vendorID and productID of (0,0) will enumerate all connected hid + % devices. + % * MATLAB does not have the hid_device_infoPtr struct so some of the returned + % information will need to be resized and cast into uint8 or chars. % - % Notes:: - % - vendorID is the vendor ID (in decimal not hex). - % - productID is the vendor ID (in decimal not hex). - % - Using a vendorID and productID of (0,0) will enumerate all - % connected hid devices. - % - MATLAB does not have the hid_device_infoPtr struct so some - % of the returned information will need to be resized and cast - % into uint8 or chars. - - if hid.debug > 0 - fprintf('hidapi enumerate\n'); - end % Enumerate the hid devices str = calllib(u.slib,'hid_enumerate',uint16(vendorID),uint16(productID)); end + + %% Wrapper + + function str = getManufacturersString(hid) + % Get manufacturers string from hid object using getHIDInfoString. + str = getHIDInfoString(hid,'hid_get_manufacturer_string'); + end + function str = getProductString(hid) + % Get product string from hid object using getProductString. + str = getHIDInfoString(hid,'hid_get_product_string'); + end + function str = getSerialNumberString(hid) + % Get serial number from hid object using getSerialNumberString. + str = getHIDInfoString(hid,'hid_get_serial_number_string'); + end end end - +% Implemented @ MMI function valid = isLibPointerValid(handle) - %isHandleValid Check whether hid.handle is valid libpointer + % Check whether hid.handle is valid libpointer valid = 0; if ~isempty(handle) diff --git a/source/tb_optparse.m b/source/tb_optparse.m deleted file mode 100755 index 2fedb2b14a51fe749d72f97268a0de2b03513f02..0000000000000000000000000000000000000000 --- a/source/tb_optparse.m +++ /dev/null @@ -1,193 +0,0 @@ -%OPTPARSE Standard option parser for Toolbox functions -% -% [OPTOUT,ARGS] = TB_OPTPARSE(OPT, ARGLIST) is a generalized option parser for -% Toolbox functions. It supports options that have an assigned value, boolean -% or enumeration types (string or int). -% -% The software pattern is: -% -% function(a, b, c, varargin) -% opt.foo = true; -% opt.bar = false; -% opt.blah = []; -% opt.choose = {'this', 'that', 'other'}; -% opt.select = {'#no', '#yes'}; -% opt = tb_optparse(opt, varargin); -% -% Optional arguments to the function behave as follows: -% 'foo' sets opt.foo <- true -% 'nobar' sets opt.foo <- false -% 'blah', 3 sets opt.blah <- 3 -% 'blah', {x,y} sets opt.blah <- {x,y} -% 'that' sets opt.choose <- 'that' -% 'yes' sets opt.select <- 2 (the second element) -% -% and can be given in any combination. -% -% If neither of 'this', 'that' or 'other' are specified then opt.choose <- 'this'. -% If neither of 'no' or 'yes' are specified then opt.select <- 1. -% -% Note: -% - that the enumerator names must be distinct from the field names. -% - that only one value can be assigned to a field, if multiple values -% are required they must be converted to a cell array. -% -% The allowable options are specified by the names of the fields in the -% structure opt. By default if an option is given that is not a field of -% opt an error is declared. -% -% Sometimes it is useful to collect the unassigned options and this can be -% achieved using a second output argument -% [opt,arglist] = tb_optparse(opt, varargin); -% which is a cell array of all unassigned arguments in the order given in -% varargin. -% -% The return structure is automatically populated with fields: verbose and -% debug. The following options are automatically parsed: -% 'verbose' sets opt.verbose <- true -% 'verbose=2' sets opt.verbose <- 2 (very verbose) -% 'verbose=3' sets opt.verbose <- 3 (extremeley verbose) -% 'verbose=4' sets opt.verbose <- 4 (ridiculously verbose) -% 'debug', N sets opt.debug <- N -% 'setopt', S sets opt <- S -% 'showopt' displays opt and arglist - -function [opt,others] = tb_optparse(in, argv) - - arglist = {}; - - argc = 1; - opt = in; - try - opt.verbose = false; - opt.debug = 0; - end - - showopt = false; - - while argc <= length(argv) - option = argv{argc}; - assigned = false; - - if isstr(option) - - switch option - % look for hardwired options - case 'verbose' - opt.verbose = true; - assigned = true; - case 'verbose=2' - opt.verbose = 2; - assigned = true; - case 'verbose=3' - opt.verbose = 3; - assigned = true; - case 'verbose=4' - opt.verbose = 4; - assigned = true; - case 'debug' - opt.debug = argv{argc+1}; - argc = argc+1; - assigned = true; - case 'setopt' - new = argv{argc+1}; - argc = argc+1; - assigned = true; - - - % copy matching field names from new opt struct to current one - for f=fieldnames(new)' - if isfield(opt, f{1}) - opt = setfield(opt, f{1}, getfield(new, f{1})); - end - end - case 'showopt' - showopt = true; - assigned = true; - - otherwise - % does the option match a field in the opt structure? - if isfield(opt, option) - val = getfield(opt, option); - if islogical(val) - % a logical variable can only be set by an option - opt = setfield(opt, option, true); - else - % otherwise grab its value from the next arg - opt = setfield(opt, option, argv{argc+1}); - argc = argc+1; - end - assigned = true; - elseif length(option)>2 && strcmp(option(1:2), 'no') && isfield(opt, option(3:end)) - val = getfield(opt, option(3:end)); - if islogical(val) - % a logical variable can only be set by an option - opt = setfield(opt, option(3:end), false); - assigned = true; - end - else - % the option doesnt match a field name - for field=fieldnames(opt)' - val = getfield(opt, field{1}); - if iscell(val) - for i=1:length(val) - if isempty(val{i}) - continue; - end - if strcmp(option, val{i}) - opt = setfield(opt, field{1}, option); - assigned = true; - break; - elseif val{i}(1) == '#' && strcmp(option, val{i}(2:end)) - opt = setfield(opt, field{1}, i); - assigned = true; - break; - end - end - if assigned - break; - end - end - end - - - end - end % switch - end - if ~assigned - % non matching options are collected - if nargout == 2 - arglist = [arglist argv(argc)]; - else - if isstr(argv{argc}) - error(['unknown options: ' argv{argc}]); - end - end - end - - argc = argc + 1; - end % while - - % if enumerator value not assigned, set the default value - for field=fieldnames(in)' - if iscell(getfield(in, field{1})) && iscell(getfield(opt, field{1})) - val = getfield(opt, field{1}); - if isempty(val{1}) - opt = setfield(opt, field{1}, val{1}); - elseif val{1}(1) == '#' - opt = setfield(opt, field{1}, 1); - else - opt = setfield(opt, field{1}, val{1}); - end - end - end - - if showopt - fprintf('Options:\n'); - opt - arglist - end - - if nargout == 2 - others = arglist; - end diff --git a/source/usbBrickIO.m b/source/usbBrickIO.m index d2c5fb245158cebf803fec35ebef9a796e1b49ef..f4ce6c086a87a6e948eeeb0460246986be7a1d2b 100755 --- a/source/usbBrickIO.m +++ b/source/usbBrickIO.m @@ -3,63 +3,75 @@ classdef usbBrickIO < BrickIO % % Notes: % * Uses the hid library implementation in hidapi.m + % * The default parameters should always work when you try to connect to an EV3 brick, + % so in nearly all use-cases, the constructor does not need any parameters (besides + % 'debug' eventually). % % Attributes: % debug (bool): If true, each open/close/read/write-call will be noted in the console. - % vendorID (numeric): = 0x694 for EV3 - % productID (numeric): = 0x0005 for EV3 - % nReadBuffer (numeric): read buffer size - % nWriteBuffer (numeric): write buffer size (1 Byte bigger than actual packet) - % timeOut (numeric >= 0): milliseconds after which a timeout-error occurs if no packet could be - % read. + % Defaults to false. + % vendorID (numeric): Vendor-ID of the USB device. Defaults to 0x694 (EV3 vendor ID). + % productID (numeric): Product-ID of the USB device. Defaults to 0x0005 (EV3 product ID). + % nReadBuffer (numeric): Read-buffer size in bytes. Defaults to 1024. + % nWriteBuffer (numeric): Write-buffer size in bytes. Needs to be 1 Byte bigger than + % actual packet. Defaults to 1025 (EV3 USB maximum packet size = 1024). + % timeOut (numeric >= 0): Milliseconds after which a timeout-error occurs if no packet could be + % read. Defaults to 10000. + % + % Examples: + % % Connecting via USB |br| + % commHandle = usbBrickIO(); % |br| + % % Connecting via USB with enabled debug output |br| + % commHandle = usbBrickIO('debug', true); % |br| % properties % debug (bool): If true, each open/close/read/write-call will be noted in the console. - debug = 0; - % vendorID (numeric): = 0x694 for EV3 - vendorID = 1684; - % productID (numeric): = 0x0005 for EV3 - productID = 5; - % nReadBuffer (numeric): read buffer size - nReadBuffer = 1024; - % nWriteBuffer (numeric): write buffer size (1 Byte bigger than actual packet) - nWriteBuffer = 1025; - % timeOut (numeric >= 0): milliseconds after which a timeout-error occurs if no packet could be - % read. - timeOut = 10000; + % Defaults to false. + debug; + % vendorID (numeric): Vendor-ID of the USB device. Defaults to 0x694 (EV3 vendor ID). + vendorID; + % productID (numeric): Product-ID of the USB device. Defaults to 0x0005 (EV3 product ID). + productID; + % nReadBuffer (numeric): Read-buffer size in bytes. Defaults to 1024. + nReadBuffer; + % nWriteBuffer (numeric): Write-buffer size in bytes. Defaults to 1025 (EV3 USB maximum packet size = 1024). + % Needs to be 1 Byte bigger than actual packet. + nWriteBuffer; + % timeOut (numeric >= 0): Milliseconds after which a timeout-error occurs if no packet could be read. Defaults to 10000. + timeOut; end - properties (Access = 'protected') - % connection handle + properties (Access = protected) + % handle: Connection handle to the device handle end methods function brickIO = usbBrickIO(varargin) - %usbBrickIO.usbBrickIO Create a usbBrickIO object + % Create an usbBrickIO object + % + % Arguments: + % varargin: Any number of property names as strings, each followed by the + % desired value. + % + % Examples: + % % Connecting via USB + % commHandle = usbBrickIO(); + % % Connecting via USB with enabled debug output + % commHandle = usbBrickIO('debug', true); % - % usbbrick = usbBrickIO(varargin) is an object which - % initialises a usb connection between MATLAB and the brick - % using hidapi.m. - % - % Notes:: - % - Can take one parameter debug which is a flag specifying - % output printing (0 or 1). + % See also USBBRICKIO.SETPROPERTIES - if nargin == 0 - brickIO.debug = 0; - else - brickIO.debug = varargin{1}; - end + brickIO.setProperties(varargin{:}); if brickIO.debug > 0 fprintf('(DEBUG) (USB init)\n'); end - % Create the usb handle + % Set the connection handle try - brickIO.handle = hidapi(0,brickIO.vendorID,brickIO.productID, ... + brickIO.handle = hidapi(brickIO.vendorID,brickIO.productID, ... brickIO.nReadBuffer,brickIO.nWriteBuffer); catch ME if ~isempty(strfind(ME.identifier, 'InvalidParameterOrFileMissing')) @@ -84,19 +96,18 @@ classdef usbBrickIO < BrickIO end end - % Open the brick IO connection + % Open the connection brickIO.open; end function delete(brickIO) - %usbBrickIO.delete Delete the usbBrickIO object - % - % delete(brickIO) closes the usb connection handle + % Delete the usbBrickIO object and closes the connection if brickIO.debug > 0 fprintf('(DEBUG) (USB delete)\n'); end + % Disconnect try brickIO.close; catch @@ -105,16 +116,13 @@ classdef usbBrickIO < BrickIO end function open(brickIO) - %usbBrickIO.open Open the usbBrickIO object - % - % usbBrickIO.open() opens the usb handle through the hidapi - % interface. + % Opens the usb connection to the brick through the hidapi interface. if brickIO.debug > 0 fprintf('(DEBUG) (USB open)\n'); end - % Open the usb handle (MMI: and handle possible errors) + % Open the usb handle try brickIO.handle.open; catch ME @@ -135,10 +143,8 @@ classdef usbBrickIO < BrickIO end function close(brickIO) - %usbBrickIO.close Close the usbBrickIO object - % - % usbBrickIO.close() closes the usb handle through the hidapi - % interface. + % Closes the usb connection the brick through the hidapi interface. + if brickIO.debug > 0 fprintf('(DEBUG) (USB close) \n'); end @@ -157,14 +163,7 @@ classdef usbBrickIO < BrickIO end function rmsg = read(brickIO) - %usbBrickIO.read Read data from the usbBrickIO object - % - % rmsg = usbBrickIO.read() reads data from the brick through - % usb and returns the data in uint8 format. - % - % Notes:: - % - This function is blocking with no time out in the current - % implementation. + % Reads data from the brick through usb using the hidapi interface and returns the data in uint8 format. if brickIO.debug > 0 fprintf('(DEBUG) (USB read) '); @@ -208,13 +207,10 @@ classdef usbBrickIO < BrickIO end function write(brickIO,wmsg) - %usbBrickIO.write Write data to the usbBrickIO object - % - % usbBrickIO.write(wmsg) writes data to the brick through usb. + % Writes data to the brick through usb using the hidapi interface. % - % Notes:: - % - wmsg is the data to be written to the brick via usb in - % uint8 format. + % Arguments: + % wmsg (uint8 array): Data to be written to the brick via usb if brickIO.debug > 0 fprintf('(DEBUG) (USB write) '); @@ -252,5 +248,33 @@ classdef usbBrickIO < BrickIO brickIO.timeOut = timeOut*1000; end + function setProperties(brickIO, varargin) + % Sets multiple usbBrickIO properties at once using MATLAB's inputParser. + % + % The syntax is as follows: commHandle.setProperties('propertyName1', + % propertyValue1, 'propertyName2', propertyValue2, ...). Valid, optional properties + % are: debug, vendorID, productID, nReadBuffer, nWriteBuffer, timeOut. + % + % See also USBBRICKIO.DEBUG, USBBRICKIO.VENDORID, USBBRICKIO.PRODUCTID, + % USBBRICKIO.NREADBUFFER, USBBRICKIO.NWRITEBUFFER, USBBRICKIO.TIMEOUT + + p = inputParser(); + + p.addOptional('debug', false); + p.addOptional('vendorID', 1684); + p.addOptional('productID', 5); + p.addOptional('nReadBuffer', 1024); + p.addOptional('nWriteBuffer', 1025); + p.addOptional('timeOut', 10000); + + p.parse(varargin{:}); + + brickIO.debug = p.Results.debug; + brickIO.vendorID = p.Results.vendorID; + brickIO.productID = p.Results.productID; + brickIO.nReadBuffer = p.Results.nReadBuffer; + brickIO.nWriteBuffer = p.Results.nWriteBuffer; + brickIO.timeOut = p.Results.timeOut; + end end end