Polled Tag Callbacks

For polled tags we use different callback functions at various stages.

Step 1
At collector start up, ihCollectorToolkitPolledInit and ihCollectorToolkitPolledInitCompleted callbacks are triggered and the details of all the Polled tags for the given collector is returned.
Step 2
If a polled tag is added, ihCollectorToolkitPolledAddTag method is called and the details of the tag is entered in the collector tag list.
Step 3
If a polled tag is deleted, ihCollectorToolkitPolledDeleteTag method is called and the tag details are removed from the collector tag list.

Example

The following sample helps you understand the given callback functions.

The collectors maintains the polled tag details in the local Cache as:

map<int, ihInterfaceTKPolledTagInfo> TagIdToTagInfoMap;

This map is filled using this sample example:

/// Polled tags initialization started
/// </summary>
/// <returns>TRUE/FALSE</returns>
int RandomValueSimulator::ihCollectorToolkitPolledInit(void)
{
TagIdToTagInfoMap.clear();
return CCollectorDelegator::ihCollectorToolkitPolledInit();
}

---------------------------------------------------------------------

/// <summary>
/// Historian updating the source saying that, polled tags initialization successful. 
Are there any initialization from source for polled tags? 
/// <summary>
/// <returns>TRUE/FALSE</returns>
int RandomValueSimulator::ihCollectorToolkitPolledInitCompleted(void)
{
return CCollectorDelegator::ihCollectorToolkitPolledInitCompleted();
}

---------------------------------------------------------------------

/// <summary>
/// Adds polled tag to the historian from source
/// </summary>
/// <param name="PolledTag">ihInterfaceTKPolledTagInfo instance</param>
/// <param name="IsCollectorStarting">collector status</param>
/// <returns>TRUE/FALSE</returns>
int RandomValueSimulator::ihCollectorToolkitPolledAddTag(ihInterfaceTKPolledTagInfo 
*PolledTag, int IsCollectorStarting)
{
TagIdToTagInfoMap.insert(std::pair<int, ihInterfaceTKPolledTagInfo>
(PolledTag-<TagId, *PolledTag));
return CCollectorDelegator::ihCollectorToolkitPolledAddTag(PolledTag, 
IsCollectorStarting);
}

-----------------------------------------------------------------------

/// <summary>
/// Deleted polled tag from Historian from client tools/non web admin/external tools
/// <summary>
/// <param name="tagId">Tag Identification</param>
/// <returns>TRUE/FALSE</returns>
int RandomValueSimulator::ihCollectorToolkitPolledDeleteTag(int tagId)
{
TagIdToTagInfoMap.erase(TagIdToTagInfoMap.find(tagId));
return CCollectorDelegator::ihCollectorToolkitPolledDeleteTag(tagId);
}