/// <summary> /// Writes the value of the specified item property. /// </summary> IdentifiedResult IDevice.Write(string itemID, PropertyID propertyID, ItemValue value) { // lookup item. DeviceItem item = GetItemFromItemsByItemID(itemID); if (item == null) { return(new IdentifiedResult(itemID, ResultID.Da.E_UNKNOWN_ITEM_NAME)); } // write value. return(item.Write(propertyID, value)); }
/// <summary> /// Reads the value of the specified item property. /// </summary> ItemValueResult IDevice.Read(string itemID, PropertyID propertyID) { // initialize result. ItemValueResult result = new ItemValueResult { ItemName = itemID, ItemPath = null, ResultID = ResultID.S_OK, DiagnosticInfo = null }; // lookup item. DeviceItem item = GetItemFromItemsByItemID(itemID); if (item == null) { result.ResultID = ResultID.Da.E_UNKNOWN_ITEM_NAME; return(result); } // read value. return(item.Read(propertyID)); }
/// <summary> /// Returns the specified properties for the specified item. /// </summary> ItemPropertyCollection IDevice.GetAvailableProperties(string itemID, PropertyID[] propertyIDs, bool returnValues) { // initialize result. ItemPropertyCollection properties = new ItemPropertyCollection { ItemName = itemID, ItemPath = null, ResultID = Opc.ResultID.S_OK, DiagnosticInfo = null }; // lookup item. DeviceItem item = GetItemFromItemsByItemID(itemID); if (item == null) { properties.ResultID = ResultID.Da.E_UNKNOWN_ITEM_NAME; return(properties); } // fetch properties. return(item.GetAvailableProperties(propertyIDs, returnValues)); }