⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serial.h

📁 一个简单的Windows Serial通讯的范例 可接收GPS讯号并解析
💻 H
字号:

// The following ifdef block is the standard way of creating macros which make exporting 
// from a DLL simpler. All files within this DLL are compiled with the SERIAL_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see 
// SERIAL_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported.
#ifdef SERIAL_EXPORTS
#define SERIAL_API __declspec(dllexport)
#else
#define SERIAL_API __declspec(dllimport)
#endif

typedef void (*voidfun)(char data);
typedef void (*FireEvent)();
#define MAX_HANDLER 10
//GPS String Collect Complete
#define GPSDataChange 0
#define GPSStringComplete 1
// This class is exported from the Serial.dll
class SERIAL_API CSerial {
public:
	CSerial(void);
	 //TODO: add your methods here.
};

extern SERIAL_API  int nSerial;

extern SERIAL_API  int fnSerial(void);
extern SERIAL_API  bool SerialOpen(char *COMName,int iBaudRate);
extern SERIAL_API  void SerialClose();
extern SERIAL_API  void RegSerialCallBack(int HookNumber,voidfun regfunc);
extern SERIAL_API  void SerialRead();
extern SERIAL_API void RegGPSCallBack(int HookNumber,FireEvent regfunc);

//GPS data
//GPS dll export data(GPRMC)
extern SERIAL_API int              GPSlatDegrees;
extern SERIAL_API float            GPSlatMinutes;
extern SERIAL_API unsigned char    GPSlatitudeCardinalString[3];
extern SERIAL_API int              GPSlongDegrees;
extern SERIAL_API float            GPSlongMinutes;
extern SERIAL_API unsigned char    GPSlongitudeCardinalString[3];
extern SERIAL_API unsigned  long   GPSutcHour;
extern SERIAL_API unsigned  long   GPSutcMinutes;
extern SERIAL_API unsigned  long   GPSutcSeconds; 
extern SERIAL_API float            GPSspeed;
extern  SERIAL_API unsigned char    GPSStatusString[3];
//GPS dll export data(GPGGA)
extern SERIAL_API int              GPSfix;
extern SERIAL_API int              GPSNumberOfSatelites;
//GPS string
extern SERIAL_API unsigned char cGPSString[100];

extern void GPSParse (unsigned char *GPSString);//parse GPS string

⌨️ 快捷键说明

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