public IEnumerator <ITask> ReplaceHandler(Replace replace) { replace.ResponsePort.Post(new dssp.DefaultReplaceResponseType()); _subMgrPort.Post(new submgr.Submit(_state, DsspActions.ReplaceRequest)); _state = replace.Body; yield break; }
/// <summary> /// Process configuration string. /// </summary> /// <param name="state"></param> /// <param name="body"></param> void ProcessConfigurationString(ref AnalogSensorState state, string body) { if ((body != null) && (body.Length > 0)) { string[] sections = body.Split(new char[] { '&' }); foreach (string rawPair in sections) { string[] keyValuePair = rawPair.Split(new char[] { '=' }, 2); if (keyValuePair.Length == 2) { string key = Uri.UnescapeDataString(keyValuePair[0]).ToUpper(); string value = Uri.UnescapeDataString(keyValuePair[1]); if (0 == key.CompareTo("SENSORINIT")) { // Sensor=_index_,_name_,_type_ string[] indexAttrib = value.Split(new char[] { ',' }); int sensorID = Convert.ToInt32(indexAttrib[0]); if ((sensorID > 0) && (sensorID <= 4) && (indexAttrib.Length == 3)) { string name = indexAttrib[1].ToString(); int type = Convert.ToInt32(indexAttrib[2]); UpdateSensorConfiguration(sensorID, name, type); } } else if (0 == key.CompareTo("PIN")) { } else if (0 == key.CompareTo("CONFIGURATION")) { } } } } }