DANSrvAE Reference
AddItem Method
See Also  Send comments on this topic.
NSPlugin Assembly > NSPlugin Namespace > GenericServer Class : AddItem Method

AppItemHandle
Handle defined int the adaptation assembly to reference the item.
This handle is passed as an item identifier in calls between the generic server and the customization plugin. It should be chosen so that it allows fast access to the item data.
ItemId
Fully qualified item name. The OPC clients use this name to access the item.
This is a fully qualified item identifier such as "device1.channel5.heater3". The generic server part builds an appropriate hierarchical address space.
Note that the separator character ( . in the above sample identifier ) must match the separator character specified in the GetServerParameters method!
Some applications may require branch-items (branches that are also items). Such branch-items can be created by speifying the ItemId with trailing separator character e.g. "device1.channel5.heater3."
AccessRights
Access rights as defined in the OPC specification: OPC.READABLE , OPC.WRITEABLE , OPC.READWRITEABLE
InitValue
Object with initial value for the item. The value also defines the item's canonical data type.
If there is no initial value known then a System.Type datatype can be passed as the value. In this case the generic server sets the canonical data type to be defined type and sets the item initial value to null.
quality
Initial quality of the item. This is a short value ( Int16) with the value of the OPCQuality enumerator.
timestamp
Initial timestamp
scanRate
Scan rate for this item in ms. A value of -1 indicates and undefined value.
This argument is used only be the generic server Professional Edition to optimize the item refresh.

Glossary Item Box

Generic server callback method.

Add an item in the generic server cache.
This method is typically called during the execution of the CreateServerItems or ValidateItems methods, but it can be called anytime an item needs to be added to the generic server cache.

Items that are added to the generic server cache can be accessed from the OPC clients.

Syntax

Visual Basic (Declaration) 
Public Shared Function AddItem( _
   ByVal AppItemHandle As Integer, _
   ByVal ItemId As String, _
   ByVal AccessRights As Integer, _
   ByVal InitValue As Object, _
   ByVal quality As Short, _
   ByVal timestamp As Date, _
   ByVal scanRate As Integer _
) As Integer
C# 
public static int AddItem( 
   int AppItemHandle,
   string ItemId,
   int AccessRights,
   object InitValue,
   short quality,
   DateTime timestamp,
   int scanRate
)

Parameters

AppItemHandle
Handle defined int the adaptation assembly to reference the item.
This handle is passed as an item identifier in calls between the generic server and the customization plugin. It should be chosen so that it allows fast access to the item data.
ItemId
Fully qualified item name. The OPC clients use this name to access the item.
This is a fully qualified item identifier such as "device1.channel5.heater3". The generic server part builds an appropriate hierarchical address space.
Note that the separator character ( . in the above sample identifier ) must match the separator character specified in the GetServerParameters method!
Some applications may require branch-items (branches that are also items). Such branch-items can be created by speifying the ItemId with trailing separator character e.g. "device1.channel5.heater3."
AccessRights
Access rights as defined in the OPC specification: OPC.READABLE , OPC.WRITEABLE , OPC.READWRITEABLE
InitValue
Object with initial value for the item. The value also defines the item's canonical data type.
If there is no initial value known then a System.Type datatype can be passed as the value. In this case the generic server sets the canonical data type to be defined type and sets the item initial value to null.
quality
Initial quality of the item. This is a short value ( Int16) with the value of the OPCQuality enumerator.
timestamp
Initial timestamp
scanRate
Scan rate for this item in ms. A value of -1 indicates and undefined value.
This argument is used only be the generic server Professional Edition to optimize the item refresh.

Return Value

Returns S_OK if the item was successfully added to the cache.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

© 2004-2017 Advosol Inc. All Rights Reserved.