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

📄 serialio.h

📁 用vc写的非常简单的小程序
💻 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 SERIALIO_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 
// SERIALIO_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported.
#ifdef SERIALIO_EXPORTS
#define SERIALIO_API __declspec(dllexport)
#else
#define SERIALIO_API __declspec(dllimport)
#endif

// This class is exported from the Serialio.dll
class SERIALIO_API CSerialio {
public:
	CSerialio(void);
};

extern SERIALIO_API int nSerialio;

SERIALIO_API int fnSerialio(void);

#include "windows.h"
#include <stdlib.h>

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define None	0
#define RTSCTS	1
#define DTRDSR	2
#define XONXOFF	3

///////////////////////// 全局变量 ///////////////////
char CIDMsg[] = "AT+CXXCID\r";
char MadeOfMsg[] = "AT+GMI\r";
char ModelMsg[] = "AT+GMM\r";
char VerMsgs[] = "AT+GMR\r";
char SMSCMsgs[] = "AT+CSCA?\r";
char SetCts[] = "ATQ0\r";
char Setecho[] = "ATE0\r";
char SetText[] = "AT+CMGF=1\r";
char DelMsg[] = "AT+CMGD=";
char SendMsg[] = "AT+CMGS=";
char ReadMsg[] = "AT+CMGR=";
char ListMsgs[] = "AT+CMGL";
char NewMsgs[] = "AT+CPMS?\r";
char msg[200];
char Getmsg[200];
static int	 sid;
int  ID;
int	Model;
int	 te;
int InputLength;
char ids[90];
int MsgAmount;

bool	HC;
unsigned char outstring[200];
unsigned char ToBinString[20];
unsigned char cs[25];
unsigned char Result = 0;
bool CheckFlag = FALSE;
BYTE inBuffer[4096];
DWORD nBytesToRead = 1024, nBytesRead;
DWORD nBytesToWrite = 1024, BytesWritten;
char Error[] = "ERROR";
HANDLE	my_hCommFile;
int IniFlag;

/////////////////// 函数定义 /////////////////////////

//内部函数
unsigned char MakeCheckCode( unsigned char*, int);
BOOL CheckAddress(char, char);
void ToBin(unsigned char*);
void ToAsc(unsigned char*);
void ASCtoBCD(unsigned char*);
void BCDtoASC(unsigned char*, int);
char* IntToString(int, char*, int);
unsigned char* ToString(int, unsigned char*, int);
int ByteToInt(char * bs, int lens);
void TestString(BYTE * test);
void AscToHex(char* as, int aslen, int hexlen);
int	Filter_z(char* sa, int length,int Model);

//通信函数
BOOL SetupCOMM(int port);
BOOL WriteCOMM(BYTE *OutBuffer, int Length);
BOOL ReadCOMM(BYTE *InBuffer);
void Delay(unsigned long);
BOOL Capabilities(DWORD CAPS);
BOOL SettaleParams(DWORD PARAMS);
BOOL CheckRS232(char* str);

//输出函数
int  SerialINI(int port);
char* ReadMessage(int index);
char* WriteMessage(char* outstring);
int GetMsgAmount(int mn);
char* GetMsgID(int type);
int Tc35DelMsg(int index);
char* Tc35CID(char*);	
char* Tc35Made(char*);
char* Tc35Model(char*);
char* Tc35Ver(char*);
char* Tc35SMSC(char*);
char* ReadMSG(int id);
int WriteMSG(char* str);
//TC35T操作函数
char* Tc35GetMsgs(int MsgType);
BOOL Tc35Read(int index);
BOOL Tc35Send(char* str);
BOOL Tc35Ini(void);
int Tc35NewMsg();
int SearchStr(char*,char*);
BOOL ReadWriteTc35t(long delay, BYTE* cmdstr, BYTE* rslstr);
void EmptyBuffer(BYTE*, int);

//////////////////////////////////////////////////////

⌨️ 快捷键说明

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