| 1 | |
|---|
| 2 | <!DOCTYPE html |
|---|
| 3 | PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
|---|
| 4 | <html> |
|---|
| 5 | <head> |
|---|
| 6 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|---|
| 7 | |
|---|
| 8 | <!-- |
|---|
| 9 | This HTML is auto-generated from an M-file. |
|---|
| 10 | To make changes, update the M-file and republish this document. |
|---|
| 11 | --> |
|---|
| 12 | <title>NXT_SendKeepAlive</title> |
|---|
| 13 | <meta name="generator" content="MATLAB 7.7"> |
|---|
| 14 | <meta name="date" content="2008-11-04"> |
|---|
| 15 | <meta name="m-file" content="script_NXT_SendKeepAlive"> |
|---|
| 16 | <link type="text/css" rel="stylesheet" href="../../style.css"> |
|---|
| 17 | </head> |
|---|
| 18 | <body> |
|---|
| 19 | <p class="header">RWTH - Mindstorms NXT Toolbox</p> |
|---|
| 20 | <div class="content"> |
|---|
| 21 | <h1>NXT_SendKeepAlive</h1> |
|---|
| 22 | <!--introduction--> |
|---|
| 23 | <p>Sends a KeepAlive packet. Optional: requests sleep time limit.</p> |
|---|
| 24 | <!--/introduction--> |
|---|
| 25 | <h2>Contents</h2> |
|---|
| 26 | <div> |
|---|
| 27 | <ul> |
|---|
| 28 | <li><a href="#2">Syntax</a></li> |
|---|
| 29 | <li><a href="#5">Description</a></li> |
|---|
| 30 | <li><a href="#15">Examples</a></li> |
|---|
| 31 | <li><a href="#19">See also</a></li> |
|---|
| 32 | <li><a href="#21">Signature</a></li> |
|---|
| 33 | </ul> |
|---|
| 34 | </div> |
|---|
| 35 | <h2>Syntax<a name="2"></a></h2> |
|---|
| 36 | <p><tt>[status SleepTimeLimit] = NXT_SendKeepAlive(ReplyMode)</tt></p> |
|---|
| 37 | <p><tt>[status SleepTimeLimit] = NXT_SendKeepAlive(ReplyMode, handle)</tt></p> |
|---|
| 38 | <h2>Description<a name="5"></a></h2> |
|---|
| 39 | <p><tt>[status SleepTimeLimit] = NXT_SendKeepAlive(ReplyMode)</tt> sends a KeepAlive packet to the NXT Brick to get the current sleep time limit of the Brick in milliseconds. By the <tt>ReplyMode</tt> one can request an acknowledgement for the packet transmission. The two strings <tt>'reply'</tt> and <tt>'dontreply'</tt> are valid. <tt>status</tt> indicates if an error occures by the packet transmission. Function <tt>checkStatusBytes</tt> is interpreting this information per default. The value <tt>SleepTimeLimit</tt> contains the time in milliseconds after the NXT brick will turn off automatically. The variable will only be set if <tt>ReplyMode</tt> is <tt>'reply'</tt>. The sleep time limit setting can only be modified using the on-screen-menu on the brick itself. |
|---|
| 40 | </p> |
|---|
| 41 | <p>Using <tt>'dontreply'</tt> will just send a keep-alive packet. This means, the NXT internal counter when to shut down automatically (this is a setting |
|---|
| 42 | that can only be accessed directly on the NXT) will be reset. This counter is not an inactivity counter: Bluetooth traffic |
|---|
| 43 | will NOT stop the NXT from turning off. E.g. if the sleep limit is set to 10 minutes, the only way to keep the NXT Brick from |
|---|
| 44 | turning off is to send a keep-alive packet within this time. |
|---|
| 45 | </p> |
|---|
| 46 | <p>If you use replymode <tt>'reply'</tt>, SleepTimeLimit tells you the current setting on the brick, in milliseconds. 0 means sleep timer is disabled. -1 is an invalid |
|---|
| 47 | answer: You obviously didn't use <tt>'reply'</tt> and still tried to get an answer. |
|---|
| 48 | </p> |
|---|
| 49 | <p><tt>[status SleepTimeLimit] = NXT_SendKeepAlive(ReplyMode, handle)</tt> uses the given NXT connection <tt>handle</tt>. This should be a struct containing a serial handle on a PC system and a file handle on a Linux system. |
|---|
| 50 | </p> |
|---|
| 51 | <p>If no NXT handle is specified the default one (<tt>COM_GetDefaultNXT</tt>) is used. |
|---|
| 52 | </p> |
|---|
| 53 | <p>For more details see the official LEGO Mindstorms communication protocol.</p> |
|---|
| 54 | <p><b>Note:</b></p> |
|---|
| 55 | <p>This function is also used if you call <tt>COM_OpenNXT()</tt> with the optional <tt>'check'</tt> parameter. Then a keep-alive packet is send and the answer will be received to check for a correctly working bidirectional |
|---|
| 56 | bluetooth connection. |
|---|
| 57 | </p> |
|---|
| 58 | <h2>Examples<a name="15"></a></h2><pre class="codeinput"> [status SleepTimeLimit] = NXT_SendKeepAlive(<span class="string">'reply'</span>); |
|---|
| 59 | </pre><pre class="codeinput"> NXT_SendKeepAlive(<span class="string">'dontreply'</span>); |
|---|
| 60 | </pre><pre class="codeinput"> handle = COM_OpenNXT(<span class="string">'bluetooth.ini'</span>,<span class="string">'check'</span>); |
|---|
| 61 | [status SleepTimeLimit] = NXT_SendKeepAlive(<span class="string">'reply'</span>, handle); |
|---|
| 62 | </pre><h2>See also<a name="19"></a></h2> |
|---|
| 63 | <p><a href="COM_OpenNXT.html">COM_OpenNXT</a>, <a href="NXT_GetBatteryLevel.html">NXT_GetBatteryLevel</a></p> |
|---|
| 64 | <h2>Signature<a name="21"></a></h2> |
|---|
| 65 | <div> |
|---|
| 66 | <ul> |
|---|
| 67 | <li><b>Author:</b> Linus Atorf (see AUTHORS) |
|---|
| 68 | </li> |
|---|
| 69 | <li><b>Date:</b> 2007/10/15 |
|---|
| 70 | </li> |
|---|
| 71 | <li><b>Copyright:</b> 2007-2008, RWTH Aachen University |
|---|
| 72 | </li> |
|---|
| 73 | </ul> |
|---|
| 74 | </div> |
|---|
| 75 | <p class="footer"><br> |
|---|
| 76 | Published with wg_publish; V1.0<br></p> |
|---|
| 77 | </div> |
|---|
| 78 | <!-- |
|---|
| 79 | ##### SOURCE BEGIN ##### |
|---|
| 80 | %% NXT_SendKeepAlive |
|---|
| 81 | % Sends a KeepAlive packet. Optional: requests sleep time limit. |
|---|
| 82 | %% |
|---|
| 83 | %% Syntax |
|---|
| 84 | % |[status SleepTimeLimit] = NXT_SendKeepAlive(ReplyMode)| |
|---|
| 85 | %% |
|---|
| 86 | % |[status SleepTimeLimit] = NXT_SendKeepAlive(ReplyMode, handle)| |
|---|
| 87 | %% |
|---|
| 88 | %% Description |
|---|
| 89 | % |[status SleepTimeLimit] = NXT_SendKeepAlive(ReplyMode)| sends a KeepAlive packet to the NXT |
|---|
| 90 | % Brick to get the current sleep time limit of the Brick in milliseconds. By the |ReplyMode| |
|---|
| 91 | % one can request an acknowledgement for the packet transmission. The two strings |'reply'| and |
|---|
| 92 | % |'dontreply'| are valid. |status| indicates if an error occures by the packet transmission. |
|---|
| 93 | % Function |checkStatusBytes| is interpreting this information per default. The value |
|---|
| 94 | % |SleepTimeLimit| contains the time in milliseconds after the NXT brick will turn off |
|---|
| 95 | % automatically. The variable will only be set if |ReplyMode| is |'reply'|. The sleep time limit |
|---|
| 96 | % setting can only be modified using the on-screen-menu on the brick itself. |
|---|
| 97 | %% |
|---|
| 98 | % Using |'dontreply'| will just send a keep-alive packet. This means, the NXT internal counter when |
|---|
| 99 | % to shut down automatically (this is a setting that can only be accessed directly on the NXT) |
|---|
| 100 | % will be reset. This counter is not an inactivity counter: Bluetooth traffic will NOT stop the |
|---|
| 101 | % NXT from turning off. E.g. if the sleep limit is set to 10 minutes, the only way to keep the NXT |
|---|
| 102 | % Brick from turning off is to send a keep-alive packet within this time. |
|---|
| 103 | %% |
|---|
| 104 | % If you use replymode |'reply'|, SleepTimeLimit tells you the current setting on the brick, in |
|---|
| 105 | % milliseconds. 0 means sleep timer is disabled. -1 is an invalid answer: You obviously didn't use |
|---|
| 106 | % |'reply'| and still tried to get an answer. |
|---|
| 107 | %% |
|---|
| 108 | % |[status SleepTimeLimit] = NXT_SendKeepAlive(ReplyMode, handle)| uses the given NXT |
|---|
| 109 | % connection |handle|. This should be a struct containing a serial handle on a PC system and a file handle on a Linux |
|---|
| 110 | % system. |
|---|
| 111 | %% |
|---|
| 112 | % If no NXT handle is specified the default one (|COM_GetDefaultNXT|) is used. |
|---|
| 113 | %% |
|---|
| 114 | % For more details see the official LEGO Mindstorms communication protocol. |
|---|
| 115 | %% |
|---|
| 116 | %% |
|---|
| 117 | % *Note:* |
|---|
| 118 | %% |
|---|
| 119 | % This function is also used if you call |COM_OpenNXT()| with the optional |'check'| parameter. Then |
|---|
| 120 | % a keep-alive packet is send and the answer will be received to check for a correctly working |
|---|
| 121 | % bidirectional bluetooth connection. |
|---|
| 122 | %% |
|---|
| 123 | %% Examples |
|---|
| 124 | [status SleepTimeLimit] = NXT_SendKeepAlive('reply'); |
|---|
| 125 | %% |
|---|
| 126 | NXT_SendKeepAlive('dontreply'); |
|---|
| 127 | %% |
|---|
| 128 | handle = COM_OpenNXT('bluetooth.ini','check'); |
|---|
| 129 | [status SleepTimeLimit] = NXT_SendKeepAlive('reply', handle); |
|---|
| 130 | %% |
|---|
| 131 | %% See also |
|---|
| 132 | % COM_OpenNXT, NXT_GetBatteryLevel |
|---|
| 133 | %% |
|---|
| 134 | %% Signature |
|---|
| 135 | %% |
|---|
| 136 | % * *Author:* Linus Atorf (see AUTHORS) |
|---|
| 137 | % * *Date:* 2007/10/15 |
|---|
| 138 | % * *Copyright:* 2007-2008, RWTH Aachen University |
|---|
| 139 | % |
|---|
| 140 | |
|---|
| 141 | ##### SOURCE END ##### |
|---|
| 142 | --> |
|---|
| 143 | </body> |
|---|
| 144 | </html> |
|---|