XDASrv Reference Manual
AddItem Method
See Also  Send Feedback
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!
AccessRights
Access rights as defined in the OPC specification: OPC.READABLE , OPC.WRITEABLE , OPC.READWRITEABLE
InitValue
Object with initial value and the item's canonical data type.
A value must always be specified for the canonical data type to be defined.
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.

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.

Item 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
Visual Basic (Usage)Copy Code
Dim AppItemHandle As Integer
Dim ItemId As String
Dim AccessRights As Integer
Dim InitValue As Object
Dim quality As Short
Dim timestamp As Date
Dim scanRate As Integer
Dim value As Integer
 
value = GenericServer.AddItem(AppItemHandle, ItemId, AccessRights, InitValue, quality, timestamp, scanRate)
C# 
public static int AddItem( 
   int AppItemHandle,
   string ItemId,
   int AccessRights,
   object InitValue,
   short quality,
   DateTime timestamp,
   int scanRate
)
Managed Extensions for C++ 
public: static int AddItem( 
   int AppItemHandle,
   string* ItemId,
   int AccessRights,
   Object* InitValue,
   short quality,
   DateTime timestamp,
   int scanRate
) 
C++/CLI 
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!
AccessRights
Access rights as defined in the OPC specification: OPC.READABLE , OPC.WRITEABLE , OPC.READWRITEABLE
InitValue
Object with initial value and the item's canonical data type.
A value must always be specified for the canonical data type to be defined.
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

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

See Also

Copyright © 2002-2011 Advosol Inc. All Rights Reserved.