private short handleStoreCondition(System.Collections.Specialized.NameValueCollection queryString, StreamWriter writer) { short storeConditionReturn = ReturnValue.ERROR; //default XElement returnElement; String timestamp, dataItemId, condition, value, code, nativeCode; if ((returnElement = handleStoreSampleStoreEventCommon(queryString, out timestamp, out dataItemId, out condition, out value, out code, out nativeCode)) == null) { if (condition == null) { returnElement = MachineAPIError.createError(MachineAPIError.UNRECOGNIZEDDATA, "The storeCondition should define \"condition\"."); } else if (!Util.CheckTypesOfCondition(condition)) { returnElement = MachineAPIError.createError(MachineAPIError.UNRECOGNIZEDDATA, "The condition is not one of the four recognizable condition types."); } else { try { storeConditionReturn = sharedData.StoreCondition(timestamp, dataItemId, condition, value, nativeCode, code); if (storeConditionReturn == ReturnValue.SUCCESS) { returnElement = new XElement(MTConnectNameSpace.mtStreams + "Acknowledge", new XAttribute("dateTime", Util.GetDateTime())); } else //not possible { returnElement = MachineAPIError.createError(MachineAPIError.UNRECOGNIZEDDATA); } } catch (AgentException e) { returnElement = MachineAPIError.createError(MachineAPIError.UNRECOGNIZEDDATA, e.Message); } } } returnElement.Save(writer); return(storeConditionReturn); }
public short StoreCondition(String timestamp, String dataItemId, String condition, String value, String nativeCode, String code) { return(data.StoreCondition(timestamp, dataItemId, condition, value, nativeCode, code)); }