Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="charUpdate"></param>
        private void OnCharacteristicNotify(CharacteristicUpdate charUpdate)
        {
            if (charUpdate == null)
            {
                _logger.Log("Encountered null characteristic, ignoring", Category.Exception, Priority.High);
                return;
            }

            if (charUpdate.Uuid == Constants.RestoreCharacteristicStatusUuid)
            {
                int value = charUpdate.IntValue;
                _logger.Log($"Received value {value}", Category.Debug, Priority.None);

                if (value == 1)
                {
                    _notifyManager.ShowDialogInfoBox("Restore Complete, the device should automatically restart.");
                    _aggregator.GetEvent <PrismEvents.RestoreCompleteEvent>().Publish();
                }
                else
                {
                    _notifyManager.ShowDialogInfoBox($"Unable to restore. Returned value: {value}");
                }

                FinishRestore();
            }
        }
Exemplo n.º 2
0
        private void KeyChar_ValueUpdated(object sender, Plugin.BLE.Abstractions.EventArgs.CharacteristicUpdatedEventArgs e)
        {
            Guid uuid = e.Characteristic.Id;

            byte[] value  = e.Characteristic.Value;
            string valStr = Helper.ByteArrayToString(value);

            _logger.Log($"Characteristic updated {uuid}; New value {valStr}", Category.Info, Priority.None);
            var charValue = new CharacteristicUpdate(uuid, value);

            _aggregator.GetEvent <PrismEvents.CharacteristicUpdatedEvent>().Publish(charValue);
        }