Class tcommport
Unit
Declaration
type tcommport = class(tmsecomponent, istatfile)
Description
Base class for custom serial protocol drivers, often connected to an RS485 bus: build your own tcommport and tcommthread descendants to implement a protocol, as tasciicommport/tasciicommthread do for ASCII protocols. thread.readstring(count,dest,timeoutus) reads a fixed number of bytes from the port thread; lower level access is possible through thread.port, e.g. thread.port.readbuffer. The state of the control lines is not used by these components; use trs232.handle with the OS serial API if you need them.
Hierarchy
- TObject
- tpersistent
- tcomponent
- tmsecomponent
- tcommport
Overview
Fields
| Protected | ftimeout: integer; |
| Protected | fthread: tcommthread; |
Methods
| Protected | procedure portchanged; virtual; |
| Protected | function postandwait(const event: tcommevent): boolean; |
| Protected | procedure postevent(const event: tcommevent); |
| Protected | procedure loaded; override; |
| Protected | function extracterrortext(error: integer; errors: array of errorrecty; var text: msestring): boolean; |
| Protected | procedure dostatread(const reader: tstatreader); virtual; |
| Protected | procedure dostatwrite(const writer: tstatwriter); virtual; |
| Protected | procedure statreading; |
| Protected | procedure statread; |
| Protected | function getstatvarname: msestring; |
| Protected | function getstatpriority: integer; |
| Protected | procedure doafteropen; virtual; |
| Public | constructor create(aowner: tcomponent); override; |
| Public | destructor destroy; override; |
| Public | function openport(raiseexception: boolean = false): boolean; |
| Public | procedure closeport; |
| Public | procedure abort; |
| Public | function geterrortext(error: integer): msestring; virtual; |
| Public | function getlastresulttext: msestring; |
Properties
| Public | property thread: tcommthread read fthread; |
| Public | property opened: boolean read getopened; |
| Public | property busy: boolean read getbusy; |
| Public | property halfduplex: boolean read gethalfduplex write sethalfduplex default false; |
| Public | property objectlinker: tobjectlinker read getobjectlinker
; |
| Published | property onportchange: notifyeventty read Fonportchange
write fonportchange; |
| Published | property onconnectchanged: booleanchangedeventty read Fonconnectedchange
write fonconnectedchange; |
| Published | property sendretries: integer read getsendretries write setsendretries default 0; |
| Published | property port: commnrty read getport write setport default cnr_1; |
| Published | property portname: filenamety read getportname write setportname; |
| Published | property baudrate: commbaudratety read getbaudrate write Setbaudrate default cbr_9600; |
| Published | property stopbit: commstopbitty read getstopbit write Setstopbit default csb_1; |
| Published | property parity: commparityty read getparity write Setparity default cpa_none; |
| Published | property databits: commdatabitsty read getdatabits write setdatabits default cdb_8; |
| Published | property rtstimevor: integer read getrtstimevor write setrtstimevor default 0; |
| Published | property rtstimenach: integer read getrtstimenach write setrtstimenach default 0; |
| Published | property timeout: integer read ftimeout write ftimeout default 200000; |
| Published | property active: boolean read factive write setactive default false; |
| Published | property statfile: tstatfile read fstatfile write setstatfile; |
| Published | property statvarname: msestring read getstatvarname write fstatvarname; |
| Published | property statpriority: integer read fstatpriority
write fstatpriority default 0; |
Description
Fields
| Protected | ftimeout: integer; |
|
This item has no description. | |
| Protected | fthread: tcommthread; |
|
This item has no description. | |
Methods
| Protected | procedure portchanged; virtual; |
|
This item has no description. | |
| Protected | function postandwait(const event: tcommevent): boolean; |
|
This item has no description. | |
| Protected | procedure postevent(const event: tcommevent); |
|
This item has no description. | |
| Protected | procedure loaded; override; |
|
This item has no description. | |
| Protected | function extracterrortext(error: integer; errors: array of errorrecty; var text: msestring): boolean; |
|
This item has no description. | |
| Protected | procedure dostatread(const reader: tstatreader); virtual; |
|
This item has no description. | |
| Protected | procedure dostatwrite(const writer: tstatwriter); virtual; |
|
This item has no description. | |
| Protected | procedure statreading; |
|
This item has no description. | |
| Protected | procedure statread; |
|
This item has no description. | |
| Protected | function getstatvarname: msestring; |
|
This item has no description. | |
| Protected | function getstatpriority: integer; |
|
This item has no description. | |
| Protected | procedure doafteropen; virtual; |
|
This item has no description. | |
| Public | constructor create(aowner: tcomponent); override; |
|
This item has no description. | |
| Public | destructor destroy; override; |
|
This item has no description. | |
| Public | function openport(raiseexception: boolean = false): boolean; |
|
This item has no description. | |
| Public | procedure closeport; |
|
This item has no description. | |
| Public | procedure abort; |
|
This item has no description. | |
| Public | function geterrortext(error: integer): msestring; virtual; |
|
This item has no description. | |
| Public | function getlastresulttext: msestring; |
|
This item has no description. | |
Properties
| Public | property thread: tcommthread read fthread; |
|
This item has no description. | |
| Public | property opened: boolean read getopened; |
|
This item has no description. | |
| Public | property busy: boolean read getbusy; |
|
This item has no description. | |
| Public | property halfduplex: boolean read gethalfduplex write sethalfduplex default false; |
|
This item has no description. | |
| Public | property objectlinker: tobjectlinker read getobjectlinker
; |
|
This item has no description. | |
| Published | property onportchange: notifyeventty read Fonportchange
write fonportchange; |
|
This item has no description. | |
| Published | property onconnectchanged: booleanchangedeventty read Fonconnectedchange
write fonconnectedchange; |
|
This item has no description. | |
| Published | property sendretries: integer read getsendretries write setsendretries default 0; |
|
This item has no description. | |
| Published | property port: commnrty read getport write setport default cnr_1; |
|
This item has no description. | |
| Published | property portname: filenamety read getportname write setportname; |
|
This item has no description. | |
| Published | property baudrate: commbaudratety read getbaudrate write Setbaudrate default cbr_9600; |
|
This item has no description. | |
| Published | property stopbit: commstopbitty read getstopbit write Setstopbit default csb_1; |
|
This item has no description. | |
| Published | property parity: commparityty read getparity write Setparity default cpa_none; |
|
This item has no description. | |
| Published | property databits: commdatabitsty read getdatabits write setdatabits default cdb_8; |
|
This item has no description. | |
| Published | property rtstimevor: integer read getrtstimevor write setrtstimevor default 0; |
|
This item has no description. | |
| Published | property rtstimenach: integer read getrtstimenach write setrtstimenach default 0; |
|
This item has no description. | |
| Published | property timeout: integer read ftimeout write ftimeout default 200000; |
|
This item has no description. | |
| Published | property active: boolean read factive write setactive default false; |
|
This item has no description. | |
| Published | property statfile: tstatfile read fstatfile write setstatfile; |
|
This item has no description. | |
| Published | property statvarname: msestring read getstatvarname write fstatvarname; |
|
This item has no description. | |
| Published | property statpriority: integer read fstatpriority
write fstatpriority default 0; |
|
This item has no description. | |
Generated by PasDoc 1.0.4.