root/tags/version-4.02/RWTHMindstormsNXT/doc/functions/help/NXT_SendKeepAlive.html @ 823

Revision 823, 6.6 KB (checked in by atorf, 4 years ago)

/!\ Create tag for version-4.02

Line 
1
2<!DOCTYPE html
3  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4<html><head>
5      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6   <!--
7This HTML is auto-generated from an M-file.
8To make changes, update the M-file and republish this document.
9      --><title>NXT_SendKeepAlive</title><meta name="generator" content="MATLAB 7.9"><meta name="date" content="2009-10-07"><meta name="m-file" content="script_NXT_SendKeepAlive">
10<link type="text/css" rel="stylesheet" href="../../style.css">
11  </head><body><div class="content"><h1>NXT_SendKeepAlive</h1><!--introduction--><p>Sends a KeepAlive packet. Optional: requests sleep time limit.</p><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#2">Syntax</a></li><li><a href="#5">Description</a></li><li><a href="#15">Examples</a></li><li><a href="#19">See also</a></li><li><a href="#21">Signature</a></li></ul></div><h2>Syntax<a name="2"></a></h2><p><tt>[status SleepTimeLimit] = NXT_SendKeepAlive(ReplyMode)</tt></p><p><tt>[status SleepTimeLimit] = NXT_SendKeepAlive(ReplyMode, handle)</tt></p><h2>Description<a name="5"></a></h2><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.</p><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 that can only be accessed directly on the NXT) will be reset. This counter is not an inactivity counter: Bluetooth traffic 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 turning off is to send a keep-alive packet within this time.</p><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 answer: You obviously didn't use <tt>'reply'</tt> and still tried to get an answer.</p><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.</p><p>If no NXT handle is specified the default one (<tt>COM_GetDefaultNXT</tt>) is used.</p><p>For more details see the official LEGO Mindstorms communication protocol.</p><p><b>Note:</b></p><p>This function is also called by <tt>COM_OpenNXT()</tt>. Then a keep-alive packet is send and the answer will be received to check for a correctly working bidirectional bluetooth connection.</p><h2>Examples<a name="15"></a></h2><pre class="codeinput">   [status SleepTimeLimit] = NXT_SendKeepAlive(<span class="string">'reply'</span>);
12</pre><pre class="codeinput">   NXT_SendKeepAlive(<span class="string">'dontreply'</span>);
13</pre><pre class="codeinput">   handle = COM_OpenNXT(<span class="string">'bluetooth.ini'</span>);
14   [status SleepTimeLimit] = NXT_SendKeepAlive(<span class="string">'reply'</span>, handle);
15</pre><h2>See also<a name="19"></a></h2><p>COM_OpenNXT, NXT_GetBatteryLevel</p><h2>Signature<a name="21"></a></h2><div><ul><li><b>Author:</b> Linus Atorf (see AUTHORS)</li><li><b>Date:</b> 2007/10/15</li><li><b>Copyright:</b> 2007-2009, RWTH Aachen University</li></ul></div><p class="footer"><br>
16</p></div><!--
17##### SOURCE BEGIN #####
18%% NXT_SendKeepAlive
19% Sends a KeepAlive packet. Optional: requests sleep time limit.
20%%
21%% Syntax
22% |[status SleepTimeLimit] = NXT_SendKeepAlive(ReplyMode)|
23%%
24% |[status SleepTimeLimit] = NXT_SendKeepAlive(ReplyMode, handle)|
25%%
26%% Description
27% |[status SleepTimeLimit] = NXT_SendKeepAlive(ReplyMode)| sends a KeepAlive packet to the NXT
28% Brick to get the current sleep time limit of the Brick in milliseconds. By the |ReplyMode|
29% one can request an acknowledgement for the packet transmission. The two strings |'reply'| and
30% |'dontreply'| are valid. |status| indicates if an error occures by the packet transmission.
31% Function |checkStatusBytes| is interpreting this information per default. The value
32% |SleepTimeLimit| contains the time in milliseconds after the NXT brick will turn off
33% automatically. The variable will only be set if |ReplyMode| is |'reply'|. The sleep time limit
34% setting can only  be modified using the on-screen-menu on the brick itself.
35%%
36% Using |'dontreply'| will just send a keep-alive packet. This means, the NXT internal counter when
37% to shut down automatically (this is a setting that can only be accessed directly on the NXT)
38% will be reset. This counter is not an inactivity counter: Bluetooth traffic will NOT stop the
39% NXT from turning off. E.g. if the sleep limit is set to 10 minutes, the only way to keep the NXT
40% Brick from turning off is to send a keep-alive packet within this time.
41%%
42% If you use replymode |'reply'|, SleepTimeLimit tells you the current setting on the brick, in
43% milliseconds. 0 means sleep timer is disabled. -1 is an invalid answer: You obviously didn't use
44% |'reply'| and still tried to get an answer.
45%%
46% |[status SleepTimeLimit] = NXT_SendKeepAlive(ReplyMode, handle)| uses the given NXT
47% connection |handle|. This should be a struct containing a serial handle on a PC system and a file handle on a Linux
48% system.
49%%
50% If no NXT handle is specified the default one (|COM_GetDefaultNXT|) is used.
51%%
52% For more details see the official LEGO Mindstorms communication protocol.
53%%
54%%
55% *Note:*
56%%
57% This function is also called by |COM_OpenNXT()|. Then a keep-alive packet is send and the
58% answer will be received to check for a correctly working bidirectional bluetooth connection.
59%%
60%% Examples
61   [status SleepTimeLimit] = NXT_SendKeepAlive('reply');
62%%
63   NXT_SendKeepAlive('dontreply');
64%%
65   handle = COM_OpenNXT('bluetooth.ini');
66   [status SleepTimeLimit] = NXT_SendKeepAlive('reply', handle);
67%%
68%% See also
69% COM_OpenNXT, NXT_GetBatteryLevel
70%%
71%% Signature
72%%
73% * *Author:* Linus Atorf (see AUTHORS)
74% * *Date:* 2007/10/15
75% * *Copyright:* 2007-2009, RWTH Aachen University
76%
77
78##### SOURCE END #####
79--></body></html>
Note: See TracBrowser for help on using the browser.