예제 #1
0
        private void MenuItem_GrainbrainBrewingMonitor(object sender, RoutedEventArgs e)
        {
            IPAddress ipAddr;

            if (GrainbrainNetDiscovery.GetGrainBrainAddress(out ipAddr))
            {
                var bm = new BrewingMonitor(ipAddr);
                bm.ShowDialog();
            }
        }
예제 #2
0
        private void MenuItem_GrainbrainStart(object sender, RoutedEventArgs e)
        {
            var sgw = new StartGrainbrainWindow();

            sgw.ShowDialog();

            LoadBrewProfileRequest req = new LoadBrewProfileRequest();

            req.BoilTime = BoilTime;

            foreach (Domain.MashProfileStep ms in  MashProfileList)
            {
                req.MashProfileSteps.Add(new Grpcproto.MashProfileStep {
                    Temperature = (int)(Math.Round(ms.Temperature)), StepTime = ms.StepTime, HeatOverTime = ms.HeatOverTime
                });
                log.Info(String.Format("Mash time {0} at {1} C", ms.StepTime, ms.Temperature));
            }

            foreach (HopAddition bh in BoilHops)
            {
                if (bh.Stage == HopAdditionStage.Boil)
                {
                    req.HopAdditionStep.Add(new HopAdditionStep {
                        Time = bh.Duration, Name = bh.Hop.Name
                    });
                    log.Info(String.Format("{0} at {1} min", bh.Hop.Name, bh.Duration));
                }
            }

            req.GrainbillWeight = GrainBillSize;
            req.MashWaterVolume = Volumes.FinalBatchVolume;
            IPAddress ipAddr;

            GrainbrainNetDiscovery.GetGrainBrainAddress(out ipAddr);
            string  addr    = String.Format("{0}:50051", ipAddr);
            Channel channel = new Channel(addr, ChannelCredentials.Insecure);

            McServer.McServerClient client = new McServer.McServerClient(channel);
            SuccessReply            reply  = client.LoadBrewProfile(req);

            StartStopRequest startReq = new StartStopRequest();

            startReq.StartStop = StartStopRequest.Types.StartStop.Start;
            SuccessReply relpy2 = client.StartStopAbort(startReq);

            log.Info("Started - Response: " + reply.Success.ToString());
        }
예제 #3
0
        private void MenuItem_GrainbrainStop(object sender, RoutedEventArgs e)
        {
            var sbpw = new StopBrewingProcessWindow();

            sbpw.ShowDialog();
            if (sbpw.Abort)
            {
                IPAddress ipAddr;
                if (!GrainbrainNetDiscovery.GetGrainBrainAddress(out ipAddr))
                {
                    return;
                }
                string addr = String.Format("{0}:50051", ipAddr);

                Channel ch = new Channel(addr, ChannelCredentials.Insecure);

                McServer.McServerClient cl = new McServer.McServerClient(ch);

                StartStopRequest req = new StartStopRequest();
                req.StartStop = StartStopRequest.Types.StartStop.Stop;
                SuccessReply resp = cl.StartStopAbort(req);
                ch.ShutdownAsync().Wait();
            }
        }
예제 #4
0
        private void handleBrewProcess(GrainBrainStatus status)
        {
            if (status.State == BrewStep.StrikeWaterTempReached)
            {
                //dispatcherTimer.Tick -= brewProcessTimer_Tick;
                dispatcherTimer.IsEnabled = false;

                var swrw = new StrikeWaterReachedWindow();
                swrw.ShowDialog();

                IPAddress ipAddr;
                if (!GrainbrainNetDiscovery.GetGrainBrainAddress(out ipAddr))
                {
                    return;
                }

                string  addr = String.Format("{0}:50051", ipAddr);
                Channel ch   = new Channel(addr, ChannelCredentials.Insecure);

                McServer.McServerClient cl = new McServer.McServerClient(ch);

                GrainsAddedNotify req  = new GrainsAddedNotify();
                Empty             resp = cl.GrainsAdded(req);
                ch.ShutdownAsync().Wait();

                //dispatcherTimer.Tick += brewProcessTimer_Tick;
                dispatcherTimer.IsEnabled = true;
            }

            if (status.State == BrewStep.MashDoneStartSparge)
            {
                dispatcherTimer.IsEnabled = false;

                var sdw = new SpargeDoneWindow();
                sdw.ShowDialog();

                IPAddress ipAddr;
                if (!GrainbrainNetDiscovery.GetGrainBrainAddress(out ipAddr))
                {
                    return;
                }

                string addr = String.Format("{0}:50051", ipAddr);

                Channel ch = new Channel(addr, ChannelCredentials.Insecure);

                McServer.McServerClient cl = new McServer.McServerClient(ch);

                SpargeDoneNotify req  = new SpargeDoneNotify();
                Empty            resp = cl.SpargeDone(req);
                ch.ShutdownAsync().Wait();

                dispatcherTimer.IsEnabled = true;
            }

            if (status.State == BrewStep.BoilDone)
            {
                dispatcherTimer.IsEnabled = false;

                var wcsw = new WortChillerSanitizedWindow();
                wcsw.ShowDialog();

                IPAddress ipAddr;
                if (!GrainbrainNetDiscovery.GetGrainBrainAddress(out ipAddr))
                {
                    return;
                }

                string addr = String.Format("{0}:50051", ipAddr);

                Channel ch = new Channel(addr, ChannelCredentials.Insecure);

                McServer.McServerClient cl = new McServer.McServerClient(ch);

                WortChillerSanitizedDoneNotify req = new WortChillerSanitizedDoneNotify();
                Empty resp = cl.WortChillerSanitizedDone(req);
                ch.ShutdownAsync().Wait();

                dispatcherTimer.IsEnabled = true;
            }
        }