本文整理汇总了C++中Sentence::send方法的典型用法代码示例。如果您正苦于以下问题:C++ Sentence::send方法的具体用法?C++ Sentence::send怎么用?C++ Sentence::send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sentence
的用法示例。
在下文中一共展示了Sentence::send方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startPlaying
//.........这里部分代码省略.........
12
1 2 3 4 5 6 7 8 9 10 11 | 13
| | | | | | | | | | | | |
$--RMC,hhmmss.ss,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,ddmmyy,x.x,a,a*hh<CR><LF>
$GPRMC,132217.00,A,5228.19856,N,01408.32249,E,47.100,267.38,300710,,,A*58
Field Number:
1) UTC Time
2) Status, A = valid position, V = Navigation receiver warning
3) Latitude ddmm.mmm
4) Latitude hemisphere, N or S
5) Longitude dddmm.mm
6) Longitude hemisphere, E or W
7) Speed over ground, knots 0.0 ... 999.9
8) Course over ground, degrees true
9) UTC date of position fix, ddmmyy format
10) Magnetic Variation, degrees
11) Magnetic Variation direction, E or W
12) Signal integrity, A=Autonomous mode
13) Checksum, hh
*/
// Prepare RMC sentence
QString rmc = "$GPRMC," + time1 + "," + status1 + "," +
latDeg1 + "," + latHem1 + "," +
lonDeg1 + "," + lonHem1 + "," +
QString("%1").arg( speed.getKnots(), 0, 'f', 1 ) + "," +
QString("%1").arg( bearing, 0, 'f', 0 ) + "," +
date + ",,," + "A";
Sentence sentence;
sentence.send( rmc, m_fifo );
/**
GLL - Geographic Position - Latitude/Longitude
1 2 3 4 5 6 7
| | | | | | |
$--GLL,llll.ll,a,yyyyy.yy,a,hhmmss.ss,A*hh<CR><LF>
Field Number:
1) Latitude
2) N or S (North or South)
3) Longitude
4) E or W (East or West)
5) Universal Time Coordinated (UTC)
6) Status A - Data Valid, V - Data Invalid
7) Checksum
$GPGLL,4916.45,N,12311.12,W,225444,A
*/
#if 0
// Not necessary to send this.
QString ggl = "$GPGLL," +
latDeg1 + "," + latHem1 + "," +
lonDeg1 + "," + lonHem1 + "," +
time1 + "," +
status1;
sentence.send( ggl, m_fifo );
#endif
/**
示例2: main
////////////////////////////////////////////////////////////////////////////////
// M A I N
////////////////////////////////////////////////////////////////////////////////
int main(int argc, char **argv)
{
QString mode;
QStringList Argv;
for (int i = 1; i <= argc; i++)
{
Argv << argv[i];
}
if( argc < 2 )
{
char *prog = basename(argv[0]);
cout << "NMEA GPS Simulator 1.6.0 for Cumulus, 2003-2008 E. Voellm, 2009-2014 A. Pauli (GPL)" << endl << endl
<< "Usage: " << prog << " str|cir|pos|gpos|nplay|iplay [params]" << endl << endl
<< "Parameters: str: Straight Flight "<< endl
<< " cir: Circling "<< endl
<< " pos: Fixed Position e.g. standstill in a wave (climb works)"<< endl
<< " gpos: Fixed Position on ground "<< endl
<< " nplay: Plays a recorded NMEA file. GPRMC is required to be contained!" << endl
<< " iplay: Plays a recorded IGC file." << endl
<< " params:"<< endl
<< " lat=dd:mm:ss[N|S] or lat=dd.mmmm Initial Latitude" << endl
<< " lon=ddd:mm:ss[E|W] or lon=dd.mmmm Initial Longitude" << endl
<< " speed=[km/h] head=[deg]: Glider speed and heading" << endl
<< " wind=[km/h] winddir=[deg]: Wind force and direction" << endl
<< " radius=[m]: needed for circling" << endl
<< " dir=[right|left]: Direction of Circle" << endl
<< " alt=[m]: Altitude of Glider" << endl
<< " climb=[m/s]: Climbrate" << endl
<< " sentence0...9='NMEA sentence without checksum': $ and * can be omitted" << endl
<< " time=[s]: duration of operation" << endl
<< " pause=[ms]: pause between to send periods" << endl
<< " device=[path to named pipe]: write into this pipe, default is /tmp/nmeasim" << endl
<< " device=[ttySx,<speed>]: write to device ttySx with the given speed" << endl
<< " file=[path to file]: to be played" << endl
<< " skip=[number]: lines to be skipped in the play file" << endl
<< " start=[HHMMSS]: goto B-Record start time in the IGC play file" << endl
<< " factor=[number]: time factor used by IGC file play, default is 1" << endl
<< " Note: all values can also be specified as float, like 110.5 " << endl << endl
<< "Example: " << prog << " str lat=48:31:48N lon=009:24:00E speed=125 winddir=270" << endl << endl
<< "NMEA output is written into named pipe '" << device.toLatin1().data() << "'." << endl
<< "Cumulus should use the same device name to get these data." << endl;
exit (0);
}
mode = Argv[0];
qDebug() << "mode=" << mode;
// @AP: Reset the locale that is used for number formatting to "C" locale.
setlocale( LC_ALL, "" );
setlocale( LC_NUMERIC, "C" );
setenv( "LC_NUMERIC", "C", 1 );
setenv( "LANG", "C", 1 );
// First of all read command configuration from file.
// Determine configuration file position. It is normally stored in the home
// directory of the user.
const char *home = getenv("HOME");
if( home )
{
confFile = QString(home) + "/nmea.cfg";
}
else
{
confFile = "./nmea.cfg";
}
readConfig();
// Override by things given at command line
cout << "\nParameters from command line:" << endl;
for (int i = 1; i < argc; i++)
{
cout << Argv[i].toLatin1().data() << endl;
scanConfig( Argv[i] );
}
// calculate Wind as it was given
cout << "Parameters for operation:" << endl;
float winddirTrue = winddir+180;
if ( winddirTrue > 360.0 )
winddirTrue -= 360.0;
if( mode == "str" )
cout << "Mode: Straight Flight " << endl;
if( mode == "cir" )
cout << "Mode: Circling " << endl;
if( mode == "gpos" )
{
//.........这里部分代码省略.........