public Multimeter(BLE.IDeviceBLE pDevice)
        {
            mDevice = pDevice ?? throw new Exception("Multimeter must connect to a BLE device, not null.");

            mDevice.Change        += (o, e) => { MyProcessor.Recieve(e.Bytes); };
            MyProcessor.mCallback += ProcessPacket;

            Screen = new MultimeterScreen();
            Menu   = new MultimeterMenu();

            #region MULTIMETER_BUTTON_EVENTS
            void SendKeycode(Packet121GW.Keycode keycode)
            {
                SendData(Packet121GW.GetKeycode(keycode));
            }

            Menu.HoldClicked  += (s, e) => { SendKeycode(Packet121GW.Keycode.HOLD); };
            Menu.RelClicked   += (s, e) => { SendKeycode(Packet121GW.Keycode.REL); };
            Menu.ModeChanged  += (s, e) => { SendKeycode(Packet121GW.Keycode.MODE); };
            Menu.RangeChanged += (s, e) => { SendKeycode(Packet121GW.Keycode.RANGE); };
            #endregion

            #region CHART_CONSTRUCTION
            Chart =
                new SmartChart(
                    new SmartData(
                        new SmartAxisPair(
                            new SmartAxisHorizontal("Horizontal", -0.1f, 0.1f),
                            new SmartAxisVertical("Vertical", -0.2f, 0.1f)), Logger.Data));

            Chart.Clicked += (o, e) =>
            {
                Plot_FullScreenClicked(o, e);
            };
            #endregion

            ChartMenu               = new SmartChartMenu(true, true);
            ChartMenu.SaveClicked  += (s, e) => { Chart.SaveCSV(); };
            ChartMenu.ResetClicked += (s, e) => { Reset(); };

            DefineGrid(1, 4);
            AutoAdd(Screen);        FormatCurrentRow(GridUnitType.Star);
            AutoAdd(Menu);      FormatCurrentRow(GridUnitType.Auto);
            AutoAdd(Chart);     FormatCurrentRow(GridUnitType.Star);
            AutoAdd(ChartMenu); FormatCurrentRow(GridUnitType.Auto);

            Item = ActiveItem.Screen;
        }
Exemplo n.º 2
0
        public void Update(Packet121GW pInput)
        {
            SetLayer(BT, true);
            foreach (var other in mOther.mLayers)
            {
                other.Off();
            }

            //Main range bits
            MainMode       = pInput;
            MainRangeValue = pInput;

            //Sub range bits
            SubMode       = pInput;
            SubRangeValue = pInput;

            //Bar graph bits
            BarStatus = pInput;

            //Update icons
            IconStatus = pInput;
        }