<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <!-- $Id: header.html 8799 2010-06-28 04:12:42Z jpgr87 $ --> <HEAD> <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=utf-8"> <meta name="keywords" content="stage, robot, simulation, player, player/stage"> <link href="doxygen.css" rel="stylesheet" type="text/css"> <style type="text/css"> .floatright { float: right; margin: 0 0 1em 1em; } body { font-family: sans-serif; #font-family: Geneva, Verdana, Helvetica, Arial, sans-serif; background-color: #FFF; color:#000; } a:link { color: #A00; } a:visited { color: #800; } a { text-decoration: none; } a:hover { text-decoration: underline; } .timestamp { text-align:right; background-color: #DDD; font-size:75%;} h1 { font-size:160%; } h2 { font-size:110%; #color: #FFF; #background-color: #666; #padding:3px; } h3 { text-align:left; } img { border: 0; } ul.menu { position:relative; left:-2.5em; margin-bottom:0px; margin-top:0px; } ul.menu1 { position:relative; left:-2.1em; margin-bottom:0px; margin-top:0px; } li.menu { list-style-type: none; position:relative; #left:-0.5em; } #sidebar { position: absolute; left:0px; padding:2em; top:0em; width:12em;} #content { position: absolute; left:12em; top:0em; padding-left:3em; padding-right:3em; padding-bottom:2em; margin-top:1em; margin-right:2em; } div.box { background-color:#EEE; border: 1px solid #000; padding: 0.5ex 0.4em 0.5ex 0.6em; margin:1em; } div.title { font-weight:bold; background-color:#eee; margin-bottom:2px;} div.topbar { position: absolute; top:0px; left:9em; margin:1em; } </style> <TITLE>Player Manual</TITLE> </HEAD> <body> <div id="sidebar"> <h2 style="text-align:center;"> <a href="index.html"> <img width=140 src="http://playerstage.sourceforge.net/images/player_button_v3.png" alt="Player logo"><br></a> </h2> <div class="box"> <div class=title>Player</div> <ul class=menu> <li class=menu><a href="index.html">Frontpage</a> <li class=menu><a href="modules.html">Contents</a> </ul> </div> <div class="box"> <div class=title>User</div> <ul class=menu> <li class=menu><a href="install.html">Installation</a> <li class=menu><a href="start.html">Quick start</a> <li class=menu><a href="supported_hardware.html">Supported devices</a> <li class=menu><a href="group__tutorials.html">Tutorials</a> <li class=menu><a href="group__utils.html">Utilities</a> <li class=menu><a href="group__clientlibs.html">Client libraries</a> <li class=menu><a href="http://playerstage.sourceforge.net/wiki/Basic_FAQ">FAQ</a> <li class=menu><a href="help.html">Help</a> </ul> </div> <div class=box> <div class="title">Developer</div> <ul class=menu> <li class=menu><a href="architecture.html">Architecture</a> <li class=menu><a href="group__libplayercore.html">libplayercore</a> <ul class=menu1> <li class=menu><a href="group__interfaces.html">interfaces</a></li> </ul> <li class=menu><a href="group__libplayerdrivers.html">libplayerdrivers</a> <ul class=menu1> <li class=menu><a href="group__drivers.html">drivers</a></li> </ul> <li class=menu><a href="group__libplayercommon.html">libplayercommon</a> <li class=menu><a href="group__libplayerutils.html">libplayerutils</a> <li class=menu><a href="group__libplayersd.html">libplayersd</a> <li class=menu><a href="group__libplayertcp.html">libplayertcp</a> <li class=menu><a href="group__libplayerxdr.html">libplayerxdr</a> <li class=menu><a href="todo.html">TODO</a> </ul> </div> <div class=box> <!-- <a href="http://sourceforge.net"><img border=0 src="http://sourceforge.net/sflogo.php?group_id=42445&type=1"></a> --> <div class="title">Online</div> <a href="http://playerstage.sourceforge.net">Homepage</a><br> <a href="http://sourceforge.net/project/showfiles.php?group_id=42445">Download</a><br> <a href="http://sourceforge.net/projects/playerstage">Project</a><br> <a href="http://sourceforge.net/tracker/?group_id=42445">Bugs</a><br> <a href="http://sourceforge.net/mail/?group_id=42445">Help</a> </div> </div> <div id="content" > <!-- Generated by Doxygen 1.7.1 --> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> | <a href="#pub-static-methods">Static Public Member Functions</a> | <a href="#pub-attribs">Public Attributes</a> | <a href="#pri-methods">Private Member Functions</a> | <a href="#pri-attribs">Private Attributes</a> </div> <div class="headertitle"> <h1>Device Class Reference</h1> </div> </div> <div class="contents"> <!-- doxytag: class="Device" --> <p>Encapsulates a device (i.e., a driver bound to an interface). <a href="#_details">More...</a></p> <p><code>#include <<a class="el" href="device_8h_source.html">device.h</a>></code></p> <p><a href="classDevice-members.html">List of all members.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="pub-methods"></a> Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDevice.html#aef388fad91ece20040656c543a358719">Device</a> (<a class="el" href="structplayer__devaddr.html">player_devaddr_t</a> <a class="el" href="classDevice.html#a8709f3daf14c81e3171a7b830df48d05">addr</a>, <a class="el" href="classDriver.html">Driver</a> *<a class="el" href="classDevice.html#a368b0f68162b000fb49d444f856addaf">driver</a>)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Constructor. <a href="#aef388fad91ece20040656c543a358719"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9dabc419c8d8df3a686c33ce042bc99a"></a><!-- doxytag: member="Device::~Device" ref="a9dabc419c8d8df3a686c33ce042bc99a" args="()" --> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDevice.html#a9dabc419c8d8df3a686c33ce042bc99a">~Device</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classDevice.html#af98df4944ecf9090d0c08749a7765336">Subscribe</a> (<a class="el" href="classQueuePointer.html">QueuePointer</a> &sub_queue)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Subscribe the given queue to this device. <a href="#af98df4944ecf9090d0c08749a7765336"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classDevice.html#a9f1e6c11baba44692a2e1f502d284201">Unsubscribe</a> (<a class="el" href="classQueuePointer.html">QueuePointer</a> &sub_queue)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Unsubscribe the given queue from this device. <a href="#a9f1e6c11baba44692a2e1f502d284201"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classDevice.html#a37323e0a016d0f8fb544199129f05a4e">PutMsg</a> (<a class="el" href="classQueuePointer.html">QueuePointer</a> &resp_queue, uint8_t type, uint8_t subtype, void *src, size_t deprecated, double *timestamp)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Send a message to this device. <a href="#a37323e0a016d0f8fb544199129f05a4e"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classDevice.html#a97acb8395613509b9aeae66e51756adf">PutMsg</a> (<a class="el" href="classQueuePointer.html">QueuePointer</a> &resp_queue, <a class="el" href="structplayer__msghdr.html">player_msghdr_t</a> *hdr, void *src, bool copy=true)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Send a message to this device (short form). <a href="#a97acb8395613509b9aeae66e51756adf"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classMessage.html">Message</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classDevice.html#aeafd1418afc82da4603310b6e35ff3dc">Request</a> (<a class="el" href="classQueuePointer.html">QueuePointer</a> &resp_queue, uint8_t type, uint8_t subtype, void *src, size_t deprecated, double *timestamp, bool threaded=true)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Make a request of another device. <a href="#aeafd1418afc82da4603310b6e35ff3dc"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classMessage.html">Message</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classDevice.html#a012b411cbffd132858beb20c1aa62a25">TimedRequest</a> (<a class="el" href="classQueuePointer.html">QueuePointer</a> &resp_queue, uint8_t type, uint8_t subtype, void *src, double timeout=0, double *timestamp=NULL, bool threaded=true)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Make a request of another device with a timeout. <a href="#a012b411cbffd132858beb20c1aa62a25"></a><br/></td></tr> <tr><td colspan="2"><h2><a name="pub-static-methods"></a> Static Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classDevice.html#a23253859a221d3e66fbd67e8f440132f">MatchDeviceAddress</a> (<a class="el" href="structplayer__devaddr.html">player_devaddr_t</a> addr1, <a class="el" href="structplayer__devaddr.html">player_devaddr_t</a> addr2)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Compare two addresses. <a href="#a23253859a221d3e66fbd67e8f440132f"></a><br/></td></tr> <tr><td colspan="2"><h2><a name="pub-attribs"></a> Public Attributes</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8b9abbac5e655959a512bcf1c254cf3f"></a><!-- doxytag: member="Device::next" ref="a8b9abbac5e655959a512bcf1c254cf3f" args="" --> <a class="el" href="classDevice.html">Device</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classDevice.html#a8b9abbac5e655959a512bcf1c254cf3f">next</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Next entry in the device table (this is a linked-list). <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8709f3daf14c81e3171a7b830df48d05"></a><!-- doxytag: member="Device::addr" ref="a8709f3daf14c81e3171a7b830df48d05" args="" --> <a class="el" href="structplayer__devaddr.html">player_devaddr_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDevice.html#a8709f3daf14c81e3171a7b830df48d05">addr</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Address for this device. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab008af8ea4fbbd117876f75606a55051"></a><!-- doxytag: member="Device::drivername" ref="ab008af8ea4fbbd117876f75606a55051" args="[PLAYER_MAX_DRIVER_STRING_LEN]" --> char </td><td class="memItemRight" valign="bottom"><a class="el" href="classDevice.html#ab008af8ea4fbbd117876f75606a55051">drivername</a> [PLAYER_MAX_DRIVER_STRING_LEN]</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">The string name for the underlying driver. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a67ba68fe0a571649c7102b45474e3d49"></a><!-- doxytag: member="Device::InQueue" ref="a67ba68fe0a571649c7102b45474e3d49" args="" --> <a class="el" href="classQueuePointer.html">QueuePointer</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classDevice.html#a67ba68fe0a571649c7102b45474e3d49">InQueue</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Pointer to the underlying driver's queue. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a375136f79dcb0fd53f2ed19eeae94d08"></a><!-- doxytag: member="Device::queues" ref="a375136f79dcb0fd53f2ed19eeae94d08" args="" --> <a class="el" href="classQueuePointer.html">QueuePointer</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classDevice.html#a375136f79dcb0fd53f2ed19eeae94d08">queues</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Linked list of subscribed queues. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6aa405426409083c9636b27164818c9e"></a><!-- doxytag: member="Device::len_queues" ref="a6aa405426409083c9636b27164818c9e" args="" --> size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classDevice.html#a6aa405426409083c9636b27164818c9e">len_queues</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Length of <code>queues</code>. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a368b0f68162b000fb49d444f856addaf"></a><!-- doxytag: member="Device::driver" ref="a368b0f68162b000fb49d444f856addaf" args="" --> <a class="el" href="classDriver.html">Driver</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classDevice.html#a368b0f68162b000fb49d444f856addaf">driver</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Pointer to the underlying driver. <br/></td></tr> <tr><td colspan="2"><h2><a name="pri-methods"></a> Private Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classDevice.html#a7a6831a89fa314b2cbdcd4886a6edeb5">Lock</a> (void)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Lock access to driver internals. <a href="#a7a6831a89fa314b2cbdcd4886a6edeb5"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classDevice.html#adc4eaf70294f20cca56960ba2223f6c0">Unlock</a> (void)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Unlock access to driver internals. <a href="#adc4eaf70294f20cca56960ba2223f6c0"></a><br/></td></tr> <tr><td colspan="2"><h2><a name="pri-attribs"></a> Private Attributes</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">pthread_mutex_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classDevice.html#a34e4808425e5aef50be532a3d7a4ed7d">accessMutex</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Mutex used to lock access, via <a class="el" href="classDevice.html#a7a6831a89fa314b2cbdcd4886a6edeb5" title="Lock access to driver internals.">Lock()</a> and <a class="el" href="classDevice.html#adc4eaf70294f20cca56960ba2223f6c0" title="Unlock access to driver internals.">Unlock()</a>, to device internals, like the list of subscribed queues. <a href="#a34e4808425e5aef50be532a3d7a4ed7d"></a><br/></td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>Encapsulates a device (i.e., a driver bound to an interface). </p> <p>A device describes an instantiated driver/interface combination. Drivers may support more than one interface, and hence appear more than once in the device table. </p> <hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="aef388fad91ece20040656c543a358719"></a><!-- doxytag: member="Device::Device" ref="aef388fad91ece20040656c543a358719" args="(player_devaddr_t addr, Driver *driver)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">Device::Device </td> <td>(</td> <td class="paramtype"><a class="el" href="structplayer__devaddr.html">player_devaddr_t</a> </td> <td class="paramname"> <em>addr</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classDriver.html">Driver</a> * </td> <td class="paramname"> <em>driver</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Constructor. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>addr</em> </td><td>: <a class="el" href="classDevice.html" title="Encapsulates a device (i.e., a driver bound to an interface).">Device</a> address </td></tr> <tr><td valign="top"></td><td valign="top"><em>driver</em> </td><td>: Pointer to the underlying driver </td></tr> </table> </dd> </dl> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="a7a6831a89fa314b2cbdcd4886a6edeb5"></a><!-- doxytag: member="Device::Lock" ref="a7a6831a89fa314b2cbdcd4886a6edeb5" args="(void)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void Device::Lock </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"></td> <td> ) </td> <td><code> [private]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Lock access to driver internals. </p> </div> </div> <a class="anchor" id="a23253859a221d3e66fbd67e8f440132f"></a><!-- doxytag: member="Device::MatchDeviceAddress" ref="a23253859a221d3e66fbd67e8f440132f" args="(player_devaddr_t addr1, player_devaddr_t addr2)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static bool Device::MatchDeviceAddress </td> <td>(</td> <td class="paramtype"><a class="el" href="structplayer__devaddr.html">player_devaddr_t</a> </td> <td class="paramname"> <em>addr1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="structplayer__devaddr.html">player_devaddr_t</a> </td> <td class="paramname"> <em>addr2</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [inline, static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Compare two addresses. </p> <p>This static method returns true if all 4 components of the two addresses match exactly. It's useful in <a class="el" href="classDriver.html#ab05d0e8502a494a83d0442a48095a35c" title="Message handler.">Driver::ProcessMessage</a> when you're deciding how to handle a message. </p> <p>References <a class="el" href="structplayer__devaddr.html#a7514f8e66c9532d235cc4258a7102af5">player_devaddr::host</a>, <a class="el" href="structplayer__devaddr.html#a2814dc42b4162c8451876312fc85f0a8">player_devaddr::index</a>, <a class="el" href="structplayer__devaddr.html#ac6a1d9efc69d7dee301aba2ef4b5948d">player_devaddr::interf</a>, and <a class="el" href="structplayer__devaddr.html#a5bfc4826407c3a01f4ae884ffcef00c7">player_devaddr::robot</a>.</p> <p>Referenced by <a class="el" href="classImageBase.html#af23227a29cf828ae353915e888be3cd4">ImageBase::MainSetup()</a>, <a class="el" href="classLaserTransform.html#aa3c5273497a2e440f689b9e5dced38b3">LaserTransform::Setup()</a>, <a class="el" href="classwbr914.html#a93132cdd0e2122bf0c632b74b935384b">wbr914::Subscribe()</a>, <a class="el" href="classP2OS.html#a41b9cfcee8fa3fd74bd1aa27d8286fac">P2OS::Subscribe()</a>, <a class="el" href="classErratic.html#aa299b2b9882799be7d1d3eafa8deea20">Erratic::Subscribe()</a>, <a class="el" href="classwbr914.html#aeac8601fe05d521fde33f008d29879a9">wbr914::Unsubscribe()</a>, <a class="el" href="classP2OS.html#a9a9a48fe08bc40aafb73bf6e5ead1368">P2OS::Unsubscribe()</a>, and <a class="el" href="classErratic.html#a6b9ad903cdbc6a8576191159e5d8432f">Erratic::Unsubscribe()</a>.</p> </div> </div> <a class="anchor" id="a97acb8395613509b9aeae66e51756adf"></a><!-- doxytag: member="Device::PutMsg" ref="a97acb8395613509b9aeae66e51756adf" args="(QueuePointer &resp_queue, player_msghdr_t *hdr, void *src, bool copy=true)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void Device::PutMsg </td> <td>(</td> <td class="paramtype"><a class="el" href="classQueuePointer.html">QueuePointer</a> & </td> <td class="paramname"> <em>resp_queue</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="structplayer__msghdr.html">player_msghdr_t</a> * </td> <td class="paramname"> <em>hdr</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void * </td> <td class="paramname"> <em>src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">bool </td> <td class="paramname"> <em>copy</em> = <code>true</code></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Send a message to this device (short form). </p> <p>This form of PutMsg is useful if you already have the message header assembled (e.g., when you're forwarding a message).</p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>resp_queue</em> </td><td>Where to push any reply </td></tr> <tr><td valign="top"></td><td valign="top"><em>hdr</em> </td><td>The message header. </td></tr> <tr><td valign="top"></td><td valign="top"><em>src</em> </td><td>The message body (its size is stored in hdr->size). </td></tr> <tr><td valign="top"></td><td valign="top"><em>copy</em> </td><td>If copy is false then the message will be claimed by the device </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a37323e0a016d0f8fb544199129f05a4e"></a><!-- doxytag: member="Device::PutMsg" ref="a37323e0a016d0f8fb544199129f05a4e" args="(QueuePointer &resp_queue, uint8_t type, uint8_t subtype, void *src, size_t deprecated, double *timestamp)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void Device::PutMsg </td> <td>(</td> <td class="paramtype"><a class="el" href="classQueuePointer.html">QueuePointer</a> & </td> <td class="paramname"> <em>resp_queue</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint8_t </td> <td class="paramname"> <em>type</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint8_t </td> <td class="paramname"> <em>subtype</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void * </td> <td class="paramname"> <em>src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"> <em>deprecated</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">double * </td> <td class="paramname"> <em>timestamp</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Send a message to this device. </p> <p>This method is the basic way of sending a message to a device. The header will be assembled and the message will get pushed on to the underlying driver's InQueue.</p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>resp_queue</em> </td><td>: Where to push any reply (e.g., your InQueue) </td></tr> <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>: <a class="el" href="classMessage.html" title="Reference-counted message objects.">Message</a> type </td></tr> <tr><td valign="top"></td><td valign="top"><em>subtype</em> </td><td>: <a class="el" href="classMessage.html" title="Reference-counted message objects.">Message</a> subtype </td></tr> <tr><td valign="top"></td><td valign="top"><em>src</em> </td><td>: <a class="el" href="classMessage.html" title="Reference-counted message objects.">Message</a> payload </td></tr> <tr><td valign="top"></td><td valign="top"><em>deprecated,:</em> </td><td>Used to be the length of the message this is now calculated </td></tr> <tr><td valign="top"></td><td valign="top"><em>timestamp</em> </td><td>: If non-NULL, the timestamp to attach to the message; otherwise, the current time is filled in. </td></tr> </table> </dd> </dl> <p>Referenced by <a class="el" href="classSegwayRMP400.html#a93f9e247bb5689d176e069c2adff3e1d">SegwayRMP400::HandlePosition2DCmd()</a>, <a class="el" href="classSegwayRMP400.html#acc75b9921b519fbf42577452a7ae618c">SegwayRMP400::HandlePosition3DCmd()</a>, <a class="el" href="classToRanger.html#a2a0a688951f0f51460c259584493e7ea">ToRanger::ProcessMessage()</a>, <a class="el" href="classLaserTransform.html#ad85a020e370ec75e3977bed61a0624f7">LaserTransform::ProcessMessage()</a>, and <a class="el" href="classFromRanger.html#a95869a189fba3c194cad01e92639fa6d">FromRanger::ProcessMessage()</a>.</p> </div> </div> <a class="anchor" id="aeafd1418afc82da4603310b6e35ff3dc"></a><!-- doxytag: member="Device::Request" ref="aeafd1418afc82da4603310b6e35ff3dc" args="(QueuePointer &resp_queue, uint8_t type, uint8_t subtype, void *src, size_t deprecated, double *timestamp, bool threaded=true)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classMessage.html">Message</a>* Device::Request </td> <td>(</td> <td class="paramtype"><a class="el" href="classQueuePointer.html">QueuePointer</a> & </td> <td class="paramname"> <em>resp_queue</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint8_t </td> <td class="paramname"> <em>type</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint8_t </td> <td class="paramname"> <em>subtype</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void * </td> <td class="paramname"> <em>src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"> <em>deprecated</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">double * </td> <td class="paramname"> <em>timestamp</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">bool </td> <td class="paramname"> <em>threaded</em> = <code>true</code></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Make a request of another device. </p> <p>This method send a request message to a device and waits for the reply.</p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>resp_queue</em> </td><td>: Where to push the reply (e.g., your InQueue) </td></tr> <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>: <a class="el" href="classMessage.html" title="Reference-counted message objects.">Message</a> type (usually PLAYER_MSGTYPE_REQ). </td></tr> <tr><td valign="top"></td><td valign="top"><em>subtype</em> </td><td>: <a class="el" href="classMessage.html" title="Reference-counted message objects.">Message</a> subtype (interface-specific) </td></tr> <tr><td valign="top"></td><td valign="top"><em>src</em> </td><td>: <a class="el" href="classMessage.html" title="Reference-counted message objects.">Message</a> body </td></tr> <tr><td valign="top"></td><td valign="top"><em>deprecated,:</em> </td><td>Used to be the length of the message this is now calculated </td></tr> <tr><td valign="top"></td><td valign="top"><em>timestamp</em> </td><td>: If non-NULL, the timestamp to attach to the request; otherwise, the current time is filled in. </td></tr> <tr><td valign="top"></td><td valign="top"><em>threaded</em> </td><td>: True if the caller is executing in its own thread, false otherwise</td></tr> </table> </dd> </dl> <dl class="note"><dt><b>Note:</b></dt><dd>It is is crucial that <code>threaded</code> be set correctly. If you call this method from within Setup() or Shutdown(), or if your driver does not run in its own thread, then <code>threaded</code> must be false. Deadlocks will otherwise result.</dd></dl> <dl class="return"><dt><b>Returns:</b></dt><dd>A pointer to the reply message. The caller is responsible for deleting this pointer. </dd></dl> <p>Referenced by <a class="el" href="classsnd.html#a92897857622d982630d9d93104fd3b42">snd::ProcessMessage()</a>, and <a class="el" href="classSegwayRMP400.html#a349a66282dd9c799c541014713d2cec4">SegwayRMP400::ProcessMessage()</a>.</p> </div> </div> <a class="anchor" id="af98df4944ecf9090d0c08749a7765336"></a><!-- doxytag: member="Device::Subscribe" ref="af98df4944ecf9090d0c08749a7765336" args="(QueuePointer &sub_queue)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int Device::Subscribe </td> <td>(</td> <td class="paramtype"><a class="el" href="classQueuePointer.html">QueuePointer</a> & </td> <td class="paramname"> <em>sub_queue</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Subscribe the given queue to this device. </p> <dl class="return"><dt><b>Returns:</b></dt><dd>0 on success, non-zero otherwise. </dd></dl> <p>Referenced by <a class="el" href="classImageBase.html#af23227a29cf828ae353915e888be3cd4">ImageBase::MainSetup()</a>, and <a class="el" href="classLaserTransform.html#aa3c5273497a2e440f689b9e5dced38b3">LaserTransform::Setup()</a>.</p> </div> </div> <a class="anchor" id="a012b411cbffd132858beb20c1aa62a25"></a><!-- doxytag: member="Device::TimedRequest" ref="a012b411cbffd132858beb20c1aa62a25" args="(QueuePointer &resp_queue, uint8_t type, uint8_t subtype, void *src, double timeout=0, double *timestamp=NULL, bool threaded=true)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classMessage.html">Message</a>* Device::TimedRequest </td> <td>(</td> <td class="paramtype"><a class="el" href="classQueuePointer.html">QueuePointer</a> & </td> <td class="paramname"> <em>resp_queue</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint8_t </td> <td class="paramname"> <em>type</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint8_t </td> <td class="paramname"> <em>subtype</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void * </td> <td class="paramname"> <em>src</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">double </td> <td class="paramname"> <em>timeout</em> = <code>0</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">double * </td> <td class="paramname"> <em>timestamp</em> = <code>NULL</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">bool </td> <td class="paramname"> <em>threaded</em> = <code>true</code></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Make a request of another device with a timeout. </p> <p>This method send a request message to a device and waits for the reply. If a timeout occurs it returns NULL.</p> <p>Note that any driver calling this here a timeout is not going to be a bad error also needs to add into its process messages somethig to handle the ACKs if they are recieved after the timeout. As such I would recomment that this is only called with a timeout not 0 if a timeout occurring is an indicaion of a system ailure (and a stall is unacceptable)</p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>resp_queue</em> </td><td>: Where to push the reply (e.g., your InQueue) </td></tr> <tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>: <a class="el" href="classMessage.html" title="Reference-counted message objects.">Message</a> type (usually PLAYER_MSGTYPE_REQ). </td></tr> <tr><td valign="top"></td><td valign="top"><em>subtype</em> </td><td>: <a class="el" href="classMessage.html" title="Reference-counted message objects.">Message</a> subtype (interface-specific) </td></tr> <tr><td valign="top"></td><td valign="top"><em>src</em> </td><td>: <a class="el" href="classMessage.html" title="Reference-counted message objects.">Message</a> body </td></tr> <tr><td valign="top"></td><td valign="top"><em>timeout,:</em> </td><td>How long to wait for a response, if zero will never timeout </td></tr> <tr><td valign="top"></td><td valign="top"><em>timestamp</em> </td><td>: If non-NULL, the timestamp to attach to the request; otherwise, the current time is filled in. </td></tr> <tr><td valign="top"></td><td valign="top"><em>threaded</em> </td><td>: True if the caller is executing in its own thread, false otherwise</td></tr> </table> </dd> </dl> <dl class="note"><dt><b>Note:</b></dt><dd>It is is crucial that <code>threaded</code> be set correctly. If you call this method from within Setup() or Shutdown(), or if your driver does not run in its own thread, then <code>threaded</code> must be false. Deadlocks will otherwise result.</dd></dl> <dl class="return"><dt><b>Returns:</b></dt><dd>A pointer to the reply message. The caller is responsible for deleting this pointer. Will return NULL on a failure </dd></dl> </div> </div> <a class="anchor" id="adc4eaf70294f20cca56960ba2223f6c0"></a><!-- doxytag: member="Device::Unlock" ref="adc4eaf70294f20cca56960ba2223f6c0" args="(void)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void Device::Unlock </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"></td> <td> ) </td> <td><code> [private]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Unlock access to driver internals. </p> </div> </div> <a class="anchor" id="a9f1e6c11baba44692a2e1f502d284201"></a><!-- doxytag: member="Device::Unsubscribe" ref="a9f1e6c11baba44692a2e1f502d284201" args="(QueuePointer &sub_queue)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int Device::Unsubscribe </td> <td>(</td> <td class="paramtype"><a class="el" href="classQueuePointer.html">QueuePointer</a> & </td> <td class="paramname"> <em>sub_queue</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Unsubscribe the given queue from this device. </p> <dl class="return"><dt><b>Returns:</b></dt><dd>0 on success, non-zero otherwise. </dd></dl> <p>Referenced by <a class="el" href="classImageBase.html#afcc6276236e652af29f2c590e1a05de5">ImageBase::MainQuit()</a>, <a class="el" href="classsnd.html#a0c601e3520ca8e8ba5c13e6677c4cc5a">snd::Shutdown()</a>, and <a class="el" href="classLaserTransform.html#a069f34add7646ae39ce850dbd06c6cc7">LaserTransform::Shutdown()</a>.</p> </div> </div> <hr/><h2>Member Data Documentation</h2> <a class="anchor" id="a34e4808425e5aef50be532a3d7a4ed7d"></a><!-- doxytag: member="Device::accessMutex" ref="a34e4808425e5aef50be532a3d7a4ed7d" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">pthread_mutex_t <a class="el" href="classDevice.html#a34e4808425e5aef50be532a3d7a4ed7d">Device::accessMutex</a><code> [private]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Mutex used to lock access, via <a class="el" href="classDevice.html#a7a6831a89fa314b2cbdcd4886a6edeb5" title="Lock access to driver internals.">Lock()</a> and <a class="el" href="classDevice.html#adc4eaf70294f20cca56960ba2223f6c0" title="Unlock access to driver internals.">Unlock()</a>, to device internals, like the list of subscribed queues. </p> </div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li><a class="el" href="device_8h_source.html">device.h</a></li> </ul> </div> <!-- render the modification time of the source file --> <div class="timestamp"> <hr> <table style="width:100%;"> <tr> <td style="text-align:left;"> Last updated 12 September 2005 21:38:45 <!-- <td style="text-align:right;"> <a href="http://validator.w3.org/check/referer"><img style="vertical-align:middle;border:0;width:88px;height:31px" src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a> <a href="http://jigsaw.w3.org/css-validator/"> <img style="vertical-align:middle;border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> </a> --> </tr> </table> </div> </tr> </table> </BODY> </HTML>