⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iopcdllloader.pas

📁 iocopm3.04源码,一套很好的工控开发工具
💻 PAS
📖 第 1 页 / 共 3 页
字号:
{$I iInclude.inc}

{$ifdef iVCL}unit  iOPCDLLLoader;{$endif}
{$ifdef iCLX}unit QiOPCDLLLoader;{$endif}

interface

uses                                                                                
  {$I iIncludeUsesForms.inc}             
  {$IFDEF iVCL} iTypes;{$ENDIF}
  {$IFDEF iCLX}QiTypes;{$ENDIF}

const
  OPCMANAGERDLLSTRINGRESOURCE = 'iOPC.dll';

type
TSignalAdd                       = function (ComputerName, OPCServerName, ItemName, GroupName: PChar; UpdateRate: Integer; Suspend: Boolean; DataType: TiTypeKind; CallBackMethod: TOPCDLLNewData): Integer;
TSignalRemove                    = procedure(SignalHandle: Integer);
TSignalSuspend                   = procedure(SignalHandle: Integer);
TSignalResume                    = procedure(SignalHandle: Integer);
TSignalGetActive                 = function (SignalHandle: Integer): Boolean;
TSignalGetGroupHandle            = function (SignalHandle: Integer): Integer;
TSignalSendData                  = procedure(SignalHandle: Integer; Data: OLEVariant);

TEditorSessionStart              = function: Integer;
TEditorSessionStop               = procedure(SessionHandle: Integer);

TEditorComputerBranchOpen        = procedure(SessionHandle: Integer; NetResource: TiNetData           );
TEditorComputerBranchClose       = procedure(SessionHandle: Integer                                   );
TEditorComputerBranchGetItemCount= function (SessionHandle: Integer                                   ): Integer;
TEditorComputerBranchGetItemData = function (SessionHandle: Integer; Index: Integer                   ): TiNetData;

TEditorServerSetup               = procedure(SessionHandle: Integer; MachineName: PChar               );
TEditorServerGetCount            = function (SessionHandle: Integer                                   ): Integer;
TEditorServerGetData             = function (SessionHandle: Integer; Index: Integer                   ): TiServerData;

TEditorItemSetup                 = procedure(SessionHandle: Integer; MachineName, OPCServerName: PChar);
TEditorItemGetBrowseType         = function (SessionHandle: Integer                                   ): TiNameSpaceType;
TEditorItemSetPath               = procedure(SessionHandle: Integer; Path: PChar                      );
TEditorItemGetBranchItems        = function (SessionHandle: Integer; iBrowseType: TiBrowseType        ): PChar;
TEditorItemGetQualifiedName      = function (SessionHandle: Integer; Path, ItemName: PChar            ): PChar;

TGroupAdd                        = function (Name: PChar; ComputerName: PChar; OPCServerName: PChar; UpdateRate: Integer; BeforeUpdate, AfterUpdate: TOPCDLLObjectUpdate): Integer;
TGroupDelete                     = procedure(GroupHandle: Integer);

TGroupResume                     = procedure(GroupHandle: Integer);
TGroupSuspend                    = procedure(GroupHandle: Integer);

TGroupGetHandleByName            = function (Name: PChar)         : Integer;
TGroupGetCount                   = function                       : Integer;
TGroupGetHandle                  = function (Index: Integer)      : Integer;
TGroupGetName                    = function (GroupHandle: Integer): PChar;
TGroupGetComputerName            = function (GroupHandle: Integer): PChar;
TGroupGetOPCServerName           = function (GroupHandle: Integer): PChar;
TGroupGetUpdateRate              = function (GroupHandle: Integer): Integer;
TGroupSetUpdateRate              = procedure(GroupHandle: Integer; Value: Integer);

TServerConnectionGetCount        = function: Integer;
TServerConnectionGetName         = function(Index: Integer): PChar;
TServerConnectionGetGroupCount   = function: Integer;
TServerConnectionGetGroupName    = function(Index: Integer): PChar;
TServerConnectionReconnect       = procedure(Name: PChar);
TServerConnectionDisconnect      = procedure(Name: PChar);

TManagerCreated                  = function: Boolean;
TManagerAddItem                  = procedure(GroupName: PChar; UpdateRate: Integer);
TManagerDestroyed                = procedure;

TIsEvaluation                    = function: Boolean;

function  OPCDLLSignalAdd                      (ComputerName, OPCServerName, ItemName, GroupName: PChar; UpdateRate: Integer; Suspend: Boolean; DataType: TiTypeKind; CallBackMethod: TOPCDLLNewData): Integer;
procedure OPCDLLSignalRemove                   (SignalHandle: Integer);
procedure OPCDLLSignalSuspend                  (SignalHandle: Integer);
procedure OPCDLLSignalResume                   (SignalHandle: Integer);
function  OPCDLLSignalGetActive                (SignalHandle: Integer): Boolean;
function  OPCDLLSignalGetGroupHandle           (SignalHandle: Integer): Integer;
procedure OPCDLLSignalSendData                 (SignalHandle: Integer; Data: OLEVariant);

function  OPCDLLEditorSessionStart: Integer;
procedure OPCDLLEditorSessionStop(SessionHandle: Integer);

procedure OPCDLLEditorComputerBranchOpen        (SessionHandle: Integer; NetResource: TiNetData           );
procedure OPCDLLEditorComputerBranchClose       (SessionHandle: Integer                                   );
function  OPCDLLEditorComputerBranchGetItemCount(SessionHandle: Integer                                   ): Integer;
function  OPCDLLEditorComputerBranchGetItemData (SessionHandle: Integer; Index: Integer                   ): TiNetData;

procedure OPCDLLEditorServerSetup               (SessionHandle: Integer; MachineName: PChar               );
function  OPCDLLEditorServerGetCount            (SessionHandle: Integer                                   ): Integer;
function  OPCDLLEditorServerGetData             (SessionHandle: Integer; Index: Integer                   ): TiServerData;

procedure OPCDLLEditorItemSetup                 (SessionHandle: Integer; MachineName, OPCServerName: PChar);
function  OPCDLLEditorItemGetBrowseType         (SessionHandle: Integer                                   ): TiNameSpaceType;
procedure OPCDLLEditorItemSetPath               (SessionHandle: Integer; Path: PChar                      );
function  OPCDLLEditorItemGetBranchItems        (SessionHandle: Integer; iBrowseType: TiBrowseType        ): PChar;
function  OPCDLLEditorItemGetQualifiedName      (SessionHandle: Integer; Path, ItemName: PChar            ): PChar;

function  OPCDLLGroupAdd                        (Name: PChar; ComputerName: PChar; OPCServerName: PChar; UpdateRate: Integer; BeforeUpdate, AfterUpdate: TOPCDLLObjectUpdate): Integer;
procedure OPCDLLGroupDelete                     (GroupHandle: Integer);

procedure OPCDLLGroupResume                     (GroupHandle: Integer);
procedure OPCDLLGroupSuspend                    (GroupHandle: Integer);

function  OPCDLLGroupGetHandleByName            (Name: PChar)         : Integer;
function  OPCDLLGroupGetCount                                         : Integer;
function  OPCDLLGroupGetHandle                  (Index: Integer)      : Integer;
function  OPCDLLGroupGetName                    (GroupHandle: Integer): PChar;
function  OPCDLLGroupGetComputerName            (GroupHandle: Integer): PChar;
function  OPCDLLGroupGetOPCServerName           (GroupHandle: Integer): PChar;
function  OPCDLLGroupGetUpdateRate              (GroupHandle: Integer): Integer;
procedure OPCDLLGroupSetUpdateRate              (GroupHandle: Integer; Value: Integer);

function  OPCDLLServerConnectionGetCount               : Integer;
function  OPCDLLServerConnectionGetName(Index: Integer): PChar;

function  OPCDLLServerConnectionGetGroupCount               : Integer;
function  OPCDLLServerConnectionGetGroupName(Index: Integer): PChar;

procedure OPCDLLServerConnectionReconnect (Name: PChar);
procedure OPCDLLServerConnectionDisconnect(Name: PChar);

function  OPCDLLManagerCreated: Boolean;
procedure OPCDLLManagerAddItem(GroupName: PChar; UpdateRate: Integer);
procedure OPCDLLManagerDestroyed;

function  OPCDLLNotLoaded   : Boolean;
function  OPCDLLIsEvaluation: Boolean;


implementation

var
  OPCManagerDLLHandle : HINST;
  OPCDLLLoaded        : Boolean;

  RawOPCDLLSignalAdd                        : TSignalAdd;
  RawOPCDLLSignalRemove                     : TSignalRemove;
  RawOPCDLLSignalSuspend                    : TSignalSuspend;
  RawOPCDLLSignalResume                     : TSignalResume;
  RawOPCDLLSignalGetActive                  : TSignalGetActive;
  RawOPCDLLSignalGetGroupHandle             : TSignalGetGroupHandle;
  RawOPCDLLSignalSendData                   : TSignalSendData;

  RawOPCDLLEditorSessionStart               : TEditorSessionStart;
  RawOPCDLLEditorSessionStop                : TEditorSessionStop;

  RawOPCDLLEditorComputerBranchOpen         : TEditorComputerBranchOpen;
  RawOPCDLLEditorComputerBranchClose        : TEditorComputerBranchClose;
  RawOPCDLLEditorComputerBranchGetItemCount : TEditorComputerBranchGetItemCount;
  RawOPCDLLEditorComputerBranchGetItemData  : TEditorComputerBranchGetItemData;

  RawOPCDLLEditorServerSetup                : TEditorServerSetup;
  RawOPCDLLEditorServerGetCount             : TEditorServerGetCount;
  RawOPCDLLEditorServerGetData              : TEditorServerGetData;

  RawOPCDLLEditorItemSetup                  : TEditorItemSetup;
  RawOPCDLLEditorItemGetBrowseType          : TEditorItemGetBrowseType;
  RawOPCDLLEditorItemSetPath                : TEditorItemSetPath;
  RawOPCDLLEditorItemGetBranchItems         : TEditorItemGetBranchItems;
  RawOPCDLLEditorItemGetQualifiedName       : TEditorItemGetQualifiedName;

  RawOPCDLLGroupAdd                         : TGroupAdd;
  RawOPCDLLGroupDelete                      : TGroupDelete;
  RawOPCDLLGroupResume                      : TGroupResume;
  RawOPCDLLGroupSuspend                     : TGroupSuspend;
  RawOPCDLLGroupGetHandleByName             : TGroupGetHandleByName;
  RawOPCDLLGroupGetCount                    : TGroupGetCount;
  RawOPCDLLGroupGetHandle                   : TGroupGetHandle;
  RawOPCDLLGroupGetName                     : TGroupGetName;
  RawOPCDLLGroupGetComputerName             : TGroupGetComputerName;
  RawOPCDLLGroupGetOPCServerName            : TGroupGetOPCServerName;
  RawOPCDLLGroupGetUpdateRate               : TGroupGetUpdateRate;
  RawOPCDLLGroupSetUpdateRate               : TGroupSetUpdateRate;

  RawOPCDLLServerConnectionGetCount         : TServerConnectionGetCount;
  RawOPCDLLServerConnectionGetName          : TServerConnectionGetName;
  RawOPCDLLServerConnectionGetGroupCount    : TServerConnectionGetGroupCount;
  RawOPCDLLServerConnectionGetGroupName     : TServerConnectionGetGroupName;
  RawOPCDLLServerConnectionReconnect        : TServerConnectionReconnect;
  RawOPCDLLServerConnectionDisconnect       : TServerConnectionDisconnect;

  RawOPCDLLManagerCreated                   : TManagerCreated;
  RawOPCDLLManagerAddItem                   : TManagerAddItem;
  RawOPCDLLManagerDestroyed                 : TManagerDestroyed;

  RawOPCDLLIsEvaluation                     : TIsEvaluation;
//******************************************************************************
procedure MapFunctionPointers;
begin

  @RawOPCDLLSignalAdd                        := GetProcAddress(OPCManagerDLLHandle, 'SignalAdd');
  @RawOPCDLLSignalRemove                     := GetProcAddress(OPCManagerDLLHandle, 'SignalRemove');

  @RawOPCDLLSignalSuspend                    := GetProcAddress(OPCManagerDLLHandle, 'SignalSuspend');
  @RawOPCDLLSignalResume                     := GetProcAddress(OPCManagerDLLHandle, 'SignalResume');
  @RawOPCDLLSignalGetActive                  := GetProcAddress(OPCManagerDLLHandle, 'SignalGetActive');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -