test.cp

来自「Garble is a C++ program for transferring」· CP 代码 · 共 63 行

CP
63
字号
// $Id: test.cp,v 1.1.1.1 2000/02/21 06:17:21 decouto Exp $#include <iostream>#include "../../serial-src/unix/serial.h"#include "garmin_serial_unix.h"#include "garmin_link.h"#include "garmin_application.h"#include "garmin_util.h"intmain(int argc, char **argv) {      garmin_serial gs("/dev/cua0", 750);  garmin::link_layer ll(&gs);  garmin::application_layer al(&ll);  try {    // get product data    garmin::product_data_type pd = al.get_product_data();    cout << "product data: " << pd.product_id 	 << " / " << pd.software_version 	 << " / " << pd.product_description << endl;    // get routes    typedef std::list<garmin::basic_waypt_type> route;    typedef std::list<route> route_list;    route_list *rl = al.get_routes();        for (route_list::iterator rli = rl->begin(); rli != rl->end(); rli++) {      route r = *rli;      for (route::iterator ri = r.begin(); ri != r.end(); ri++) {      garmin::basic_waypt_type wp = *ri;      garmin::degree_type deg_pos = garmin::semicircle2degree(wp.pos);      cout << "waypt " << wp.id << " / " 	   << deg_pos.lat << ", " 	   << deg_pos.lon << " / "	   << wp.comment << endl;      }      cout << endl;    }    // get waypoints    typedef std::vector<garmin::basic_waypt_type> wp_vec;    wp_vec *wv = al.get_waypoints();    for (wp_vec::iterator wvi = wv->begin(); wvi != wv->end(); wvi++) {      garmin::basic_waypt_type wp = *wvi;      garmin::degree_type deg_pos = garmin::semicircle2degree(wp.pos);      cout << "waypt " << wp.id << " / " 	   << deg_pos.lat << ", " 	   << deg_pos.lon << " / "	   << wp.comment << endl;      }  }  catch (garmin::error &ex) {    cerr << "caught exception: " << ex.m_msg << endl;    exit(-1);  }  return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?