public void OnInputClicked(InputClickedEventData eventData) { //Debug.LogFormat("OnInputClicked\r\nSource: {0} SourceId: {1} TapCount: {2}", eventData.InputSource, eventData.SourceId, eventData.TapCount); Actuator a = (Actuator)ItemManager.getInstance().getItem(itemName); if (a == null) Debug.Log("actuator " + itemName + " could not be found"); //fetch instruction type and send appropriate request switch (this.gameObject.name) { case "ButtonON": StartCoroutine(a.sendON()); break; case "ButtonOFF": StartCoroutine(a.sendOFF()); break; case "ButtonINCREASE": { if (a is DimmerActuator) { StartCoroutine(((DimmerActuator)a).sendINCREASE()); break; } else { if (a is HueDimmer) { StartCoroutine(((HueDimmer)a).sendINCREASE()); break; } } break; } case "ButtonDECREASE": { if (a is DimmerActuator) { StartCoroutine(((DimmerActuator)a).sendDECREASE()); break; } else { if (a is HueDimmer) { StartCoroutine(((HueDimmer)a).sendDECREASE()); break; } } break; } default: return; } }
public Page_Actuator(Actuator db_actuator) { InitializeComponent(); //동기화 this.db_actuator = Page_Monitor.Page_Monitor.databaseSystem.system.actuatorList.Find(obj => obj.ActuatorName == db_actuator.ActuatorName); //이미지 로드 if (db_actuator.ThumbNailPath != null) { BitmapImage thumbNail = new BitmapImage(); thumbNail.BeginInit(); thumbNail.UriSource = new Uri(db_actuator.ThumbNailPath); thumbNail.EndInit(); xml_ThumbNail.Source = thumbNail; } /* * //디렉토리검사 타이머 * DispatcherTimer timer = new DispatcherTimer(); //객체생성 * * timer.Interval = TimeSpan.FromMilliseconds(2000); //시간간격 설정 * timer.Tick += new EventHandler((send, ee) => * { * * }); * timer.Start(); */ String path = System.Environment.CurrentDirectory + @"\Record\"; if (System.IO.Directory.Exists(path)) { System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(path); xml_CurrentSoundList.Children.Clear(); foreach (var item in di.GetFiles()) { xml_CurrentSoundList.Children.Add(new Page_Actuator_CurrentSound() { SoundName = item.Name }); } } //속성 로드 xml_ActuatorName.Text = db_actuator.ActuatorName; xml_NotificationMax.Text = db_actuator.NotificationMax.ToString(); xml_NotificationMin.Text = db_actuator.NotificationMin.ToString(); }
public async Task <IActionResult> CleanerAll(Actuator data) { using (var httpClient = new HttpClient()) { var c = JsonConvert.SerializeObject(data); StringContent content = new StringContent(c, Encoding.UTF8, "application/json"); using (var response = await httpClient.PutAsync("http://gateway:3000/cleaner/all", content)) { string response1 = await response.Content.ReadAsStringAsync(); } } return(Ok()); }
public RepositoryActionResult <Actuator> Create(Actuator actuator) { try { context.Actuator.Add(actuator); context.SaveChanges(); return(new RepositoryActionResult <Actuator>(actuator, RepositoryActionStatus.Created)); } catch (Exception ex) { return(new RepositoryActionResult <Actuator>(null, RepositoryActionStatus.Error, ex)); } }
public StuartPlatform(double baseAngle, double baseRadius, double workAngle, double workRadius, double actuatorMin, double actuatorMax) { BasePlatform = new Platform(baseAngle, baseRadius); WorkPlatform = new Platform(workAngle, workRadius); for (int N = 0; N < Actuators.Length; N++) { Actuators[N] = new Actuator(this, N) { MinLength = actuatorMin, MaxLength = actuatorMax } } ; }
// Различные механизмы public override void SetActuators() { SmartHouse.Actuators = new List <Actuator>(); for (int i = 0; i < Actuator.TypesOfActuators.Count; i++) { if (rnd.Next(0, 2) == 1) { Actuator a = new Actuator(); a.TypeOfActuator = Actuator.TypesOfActuators[i]; SmartHouse.Actuators.Add(a); } } }
// device setup functions /** * add new actuator to platform * * @param actuator index of actuator (and index of 1-4) * @param roatation positive direction of actuator rotation * @param port specified motor port to be used (motor ports 1-4 on the Haply board) */ public void Add_actuator(int actuator, int rotation, int port) { bool error = false; if (port < 1 || port > 4) { Debug.LogError("error: encoder port index out of bounds"); error = true; } if (actuator < 1 || actuator > 4) { Debug.LogError("error: encoder index out of bound!"); error = true; } int j = 0; for (int i = 0; i < actuatorsActive; i++) { if (motors[i].Actuators < actuator) { j++; } if (motors[i].Actuators == actuator) { Debug.LogError("error: actuator " + actuator + " has already been set"); error = true; } } if (!error) { Actuator[] temp = new Actuator[actuatorsActive + 1]; System.Array.Copy(motors, 0, temp, 0, motors.Length); if (j < actuatorsActive) { System.Array.Copy(motors, j, temp, j + 1, motors.Length - j); } temp[j] = new Actuator(actuator, rotation, port); Actuator_assignment(actuator, port); motors = temp; actuatorsActive++; } }
void SetUpBone(GameObject bone) { // Creo el componente para detectar triggers var boneDetector = bone.AddComponent <BoneTriggerDetector>(); boneDetector.Owner = this; // Veo de agregar el actuador para al terminar la animacion forzar el reinicio Actuator actuator = bone.GetComponent <Actuator>(); if (actuator != null) { actuators.Add(actuator); } }
public async Task <Actuator> Add(ActuatorValue value) { if (value == null) { return(null); } var actuator = new Actuator(Guid.NewGuid(), value); await _db.Actuators.AddAsync(_converter.ToActuatorDataModel(actuator)); await _db.SaveChangesAsync(); return(await Get(actuator.Id)); }
private void UserControl_MouseUp(object sender, MouseButtonEventArgs e) { Actuator newActuator = new Actuator(); newActuator.ActuatorName = "새 장치"; newActuator.NotificationMax = 100; newActuator.NotificationMin = 0; Page_Monitor.databaseSystem.system.actuatorList.Add(newActuator); MainWindow.View2.Children.Clear(); MainWindow.View2.Children.Add(new Views.Page_Actuator.Page_Actuator(newActuator)); MainWindow.DoMoveRight(); }
// GET: Actuators/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Actuator valve = db.Actuators.Find(id); if (valve == null) { return(HttpNotFound()); } return(View(valve)); }
public override void OnBinding(Agent agent) { this.agent = agent; type = SensorType.sint; currentEnergy = maxEnergy; if (actionPath != null) { foreach (NodePath path in actionPath) { Actuator a = (GetNode(path) as Actuator); a.Subscribe(this); } } }
// GET: Actuators/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Actuator valve = db.Actuators.Find(id); if (valve == null) { return(HttpNotFound()); } ViewBag.InterfaceCode = new SelectList(db.ActuatorInterfaceCodes, "InterfaceCode", "InterfaceCode", valve.InterfaceCode); return(View(valve)); }
private static ActuatorState GetActuatorState(int joystick, Actuator actuator, ActuatorState oldState) { ActuatorState newState = oldState; float inputValue; bool inputButton; bool inputDown; bool inputUp; if (actuator.inputIsAxis) { string axisName = InputAxisNames[joystick, actuator.inputAxis]; float rawValue = Input.GetAxisRaw(axisName); if (actuator.inputFalseZero && !newState.handledFalseZero) { if (Mathf.Approximately(rawValue, 0f)) { rawValue = actuator.inputMin; } else { newState.handledFalseZero = true; } } inputValue = Mathf.InverseLerp(actuator.inputMin, actuator.inputMax, rawValue); inputButton = (inputValue >= 0.75f); inputDown = false; inputUp = false; } else { string keyName = InputButtonKeyNames[joystick, actuator.inputButton]; bool rawValue = Input.GetKey(keyName); inputValue = rawValue ? actuator.inputMax : actuator.inputMin; inputButton = rawValue; inputDown = Input.GetKeyDown(keyName); inputUp = Input.GetKeyUp(keyName); } // FIXME - handle dead zone // return Mathf.InverseLerp(config.deadZone, 1, Mathf.Abs(value)) * Mathf.Sign(value); newState.axis = Mathf.Lerp(actuator.outputMin, actuator.outputMax, inputValue); newState.button = inputButton; newState.buttonDown = inputDown; newState.buttonUp = inputUp; return(newState); }
public virtual void StartData() { sensors = new List <Sensor>(); actuators = new List <Actuator>(); OnSetup(); foreach (Node node in GetChildren()) { if (node.GetType().IsSubclassOf(typeof(Sensor))) { Sensor s = node as Sensor; sensors.Add(s); if (s.resettable) { AddResetListener(s); } s.OnBinding(this); } if (node.GetType().IsSubclassOf(typeof(Actuator))) { Actuator a = node as Actuator; actuators.Add(a); if (a.resettable) { AddResetListener(a); } a.OnBinding(this); } } numberOfFields = sensors.Count; numberOfActions = actuators.Count; if (numberOfFields == 0) { GD.Print("The agent should have at least one sensor! Target name: " + GetParent().Name); } if (numberOfActions == 0) { GD.Print("The agent should have at least one actuator! Target name: " + GetParent().Name); } System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; desc = new string[numberOfFields]; types = new byte[numberOfFields]; values = new string[numberOfFields]; OnSetupDone(); }
public Page_Monitor_Actuator(Actuator db_actuator) { InitializeComponent(); //동기화 this.db_actuator = Page_Monitor.databaseSystem.system.actuatorList.Find(obj => obj.ActuatorName == db_actuator.ActuatorName); xml_ActuatorName.Text = db_actuator.ActuatorName; if (db_actuator.ThumbNailPath != null) { BitmapImage thumbNail = new BitmapImage(); thumbNail.BeginInit(); thumbNail.UriSource = new Uri(db_actuator.ThumbNailPath); thumbNail.EndInit(); xml_ThumbNail.Source = thumbNail; } }
/// <summary> /// 处理照明灯的逻辑 /// </summary> /// <param name="index">模块数量</param> /// <param name="data">数据</param> /// <param name="type">类型编码</param> /// <param name="name">模块名称</param> /// <returns></returns> private int ProcessLamp(int index, byte[] data, int type, string name) { Actuator Lamp1 = new Actuator(); string moduleId = Convert.ToString(data[index++], 16); Lamp1.Name = name; Lamp1.Type = type; int state = data[index++]; int moduleNum = state >> 7; if (moduleNum == 1) //一个节点控制两盏灯 { //将单个节点控制多个灯的状态值保存起来 Cache.AddCache(classRoomId, state); int moduleState = state & 0x1; Lamp1.Id = moduleId + "_0"; Lamp1.State = moduleState != 0 ? StateType.StateOpen : StateType.StateClose; Lamp1.IsOpen = moduleState == 1; //数据位第4位表示在线状态 Lamp1.Online = OnLineState(state); Lamp1.Controllable = true; Sensors.Add(Lamp1); Actuator Lamp2 = new Actuator(); Lamp2.Name = name; Lamp2.Type = type; Lamp2.Id = moduleId + "_1"; int module1State = (state >> 1) & 0x1; Lamp2.State = module1State != 0 ? StateType.StateOpen : StateType.StateClose; Lamp2.IsOpen = module1State == 1; Lamp2.Online = OnLineState(state); Lamp2.Controllable = true; Sensors.Add(Lamp2); } else { Lamp1.Id = moduleId; Lamp1.State = (state & 1) != 0 ? StateType.StateOpen : StateType.StateClose; Lamp1.IsOpen = (state & 1) == 1; Lamp1.Online = OnLineState(state); Lamp1.Controllable = true; Sensors.Add(Lamp1); } return(index); }
public async Task <ActionResult> Create(Actuator actuator) { string json = JsonConvert.SerializeObject(actuator); using (var content = new StringContent (json, Encoding.UTF8, "application/json")) { HttpResponseMessage result = await _httpClient.PostAsync("http://localhost:5005/api/actuators/", content); if (result.IsSuccessStatusCode) { return(RedirectToAction("Index")); } } ModelState.AddModelError("", "Error while creating data."); return(View()); }
/// <summary> /// 处理投影屏数据 /// </summary> /// <param name="num"></param> /// <param name="index"></param> /// <param name="data"></param> /// <param name="type"></param> /// <returns></returns> private int ProcessProjectionScreen(int num, int index, byte[] data, int type) { for (int i = 0; i < num; i++) { Actuator ProjectionScreen = new Actuator(); ProjectionScreen.Id = Convert.ToString(data[index++], 16); int state = data[index++]; ProjectionScreen.State = GetState(state); ProjectionScreen.IsOpen = state == 1 ? false : true; ProjectionScreen.Controllable = true; ProjectionScreen.Name = "投影屏"; ProjectionScreen.Type = type; ProjectionScreen.Online = state == 0 ? StateType.Offline : StateType.Online; ProjectionScreen.State = state != 0 ? StateType.StateOpen : StateType.StateClose; ProjectionScreen.Controllable = true; Sensors.Add(ProjectionScreen); } return(index); }
public RepositoryActionResult <Actuator> Update(Actuator actuator) { try { var existingAct = context.Actuator.Where(c => c.ActuatorId == actuator.ActuatorId).FirstOrDefault(); if (existingAct != null) { context.Entry(existingAct).State = EntityState.Detached; context.Actuator.Attach(actuator); context.Entry(actuator).State = EntityState.Modified; context.SaveChanges(); return(new RepositoryActionResult <Actuator>(actuator, RepositoryActionStatus.Updated)); } return(new RepositoryActionResult <Actuator>(null, RepositoryActionStatus.NothingModified)); } catch (Exception ex) { return(new RepositoryActionResult <Actuator>(null, RepositoryActionStatus.Error, ex)); } }
static void Main(string[] args) { try { Kundendaten ersterk = new Kundendaten("Max Mustermann", "Musterweg 15", 1); ersterk.Print(); ersterk.neueNummer(2); ersterk.Print(); Kundendaten zweiterk = new Kundendaten("Ludwig Leiner", "Kikagasse 68", 2); Mitarbeiter ersterm = new Mitarbeiter("Karl Klumpat", "Forstgasse 27", "Elektriker", 1); Mitarbeiter zweiterm = new Mitarbeiter("Toni Toner", "Druckstrasse 87", "Assistent", 2); IPerson[] PersonArray = { ersterk, zweiterk, ersterm, zweiterm, new Kundendaten("Ilse Ilsensberger", "Ilsenweg 30", 3), new Mitarbeiter("Koalrina Karlson", "Karlsonweg 12", "EDV-Technikerin", 3) }; foreach (IPerson Person in PersonArray) { Person.Print(); } var jsonsettings = new JsonSerializerSettings() { Formatting = Formatting.Indented, TypeNameHandling = TypeNameHandling.Auto }; var json = JsonConvert.SerializeObject(PersonArray, jsonsettings); Console.WriteLine(json); File.WriteAllText(@"Person.json", json); string content = File.ReadAllText(@"Person.json"); var itemsfromjson = JsonConvert.DeserializeObject <IPerson[]>(content, jsonsettings); foreach (var Actuator in itemsfromjson) { Actuator.Print(); } } catch (Exception error) { Console.WriteLine($"Error ({error.Message})"); } }
static void Main(string[] args) { LidarSensorInput sensor = new LidarSensorInput(); Agent agent = new SelfDrivingCar(); sensor.DistanceTo = 10; Actuator action = agent.process(sensor); Console.WriteLine(action.ToString()); sensor.DistanceTo = 15; action = agent.process(sensor); Console.WriteLine(action.ToString()); sensor.DistanceTo = 13; action = agent.process(sensor); Console.WriteLine(action.ToString()); sensor.DistanceTo = 10; action = agent.process(sensor); Console.WriteLine(action.ToString()); }
public async Task <ActionResult> Create([FromBody] Actuator actuator) { if (actuator == null) { return(new UnprocessableEntityResult()); } var Mcu = await microControllerService.FindByID(actuator.MicrocontrollerID); if (Mcu == null) { return(new BadRequestResult()); } var inserted = await actuatorService.Create(actuator); if (inserted == null) { return(new BadRequestResult()); } return(new OkObjectResult(inserted)); }
protected override void InvokeStepSingleTime(bool forceInvoke) { // 重置计时时间 Actuator.ResetTiming(); // 调用前置监听 OnPreListener(); this.Result = StepResult.NotAvailable; this.Result = Actuator.InvokeStep(forceInvoke); // 如果当前step被标记为记录状态,则返回状态信息 if (null != StepData && StepData.RecordStatus) { RecordRuntimeStatus(); } // 调用后置监听 OnPostListener(); object returnValue = Actuator.Return; // 如果执行结果不是bool类型或者为False,或者没有下级节点,则退出当前循环 bool conditionFail = !(returnValue is bool) || !(bool)returnValue; if (conditionFail || null == StepData || !StepData.HasSubSteps) { return; } // 执行下级的所有Step StepTaskEntityBase subStepEntity = SubStepRoot; do { if (!forceInvoke && Context.Cancellation.IsCancellationRequested) { this.Result = StepResult.Abort; return; } subStepEntity.Invoke(forceInvoke); } while (null != (subStepEntity = subStepEntity.NextStep)); }
// protected override void CheckSequenceData() // { // if (null != StepData.Function) // { // Context.LogSession.Print(LogLevel.Error, Context.SessionId, // $"Conditionblock cannot configure function data. Step:{StepData.Name}"); // I18N i18N = I18N.GetInstance(Constants.I18nName); // throw new TestflowDataException(ModuleErrorCode.SequenceDataError, i18N.GetStr("ConditionBlockHasFunc")); // // } // if (null != StepData.SubSteps && // StepData.SubSteps.Any(item => item.StepType != SequenceStepType.ConditionStatement)) // { // Context.LogSession.Print(LogLevel.Error, Context.SessionId, // $"Some steps under condition block is not ConditionStatement type. Step:{GetStack()}"); // I18N i18N = I18N.GetInstance(Constants.I18nName); // throw new TestflowDataException(ModuleErrorCode.SequenceDataError, i18N.GetStr("IllegalStepType")); // } // } protected override void InvokeStepSingleTime(bool forceInvoke) { // 重置计时时间 Actuator.ResetTiming(); // 调用前置监听 OnPreListener(); // 开始计时 Actuator.StartTiming(); // 停止计时 Actuator.EndTiming(); this.Result = StepResult.Pass; // 如果当前step被标记为记录状态,则返回状态信息 if (null != StepData && StepData.RecordStatus) { RecordRuntimeStatus(); } // 调用后置监听 OnPostListener(); if (null != StepData && StepData.HasSubSteps) { StepTaskEntityBase subStepEntity = SubStepRoot; do { subStepEntity.Invoke(forceInvoke); object returnValue = subStepEntity.Return; // 如果ConditionStatement返回值为True则说明该分支已执行完成,则跳过后续的Step if (returnValue is bool && (bool)returnValue) { break; } } while (null != (subStepEntity = subStepEntity.NextStep)); } }
void UpdateActuators() { // Aca lo que vamos a hacer es usar un bool para ver cuando agrego el modelo físico, si no lo agrego lo procesa una vez para asociar los bones a los joints (spheres) if (PhysicsHand != null && _cylinderTransforms != null) { foreach (FingerModel finger in PhysicsHand.fingers) { foreach (Transform bone in finger.bones) { if (bone == null) { continue; } int i = (int)finger.fingerType; // El name del bone tiene la forma "bone1", "bone2" ... Extraigo el número y resto para contar desde cero. int j = Int32.Parse(Regex.Match(bone.name, @"\d+").Value) - 1; int key = i * 3 + j; Transform cylinder = _cylinderTransforms[key]; Actuator actuator = bone.gameObject.GetComponent <Actuator>(); // Si no hay actuador, lo pinta de blanco Color color = DisabledColor; if (actuator != null) { // El rojo esa la presencia del actuador, el verde y el azul son para expresar el rango de valores del actuador color = GetActuatorColor(actuator.Value); } cylinder.GetComponent <MeshRenderer>().sharedMaterial.color = color; if (actuator != null && actuator.Value != 0f) { //sound.Play(); } } } } }
public void Initialize() { InitializeCommunity(); var companyAlan = _individualAlan.CreateCompany(); companyAlan.Name = "Encom"; var companyFlynn = _individualFlynn.CreateCompany(); companyFlynn.Name = "Flynn's"; Synchronize(); _moderator = new ModeratorService( _domainModerator.CreateGame(_domainModerator.Companies)); Synchronize(); var gameAlan = companyAlan.Games.Single(); var gameFlynn = companyFlynn.Games.Single(); _alan = new CompanyGameService(companyAlan, gameAlan); _flynn = new CompanyGameService(companyFlynn, gameFlynn); _actuator = new Actuator(); _alan.RegisterWith(_actuator); _flynn.RegisterWith(_actuator); _actuator.Start(); }
public void RegisterWith(Actuator actuator) { actuator.Add(new CreateTurnAutomaton(this)); }
protected override void InvokeStepSingleTime(bool forceInvoke) { int index = 0; while (true) { try { while (true) { // 设置循环变量的值 if (null != _loopVariable) { Context.VariableMapper.SetParamValue(_loopVariable, StepData.LoopCounter.CounterVariable, index++); } // 如果是取消状态并且不是强制执行则返回。因为ConditionLoop内部有循环,所以需要在内部也做判断 if (!forceInvoke && Context.Cancellation.IsCancellationRequested) { BreakAndReportAbortMessage(); } // 重置计时时间 Actuator.ResetTiming(); // 调用前置监听 OnPreListener(); this.Result = StepResult.NotAvailable; this.Result = Actuator.InvokeStep(forceInvoke); // 如果当前step被标记为记录状态,则返回状态信息 if (null != StepData && StepData.RecordStatus) { RecordRuntimeStatus(); } // 调用后置监听 OnPostListener(); // 如果执行结果不是bool类型或者为False,或者没有下级节点,则退出当前循环 object returnValue = Actuator.Return; bool conditionFail = !(returnValue is bool) || !(bool)returnValue; if (conditionFail || null == StepData || !StepData.HasSubSteps) { return; } // 执行所有的下级Step StepTaskEntityBase subStepEntity = SubStepRoot; do { if (!forceInvoke && Context.Cancellation.IsCancellationRequested) { this.Result = StepResult.Abort; return; } subStepEntity.Invoke(forceInvoke); } while (null != (subStepEntity = subStepEntity.NextStep)); } } catch (TestflowLoopBreakException ex) { ex.CalcDown(); // 如果计数大于0,则继续抛出到上层 if (ex.Count > 0) { throw; } // 如果是跳出当前循环,则return if (ex.BreakLoop) { return; } } } }
public void control(Actuator act,string ctrl_param) { new Thread(new ParameterizedThreadStart(doControl)).Start(new Tuple<Actuator, string>(act, ctrl_param)); }
private Actuator AddActuator(string _display_name,string _node_name,string _actuator_name,string _id,string[] _pic=null,string[] _dname=null,int _min=300,int _max=1200,int _def=300) { log("添加执行器:" + _display_name + " " + _node_name+" "+_actuator_name); listBox2.Items.Add(_display_name + " " + _node_name + " " + _actuator_name); var act = new Actuator() { display_name = _display_name, node_name = _node_name, actuator_name = _actuator_name, pic = _pic, dname = _dname, id = _id, min = _min, max = _max, def = _def }; actuators.Add(act); return act; }
/*#--------------------------------------------------------------------------#*/ /* Description: IO Handle start * to couple real target to application to get real sensor feedback * or to couple simulator output back to application * Also reset target/simulator to achieve known startup, target * maybe already be running/initialized * * * Input(s) : * * Output(s) : * * Returns : * * Pre.Cond. : * * Post.Cond. : * * Notes : */ /*#--------------------------------------------------------------------------#*/ public void Start(bool FYSimulatorActive) { // Instantiate actuators TOP here, after all source files are generated and itmes are created, otherwise deadlock (egg - chicken story) Actuator Act_CoupleTop = new Actuator("Couple", "FiddleYardTOP", "a1\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().Couple.Attach(Act_CoupleTop); Actuator Act_UncoupleTop = new Actuator("Uncouple", "FiddleYardTOP", "a2\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().Uncouple.Attach(Act_UncoupleTop); Actuator Act_FiddleOneLeftTop = new Actuator("FiddleOneLeft", "FiddleYardTOP", "a3\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().FiddleOneLeft.Attach(Act_FiddleOneLeftTop); Actuator Act_FiddleOneRightTop = new Actuator("FiddleOneRight", "FiddleYardTOP", "a4\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().FiddleOneRight.Attach(Act_FiddleOneRightTop); Actuator Act_FiddleGo1Top = new Actuator("FiddleGo1", "FiddleYardTOP", "a5\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().FiddleGo1.Attach(Act_FiddleGo1Top); Actuator Act_FiddleGo2Top = new Actuator("FiddleGo2", "FiddleYardTOP", "a6\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().FiddleGo2.Attach(Act_FiddleGo2Top); Actuator Act_FiddleGo3Top = new Actuator("FiddleGo3", "FiddleYardTOP", "a7\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().FiddleGo3.Attach(Act_FiddleGo3Top); Actuator Act_FiddleGo4Top = new Actuator("FiddleGo4", "FiddleYardTOP", "a8\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().FiddleGo4.Attach(Act_FiddleGo4Top); Actuator Act_FiddleGo5Top = new Actuator("FiddleGo5", "FiddleYardTOP", "a9\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().FiddleGo5.Attach(Act_FiddleGo5Top); Actuator Act_FiddleGo6Top = new Actuator("FiddleGo6", "FiddleYardTOP", "aA\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().FiddleGo6.Attach(Act_FiddleGo6Top); Actuator Act_FiddleGo7Top = new Actuator("FiddleGo7", "FiddleYardTOP", "aB\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().FiddleGo7.Attach(Act_FiddleGo7Top); Actuator Act_FiddleGo8Top = new Actuator("FiddleGo8", "FiddleYardTOP", "aC\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().FiddleGo8.Attach(Act_FiddleGo8Top); Actuator Act_FiddleGo9Top = new Actuator("FiddleGo9", "FiddleYardTOP", "aD\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().FiddleGo9.Attach(Act_FiddleGo9Top); Actuator Act_FiddleGo10Top = new Actuator("FiddleGo10", "FiddleYardTOP", "aE\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().FiddleGo10.Attach(Act_FiddleGo10Top); Actuator Act_FiddleGo11Top = new Actuator("FiddleGo11", "FiddleYardTOP", "aF\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().FiddleGo11.Attach(Act_FiddleGo11Top); Actuator Act_TrainDetectTop = new Actuator("TrainDetect", "FiddleYardTOP", "aG\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().TrainDetect.Attach(Act_TrainDetectTop); Actuator Act_StartTop = new Actuator("Start", "FiddleYardTOP", "aH\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().FYStart.Attach(Act_StartTop); Actuator Act_StopTop = new Actuator("Stop", "FiddleYardTOP", "aI\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().FYStop.Attach(Act_StopTop); Actuator Act_ResetTop = new Actuator("Reset", "FiddleYardTOP", "aJ\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().Reset.Attach(Act_ResetTop); Actuator Act_Occ5BOnTrueTop = new Actuator("Occ5BOnTrue", "FiddleYardTOP", "aK\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().Occ5BOnTrue.Attach(Act_Occ5BOnTrueTop); Actuator Act_Occ5BOnFalseTop = new Actuator("Occ5BOnFalse", "FiddleYardTOP", "aL\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().Occ5BOnFalse.Attach(Act_Occ5BOnFalseTop); Actuator Act_Occ6OnTrueTop = new Actuator("Occ6OnTrue", "FiddleYardTOP", "aM\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().Occ6OnTrue.Attach(Act_Occ6OnTrueTop); Actuator Act_Occ6OnFalseTop = new Actuator("Occ6OnFalse", "FiddleYardTOP", "aN\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().Occ6OnFalse.Attach(Act_Occ6OnFalseTop); Actuator Act_Occ7OnTrueTop = new Actuator("Occ7OnTrue", "FiddleYardTOP", "aO\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().Occ7OnTrue.Attach(Act_Occ7OnTrueTop); Actuator Act_Occ7OnFalseTop = new Actuator("Occ7OnFalse", "FiddleYardTOP", "aP\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().Occ7OnFalse.Attach(Act_Occ7OnFalseTop); Actuator Act_RecoverdTop = new Actuator("Recoverd", "FiddleYardTOP", "aQ\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().Recoverd.Attach(Act_RecoverdTop); Actuator Act_CollectTop = new Actuator("Collect", "FiddleYardTOP", "aR\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppTop().Collect.Attach(Act_CollectTop); // Instantiate actuators BOT here, after all source files are generated and itmes are created, otherwise deadlock (egg - chicken story) Actuator Act_CoupleBot = new Actuator("Couple", "FiddleYardBOT", "b1\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().Couple.Attach(Act_CoupleBot); Actuator Act_UncoupleBot = new Actuator("Uncouple", "FiddleYardBOT", "b2\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().Uncouple.Attach(Act_UncoupleBot); Actuator Act_FiddleOneLeftBot = new Actuator("FiddleOneLeft", "FiddleYardBOT", "b3\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().FiddleOneLeft.Attach(Act_FiddleOneLeftBot); Actuator Act_FiddleOneRightBot = new Actuator("FiddleOneRight", "FiddleYardBOT", "b4\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().FiddleOneRight.Attach(Act_FiddleOneRightBot); Actuator Act_FiddleGo1Bot = new Actuator("FiddleGo1", "FiddleYardBOT", "b5\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().FiddleGo1.Attach(Act_FiddleGo1Bot); Actuator Act_FiddleGo2Bot = new Actuator("FiddleGo2", "FiddleYardBOT", "b6\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().FiddleGo2.Attach(Act_FiddleGo2Bot); Actuator Act_FiddleGo3Bot = new Actuator("FiddleGo3", "FiddleYardBOT", "b7\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().FiddleGo3.Attach(Act_FiddleGo3Bot); Actuator Act_FiddleGo4Bot = new Actuator("FiddleGo4", "FiddleYardBOT", "b8\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().FiddleGo4.Attach(Act_FiddleGo4Bot); Actuator Act_FiddleGo5Bot = new Actuator("FiddleGo5", "FiddleYardBOT", "b9\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().FiddleGo5.Attach(Act_FiddleGo5Bot); Actuator Act_FiddleGo6Bot = new Actuator("FiddleGo6", "FiddleYardBOT", "bA\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().FiddleGo6.Attach(Act_FiddleGo6Bot); Actuator Act_FiddleGo7Bot = new Actuator("FiddleGo7", "FiddleYardBOT", "bB\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().FiddleGo7.Attach(Act_FiddleGo7Bot); Actuator Act_FiddleGo8Bot = new Actuator("FiddleGo8", "FiddleYardBOT", "bC\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().FiddleGo8.Attach(Act_FiddleGo8Bot); Actuator Act_FiddleGo9Bot = new Actuator("FiddleGo9", "FiddleYardBOT", "bD\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().FiddleGo9.Attach(Act_FiddleGo9Bot); Actuator Act_FiddleGo10Bot = new Actuator("FiddleGo10", "FiddleYardBOT", "bE\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().FiddleGo10.Attach(Act_FiddleGo10Bot); Actuator Act_FiddleGo11Bot = new Actuator("FiddleGo11", "FiddleYardBOT", "bF\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().FiddleGo11.Attach(Act_FiddleGo11Bot); Actuator Act_TrainDetectBot = new Actuator("TrainDetect", "FiddleYardBOT", "bG\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().TrainDetect.Attach(Act_TrainDetectBot); Actuator Act_StartBot = new Actuator("Start", "FiddleYardBOT", "bH\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().FYStart.Attach(Act_StartBot); Actuator Act_StopBot = new Actuator("Stop", "FiddleYardBOT", "bI\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().FYStop.Attach(Act_StopBot); Actuator Act_ResetBot = new Actuator("Reset", "FiddleYardBOT", "bJ\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().Reset.Attach(Act_ResetBot); Actuator Act_Occ5BOnTrueBot = new Actuator("Occ5BOnTrue", "FiddleYardBOT", "bK\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().Occ5BOnTrue.Attach(Act_Occ5BOnTrueBot); Actuator Act_Occ5BOnFalseBot = new Actuator("Occ5BOnFalse", "FiddleYardBOT", "bL\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().Occ5BOnFalse.Attach(Act_Occ5BOnFalseBot); Actuator Act_Occ6OnTrueBot = new Actuator("Occ6OnTrue", "FiddleYardBOT", "bM\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().Occ6OnTrue.Attach(Act_Occ6OnTrueBot); Actuator Act_Occ6OnFalseBot = new Actuator("Occ6OnFalse", "FiddleYardBOT", "bN\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().Occ6OnFalse.Attach(Act_Occ6OnFalseBot); Actuator Act_Occ7OnTrueBot = new Actuator("Occ7OnTrue", "FiddleYardBOT", "bO\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().Occ7OnTrue.Attach(Act_Occ7OnTrueBot); Actuator Act_Occ7OnFalseBot = new Actuator("Occ7OnFalse", "FiddleYardBOT", "bP\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().Occ7OnFalse.Attach(Act_Occ7OnFalseBot); Actuator Act_RecoverdBot = new Actuator("Recoverd", "FiddleYardBOT", "bQ\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().Recoverd.Attach(Act_RecoverdBot); Actuator Act_CollectBot = new Actuator("Collect", "FiddleYardBOT", "bR\r", (name, layer, cmd) => ActuatorCmd(name, layer, cmd)); // initialize and subscribe actuators m_iFYCtrl.GetFYAppBot().Collect.Attach(Act_CollectBot); m_FYSimulatorActive = FYSimulatorActive; if (m_FYSimulatorActive == false) { m_iFYCtrl.GetFYSimulatorTop().NewData -= HandleNewData; m_iFYCtrl.GetFYSimulatorBot().NewData -= HandleNewData; FYreceiver.NewData += HandleNewData; } else if (m_FYSimulatorActive == true) { FYreceiver.NewData -= HandleNewData; m_iFYCtrl.GetFYSimulatorTop().NewData += HandleNewData; m_iFYCtrl.GetFYSimulatorBot().NewData += HandleNewData; } ActuatorCmd("Reset", "FiddleYardTOP", "aJ\r"); // Reset Fiddle Yard TOP layer to reset target in order to sync C# application and C embedded software System.Threading.Thread.Sleep(50); // Add aditional wait time for the target to process the reset command ActuatorCmd("Reset", "FiddleYardBOT", "bJ\r"); // Reset Fiddle Yard BOT layer to reset target in order to sync C# application and C embedded software System.Threading.Thread.Sleep(50); // Add aditional wait time for the target to process the reset command }
public void OnInputClicked(InputClickedEventData eventData) { //Needs: SourceName, TargetName, ActuatorOperation, ConditionOperator, rightSide of Condition as String //SensActConnection.commands targetCommand; SenActFensterName = this.gameObject.transform.parent.name; SenActFenster = this.gameObject.transform.parent.gameObject; this.LineID = SenActFenster.GetComponent <LogicSenActInput>().LineID; this.SourceNamelong = SenActFenster.GetComponent <LogicSenActInput>().SourceName; this.TargetNamelong = SenActFenster.GetComponent <LogicSenActInput>().TargetName; this.condOperator = SenActFenster.GetComponent <LogicSenActInput>().GetOperator(); bool targetOp = SenActFenster.GetComponent <LogicSenActInput>().GetTargetStatus(); if (!targetOp) { targetCommand = SensActConnection.commands.OFF; } else { targetCommand = SensActConnection.commands.ON; } Item source = ItemManager.getInstance().getItem(SourceNamelong); Item target = ItemManager.getInstance().getItem(TargetNamelong); if (source is NfcReader || source is MyoArmband) { this.rightSideString = SenActFenster.GetComponent <LogicSenActInput>().GetSenValueString(); } else { this.rightSide = SenActFenster.GetComponent <LogicSenActInput>().GetSenValue(); } if (source is Sensor && target is Actuator) { if (!ConnectionManager.getInstance().getConnections().ContainsKey(LineID)) { Sensor sSens = (Sensor)source; Actuator tDimmer = (Actuator)target; if (source is NfcReader || source is MyoArmband) { if (source is NfcReader) { NfcReader nfcr = (NfcReader)source; nc = ConnectionCreator.createNfcActConnection(LineID, SourceNamelong, TargetNamelong, rightSideString, condOperator, targetCommand); } else { MyoArmband myoa = (MyoArmband)source; mc = ConnectionCreator.createMyoActConnection(LineID, SourceNamelong, TargetNamelong, rightSideString, condOperator, targetCommand); } } else { c = ConnectionCreator.createSensActConnection(LineID, SourceNamelong, TargetNamelong, rightSide, condOperator, targetCommand); } ConnectionManager.getInstance().startConnection(LineID); } else { if (source is NfcReader || source is MyoArmband) { if (source is NfcReader) { nc = (NfcActConnection)ConnectionManager.getInstance().getConnection(LineID); } else { mc = (MyoActConnection)ConnectionManager.getInstance().getConnection(LineID); } } else { c = (SensActConnection)ConnectionManager.getInstance().getConnection(LineID); } ConnectionManager.getInstance().startConnection(LineID); } } SenActFenster.transform.GetChild(1).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); this.transform.localScale = new Vector3(0, 0, 0); }
void Update() { if (c != null || nc != null || mc != null) { updateCounter++; if (updateCounter >= Settings.requestUpdateNumber) { if (c != null) { if (c.connState.Equals(Connection.States.Active)) { Item source = ItemManager.getInstance().getItem(SourceNamelong); Actuator target = (Actuator)ItemManager.getInstance().getItem(TargetNamelong); string leftSide = source.state; float leftValue = float.Parse(leftSide); float rightValue = rightSide; switch (c.condOperator) { case LogicSenActInput.Operatoren.kleiner: { if (leftValue < rightValue) { if (c.targetCommand.Equals(SensActConnection.commands.ON)) { StartCoroutine(target.sendON()); ConnectionManager.getInstance().stopConnection(c.id); SenActFenster.transform.GetChild(3).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); SenActFenster.transform.GetChild(1).transform.localScale = new Vector3(0, 0, 0); } else { StartCoroutine(target.sendOFF()); ConnectionManager.getInstance().stopConnection(c.id); SenActFenster.transform.GetChild(3).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); SenActFenster.transform.GetChild(1).transform.localScale = new Vector3(0, 0, 0); } } break; } case LogicSenActInput.Operatoren.gleich: { if (leftValue == rightValue) { if (c.targetCommand.Equals(SensActConnection.commands.ON)) { StartCoroutine(target.sendON()); ConnectionManager.getInstance().stopConnection(c.id); SenActFenster.transform.GetChild(3).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); SenActFenster.transform.GetChild(1).transform.localScale = new Vector3(0, 0, 0); } else { StartCoroutine(target.sendOFF()); ConnectionManager.getInstance().stopConnection(c.id); SenActFenster.transform.GetChild(3).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); SenActFenster.transform.GetChild(1).transform.localScale = new Vector3(0, 0, 0); } } break; } case LogicSenActInput.Operatoren.groesser: { if (leftValue > rightValue) { if (c.targetCommand.Equals(SensActConnection.commands.ON)) { StartCoroutine(target.sendON()); ConnectionManager.getInstance().stopConnection(c.id); SenActFenster.transform.GetChild(3).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); SenActFenster.transform.GetChild(1).transform.localScale = new Vector3(0, 0, 0); } else { StartCoroutine(target.sendOFF()); ConnectionManager.getInstance().stopConnection(c.id); SenActFenster.transform.GetChild(3).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); SenActFenster.transform.GetChild(1).transform.localScale = new Vector3(0, 0, 0); } } break; } default: break; } } } else { if (nc != null) { if (nc.connState.Equals(Connection.States.Active)) { Item source = ItemManager.getInstance().getItem(SourceNamelong); Actuator target = (Actuator)ItemManager.getInstance().getItem(TargetNamelong); NfcReader nfcr = (NfcReader)source; string leftSide = nfcr.niceState; if (nc.condOperator.Equals(LogicSenActInput.Operatoren.gleich)) { if (leftSide.Equals(nc.rightSide)) { if (nc.targetCommand.Equals(SensActConnection.commands.ON)) { StartCoroutine(target.sendON()); ConnectionManager.getInstance().stopConnection(nc.id); SenActFenster.transform.GetChild(3).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); SenActFenster.transform.GetChild(1).transform.localScale = new Vector3(0, 0, 0); } else { StartCoroutine(target.sendOFF()); ConnectionManager.getInstance().stopConnection(nc.id); SenActFenster.transform.GetChild(3).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); SenActFenster.transform.GetChild(1).transform.localScale = new Vector3(0, 0, 0); } } } } } else { if (mc != null) { if (mc.connState.Equals(Connection.States.Active)) { Item source = ItemManager.getInstance().getItem(SourceNamelong); Actuator target = (Actuator)ItemManager.getInstance().getItem(TargetNamelong); MyoArmband myoa = (MyoArmband)source; string leftSide = myoa.niceState; if (mc.condOperator.Equals(LogicSenActInput.Operatoren.gleich)) { if (leftSide.Equals(mc.rightSide)) { if (mc.targetCommand.Equals(SensActConnection.commands.ON)) { StartCoroutine(target.sendON()); ConnectionManager.getInstance().stopConnection(mc.id); SenActFenster.transform.GetChild(3).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); SenActFenster.transform.GetChild(1).transform.localScale = new Vector3(0, 0, 0); } else { StartCoroutine(target.sendOFF()); ConnectionManager.getInstance().stopConnection(mc.id); SenActFenster.transform.GetChild(3).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); SenActFenster.transform.GetChild(1).transform.localScale = new Vector3(0, 0, 0); } } } } } } } updateCounter = 0; } } }
///<exclude/> public bool Equals(Actuator other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return other._Position.Equals(_Position) && other._Speed.Equals(_Speed) && other._Accel.Equals(_Accel) && other._Current.Equals(_Current) && other._Status.Equals(_Status); }