Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
CESeries.h
Package: GPSserial.rar [view]
Upload User: zhqmouse
Upload Date: 2022-05-26
Package Size: 47k
Code Size: 1k
Category:
GPS develop
Development Platform:
Visual C++
- /*-----------------------------------------
- *
- * 文件名称: CESeries.h
- * 文件标识:
- * 摘要:用于封装WINCE 串口通讯
- *
- ----------------------------------------*/
- #pragma once
- //定义串口接收数据函数类型
- typedef void (CALLBACK* ONSERIESREAD)(void * pOwner /*父对象指针*/
- ,BYTE* buf /*接收到的缓冲区*/
- ,DWORD dwBufLen /*接收到的缓冲区长度*/);
- class CCESeries
- {
- public:
- CCESeries(void);
- ~CCESeries(void);
- public:
- //打开串口
- BOOL OpenPort(void* pOwner,/*指向父指针*/
- UINT portNo = 1, /*串口号*/
- UINT baud = 4800, /*波特率*/
- UINT parity = NOPARITY, /*奇偶校验*/
- UINT databits = 8, /*数据位*/
- UINT stopbits = 0 /*停止位*/
- );
- //关闭串口
- void ClosePort();
- //同步写入数据
- BOOL WriteSyncPort(const BYTE*buf , DWORD bufLen);
- //设置串口读取、写入超时
- BOOL SetSeriesTimeouts(COMMTIMEOUTS CommTimeOuts);
- //得到串口是否打开
- BOOL GetComOpened();
- private:
- //串口读线程函数
- static DWORD WINAPI ReadThreadFunc(LPVOID lparam);
- private:
- //关闭读线程
- void CloseReadThread();
- private:
- //已打开的串口句柄
- HANDLE m_hComm;
- //读线程句柄
- HANDLE m_hReadThread;
- //读线程ID标识
- DWORD m_dwReadThreadID;
- //读线程退出事件
- HANDLE m_hReadCloseEvent;
- BOOL m_bOpened; //串口是否打开
- void * m_pOwner; //指定父对象指针
- public:
- ONSERIESREAD m_OnSeriesRead; //串口读取回调函数
- };