亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? garmin_application.cp

?? Garble is a C++ program for transferring data to and from Garmin GPS
?? CP
?? 第 1 頁 / 共 2 頁
字號:
// -*- mode: c++; c-basic-offset: 8; -*-// $Id: garmin_application.cp,v 1.1.1.1 2000/02/21 06:17:21 decouto Exp $// garmin_application.cp// Douglas S. J. De Couto// September 9, 1998// Copyright (C) 1998 Douglas S. J. De Couto// <decouto@lcs.mit.edu>//// This program is free software; you can redistribute it and/or// modify it under the terms of the GNU General Public License// as published by the Free Software Foundation; either version 2// of the License, or (at your option) any later version.//// This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the// GNU General Public License for more details.#include "garmin_application.h"#include "garmin_command.h"#include "garmin_util.h"#ifdef DBUG#include <iostream>#endif#include <cctype>#include <algorithm>namespace garmin {using namespace std;#define check_init() if (!m_init) throw not_possible("The garmin application layer is not initialized")//////////////////product_data_typeapplication_layer::get_product_data(void) throw (not_possible, timeout){	check_init();		uint8 sz;	packet_id pid;		m_ll->put_packet(pid_product_rqst, m_buf, 0);	pid = m_ll->get_packet(m_buf, sz);		if (pid != pid_product_data) {		throw not_possible("GPS did not reply with product data packet");	}		if (sz < 5) {		throw not_possible("Product data packet is too small");	}		product_data_type pd;	sint16 *buf16 = (sint16 *) m_buf;	pd.product_id = garmin2host16(buf16[0]);	pd.software_version = garmin2host16(buf16[1]);	pd.product_description = &((char *) m_buf)[4];		// get capability protocol info... (A001),	// but not supported on all units!	try {		pid = m_ll->get_packet(m_buf, sz);	}	catch (timeout &ex) {		// timeout indicates gps is not sending capability protocol info		m_got_protocol_info = false;		return pd;	}	m_got_protocol_info = true;	if (pid != pid_protocol_array) {		throw not_possible("Product data packet followed by some packet besides capability protocol");	}	if ((sz % 3) != 0) {		throw not_possible("Capability protocol packet is strange size");	}		for (sint16 i = 0; i < sz; i +=3) {		// char tag = (char) m_buf[i];		// uint16 *data = (uint16 *) (m_buf + i + 1);				//		cout << "tag: " << tag << "; data: " << garmin2host16(*data) << endl;	}		return pd;}/////////////////waypt_vec_t *application_layer::get_waypoints(void) throw (not_possible, timeout){	check_init();		uint8 sz;	sint16 *buf16 = (sint16 *) m_buf;	char ident[7];	char cmnt[41];	ident[6] = cmnt[40] = 0;		buf16[0] = host2garmin16((sint16) cmnd_transfer_wpt);	m_ll->put_packet(pid_command_data, m_buf, 2);		packet_id pid = m_ll->get_packet(m_buf, sz);		if (pid != pid_records) {		throw not_possible("GPS did not reply with start of records data packet for waypoint data");	}	if (sz != 2) {		throw not_possible("Waypoint data start of records packet is wrong size");	}		sint16 num_recs = garmin2host16(buf16[0]);	waypt_vec_t *waypts = new waypt_vec_t(num_recs);			for (sint16 i = 0; i < num_recs; i++) {		basic_waypt_type &waypt = (*waypts)[i];				pid = m_ll->get_packet(m_buf, sz);				if (pid != pid_wpt_data) {			delete waypts;			throw not_possible("GPS did not send waypoint data packet");		}		if (sz < (6 + 8 + 4 + 40)) {			delete waypts;			throw not_possible("Waypoint data packet is too small");		}				uint32 *buf32 = (uint32 *) (m_buf + 6);		waypt.pos.lat = garmin2host32(buf32[0]);		waypt.pos.lon = garmin2host32(buf32[1]);		strncpy(ident, (char *) m_buf, 6);		waypt.id = string(ident);			strncpy(cmnt, (char *) (m_buf + 18), 40);		waypt.comment = string(cmnt);	}		pid = m_ll->get_packet(m_buf, sz);	if (pid != pid_xfer_cmplt) {		delete waypts;		throw not_possible("GPS did not terminate waypoint data with end of records packet");	}	if (garmin2host16(buf16[0]) != cmnd_transfer_wpt) {		delete waypts;		throw not_possible("End of records packet does not match original waypoint transfer command");	}			return waypts;		}/////////////////////void application_layer::send_waypoints(waypt_vec_t *waypts) throw (not_possible, timeout){	check_init();		product_data_type pd = get_product_data();	sint16 valid_products[] = { 73, 77, 87, 95, 96, 97, 100, 105, 106, -1 };	const	int d103_sz = 6 + 8 + 4 + 40 + 2;		bool is_valid_product = false;	int i = 0;	while (valid_products[i] != -1) {		if (pd.product_id == valid_products[i]) {			is_valid_product = true;			break;		}		i++;	}		if (!is_valid_product) {		throw not_possible("Waypoint download not supported for this GPS");	}	sint16 *buf16 = (sint16 *) m_buf;	buf16[0] = host2garmin16(waypts->size());		m_ll->put_packet(pid_records, m_buf, 2);		for (unsigned int i = 0; i < waypts->size(); i++) {		basic_waypt_type &w = (*waypts)[i];				// clear all fields		memset(m_buf, 0, d103_sz);		// set all waypt strings to blank spaces		memset(m_buf, ' ', 6);		memset(m_buf + 18, ' ', 40);				// copy in strings, fixing up for GPS; leave bad characters as spaces		for (size_t j = 0; j < min<size_t>(6, w.id.size()); j++) {			char c = w.id[j];			if (isalnum(c)) {				m_buf[j] = toupper(c);			}		}		for (size_t j = 0; j < min<size_t>(40, w.comment.length()); j++) {			char c = w.comment[j];			if (isalnum(c) || c == '-') {				m_buf[j + 18] = toupper(c);			}		}				// copy in position data		uint32 *buf32 = (uint32 *) (m_buf + 6);		buf32[0] = host2garmin32(w.pos.lat);		buf32[1] = host2garmin32(w.pos.lon);				m_ll->put_packet(pid_wpt_data, m_buf, d103_sz);	}		buf16[0] = host2garmin16(cmnd_transfer_wpt);	m_ll->put_packet(pid_xfer_cmplt, m_buf, 2);}/////////////////////route_list_t *application_layer::get_routes(void) throw (not_possible, timeout){	check_init();		uint16 *buf16 = (uint16 *) m_buf;	buf16[0] = host2garmin16((sint16) cmnd_transfer_rte);	m_ll->put_packet(pid_command_data, m_buf, 2);	uint8 sz;	packet_id pid = m_ll->get_packet(m_buf, sz);	if (pid != pid_records) {		throw not_possible("GPS did not reply with start of records data packet for route data");	}	if (sz != 2) {		throw not_possible("Route data start of records packet is wrong size");	}	sint16 num_packets = garmin2host16(buf16[0]);	// create route list with no routes	route_list_t *retval = new route_list_t(0);		bool curr_rt_exists = false;	for (sint16 i = 0; i < num_packets; i++) {		pid = m_ll->get_packet(m_buf, sz);		if (pid == pid_rte_hdr) {			// start new route			retval->push_back(list<basic_waypt_type>());			curr_rt_exists = true;			continue;		}				if (pid != pid_rte_wpt_data) {			delete retval;			throw not_possible("Packet is not route waypoint data or route header");		}		if (!curr_rt_exists) {			delete retval;			throw not_possible("Route waypoint data packet was not preceded by a route header packet");		}		if (sz < (6 + 8 + 2 + 40)) {			delete retval;			throw not_possible("Route waypoint data packet is too small");		}				semicircle_type *sp = (semicircle_type *) (m_buf + 6);		sp->lat = garmin2host32(sp->lat);		sp->lon = garmin2host32(sp->lon);		basic_waypt_type waypt;		char ident[7], cmnt[41];		ident[6] = cmnt[40] = 0;		strncpy(ident, (char *) m_buf, 6);		waypt.id = string(ident);		waypt.pos = *sp;				strncpy(cmnt, (char *) m_buf + 14, 40);		waypt.comment = string(cmnt);				// add this waypoint to end of last route in route list.		retval->back().push_back(waypt);			}		pid = m_ll->get_packet(m_buf, sz);	if (pid != pid_xfer_cmplt) {		delete retval;		throw not_possible("GPS did not terminate route data with end of records packet");	}	if (garmin2host16(buf16[0]) != cmnd_transfer_rte) {		delete retval;		throw not_possible("End of records packet does not match original route transfer command");	}			return retval;		}/////////////////////void application_layer::send_routes(route_list_t *routes) throw (not_possible, timeout){	check_init();			product_data_type pd = get_product_data();	sint16 valid_products[] = { 73, 77, 87, 95, 96, 97, 100, 105, 106, -1 };	const	int d103_sz = 6 + 8 + 4 + 40 + 2;		bool is_valid_product = false;	int i = 0;	while (valid_products[i] != -1) {		if (pd.product_id == valid_products[i]) {			is_valid_product = true;			break;		}		i++;	}		if (!is_valid_product) {		throw not_possible("Route download not supported for this GPS");	}		// how many data packets?	sint16 num_recs = 0;	route_list_t::const_iterator llw;	for (llw = routes->begin(); llw != routes->end(); llw++) {		num_recs += llw->size();	}	num_recs += routes->size(); // plus 1 header packet for each route		sint16 *buf16 = (sint16 *) m_buf;	buf16[0] = host2garmin16(num_recs);		m_ll->put_packet(pid_records, m_buf, 2);		for (llw = routes->begin(); llw != routes->end(); llw++) {				// put route header		m_buf[0] = 10;		char *test = "TESTING COMMENT     "; 		for (int k = 0; k < 20; k++) {			m_buf[k + 1] = test[k];		}		m_ll->put_packet(pid_rte_hdr, m_buf, 21);				// put route waypoints		route_t::const_iterator lw;		for (lw = llw->begin(); lw != llw->end(); lw++) {			memset(m_buf, 0, d103_sz);			// set all waypt strings to blank spaces			memset(m_buf, ' ', 6);			memset(m_buf + 18, ' ', 40);					// copy in strings, fixing up for GPS; leave bad characters as spaces			for (size_t j = 0; j < min<size_t>(6, lw->id.size()); j++) {				char c = lw->id[j];				if (isalnum(c)) {					m_buf[j] = toupper(c);				}			}			for (size_t j = 0; j < min<size_t>(40, lw->comment.length()); j++) {				char c = lw->comment[j];				if (isalnum(c) || c == '-') {					m_buf[j + 18] = toupper(c);				}			}					// copy in position data			uint32 *buf32 = (uint32 *) (m_buf + 6);			buf32[0] = host2garmin32(lw->pos.lat);			buf32[1] = host2garmin32(lw->pos.lon);					m_ll->put_packet(pid_rte_wpt_data, m_buf, d103_sz);		}	}	buf16[0] = host2garmin16(cmnd_transfer_rte);	m_ll->put_packet(pid_xfer_cmplt, m_buf, 2);}	/////////////////////

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产午夜精品一区二区| 亚洲久本草在线中文字幕| 99re热视频这里只精品 | 樱花草国产18久久久久| 精品国产麻豆免费人成网站| 91久久精品一区二区| 国产一区美女在线| 亚洲综合激情小说| 国产精品无圣光一区二区| 制服丝袜亚洲精品中文字幕| av成人老司机| 国产99久久久国产精品免费看 | 国产suv一区二区三区88区| 亚洲h在线观看| 亚洲三级电影网站| 久久久亚洲欧洲日产国码αv| 欧美三片在线视频观看| 91在线观看地址| 国产成人精品网址| 麻豆91免费看| 首页国产欧美日韩丝袜| 亚洲精选免费视频| 国产精品成人午夜| 日本一区二区三区在线观看| 26uuu亚洲综合色| 日韩片之四级片| 欧美少妇一区二区| 色婷婷久久一区二区三区麻豆| 粗大黑人巨茎大战欧美成人| 国产麻豆精品一区二区| 麻豆91免费观看| 久久99精品国产91久久来源| 日本女优在线视频一区二区| 午夜久久久久久| 午夜精品久久久久久| 夜夜精品浪潮av一区二区三区| 亚洲婷婷综合久久一本伊一区| 中文字幕成人网| 国产精品色一区二区三区| 久久精品视频免费观看| 精品国产乱子伦一区| 26uuu亚洲婷婷狠狠天堂| 久久亚洲精品国产精品紫薇| 国产亚洲视频系列| 亚洲国产精品高清| 国产精品美女久久久久久久久久久 | 精品写真视频在线观看| 老司机精品视频在线| 国产一区久久久| 成a人片国产精品| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 欧美精品久久99久久在免费线| 欧美日韩一区视频| 在线不卡一区二区| 日韩欧美国产不卡| 国产欧美日韩综合精品一区二区| 久久精品网站免费观看| 国产精品久久精品日日| 亚洲美女免费在线| 亚洲va欧美va人人爽| 日本不卡1234视频| 国产高清久久久| 色老汉av一区二区三区| 欧美日韩精品一区二区天天拍小说| 在线电影院国产精品| 欧美刺激午夜性久久久久久久| 精品福利一二区| 国产精品久久三区| 亚洲国产cao| 久久成人免费网站| 成人国产精品免费观看视频| 色激情天天射综合网| 日韩视频免费观看高清完整版 | 免费成人美女在线观看| 国产麻豆精品95视频| 色婷婷激情综合| 日韩一区二区视频在线观看| 国产欧美日韩中文久久| 亚洲第一狼人社区| 国产一区二区三区免费| 一本久道中文字幕精品亚洲嫩| 91精品久久久久久久91蜜桃| 国产亚洲成年网址在线观看| 亚洲自拍另类综合| 国产一区二区三区观看| 欧美性受xxxx黑人xyx性爽| 欧美成人一级视频| 一区av在线播放| 国产精品一二三四| 欧美无乱码久久久免费午夜一区 | 日韩三级在线免费观看| 亚洲欧美综合在线精品| 日本成人在线电影网| 99这里只有精品| 欧美成人官网二区| 一区二区欧美视频| 成人国产精品免费观看动漫| 欧美一区二区免费| 亚洲男人的天堂一区二区| 老司机精品视频线观看86| 一本一道综合狠狠老| 久久久亚洲欧洲日产国码αv| 亚洲成av人片一区二区| 成人三级伦理片| 日韩欧美亚洲另类制服综合在线| 亚洲精品日日夜夜| 久久99精品视频| 欧美色图天堂网| 国产精品久久久久久久久免费桃花| 日韩成人精品视频| 在线视频亚洲一区| 国产亚洲欧美日韩日本| 免费在线成人网| 欧美三区免费完整视频在线观看| 国产精品色呦呦| 国产麻豆成人精品| 精品电影一区二区三区| 亚洲444eee在线观看| 色系网站成人免费| 日本一二三不卡| 国产一区二区中文字幕| 欧美成人艳星乳罩| 蜜桃av一区二区| 欧美一区二区视频在线观看2020| 亚洲免费观看高清| 91美女精品福利| 中文字幕中文乱码欧美一区二区| 国产精品一二三在| 国产无一区二区| 国产福利不卡视频| 久久人人爽爽爽人久久久| 激情另类小说区图片区视频区| 欧美一二三区在线| 日本系列欧美系列| 日韩免费在线观看| 美国毛片一区二区| 精品免费视频.| 黄色日韩三级电影| 久久新电视剧免费观看| 精品一区二区三区在线播放视频| 欧美成人激情免费网| 精品一区免费av| 久久综合九色综合97婷婷| 国产麻豆欧美日韩一区| 中文一区在线播放| 91日韩一区二区三区| 尤物视频一区二区| 777欧美精品| 黄网站免费久久| 中文字幕不卡在线观看| 91视频在线看| 亚洲国产成人av好男人在线观看| 91精品欧美福利在线观看 | 在线一区二区三区四区| 亚洲综合色丁香婷婷六月图片| 欧美日韩精品一区二区三区四区| 日日嗨av一区二区三区四区| 日韩欧美你懂的| 国产精品一区二区久久精品爱涩| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 国产精品夫妻自拍| 色国产精品一区在线观看| 五月天亚洲婷婷| 久久蜜臀精品av| 91久久精品一区二区二区| 日本美女一区二区| 国产精品网站在线播放| 色成年激情久久综合| 日韩av一二三| 国产日韩成人精品| 欧美日韩中文字幕精品| 久久99精品视频| 亚洲欧美日韩中文字幕一区二区三区| 欧美色综合影院| 国模冰冰炮一区二区| 1000精品久久久久久久久| 欧美精品高清视频| 在线亚洲一区二区| 麻豆极品一区二区三区| 综合精品久久久| 在线播放中文一区| 成人午夜大片免费观看| 视频一区二区欧美| 亚洲国产精品av| 4438亚洲最大| 92国产精品观看| 免费欧美在线视频| 亚洲精品免费在线| 久久色在线观看| 欧美另类一区二区三区| 成人免费视频视频| 免费一级片91| 亚洲国产你懂的| 欧美经典一区二区| 日韩一本二本av| 欧美日韩不卡视频| 91小视频在线观看| 国产a视频精品免费观看| 日本一不卡视频| 性感美女极品91精品|