下面是C++的代码,有几个部分实在搞不懂了,请大家帮忙!
#ifdef WIN32
typedef HANDLE T_HANDLE;
#else
typedef long T_HANDLE;
#endif
typedef struct s232_comprop
{
int baud; /*baud rate: 9600, 19200,...*/
int parity;/*parity*/
int stop; /*stop bit*/
int data; /*data bit*/
} T232_COMPROP;
/*end: 232 port communication property*//*begin: the descriptor of 232 port and its device*/
typedef struct s232_dd
{
T_HANDLE port; /*232 port handler*/
char portstr[8];
T232_COMPROP prop; /*232 port communication state*/
long device; /*device id*/
char devprop[2048];/*the device information pointer*/
} T232_DD;
/*end: the descriptor of 232 port and its device*/extern int OpenPort(char *p_PortStr_p, T232_COMPROP * p_ComProp_p, T232_DD * p_DD_p);
extern int ClosePort(T232_DD *p_DD_p);
extern int SndStr(T232_DD * p_DD_p, unsigned char *p_Data_p, int p_Len_i);
extern int RecStr(T232_DD *p_DD_p, unsigned char *p_Data_p, int p_Len_i);还有一部分,另开贴求教!
#ifdef WIN32
typedef HANDLE T_HANDLE;
#else
typedef long T_HANDLE;
#endif
typedef struct s232_comprop
{
int baud; /*baud rate: 9600, 19200,...*/
int parity;/*parity*/
int stop; /*stop bit*/
int data; /*data bit*/
} T232_COMPROP;
/*end: 232 port communication property*//*begin: the descriptor of 232 port and its device*/
typedef struct s232_dd
{
T_HANDLE port; /*232 port handler*/
char portstr[8];
T232_COMPROP prop; /*232 port communication state*/
long device; /*device id*/
char devprop[2048];/*the device information pointer*/
} T232_DD;
/*end: the descriptor of 232 port and its device*/extern int OpenPort(char *p_PortStr_p, T232_COMPROP * p_ComProp_p, T232_DD * p_DD_p);
extern int ClosePort(T232_DD *p_DD_p);
extern int SndStr(T232_DD * p_DD_p, unsigned char *p_Data_p, int p_Len_i);
extern int RecStr(T232_DD *p_DD_p, unsigned char *p_Data_p, int p_Len_i);还有一部分,另开贴求教!
parity:integer;/*parity*/
stop:integer; /*stop bit*/
data:integer; /*data bit*/
end;
portstr:array[0..7] of char;
prop:T232_COMPROP ; /*232 port communication state*/
device:DWORD; /*device id*/
devprop:array[0..2047] of char;/*the device information end;