You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

137 lines
14 KiB

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>ArduPilot Libraries: /home/jgoppert/Projects/ap/libraries/AP_GPS/GPS.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.1 -->
<div class="navigation" id="top">
<div class="tabs">
<ul class="tablist">
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
</ul>
</div>
<div class="header">
<div class="headertitle">
<h1>/home/jgoppert/Projects/ap/libraries/AP_GPS/GPS.h</h1> </div>
</div>
<div class="contents">
<a href="_g_p_s_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*-</span>
<a name="l00002"></a>00002
<a name="l00005"></a>00005
<a name="l00006"></a>00006 <span class="preprocessor">#ifndef GPS_h</span>
<a name="l00007"></a>00007 <span class="preprocessor"></span><span class="preprocessor">#define GPS_h</span>
<a name="l00008"></a>00008 <span class="preprocessor"></span>
<a name="l00009"></a>00009 <span class="preprocessor">#include &lt;inttypes.h&gt;</span>
<a name="l00010"></a>00010 <span class="preprocessor">#include &lt;Stream.h&gt;</span>
<a name="l00011"></a>00011
<a name="l00014"></a><a class="code" href="class_g_p_s.html">00014</a> <span class="keyword">class </span><a class="code" href="class_g_p_s.html" title="Abstract base class for GPS receiver drivers.">GPS</a>
<a name="l00015"></a>00015 {
<a name="l00016"></a>00016 <span class="keyword">public</span>:
<a name="l00017"></a>00017
<a name="l00025"></a><a class="code" href="class_g_p_s.html#a8ba9e9e496efbaf3524b0bf47302aee3">00025</a> <a class="code" href="class_g_p_s.html#a8ba9e9e496efbaf3524b0bf47302aee3">GPS</a>(<a class="code" href="class_stream.html">Stream</a> *s) : <a class="code" href="class_g_p_s.html#ab534b33b2596f63c716744b6e258c6ee" title="port the GPS is attached to">_port</a>(s) {};
<a name="l00026"></a>00026
<a name="l00034"></a>00034 <span class="keywordtype">void</span> <a class="code" href="class_g_p_s.html#a05a534e0c72a450d6c9ae6207513e59a">update</a>(<span class="keywordtype">void</span>);
<a name="l00035"></a>00035
<a name="l00040"></a><a class="code" href="class_g_p_s.html#aa3c9862ff33053e317f423a398bd92c0">00040</a> <span class="keyword">enum</span> <a class="code" href="class_g_p_s.html#aa3c9862ff33053e317f423a398bd92c0">GPS_Status</a> {
<a name="l00041"></a><a class="code" href="class_g_p_s.html#aa3c9862ff33053e317f423a398bd92c0ac0fa717d7b54a06e36c2b30644001dae">00041</a> <a class="code" href="class_g_p_s.html#aa3c9862ff33053e317f423a398bd92c0ac0fa717d7b54a06e36c2b30644001dae" title="No GPS connected/detected.">NO_GPS</a> = 0,
<a name="l00042"></a><a class="code" href="class_g_p_s.html#aa3c9862ff33053e317f423a398bd92c0a81bda4cd96be8b2577fc963c6ba23fa8">00042</a> <a class="code" href="class_g_p_s.html#aa3c9862ff33053e317f423a398bd92c0a81bda4cd96be8b2577fc963c6ba23fa8" title="Receiving valid GPS messages but no lock.">NO_FIX</a> = 1,
<a name="l00043"></a><a class="code" href="class_g_p_s.html#aa3c9862ff33053e317f423a398bd92c0abd7c07383a51c659af88b8b7bd0df240">00043</a> <a class="code" href="class_g_p_s.html#aa3c9862ff33053e317f423a398bd92c0abd7c07383a51c659af88b8b7bd0df240" title="Receiving valid messages and locked.">GPS_OK</a> = 2
<a name="l00044"></a>00044 };
<a name="l00045"></a>00045
<a name="l00053"></a><a class="code" href="class_g_p_s.html#a0678132b5dba41a2e53c3398cd0492c3">00053</a> <a class="code" href="class_g_p_s.html#aa3c9862ff33053e317f423a398bd92c0">GPS_Status</a> <a class="code" href="class_g_p_s.html#a0678132b5dba41a2e53c3398cd0492c3">status</a>(<span class="keywordtype">void</span>) { <span class="keywordflow">return</span> _status; }
<a name="l00054"></a>00054
<a name="l00062"></a>00062 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_g_p_s.html#a2aecc2de1271d131b132ad2e259101ad">init</a>(<span class="keywordtype">void</span>) = 0;
<a name="l00063"></a>00063
<a name="l00064"></a>00064 <span class="comment">// Properties</span>
<a name="l00065"></a><a class="code" href="class_g_p_s.html#a5400664cf0d912138e91260cbd2b3fa0">00065</a> <span class="keywordtype">long</span> <a class="code" href="class_g_p_s.html#a5400664cf0d912138e91260cbd2b3fa0" title="GPS time in milliseconds from the start of the week.">time</a>;
<a name="l00066"></a><a class="code" href="class_g_p_s.html#aa5df9c7bd452a9689054e55ec90dfef1">00066</a> <span class="keywordtype">long</span> <a class="code" href="class_g_p_s.html#aa5df9c7bd452a9689054e55ec90dfef1" title="latitude in degrees * 10,000,000">latitude</a>;
<a name="l00067"></a><a class="code" href="class_g_p_s.html#ae64cbfd073326bd5ec8a6d0a1bae2746">00067</a> <span class="keywordtype">long</span> <a class="code" href="class_g_p_s.html#ae64cbfd073326bd5ec8a6d0a1bae2746" title="longitude in degrees * 10,000,000">longitude</a>;
<a name="l00068"></a><a class="code" href="class_g_p_s.html#aaf73c8b7f3a10e7c37432448ad6582b2">00068</a> <span class="keywordtype">long</span> <a class="code" href="class_g_p_s.html#aaf73c8b7f3a10e7c37432448ad6582b2" title="altitude in cm">altitude</a>;
<a name="l00069"></a><a class="code" href="class_g_p_s.html#aba8ad9c8dd3aac81d0e3e2b25ef304c0">00069</a> <span class="keywordtype">long</span> <a class="code" href="class_g_p_s.html#aba8ad9c8dd3aac81d0e3e2b25ef304c0" title="ground speed in cm/sec">ground_speed</a>;
<a name="l00070"></a><a class="code" href="class_g_p_s.html#a223b8bf1d912252c15aff621c37d00e3">00070</a> <span class="keywordtype">long</span> <a class="code" href="class_g_p_s.html#a223b8bf1d912252c15aff621c37d00e3" title="ground course in 100ths of a degree">ground_course</a>;
<a name="l00071"></a><a class="code" href="class_g_p_s.html#a39fa3ac4a5d784f63c934cdc37eac8b6">00071</a> <span class="keywordtype">long</span> <a class="code" href="class_g_p_s.html#a39fa3ac4a5d784f63c934cdc37eac8b6" title="3D speed in cm/sec (not always available)">speed_3d</a>;
<a name="l00072"></a><a class="code" href="class_g_p_s.html#a354808671a37cd3d8681e51a7d809bcb">00072</a> <span class="keywordtype">int</span> <a class="code" href="class_g_p_s.html#a354808671a37cd3d8681e51a7d809bcb" title="horizontal dilution of precision in cm">hdop</a>;
<a name="l00073"></a><a class="code" href="class_g_p_s.html#ada1d7424a7a9afa17cfffcd73f741971">00073</a> uint8_t <a class="code" href="class_g_p_s.html#ada1d7424a7a9afa17cfffcd73f741971" title="Number of visible satelites.">num_sats</a>;
<a name="l00074"></a>00074
<a name="l00078"></a><a class="code" href="class_g_p_s.html#a31aed57ed5fbfbfb0bb1e4105e337b9a">00078</a> <span class="keywordtype">bool</span> <a class="code" href="class_g_p_s.html#a31aed57ed5fbfbfb0bb1e4105e337b9a">new_data</a>;
<a name="l00079"></a>00079
<a name="l00080"></a>00080 <span class="comment">// Deprecated properties</span>
<a name="l00081"></a><a class="code" href="class_g_p_s.html#a0b2a93a9f1d0e234d791177ea5f42078">00081</a> <span class="keywordtype">bool</span> <a class="code" href="class_g_p_s.html#a0b2a93a9f1d0e234d791177ea5f42078" title="true if we have a position fix (use status instead)">fix</a>;
<a name="l00082"></a><a class="code" href="class_g_p_s.html#a0f035818b7805f69f62cb1b734d7bf21">00082</a> <span class="keywordtype">bool</span> <a class="code" href="class_g_p_s.html#a0f035818b7805f69f62cb1b734d7bf21" title="true if we have seen data from the GPS (use status instead)">valid_read</a>;
<a name="l00083"></a>00083
<a name="l00084"></a>00084 <span class="comment">// Debug support</span>
<a name="l00085"></a><a class="code" href="class_g_p_s.html#ab75d2968105736833a2e852a797c52a6">00085</a> <span class="keywordtype">bool</span> <a class="code" href="class_g_p_s.html#ab75d2968105736833a2e852a797c52a6" title="deprecated">print_errors</a>;
<a name="l00086"></a>00086
<a name="l00087"></a>00087 <span class="keyword">protected</span>:
<a name="l00088"></a><a class="code" href="class_g_p_s.html#ab534b33b2596f63c716744b6e258c6ee">00088</a> <a class="code" href="class_stream.html">Stream</a> *<a class="code" href="class_g_p_s.html#ab534b33b2596f63c716744b6e258c6ee" title="port the GPS is attached to">_port</a>;
<a name="l00089"></a>00089
<a name="l00096"></a>00096 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_g_p_s.html#a4b99d4f414678d48ecb19a655354cbe5">read</a>(<span class="keywordtype">void</span>) = 0;
<a name="l00097"></a>00097
<a name="l00104"></a>00104 <span class="keywordtype">long</span> <a class="code" href="class_g_p_s.html#aed9c2c8d88047b0fea17f690f9ef107f">_swapl</a>(<span class="keyword">const</span> <span class="keywordtype">void</span> *bytes);
<a name="l00105"></a>00105
<a name="l00111"></a>00111 <span class="keywordtype">int</span> <a class="code" href="class_g_p_s.html#af4358672ea2ce3a4d48f365c92aeb120">_swapi</a>(<span class="keyword">const</span> <span class="keywordtype">void</span> *bytes);
<a name="l00112"></a>00112
<a name="l00123"></a>00123 <span class="keywordtype">void</span> <a class="code" href="class_g_p_s.html#acfd79aa1f9bcad32c0b89c2b16d150cf">_error</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *msg);
<a name="l00124"></a>00124
<a name="l00125"></a>00125 <span class="keyword">private</span>:
<a name="l00126"></a>00126
<a name="l00130"></a>00130 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> _idleTimeout = 500;
<a name="l00131"></a>00131
<a name="l00134"></a>00134 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> _idleTimer;
<a name="l00135"></a>00135
<a name="l00137"></a>00137 <a class="code" href="class_g_p_s.html#aa3c9862ff33053e317f423a398bd92c0">GPS_Status</a> _status;
<a name="l00138"></a>00138 };
<a name="l00139"></a>00139
<a name="l00140"></a>00140 <span class="keyword">inline</span> <span class="keywordtype">long</span>
<a name="l00141"></a><a class="code" href="class_g_p_s.html#aed9c2c8d88047b0fea17f690f9ef107f">00141</a> <a class="code" href="class_g_p_s.html#aed9c2c8d88047b0fea17f690f9ef107f">GPS::_swapl</a>(<span class="keyword">const</span> <span class="keywordtype">void</span> *bytes)
<a name="l00142"></a>00142 {
<a name="l00143"></a>00143 <span class="keyword">const</span> uint8_t *b = (<span class="keyword">const</span> uint8_t *)bytes;
<a name="l00144"></a>00144 <span class="keyword">union </span>{
<a name="l00145"></a>00145 <span class="keywordtype">long</span> v;
<a name="l00146"></a>00146 uint8_t b[4];
<a name="l00147"></a>00147 } u;
<a name="l00148"></a>00148
<a name="l00149"></a>00149 u.b[0] = b[3];
<a name="l00150"></a>00150 u.b[1] = b[2];
<a name="l00151"></a>00151 u.b[2] = b[1];
<a name="l00152"></a>00152 u.b[3] = b[0];
<a name="l00153"></a>00153
<a name="l00154"></a>00154 <span class="keywordflow">return</span>(u.v);
<a name="l00155"></a>00155 }
<a name="l00156"></a>00156
<a name="l00157"></a>00157 <span class="keyword">inline</span> int16_t
<a name="l00158"></a><a class="code" href="class_g_p_s.html#af4358672ea2ce3a4d48f365c92aeb120">00158</a> <a class="code" href="class_g_p_s.html#af4358672ea2ce3a4d48f365c92aeb120">GPS::_swapi</a>(<span class="keyword">const</span> <span class="keywordtype">void</span> *bytes)
<a name="l00159"></a>00159 {
<a name="l00160"></a>00160 <span class="keyword">const</span> uint8_t *b = (<span class="keyword">const</span> uint8_t *)bytes;
<a name="l00161"></a>00161 <span class="keyword">union </span>{
<a name="l00162"></a>00162 int16_t v;
<a name="l00163"></a>00163 uint8_t b[2];
<a name="l00164"></a>00164 } u;
<a name="l00165"></a>00165
<a name="l00166"></a>00166 u.b[0] = b[1];
<a name="l00167"></a>00167 u.b[1] = b[0];
<a name="l00168"></a>00168
<a name="l00169"></a>00169 <span class="keywordflow">return</span>(u.v);
<a name="l00170"></a>00170 }
<a name="l00171"></a>00171
<a name="l00172"></a>00172 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Sun Dec 26 2010 21:58:34 for ArduPilot Libraries by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
</body>
</html>