private async Task DoReadAmbientLight()
        {
            SetStatusActive(true); // the false happens in the bluetooth status handler.
            ncommand++;
            try
            {
                var valueList = await bleDevice.ReadAmbientLight();

                if (valueList == null)
                {
                    SetStatus($"Error: unable to read AmbientLight");
                    return;
                }

                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?
                }


                AmbientLightRecordData.Add(record);
            }
            catch (Exception ex)
            {
                SetStatus($"Error: exception: {ex.Message}");
            }
        }
        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);
                });
            }
        }