Example #1
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());
        }
Example #2
0
        private static void updateStatus()
        {
            string  addr    = String.Format("{0}:50051", ipAddr);
            Channel channel = new Channel(addr, ChannelCredentials.Insecure);

            McServer.McServerClient client = new McServer.McServerClient(channel);

            Empty           statusReq = new Empty();
            BrewStatusReply rep       = client.GetStatus(statusReq);

            channel.ShutdownAsync().Wait();

            status.RemainingMashStepList.Clear();

            foreach (MashProfileStep statusMp in rep.RemainingMashSteps)
            {
                var mps = new GFCalc.Domain.MashProfileStep();
                mps.Temperature = statusMp.Temperature;
                mps.StepTime    = statusMp.StepTime;

                status.RemainingMashStepList.Add(mps);
            }

            var ol = status.RemainingMashStepList.OrderBy(x => x.Temperature).ToList();

            status.RemainingMashStepList.Clear();

            foreach (GFCalc.Domain.MashProfileStep ms in ol)
            {
                status.RemainingMashStepList.Add(ms);
            }

            status.Temperature       = (int)(Math.Round(rep.MashTemperature));
            status.RemainingBoilTime = rep.RemainingBoilTime;
            status.State             = rep.CurrentBrewStep;
            status.Progress          = rep.Progress;
        }
Example #3
0
        private static void updateStatus()
        {

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

            McServer.McServerClient client = new McServer.McServerClient(channel);

            Empty statusReq = new Empty();
            BrewStatusReply rep = client.GetStatus(statusReq);
            channel.ShutdownAsync().Wait();

            status.RemainingMashStepList.Clear();

            foreach (MashProfileStep statusMp in rep.RemainingMashSteps)
            {
                var mps = new GFCalc.Domain.MashProfileStep();
                mps.Temperature = statusMp.Temperature;
                mps.StepTime = statusMp.StepTime;

                status.RemainingMashStepList.Add(mps);
            }

            var ol = status.RemainingMashStepList.OrderBy(x => x.Temperature).ToList();
            status.RemainingMashStepList.Clear();

            foreach (GFCalc.Domain.MashProfileStep ms in ol)
            {
                status.RemainingMashStepList.Add(ms);
            }

            status.Temperature = (int)(Math.Round(rep.MashTemperature));
            status.RemainingBoilTime = rep.RemainingBoilTime;
            status.State = rep.CurrentBrewStep;
            status.Progress = rep.Progress;
        }
Example #4
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();
            }
        }
Example #5
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;
            }
        }
Example #6
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;
            }

        }
Example #7
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();

            }
        }
Example #8
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));
                }

            }

            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());


        }