<< 点击显示目录 >> 主页 PVI通信 > PVI帮助信息 > PVI Services > BR.AN.Namespace > BR.AN.PviServices > Variable Class > Variable Methods > Connect Method > Variable.Connect(ConnectionType) Method |
Creates a connection of this instance to its processvariable.
[Visual Basic]
Public Overrides Overloads Sub Connect( _
ByVal conType As ConnectionType _
)
[C#]
public override void Connect(
ConnectionType conType
);
conType
Defines the ConnectionType of this Variable object
The Connected event notifies, that the connection was successfully created whereas the "Error" event notifies, that an error has occured. (e.g. task does not exist) It is also possible to connect the variable object, when its parent (cpu object) was not already connected. In that case the variable object store this "connect" action, to connect the variable object automatically when the cpu connectedevent received. For creating a link object to an existing variable object its needed to specify the LinkName property with the FullName property of the variable to link.
// Creating service and cpu object
Service service = new Service("Service1");
service.Connect();
Cpu cpu = new Cpu(service,"Cpu1");
cpu.Connect();
..
..
// Creating connection to global Variable
Variable globVar = new Variable(cpu,"var1");
globVar.Connect();
globVar.Connected += new PviEventHandler(Var_Connected);
..
..
private void Var_Connected(object sender, PviEventArgs e)
{
// Creating link connection to existing variable
Variable linkToGlobVar = new Variable(cpuObj,"linkVar");
linkToGlobVar.LinkName = "Service1.Cpu1.var1"; // or globVar.FullName;
linkToGlobVar.Connect(ConnectionType.Link);
}
Variable Class | BR.AN.PviServices Namespace | Variable.Connect Overload List
Generated from assembly BR.AN.PviServices [8.1.0.4]