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

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

?? garmin.c

?? gpsd, a popular GPS daemon.
?? C
?? 第 1 頁 / 共 3 頁
字號:
	gpsd_report(LOG_PROG, "Set Garmin to send reports every 1 second\n");        Build_Send_SER_Packet(session, GARMIN_LAYERID_APPL	    , GARMIN_PKTID_L001_COMMAND_DATA, 2, CMND_START_PVT_DATA);#if USE_RMD	// turn on RMD data 110	gpsd_report(LOG_PROG, "Set Garmin to send Raw sat data\n");        Build_Send_SER_Packet(session, GARMIN_LAYERID_APPL	      , GARMIN_PKTID_L001_COMMAND_DATA, 2, CMND_START_RM_DATA);#endif    }}static void garmin_close(struct gps_device_t *session UNUSED) {    /* FIXME -- do we need to put the garmin to sleep?  or is closing the port       sufficient? */    gpsd_report(LOG_PROG, "garmin_close()\n");    return;}#define Send_ACK()    Build_Send_SER_Packet(session, 0, ACK, 0, 0)#define Send_NAK()    Build_Send_SER_Packet(session, 0, NAK, 0, 0)/*@ +charint @*/gps_mask_t garmin_ser_parse(struct gps_device_t *session){    unsigned char *buf = session->packet.outbuffer;    size_t len = session->packet.outbuflen;    unsigned char data_buf[MAX_BUFFER_SIZE];    unsigned char c;    int i = 0;    size_t n = 0;    int data_index = 0;    int got_dle = 0;    unsigned char pkt_id = 0;    unsigned char pkt_len = 0;    unsigned char chksum = 0;    gps_mask_t mask = 0;    gpsd_report(LOG_RAW, "garmin_ser_parse()\n");    if (  6 > len ) {	/* WTF? */        /* minimum packet; <DLE> [pkt id] [length=0] [chksum] <DLE> <STX> */	Send_NAK();	gpsd_report(LOG_RAW+1, "Garmin serial too short: %#2x\n", len);	return 0;    }    /* debug */    for ( i = 0 ; i < (int)len ; i++ ) {	gpsd_report(LOG_RAW+1, "Char: %#02x\n", buf[i]);    }        if ( '\x10' != buf[0] ) {	Send_NAK();	gpsd_report(LOG_RAW+1, "buf[0] not DLE\n", buf[0]);        return 0;    }    n = 1;    pkt_id = buf[n++];    chksum = pkt_id;    if ( '\x10' == pkt_id ) {        if ( '\x10' != buf[n++] ) {	    Send_NAK();	    gpsd_report(LOG_RAW+1, "Bad pkt_id %#02x\n", pkt_id);	    return 0;        }    }    pkt_len = buf[n++];    chksum += pkt_len;    if ( '\x10' == pkt_len ) {        if ( '\x10' != buf[n++] ) {	    gpsd_report(LOG_RAW+1, "Bad pkt_len %#02x\n", pkt_len);	    Send_NAK();	    return 0;        }    }    data_index = 0;    for ( i = 0; i < 256 ; i++ ) {	if ( (int)pkt_len == data_index )  {		// got it all		break;	}        if ( len < n + i ) {	    gpsd_report(LOG_RAW+1, "Packet too short %#02x < %#0x\n", len, n + i);	    Send_NAK();	    return 0;        }	c = buf[n + i];        if ( got_dle ) {	    got_dle = 0;            if ( '\x10' != c ) {		Send_NAK();	        gpsd_report(LOG_RAW+1, "Bad DLE %#02x\n", c);	        return 0;            }	} else {            chksum += c;	    data_buf[ data_index++ ] = c;            if ( '\x10' == c ) {		got_dle = 1;	    }	}    }    /* get checksum */    if ( len < n + i ) {	Send_NAK();        gpsd_report(LOG_RAW+1, "No checksum, Packet too short %#02x < %#0x\n"	    , len, n + i);        return 0;    }    c = buf[n + i++];    chksum += c;    /* get final DLE */    if ( len < n + i ) {	Send_NAK();        gpsd_report(LOG_RAW+1, "No final DLE, Packet too short %#02x < %#0x\n"	    , len, n + i);        return 0;    }    c = buf[n + i++];    if ( '\x10' != c ) {	Send_NAK();	gpsd_report(LOG_RAW+1, "Final DLE not DLE\n", c);        return 0;    }    /* get final ETX */    if ( len < n + i ) {	Send_NAK();        gpsd_report(LOG_RAW+1, "No final ETX, Packet too short %#02x < %#0x\n"	    , len, n + i);        return 0;    }    c = buf[n + i++];    if ( '\x03' != c ) {	Send_NAK();	gpsd_report(LOG_RAW+1, "Final ETX not ETX\n", c);        return 0;    }    /* debug */    /*@ -usedef -compdef @*/    for ( i = 0 ; i < data_index ; i++ ) {	gpsd_report(LOG_RAW+1, "Char: %#02x\n", data_buf[i]);    }    gpsd_report(LOG_IO	, "garmin_ser_parse() Type: %#02x, Len: %#02x, chksum: %#02x\n"        , pkt_id, pkt_len, chksum);    mask = PrintSERPacket(session, pkt_id, pkt_len, data_buf);    // sending ACK too soon might hang the session    // so send ACK last, after a pause    (void)usleep(300);    Send_ACK();    /*@ +usedef +compdef @*/    return mask;}/*@ -charint @*/#ifdef ALLOW_RECONFIGUREstatic void settle(void){    struct timespec delay, rem;    /*@ -type -unrecog @*/    memset( &delay, 0, sizeof(delay));    delay.tv_sec = 0;    delay.tv_nsec = 333000000L;    nanosleep(&delay, &rem);    /*@ +type +unrecog @*/}#endif /* ALLOW_RECONFIGURE */static void garmin_switcher(struct gps_device_t *session, int mode){#ifdef ALLOW_RECONFIGURE    if (mode == 0) {	const char *switcher = "\x10\x0A\x02\x26\x00\xCE\x10\x03";	int status = (int)gpsd_write(session, switcher, strlen(switcher));	if (status == (int)strlen(switcher)) {	    gpsd_report(LOG_IO, "=> GPS: turn off binary %02x %02x %02x... \n"			, switcher[0], switcher[1], switcher[2]);	} else {	    gpsd_report(LOG_ERROR, "=> GPS: FAILED\n");	}	settle(); // wait 333mS, essential!	/* once a sec, no binary, no averaging, NMEA 2.3, WAAS */	(void)nmea_send(session->gpsdata.gps_fd, "$PGRMC1,1,1");	//(void)nmea_send(fd, "$PGRMC1,1,1,1,,,,2,W,N");	(void)nmea_send(session->gpsdata.gps_fd, "$PGRMI,,,,,,,R");	settle();    // wait 333mS, essential!    } else {	(void)nmea_send(session->gpsdata.gps_fd, "$PGRMC1,1,2,1,,,,2,W,N");	(void)nmea_send(session->gpsdata.gps_fd, "$PGRMI,,,,,,,R");	// garmin serial binary is 9600 only!	gpsd_report(LOG_ERROR, "NOTE: Garmin binary is 9600 baud only!\n");	settle();	// wait 333mS, essential!    }#endif /* ALLOW_RECONFIGURE */}/* this is everything we export */#ifdef __UNUSED__static int GetPacket (struct gps_device_t *session );//-----------------------------------------------------------------------------// Gets a single packet.// this is odd, the garmin usb driver will only return 64 bytes, or less// at a time, no matter what you ask for.//// is you ask for less than 64 bytes then the next packet will include// just the remaining bytes of the last 64 byte packet.//// Reading a packet of length Zero, or less than 64, signals the end of // the entire packet.//// The Garmin sample WinXX code also assumes the same behavior, so// maybe it is something in the USB protocol.//// Return: 0 = got a good packet//         -1 = error//         1 = got partial packetstatic int GetPacket (struct gps_device_t *session ) {    struct timespec delay, rem;    int cnt = 0;    // int x = 0; // for debug dump    memset( session->driver.garmin.Buffer, 0, sizeof(Packet_t));    memset( &delay, 0, sizeof(delay));    session->driver.garmin.BufferLen = 0;    session->packet.outbuflen = 0;    gpsd_report(LOG_IO, "GetPacket()\n");    for( cnt = 0 ; cnt < 10 ; cnt++ ) {	size_t pkt_size;	// Read async data until the driver returns less than the	// max async data size, which signifies the end of a packet	// not optimal, but given the speed and packet nature of	// the USB not too bad for a start	ssize_t theBytesReturned = 0;	uint8_t *buf = (uint8_t *)session->driver.garmin.Buffer;	Packet_t *thePacket = (Packet_t*)buf;	theBytesReturned = read(session->gpsdata.gps_fd		, buf + session->driver.garmin.BufferLen		, ASYNC_DATA_SIZE);	// zero byte returned is a legal value and denotes the end of a         // binary packet.        if ( 0 >  theBytesReturned ) {	    // read error...            // or EAGAIN, but O_NONBLOCK is never set	    gpsd_report(LOG_ERROR, "GetPacket() read error=%d, errno=%d\n"		, theBytesReturned, errno);	    continue;	}	gpsd_report(LOG_RAW, "got %d bytes\n", theBytesReturned);#if 1        gpsd_report(LOG_IO, "getPacket(), got %d bytes: %s\n"		, theBytesReturned, gpsd_hexdump(thePacket, theBytesReturned));#endif	session->driver.garmin.BufferLen += theBytesReturned;	if ( 256 <=  session->driver.garmin.BufferLen ) {	    // really bad read error...	    gpsd_report(LOG_ERROR, "GetPacket() packet too long, %ld > 255 !\n"		    , session->driver.garmin.BufferLen);	    session->driver.garmin.BufferLen = 0;	    break;	}	pkt_size = 12 + get_int32((uint8_t*)&thePacket->mDataSize);	if ( 12 <= session->driver.garmin.BufferLen) {	    // have enough data to check packet size	    if ( session->driver.garmin.BufferLen > pkt_size) {	        // wrong amount of data in buffer	        gpsd_report(LOG_ERROR		    , "GetPacket() packet size wrong! Packet: %ld, s/b %ld\n"		    , session->driver.garmin.BufferLen		    , pkt_size);	        session->driver.garmin.BufferLen = 0;	        break;	    }	}	if ( 64 > theBytesReturned ) {	    // zero length, or short, read is a flag for got the whole packet            break;	}			/*@ ignore @*/	delay.tv_sec = 0;	delay.tv_nsec = 3330000L;	while (nanosleep(&delay, &rem) < 0)	    continue;	/*@ end @*/    }    // dump the individual bytes, debug only    // for ( x = 0; x < session->driver.garmin.BufferLen; x++ ) {        // gpsd_report(LOG_RAW+1, "p[%d] = %x\n", x, session->driver.garmin.Buffer[x]);    // }    if ( 10 <= cnt ) {	    gpsd_report(LOG_ERROR, "GetPacket() packet too long or too slow!\n");	    return -1;    }    gpsd_report(LOG_RAW, "GotPacket() sz=%d \n", session->driver.garmin.BufferLen);    session->packet.outbuflen = session->driver.garmin.BufferLen;    return 0;}static gps_mask_t garmin_usb_parse(struct gps_device_t *session){    gpsd_report(LOG_PROG, "garmin_usb_parse()\n");    return PrintUSBPacket(session, (Packet_t*)session->driver.garmin.Buffer);}static ssize_t garmin_get_packet(struct gps_device_t *session) {    return (ssize_t)( 0 == GetPacket( session ) ? 1 : 0);}struct gps_type_t garmin_usb_binary_old ={    .type_name      = "Garmin USB binary",	/* full name of type */    .trigger        = NULL,		/* no trigger, it has a probe */    .channels       = GARMIN_CHANNELS,	/* consumer-grade GPS */    .probe_wakeup   = NULL,		/* no wakeup to be done before hunt */    .probe_detect   = garmin_detect,	/* how to detect at startup time */    .probe_subtype  = garmin_probe_subtype,	/* get subtype info */#ifdef ALLOW_RECONFIGURE    .configurator   = garmin_usb_configure,	/* eable what we need */#endif /* ALLOW_RECONFIGURE */    .get_packet     = garmin_get_packet,/* how to grab a packet */    .parse_packet   = garmin_usb_parse,	/* parse message packets */    .rtcm_writer    = NULL,		/* don't send DGPS corrections */    .speed_switcher = NULL,		/* no speed switcher */    .mode_switcher  = NULL,		/* no mode switcher */    .rate_switcher  = NULL,		/* no sample-rate switcher */    .cycle_chars    = -1,		/* not relevant, no rate switch */#ifdef ALLOW_RECONFIGURE    .revert         = NULL,		/* no setting-reversion method */#endif /* ALLOW_RECONFIGURE */    .wrapup         = garmin_close,	/* close hook */    .cycle          = 1,		/* updates every second */};#endif /* __UNUSED__ */struct gps_type_t garmin_usb_binary ={    .type_name      = "Garmin USB binary",	/* full name of type */    .trigger        = NULL,		/* no trigger, it has a probe */    .channels       = GARMIN_CHANNELS,	/* consumer-grade GPS */    .probe_wakeup   = NULL,		/* no wakeup to be done before hunt */    .probe_detect   = garmin_detect,	/* how to detect at startup time */    .probe_subtype  = garmin_probe_subtype,	/* get subtype info */#ifdef ALLOW_RECONFIGURE    .configurator   = NULL,	        /* enable what we need */#endif /* ALLOW_RECONFIGURE */    .get_packet     = generic_get,      /* how to grab a packet */    .parse_packet   = garmin_ser_parse,	/* parse message packets */    .rtcm_writer    = NULL,		/* don't send DGPS corrections */    .speed_switcher = NULL,		/* no speed switcher */    .mode_switcher  = NULL,		/* no mode switcher */    .rate_switcher  = NULL,		/* no sample-rate switcher */    .cycle_chars    = -1,		/* not relevant, no rate switch */#ifdef ALLOW_RECONFIGURE    .revert         = NULL,		/* no setting-reversion method */#endif /* ALLOW_RECONFIGURE */    .wrapup         = garmin_close,	/* close hook */    .cycle          = 1,		/* updates every second */};struct gps_type_t garmin_ser_binary ={    .type_name      = "Garmin Serial binary",	/* full name of type */    .trigger        = NULL,		/* no trigger, it has a probe */    .channels       = GARMIN_CHANNELS,	/* consumer-grade GPS */    .probe_wakeup   = NULL,		/* no wakeup to be done before hunt */    .probe_detect   = NULL,        	/* how to detect at startup time */    .probe_subtype  = NULL,        	/* initialize the device */#ifdef ALLOW_RECONFIGURE    .configurator   = NULL,	        /* enable what we need */#endif /* ALLOW_RECONFIGURE */    .get_packet     = generic_get,       /* how to grab a packet */    .parse_packet   = garmin_ser_parse,	/* parse message packets */    .rtcm_writer    = NULL,		/* don't send DGPS corrections */    .speed_switcher = NULL,		/* no speed switcher */    .mode_switcher  = garmin_switcher,	/* how to change modes */    .rate_switcher  = NULL,		/* no sample-rate switcher */    .cycle_chars    = -1,		/* not relevant, no rate switch */#ifdef ALLOW_RECONFIGURE    .revert         = NULL,		/* no setting-reversion method */#endif /* ALLOW_RECONFIGURE */    .wrapup         = NULL,	        /* close hook */    .cycle          = 1,		/* updates every second */};#endif /* GARMIN_ENABLE */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产乱码久久| 欧美色网站导航| 国产亚洲1区2区3区| 久久99精品国产麻豆不卡| 日韩亚洲欧美在线观看| 日本不卡一二三| 久久亚洲一区二区三区四区| 国产尤物一区二区| 国产精品久久久久久久午夜片| 99亚偷拍自图区亚洲| 一区二区三区日韩欧美| 精品视频1区2区| 激情文学综合插| 国产精品入口麻豆九色| 色美美综合视频| 六月丁香婷婷久久| 国产精品美女久久福利网站| 欧美性欧美巨大黑白大战| 日本不卡一区二区三区高清视频| 26uuu亚洲婷婷狠狠天堂| av激情成人网| 日韩高清在线观看| 国产精品无圣光一区二区| 欧日韩精品视频| 精品无人码麻豆乱码1区2区 | 麻豆专区一区二区三区四区五区| 欧美高清dvd| 麻豆91在线播放| 中文子幕无线码一区tr| 91一区一区三区| 天天综合网天天综合色| 2021久久国产精品不只是精品| 高清不卡一区二区在线| 有码一区二区三区| 日韩一区国产二区欧美三区| 国产福利精品一区| 亚洲制服丝袜av| 精品久久久久久久久久久久久久久久久| 大陆成人av片| 精品午夜久久福利影院| 亚洲精品中文在线观看| 日韩视频免费观看高清在线视频| 懂色av一区二区三区蜜臀| 亚洲国产精品天堂| 久久麻豆一区二区| 欧美亚洲丝袜传媒另类| 亚洲午夜激情网页| 精品少妇一区二区三区视频免付费 | 日韩激情视频在线观看| 国产欧美一区二区精品性色超碰 | 91女厕偷拍女厕偷拍高清| 午夜视频久久久久久| 久久久久久麻豆| 91国内精品野花午夜精品| 麻豆高清免费国产一区| 亚洲男帅同性gay1069| 欧美精品日韩一区| 91在线视频网址| 国产在线国偷精品产拍免费yy| 亚洲综合网站在线观看| 国产亚洲短视频| 日韩欧美国产一区二区在线播放 | 精品一区二区三区免费播放| 亚洲综合色区另类av| 国产香蕉久久精品综合网| 欧美日韩国产系列| 91啦中文在线观看| 国产乱一区二区| 日本成人在线视频网站| 亚洲一区中文日韩| 18欧美乱大交hd1984| 久久久久久久久久美女| 7777精品伊人久久久大香线蕉的 | 日韩精品高清不卡| 亚洲女女做受ⅹxx高潮| 久久久精品中文字幕麻豆发布| 4438x亚洲最大成人网| heyzo一本久久综合| 精品一二三四在线| 国内成人免费视频| 美女网站在线免费欧美精品| 亚洲电影一级黄| 亚洲最大成人综合| 亚洲视频狠狠干| 国产精品夫妻自拍| 中文字幕第一区二区| 欧美成人a视频| 欧美电影影音先锋| 日韩一级黄色片| 91精品国产综合久久蜜臀| 欧美三级电影在线看| 欧美中文字幕不卡| 欧美综合久久久| 欧美视频在线观看一区| 91电影在线观看| 日本福利一区二区| 91成人在线免费观看| 91福利视频网站| 欧美日韩一区 二区 三区 久久精品| 色就色 综合激情| 在线观看国产精品网站| 91精品国产福利| 精品欧美久久久| 久久久久久久久岛国免费| 久久理论电影网| 中文字幕一区二区三| 国产精品美女久久久久久久久久久 | 在线播放日韩导航| 欧美精品色综合| 2020国产精品自拍| 国产精品久久久久久久久快鸭| 国产精品天干天干在线综合| 国产精品剧情在线亚洲| 中文一区二区在线观看| 国产精品欧美精品| 日韩一区欧美一区| 日韩国产一区二| 国产精品白丝av| 一本一道波多野结衣一区二区| 欧美揉bbbbb揉bbbbb| 91精品国产综合久久精品app| 精品欧美久久久| 国产精品久久二区二区| 亚洲综合视频网| 九九精品视频在线看| 成a人片国产精品| 欧美剧在线免费观看网站| 日韩欧美色电影| 日韩毛片精品高清免费| 日韩国产高清影视| 成人av资源在线| 欧美日韩久久一区| 欧美精品一区二区在线播放| 国产精品私人影院| 美洲天堂一区二卡三卡四卡视频| 国产伦精品一区二区三区免费| 99re亚洲国产精品| 在线播放中文一区| 国产精品国产精品国产专区不蜜 | a亚洲天堂av| 欧美一区二区美女| 国产精品入口麻豆原神| 日韩在线观看一区二区| 高清久久久久久| 91精品国产91综合久久蜜臀| 亚洲色图第一区| 国产一区二区三区久久悠悠色av | 91福利视频在线| 国产日韩在线不卡| 无码av免费一区二区三区试看| 成人免费高清视频在线观看| 欧美一区二区三区免费在线看| 国产精品美女www爽爽爽| 日本va欧美va欧美va精品| 91女厕偷拍女厕偷拍高清| 久久精品视频免费观看| 天天色综合成人网| 欧美亚洲综合久久| 国产精品理伦片| 国产乱国产乱300精品| 欧美日韩国产经典色站一区二区三区| 日韩欧美国产不卡| 亚洲国产日日夜夜| 欧美性videosxxxxx| 日韩一区欧美一区| 成人av网站免费| 精品日韩一区二区三区| 亚洲va国产天堂va久久en| av色综合久久天堂av综合| 国产午夜精品久久| 国精产品一区一区三区mba桃花| 欧美日韩一级二级三级| 亚洲日本一区二区| 成人精品高清在线| 国产欧美一区二区三区沐欲| 久久精品国产成人一区二区三区 | 26uuu欧美| 久久福利视频一区二区| 欧美一级搡bbbb搡bbbb| 亚洲成人av一区| 欧美日韩国产欧美日美国产精品| 亚洲欧美国产高清| 91亚洲午夜精品久久久久久| 中文字幕一区二区三区不卡在线 | 99r国产精品| 亚洲私人影院在线观看| 成人丝袜18视频在线观看| 欧美激情综合在线| 国产.精品.日韩.另类.中文.在线.播放| 日韩三级中文字幕| 青青草精品视频| 这里是久久伊人| 国产一区亚洲一区| 2019国产精品| 成人av动漫在线| 亚洲精品国产视频| 欧美性大战久久久久久久| 亚洲国产精品久久艾草纯爱| av成人免费在线| 亚洲免费观看高清在线观看|