Beispiel #1
0
        private void Nrf_ReceiveEvent(BleEditor.ValueParserResult data)
        {
            var str = data.UserString;

            Terminal?.ReceivedData(str);
            Terminal?.SetDeviceStatus($"read OK");
        }
Beispiel #2
0
 private async void BleDevice_OpticalServiceDataEvent(BleEditor.ValueParserResult data)
 {
     if (data.Result == BleEditor.ValueParserResult.ResultValues.Ok)
     {
         await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
         {
             var Lux = data.ValueList.GetValue("Lux").AsDouble;
             OpticalServiceData_Lux.Text = Lux.ToString("F3");
         });
     }
 }
Beispiel #3
0
        private async void BleDevice_Data_ValuesEvent(BleEditor.ValueParserResult data)
        {
            if (data.Result == BleEditor.ValueParserResult.ResultValues.Ok)
            {
                await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                {
                    var valueList = data.ValueList;

                    var record = new Data_ValuesRecord();

                    var Command = valueList.GetValue("Command");
                    if (Command.CurrentType == BCBasic.BCValue.ValueType.IsDouble || Command.CurrentType == BCBasic.BCValue.ValueType.IsString)
                    {
                        record.Command           = (double)Command.AsDouble;
                        Data_Values_Command.Text = record.Command.ToString(); // "N0"); // either N or F3 based on DEC HEX FIXED. hex needs conversion to int first?
                    }

                    var Range = valueList.GetValue("Range");
                    if (Range.CurrentType == BCBasic.BCValue.ValueType.IsDouble || Range.CurrentType == BCBasic.BCValue.ValueType.IsString)
                    {
                        record.Range           = (double)Range.AsDouble;
                        Data_Values_Range.Text = record.Range.ToString(); // "N0"); // either N or F3 based on DEC HEX FIXED. hex needs conversion to int first?
                    }

                    var Value = valueList.GetValue("Value");
                    if (Value.CurrentType == BCBasic.BCValue.ValueType.IsDouble || Value.CurrentType == BCBasic.BCValue.ValueType.IsString)
                    {
                        record.Value           = (double)Value.AsDouble;
                        Data_Values_Value.Text = record.Value.ToString(); // "N0"); // either N or F3 based on DEC HEX FIXED. hex needs conversion to int first?
                    }

                    var V3 = valueList.GetValue("V3");
                    if (V3.CurrentType == BCBasic.BCValue.ValueType.IsDouble || V3.CurrentType == BCBasic.BCValue.ValueType.IsString)
                    {
                        record.V3           = (double)V3.AsDouble;
                        Data_Values_V3.Text = record.V3.ToString(); // "N0"); // either N or F3 based on DEC HEX FIXED. hex needs conversion to int first?
                    }

                    var More_Data = valueList.GetValue("More_Data");
                    if (More_Data.CurrentType == BCBasic.BCValue.ValueType.IsDouble || More_Data.CurrentType == BCBasic.BCValue.ValueType.IsString)
                    {
                        record.More_Data           = (string)More_Data.AsString;
                        Data_Values_More_Data.Text = record.More_Data.ToString(); // "N0"); // either N or F3 based on DEC HEX FIXED. hex needs conversion to int first?
                    }

                    var addResult = Data_ValuesRecordData.AddRecord(record);
                });
            }
        }
        private async void BleDevice_AmbientLightEvent(BleEditor.ValueParserResult data)
        {
            if (data.Result == BleEditor.ValueParserResult.ResultValues.Ok)
            {
                await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                {
                    var valueList = data.ValueList;

                    var record = new AmbientLightRecord();

                    var AmbientLight = valueList.GetValue("AmbientLight");
                    if (AmbientLight.CurrentType == BCBasic.BCValue.ValueType.IsDouble || AmbientLight.CurrentType == BCBasic.BCValue.ValueType.IsString)
                    {
                        record.AmbientLight            = (double)AmbientLight.AsDouble;
                        AmbientLight_AmbientLight.Text = record.AmbientLight.ToString(); // "N0"); // either N or F3 based on DEC HEX FIXED. hex needs conversion to int first?
                    }

                    var addResult = AmbientLightRecordData.AddRecord(record);
                });
            }
        }
        private async void BleDevice_MicrophoneEvent(BleEditor.ValueParserResult data)
        {
            if (data.Result == BleEditor.ValueParserResult.ResultValues.Ok)
            {
                await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                {
                    var valueList = data.ValueList;

                    var record = new MicrophoneRecord();

                    var Audio = valueList.GetValue("Audio");
                    if (Audio.CurrentType == BCBasic.BCValue.ValueType.IsDouble || Audio.CurrentType == BCBasic.BCValue.ValueType.IsString)
                    {
                        record.Audio          = (string)Audio.AsString;
                        Microphone_Audio.Text = record.Audio.ToString(); // "N0"); // either N or F3 based on DEC HEX FIXED. hex needs conversion to int first?
                    }

                    var addResult = MicrophoneRecordData.AddRecord(record);
                });
            }
        }