public void IsFull(MyStopWatch timer, Context context, IRaspberryPiStates emptyState, IRaspberryPiStates fullState, IRaspberryPiStates notDoneState) { //Console.WriteLine("Fullstate"); if (LaserTop.Detected() == false) { //bt.SendData("Fullstate"); context.setState(fullState); return; } if (LaserTop.Detected() && Magnet.Detected() == true) { timer.StartTimer(); //Bluetooth //bt.Init(); //bt.SendData("NotDoneState"); writer.JsonWriterFunc("NotDonestate", "0", ""); context.setState(notDoneState); } else { throw new ArgumentException("Error In FullState"); } }
public void IsFull(MyStopWatch timer, Context context, IRaspberryPiStates emptyState, IRaspberryPiStates fullState, IRaspberryPiStates notDoneState) { //Console.WriteLine("NotDoneState"); if (LaserBot.Detected() == false) { //bt.SendData("NotDoneState"); context.setState(notDoneState); } if (Magnet.Detected() == false && LaserBot.Detected() == true) { //bt.Init(); string result = null; result = timer.StopTimer(); Console.WriteLine(result); //bt.SendData(result); //bt.SendData("EmptyState"); writer.JsonWriterFunc("Emptystate", result, ""); context.setState(emptyState); } if (timer.GetTime() > MAX_TIME) { throw new InvalidOperationException("TimeOut"); } }