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

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

?? gps.c

?? Open DMT Client C Source code
?? C
?? 第 1 頁 / 共 4 頁
字號:
// ----------------------------------------------------------------------------// Copyright 2006-2007, Martin D. Flynn// All rights reserved// ----------------------------------------------------------------------------//// Licensed under the Apache License, Version 2.0 (the "License");// you may not use this file except in compliance with the License.// You may obtain a copy of the License at// // http://www.apache.org/licenses/LICENSE-2.0// // Unless required by applicable law or agreed to in writing, software// distributed under the License is distributed on an "AS IS" BASIS,// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.// See the License for the specific language governing permissions and// limitations under the License.//// ----------------------------------------------------------------------------// Description://  Machine interface to GPS module.//  Abstraction layer for the machine interface to the GPS module.// Notes://  - The code included here is only an example of how to parse NMEA-0183 GPS records.//  This module should perform sufficient error checking to insure that the GPS module//  is functioning properly.//  - Ideally, GPS aquisition should occur in it's own thread in order to return//  the latest GPS fix to the requestor immediately (without blocking).  In non-thread//  mode, this implementation will block until a new GPS fix has been aquired (or if a //  timeout occurs).// ---// Change History://  2006/01/04  Martin D. Flynn//     -Initial release//  2006/02/09  Martin D. Flynn//     -This module now maintains its "stale" state.//     -"gpsGetDiagnostics" now returns a structure.//  2006/06/08  Martin D. Flynn//     -Added support for parsing "$GPGSA" //      (the DOP values are not currently used for fix discrimination).//  2007/01/28  Martin D. Flynn//     -WindowsCE port//     -Switched to generic thread access methods in 'tools/threads.h'//     -Initial implementation of a 'power-save' mode feature that closes the GPS //      comport if the sampling interval is greater than a minute (or so).  The HP //      hw6945 turns off the GPS receiver when the comport has been closed - to save //      power.  This feature allows GPS tracking on the HP hw6945 to conserve power//      (at the expense of some event accuracy).  Note: this feature is still under//      development and may not currently produce the desired results if used.// ----------------------------------------------------------------------------#include "stdafx.h" // TARGET_WINCE#include "custom/defaults.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <ctype.h>#include <time.h>#include <math.h>#include "custom/log.h"#include "custom/gps.h"#include "custom/gpsmods.h"#include "tools/stdtypes.h"#include "tools/utctools.h"#include "tools/strtools.h"#include "tools/checksum.h"#include "tools/comport.h"#include "base/events.h"#include "base/propman.h"#include "base/statcode.h"// ----------------------------------------------------------------------------#if !defined(GPS_COM_DATA_FORMAT)#  define GPS_COM_DATA_FORMAT           "8N1"#endif// ----------------------------------------------------------------------------/* compiling with thread support? */#if defined(GPS_THREAD)//#  warning GPS thread support enabled#  include "tools/threads.h"#else//#  warning GPS thread support disabled#endif// ----------------------------------------------------------------------------// References://   "GPS Hackery": http://www.ualberta.ca/~ckuethe/gps///   "GPS Applications": http://www.codeproject.com/vb/net/WritingGPSApplications1.asp// ----------------------------------------------------------------------------/* default GPS port */// This default value is not used if the GPS comport property is in effect.// The real default value is specified in 'propman.c'#if defined(TARGET_WINCE)#  define DEFAULT_GPS_PORT      ""#else#  define DEFAULT_GPS_PORT      "TTYS2"#endif/* simjulator port name */#define GPS_SIMULATOR_PORT      "sim"/* GPS bps */#define DEFAULT_GPS_SPEED       4800L // 8N1 assumed/* maximum out-of-sync seconds between GPS time and system time */// set this value to '0' to ignore sync'ing with system clock #define MAX_DELTA_CLOCK_TIME    20L/* minimum out-of-sync seconds between GPS time and system time */// delta must be at least this value to cause a system clock update#define MIN_DELTA_CLOCK_TIME    5L/* maximum number of allowed seconds in a $GP record 'cycle' */// In most GPS receivers, the default 'cycle' is 1 second#define GP_EXPIRE               5L/* power-save threshold */// if PROP_GPS_SAMPLE_RATE is >= this value, the GPS port will not be openned// until 'gpsAquire' is called, and will be closed after a GPS fix is aquired.#define POWER_SAVE_THRESHOLD    45L // seconds// ----------------------------------------------------------------------------/* control characters */#define ASCII_XON               17 // DC1, CTL_Q#define ASCII_XOFF              19 // DC3, CTL_S// ----------------------------------------------------------------------------#define SUPPORT_TYPE_GPRMC      0x0001 // should always be defined#define SUPPORT_TYPE_GPGGA      0x0002 // altitude, HDOP#define SUPPORT_TYPE_GPGSA      0x0004 // PDOP, HDOP, VDOP// ----------------------------------------------------------------------------#if defined(GPS_DEVICE_SIMULATOR)static utBool                   gpsSimulator = utFalse;#endifstatic ComPort_t                gpsComPort;static utBool                   gpsPortDebug;static GPS_t                    gpsFixLast;static GPS_t                    gpsFixUnsafe;static double                   gpsLastPDOP             = GPS_UNDEFINED_DOP;static double                   gpsLastHDOP             = GPS_UNDEFINED_DOP;static double                   gpsLastVDOP             = GPS_UNDEFINED_DOP;static TimerSec_t               gpsLastHDOPTimer        = 0L;static utBool                   gpsIsStale              = utFalse;static UInt32                   gpsSampleCount_A        = 0L; // validstatic UInt32                   gpsSampleCount_V        = 0L; // invalidstatic UInt32                   gpsRestartCount         = 0L;static TimerSec_t               gpsLastSampleTimer      = 0L;static TimerSec_t               gpsLastValidTimer       = 0L;static TimerSec_t               gpsLastReadErrorTimer   = 0L;static TimerSec_t               gpsLastLostErrorTimer   = 0L;static utBool                   gpsAquireRequest        = utFalse;static UInt32                   gpsAquireTimeoutMS      = 0L;#if defined(GPS_THREAD)static utBool                   gpsRunThread = utFalse;static threadThread_t           gpsThread;static threadMutex_t            gpsMutex;static threadMutex_t            gpsSampleMutex;static threadMutex_t            gpsAquireMutex;static threadCond_t             gpsAquireCond;#define SAMPLE_LOCK             MUTEX_LOCK(&gpsSampleMutex);#define SAMPLE_UNLOCK           MUTEX_UNLOCK(&gpsSampleMutex);#define GPS_LOCK                MUTEX_LOCK(&gpsMutex);#define GPS_UNLOCK              MUTEX_UNLOCK(&gpsMutex);#define AQUIRE_LOCK             MUTEX_LOCK(&gpsAquireMutex);#define AQUIRE_UNLOCK           MUTEX_UNLOCK(&gpsAquireMutex);#define AQUIRE_WAIT             CONDITION_WAIT(&gpsAquireCond, &gpsAquireMutex);#define AQUIRE_NOTIFY           CONDITION_NOTIFY(&gpsAquireCond);#else#define SAMPLE_LOCK     #define SAMPLE_UNLOCK   #define GPS_LOCK        #define GPS_UNLOCK      #define AQUIRE_LOCK             #define AQUIRE_UNLOCK           #define AQUIRE_WAIT             #define AQUIRE_NOTIFY           #endif// ----------------------------------------------------------------------------static GPSDiagnostics_t gpsStats = { 0L, 0L, 0L, 0L, 0L };GPSDiagnostics_t *gpsGetDiagnostics(GPSDiagnostics_t *stats){#if !defined(GPS_THREAD)// These values will not be accurate if not running in thread mode#  warning GPS is not running in thread mode, diagnostic values will not be accurate.#endif    GPSDiagnostics_t *s = stats? stats : &gpsStats;    SAMPLE_LOCK {        s->lastSampleTime = TIMER_TO_UTC(gpsLastSampleTimer);        s->lastValidTime  = TIMER_TO_UTC(gpsLastValidTimer);        s->sampleCount_A  = gpsSampleCount_A;        s->sampleCount_V  = gpsSampleCount_V;        s->restartCount   = gpsRestartCount;    } SAMPLE_UNLOCK    return s;}// ----------------------------------------------------------------------------#if defined(TARGET_WINCE)// skip handling of specific GPS receiver types#elsestatic void _gpsConfigGarmin(ComPort_t *com){    // This configures a Garmin receiver to send only GPRMC & GPGGA records,    // and send them only once every 2 seconds.        // disable all sentences    comPortWriteString(com, "$PGRMO,,2\r\r\n");    // "$PGRMO,,4" restores factory default sentences    comPortFlush(com, 100L);        // Fix mode: Automatic    // Differential mode: Automatic    comPortWriteString(com, "$PGRMC,A,,,,,,,,A\r\r\n");    comPortFlush(com, 100L);        // output every 2 seconds    // automatic position averaging when stopped    // NMEA-0183 v2.30 off    // enable WAAS    comPortWriteString(com, "$PGRMC1,2,,2,,,,1,W\r\r\n");    // "$PGRMC1,1" set it back to 1/sec    // "$PGRMC1E" queries current config    comPortFlush(com, 100L);    // enable GPRMC sentence    comPortWriteString(com, "$PGRMO,GPRMC,1\r\r\n");    comPortFlush(com, 100L);    // enable GPGGA sentence    comPortWriteString(com, "$PGRMO,GPGGA,1\r\r\n");    comPortFlush(com, 100L);    /* done */    logDEBUG(LOGSRC,"Garmin GPS configured");}#endif// ----------------------------------------------------------------------------/* open gps serial port */static utBool _gpsOpen(){    ComPort_t *com = &gpsComPort;    comPortInitStruct(com);    /* check port */    const char *portName = propGetString(PROP_CFG_GPS_PORT, "");    if (!portName || !*portName) { portName = DEFAULT_GPS_PORT; }        /* simulator mode? */#if defined(GPS_DEVICE_SIMULATOR)    gpsSimulator = strEqualsIgnoreCase(portName,GPS_SIMULATOR_PORT);    if (gpsSimulator) {        // should not be here if we are running in simulator mode        return utFalse;    }#endif    /* speed */    long bpsSpeed = (long)propGetUInt32(PROP_CFG_GPS_BPS, -1L);    if (bpsSpeed <= 0L) { bpsSpeed = DEFAULT_GPS_SPEED; }    /* open */    if (comPortOpen(com,portName,bpsSpeed,GPS_COM_DATA_FORMAT,utFalse) == (ComPort_t*)0) {        // The outer loop will retry the open later        // Generally, this should not occur on the GumStix        //logWARNING(LOGSRC,"Unable to open GPS port '%s' [%s]", portName, strerror(errno));        logWARNING(LOGSRC,"Unable to open GPS port '%s'", portName);        return utFalse;    }    logDEBUG(LOGSRC,"Opened GPS port: %s [%ld bps]", comPortName(com), bpsSpeed);    threadSleepMS(500L); // wait for connection to settle    /* comport logging */    gpsPortDebug = propGetBoolean(PROP_CFG_GPS_DEBUG,utFalse);#if defined(TARGET_WINCE)    // TODO: implement comport logging feature#else    if (gpsPortDebug) {        comPortSetDebugLogger(com, 0);    }#endif    /* specific GPS device configuration */#if defined(TARGET_WINCE)    // skip handling of specific GPS receiver types#else    const char *receiver = propGetString(PROP_CFG_GPS_MODEL,"");    if (strEqualsIgnoreCase(receiver,GPS_RECEIVER_GARMIN)) {        // Garmin 15, 18PC        _gpsConfigGarmin(com);    }#endif    /* return success */    return utTrue;}/* close gps serial port */static void _gpsClose(){    comPortClose(&gpsComPort);}// ----------------------------------------------------------------------------/* update system clock time */static utBool gpsUpdateSystemClock(long fixtime){    long delta = (long)propGetUInt32(PROP_GPS_CLOCK_DELTA, MAX_DELTA_CLOCK_TIME);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美一区二区三区国产精品 | kk眼镜猥琐国模调教系列一区二区| 欧美一区二区三区在线看| 奇米综合一区二区三区精品视频| 欧美一级艳片视频免费观看| 老司机精品视频导航| 久久色在线观看| 99久久久久久| 午夜影视日本亚洲欧洲精品| 欧美成人一区二区三区在线观看| 国产成人精品免费| 亚洲日本乱码在线观看| 6080午夜不卡| 国产精品12区| 一区二区三区中文字幕电影 | 中文字幕国产一区二区| 色哟哟一区二区三区| 亚洲成人av电影在线| 日韩精品一区二区三区蜜臀| 粉嫩av亚洲一区二区图片| 亚洲欧美日韩国产综合| 在线播放91灌醉迷j高跟美女| 激情都市一区二区| 亚洲欧洲av色图| 91精品国产综合久久久蜜臀图片| 国产一区在线视频| 亚洲欧美日韩一区二区 | 欧美一区中文字幕| 国产成人在线观看| 亚洲观看高清完整版在线观看| 精品国产乱码久久久久久免费| 91碰在线视频| 精品一区免费av| 亚洲乱码日产精品bd | 国产视频在线观看一区二区三区| 色一区在线观看| 国产在线观看免费一区| 亚洲一区二区在线观看视频| 久久九九99视频| 7878成人国产在线观看| a在线欧美一区| 欧美日韩五月天| 国产91丝袜在线18| 毛片av一区二区| 一区二区久久久久| 国产欧美一区二区精品仙草咪 | 欧美一级爆毛片| 97国产一区二区| 国产成人亚洲综合a∨婷婷| 午夜精品久久久久久久| 日韩理论电影院| 国产日韩精品视频一区| 欧美成人精品福利| 欧美日韩国产大片| 色综合网站在线| 成人av第一页| 国产精品18久久久久久vr| 日本欧洲一区二区| 亚洲444eee在线观看| 亚洲精品综合在线| 国产精品久久久久久久久免费樱桃 | 国产成人小视频| 国产在线观看一区二区| 裸体歌舞表演一区二区| 性做久久久久久| 午夜欧美视频在线观看| 亚洲国产色一区| 亚洲国产精品久久一线不卡| 一区二区三区在线视频免费观看| 最新热久久免费视频| 亚洲欧洲精品一区二区三区不卡| 国产精品色在线观看| 国产精品女同互慰在线看| 欧美高清在线一区二区| 中文字幕av资源一区| 国产欧美日韩视频一区二区 | 亚洲三级理论片| 亚洲青青青在线视频| 亚洲婷婷国产精品电影人久久| 国产精品天美传媒沈樵| 中文字幕一区在线观看视频| 国产精品第一页第二页第三页| 国产精品久久久99| 亚洲乱码国产乱码精品精的特点| 一区二区三区免费观看| 亚洲国产婷婷综合在线精品| 天堂一区二区在线| 蜜桃视频在线一区| 国产一区日韩二区欧美三区| 东方aⅴ免费观看久久av| 99久久国产综合精品色伊 | 成人黄色免费短视频| 亚洲精品在线一区二区| 久久亚洲捆绑美女| 国产精品国产三级国产| 一区二区三区在线免费播放| 午夜一区二区三区在线观看| 日韩电影在线免费观看| 国产一区二区三区四| 国产成人在线看| 色av一区二区| 日韩一级片网址| 亚洲国产精品ⅴa在线观看| 一区二区三区在线免费视频| 日韩高清一区在线| 国产成人午夜99999| 色乱码一区二区三区88| 欧美一区日韩一区| 国产欧美一二三区| 亚洲一区二区三区中文字幕在线| 麻豆精品视频在线| www.色精品| 91精品在线观看入口| 国产日产精品1区| 亚洲成人午夜电影| 成人小视频免费观看| 欧美调教femdomvk| 国产免费成人在线视频| 五月婷婷激情综合| 成人性生交大片免费看中文 | 欧美伦理电影网| 日本一区二区三区四区 | 亚洲欧洲成人精品av97| 青青草成人在线观看| 成人免费毛片嘿嘿连载视频| 欧美日韩电影在线播放| 国产欧美精品一区二区三区四区 | 欧美国产禁国产网站cc| 偷窥国产亚洲免费视频 | 欧美手机在线视频| 国产精品午夜电影| 麻豆精品在线观看| 欧美亚洲国产一区二区三区| 2021中文字幕一区亚洲| 亚洲国产一区二区三区| 不卡一卡二卡三乱码免费网站| 日韩一区二区三区四区| 亚洲永久精品国产| 成人黄色软件下载| 国产亚洲人成网站| 久久精品久久精品| 欧美午夜精品久久久久久超碰| 国产精品久久久久永久免费观看| 国产自产视频一区二区三区| 69p69国产精品| 亚洲高清不卡在线| 91福利在线免费观看| 国内精品伊人久久久久av影院| 欧美福利视频一区| 亚洲国产成人tv| 91福利资源站| 一区二区三区.www| 99精品热视频| 18成人在线视频| 不卡视频一二三| 中文字幕制服丝袜成人av | 日韩精品欧美精品| 蜜桃91丨九色丨蝌蚪91桃色| 欧美性一级生活| 国产精品久久二区二区| 国产精品一区不卡| 国产亚洲人成网站| 精品一区二区影视| 911国产精品| 亚洲国产精品自拍| 欧美日韩美少妇| 亚洲另类色综合网站| 成人黄色在线网站| 欧美久久久久久久久中文字幕| 亚洲成va人在线观看| 一本久久a久久免费精品不卡| 国产午夜精品一区二区| 国产一区在线视频| 精品成人在线观看| 亚洲日本在线天堂| 99久久精品免费看国产免费软件| 中文字幕一区二区三区在线观看| 国产成人自拍网| 国产色一区二区| 成人精品视频一区二区三区尤物| 欧美国产禁国产网站cc| 成人晚上爱看视频| 国产精品国产a| 成人91在线观看| 亚洲欧洲日韩在线| 精品国产乱码久久久久久牛牛 | 久久久电影一区二区三区| 久久99久久久久久久久久久| 6080国产精品一区二区| 婷婷国产在线综合| 91精品国产免费| 青青草国产精品亚洲专区无| 久久久国产午夜精品 | 国产精品18久久久| 亚洲同性gay激情无套| 91九色02白丝porn| 日韩中文字幕麻豆| 欧美在线视频不卡| 国产伦理精品不卡| 中文字幕成人av|