forked from efecanicoz/lad_configurator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RS232implements.h
56 lines (35 loc) · 1 KB
/
RS232implements.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//---------------------------------------------------------------------------
#ifndef RS232implementsH
#define RS232implementsH
#include <vcl.h>
#include <stdio.h>
#include <windows.h>
#include <TCHAR.H >
#include <conio.h>
#include <SysUtils.hpp>
#include <Classes.hpp>
#include <SyncObjs.hpp>
#include <winbase.h>
//---------------------------------------------------------------------------
class TComPort
{
private:
HANDLE porth;
public:
TComPort();
~TComPort();
bool EnumPorts(TStringList *List);
bool IsOpened();
void ClosePort();
bool OpenPort(UnicodeString PortName, //like COMx
int CBR, //BaudRate, ilke CBR_19200, CBR_115200, CBR_256000
int Bytes, //7,8
int Parity, //NOPARITY, ODDPARITY, EVENPARITY, MARKPARITY, SPACEPARITY
int StopBits, //ONESTOPBIT, ONE5STOPBITS, TWOSTOPBITS
int RWTimeout //100
);
unsigned long PortWrite(AnsiString Message);
AnsiString PortRead();
bool ReadWrite(AnsiString Message, AnsiString &Answer);
};
#endif