-
Notifications
You must be signed in to change notification settings - Fork 5
/
dmSerial.Base.pas
68 lines (53 loc) · 1.62 KB
/
dmSerial.Base.pas
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
56
57
58
59
60
61
62
63
64
65
66
67
68
{
Base object to define a basic layout for communications.
}
unit dmSerial.Base;
interface
uses
diagnostics,
FMX.Dialogs,
FMX.Memo,
system.classes,
system.SysUtils;
type
TdmSerialBase = class(tobject)
private
fError: String;
fErrorCode: integer;
fComFailure: boolean;
// fOnRxChar: TNotifyEvent;
protected
//procedure SetOnRxChar(value: TNotifyEvent); virtual; Abstract;
public
onError: TNotifyEvent;
fmemoDebug: tmemo;
constructor Create;
destructor Destroy; override;
procedure Close; virtual; abstract;
function Open: boolean; virtual; abstract;
function Active: boolean; virtual; abstract;
function ReadString: String; Virtual; abstract;
function SendCommand(cmd: string; const readtimeout: integer = 500; const waitfor: integer = 100): string;
virtual; abstract;
function SendCommandOnly(cmd: string): String; virtual; abstract;
function SendCommandAndWaitForValue(cmd: string; const readtimeout: integer = 500; const waitfor: string = '';
const count: byte = 1): string; virtual; abstract;
procedure PurgeInput; virtual; abstract;
procedure PurgeOutput; virtual; abstract;
procedure WaitForReadCompletion; virtual; abstract;
procedure WaitForWriteCompletion; virtual; abstract;
property Error: String read fError;
property ErrorCode: integer read fErrorCode;
property Failure: boolean read fComFailure;
//property OnRXChar: TNotifyEvent read fOnRxChar write SetOnRxChar;
end;
implementation
constructor TdmSerialBase.Create;
begin
inherited;
end;
Destructor TdmSerialBase.destroy;
begin
inherited;
end;
end.