Class TProtocolDriver
Unit
Declaration
type TProtocolDriver = class(TComponent, IPortDriverEventNotification)
Description
TProtocolDriver
Hierarchy
- TComponent
- TProtocolDriver
Overview
Fields
PReadSomethingAlways:Boolean; |
|
PUpdatingMultipleTags:Integer; |
|
FProtocolReady:Boolean; |
|
PDriverID:Cardinal; |
|
PCommPort:TCommPortDriver; |
|
FScanReadID:Cardinal; |
|
FScanWriteID:Cardinal; |
|
FReadID:Cardinal; |
|
FWriteID:Cardinal; |
|
FReadCS:TCriticalSection; |
|
FWriteCS:TCriticalSection; |
|
FPause:TCrossEvent; |
|
PCallersCS:TCriticalSection; |
Methods
procedure HighLatencyOperationWillBegin(Sender:TObject); |
|
procedure HighLatencyOperationWasEnded(Sender:TObject); |
|
function GetPortOpenedEvent:TNotifyEvent; |
|
function GetPortClosedEvent:TNotifyEvent; |
|
function GetPortDisconnectedEvent:TNotifyEvent; |
|
function NotifyThisEvents:TNotifyThisEvents; virtual; |
|
procedure PortOpened(Sender: TObject); virtual; |
|
procedure PortClosed(Sender: TObject); virtual; |
|
procedure PortDisconnected(Sender: TObject); virtual; |
|
procedure SetCommPort(CommPort:TCommPortDriver); |
|
procedure CopyIOPacket(const Source:TIOPacket; var Dest:TIOPacket); |
|
procedure CommPortCallBack(var Result:TIOPacket); virtual; |
|
procedure DoAddTag(TagObj:TTag; TagValid:Boolean); virtual; |
|
procedure DoDelTag(TagObj:TTag); virtual; |
|
procedure DoScanRead(Sender:TObject; var NeedSleep:LongInt); virtual; abstract; |
|
procedure DoGetValue(TagRec:TTagRec; var values:TScanReadRec); virtual; abstract; |
|
function DoWrite(const tagrec:TTagRec; const Values:TArrayOfDouble; Sync:Boolean):TProtocolIOResult; virtual; abstract; |
|
function DoRead (const tagrec:TTagRec; out Values:TArrayOfDouble; Sync:Boolean):TProtocolIOResult; virtual; abstract; |
|
procedure AddTag(TagObj:TTag); |
|
procedure StartUpdateMultipleTags; |
|
procedure StopUpdateMultipleTags; |
|
procedure RemoveTag(TagObj:TTag); |
|
function IsMyTag(TagObj:TTag):Boolean; |
|
function SizeOfTag(aTag:TTag; isWrite:Boolean; var ProtocolTagType:TProtocolTagType):BYTE; virtual; abstract; |
|
function ScanRead(const tagrec:TTagRec):Cardinal; |
|
function ScanWrite(const tagrec:TTagRec; const Values:TArrayOfDouble):Cardinal; |
|
procedure Read(const tagrec:TTagRec); |
|
procedure Write(const tagrec:TTagRec; const Values:TArrayOfDouble); |
|
function LiteralTagAddress(aTag:TTag; aBlockTag:TTag=nil):AnsiString; virtual; |
|
procedure OpenTagEditor(InsertHook:TAddTagInEditorHook; CreateProc:TCreateTagProc); virtual; |
|
function HasTabBuilderEditor:Boolean; virtual; |
Properties
property ReadSomethingAlways: Boolean read PReadSomethingAlways write PReadSomethingAlways default true; |
|
property ReadOnly: Boolean read GetIsReadOnly write SetIsReadOnly; |
|
property TagCount: LongInt read GetTagCount; |
|
property Tag[index:LongInt]: TTag read GetTag; |
|
property TagName[index:LongInt]: AnsiString read GetTagName; |
|
property TagByName[Nome:AnsiString]: TTag read GetTagByName; |
|
property CommunicationPort: TCommPortDriver read PCommPort write SetCommPort nodefault; |
|
property DriverID: Cardinal read PDriverID; |
|
property AvgTagUpdateTime: Double read FUserUpdateTime; |
Description
Fields
PReadSomethingAlways:Boolean; |
|
: Tells if at least one item must be read at each scan cycle of protocol driver. |
PUpdatingMultipleTags:Integer; |
|
: Missing comment. |
FProtocolReady:Boolean; |
|
: Tells if the protocol driver is ready |
PDriverID:Cardinal; |
|
: Stores the unique identification of protocol driver. |
PCommPort:TCommPortDriver; |
|
: Stores the communication port driver used by protocol driver. |
FScanReadID:Cardinal; |
|
: Stores the unique identification of each kind of request. |
FScanWriteID:Cardinal; |
|
: Stores the unique identification of each kind of request. |
FReadID:Cardinal; |
|
: Stores the unique identification of each kind of request. |
FWriteID:Cardinal; |
|
: Stores the unique identification of each kind of request. |
FReadCS:TCriticalSection; |
|
: Mutex that protect the protocol driver. |
FWriteCS:TCriticalSection; |
|
: Mutex that protect the protocol driver. |
FPause:TCrossEvent; |
|
: Stop thread to keep the normal execution of the all system. |
PCallersCS:TCriticalSection; |
|
: Mutex that protect the scan procedures of the protocol driver. |
Methods
procedure HighLatencyOperationWillBegin(Sender:TObject); |
|
: Tells to driver that a high latency operation will begins, releasing some resources of the driver. |
procedure HighLatencyOperationWasEnded(Sender:TObject); |
|
: Tells to driver that a high latency operation was ended, taking back some resources back to driver. |
function GetPortOpenedEvent:TNotifyEvent; |
|
: Returns the procedure of protocol driver that must be called when the communication port was open.
See also |
function GetPortClosedEvent:TNotifyEvent; |
|
: Returns the procedure of protocol driver that must be called when the communication port was closed. See also |
function GetPortDisconnectedEvent:TNotifyEvent; |
|
: Returns the procedure of protocol driver that must be called when the communication port was disconnected. See also |
function NotifyThisEvents:TNotifyThisEvents; virtual; |
|
: Returns what's the events of communication port driver must be notified to protocol driver. See also
|
procedure PortOpened(Sender: TObject); virtual; |
|
: Procedure called by the communication port when it was open. See also |
procedure PortClosed(Sender: TObject); virtual; |
|
: Procedure called by the communication port when it was closed. See also |
procedure PortDisconnected(Sender: TObject); virtual; |
|
: Procedure called by the communication port when it was disconnected. See also |
procedure SetCommPort(CommPort:TCommPortDriver); |
|
: Sets the communication port driver that will be used by the protocol driver. |
procedure CopyIOPacket(const Source:TIOPacket; var Dest:TIOPacket); |
|
: Copies a TIOPacket to another Parameters
|
procedure CommPortCallBack(var Result:TIOPacket); virtual; |
|
: Callback called by the communication port driver to returns the result of I/O. (Result TIOPacket. Record with the data and I/O results returned by the communication port. Is destroyed automaticaly. Parameters |
procedure DoAddTag(TagObj:TTag; TagValid:Boolean); virtual; |
|
: Procedure called to add a tag into the scan of the protocol driver. Parameters
See also |
procedure DoDelTag(TagObj:TTag); virtual; |
|
: Procedure called to remove a tag from the scan of the protocol driver. Parameters
See also |
procedure DoGetValue(TagRec:TTagRec; var values:TScanReadRec); virtual; abstract; |
|
: Procedure called by the protocol driver threads to update the tag values. Parameters
|
function DoWrite(const tagrec:TTagRec; const Values:TArrayOfDouble; Sync:Boolean):TProtocolIOResult; virtual; abstract; |
|
: Function called to write tag values (single or block) on device.
. Parameters
ReturnsTProtocolIOResult |
function DoRead (const tagrec:TTagRec; out Values:TArrayOfDouble; Sync:Boolean):TProtocolIOResult; virtual; abstract; |
|
: Function called to read values from your device.
. Parameters
ReturnsTProtocolIOResult |
procedure AddTag(TagObj:TTag); |
|
: Add a tag into the scan cycle of the protocol driver. Parameters
Exceptions raised
|
procedure StartUpdateMultipleTags; |
|
procedure StopUpdateMultipleTags; |
|
procedure RemoveTag(TagObj:TTag); |
|
: Remove a tag from the scan cycle of the protocol driver. Parameters
|
function IsMyTag(TagObj:TTag):Boolean; |
|
: Function that returns if the tag is already linked with the protocol driver. Parameters
Returns
|
function SizeOfTag(aTag:TTag; isWrite:Boolean; var ProtocolTagType:TProtocolTagType):BYTE; virtual; abstract; |
|
: Returns the word size of the tag on protocol, in bits. Parameters
ReturnsThe current word size on protocol of the tag, OR 0 (zero) if it fails. |
function ScanRead(const tagrec:TTagRec):Cardinal; |
|
: Requests a tag update. Parameters
ReturnsCardinal. The unique identification number of the request. |
function ScanWrite(const tagrec:TTagRec; const Values:TArrayOfDouble):Cardinal; |
|
: Write values asynchronous using the scan of the protocol driver. Parameters
ReturnsCardinal. The unique identification number of the request. |
procedure Read(const tagrec:TTagRec); |
|
: Read the tag value from the device (synchronous). Parameters
|
procedure Write(const tagrec:TTagRec; const Values:TArrayOfDouble); |
|
: Write the tag values (synchronous). Parameters
|
function LiteralTagAddress(aTag:TTag; aBlockTag:TTag=nil):AnsiString; virtual; |
|
: Returns the literal address of the tag. |
procedure OpenTagEditor(InsertHook:TAddTagInEditorHook; CreateProc:TCreateTagProc); virtual; |
|
: Opens the Tag Builder of the protocol driver (if exists) |
function HasTabBuilderEditor:Boolean; virtual; |
|
: Tell to the protocol editor if the current protocol has a tab builder tool defined. |
Properties
property ReadSomethingAlways: Boolean read PReadSomethingAlways write PReadSomethingAlways default true; |
|
: Tells if the protocol driver must read something on each scan cycle. |
property ReadOnly: Boolean read GetIsReadOnly write SetIsReadOnly; |
|
: Average time in milliseconds used to update values of tags and their dependents. |
property TagCount: LongInt read GetTagCount; |
|
: Return how many tags are on scan cycle of the protocol driver. |
property Tag[index:LongInt]: TTag read GetTag; |
|
: Return the tags using the index. |
property TagName[index:LongInt]: AnsiString read GetTagName; |
|
: Return the tag names. |
property TagByName[Nome:AnsiString]: TTag read GetTagByName; |
|
: Returns the tag by the name index. |
property CommunicationPort: TCommPortDriver read PCommPort write SetCommPort nodefault; |
|
: Communication port driver used by the protocol driver. See also
|
property DriverID: Cardinal read PDriverID; |
|
: Unique protocol identification. |
property AvgTagUpdateTime: Double read FUserUpdateTime; |
|
: Average time in milliseconds used to update values of tags and their dependents. |
Generated by PasDoc 0.14.0.