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.
Visual Basic (Usage) | ![]() |
---|---|
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 ) |
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.Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2