Exemple #1
0
 /// <summary>
 ///     Method for waking up ble device
 /// </summary>
 public async Task ResetBlue2AutoOff()
 {
     try
     {
         if (resetAutoOffChar != null)
         {
             await resetAutoOffChar.WriteMessageAsync("1");
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Error on ResetBlue2AutoOff : {0}", ex.Message);
     }
 }
Exemple #2
0
        /// <summary>
        ///     Method for updating ble settings
        /// </summary>
        /// <param name="chr"></param>
        /// <param name="value"></param>
        public async Task UpdateBLESettings(BLEChar chr, string value)
        {
            try
            {
                switch (chr)
                {
                case BLEChar.Scale:
                    if (measurementScaleChar != null)
                    {
                        await measurementScaleChar.WriteMessageAsync(value);
                    }
                    break;

                case BLEChar.Time:
                    if (measurementTimeChar != null)
                    {
                        await measurementTimeChar.WriteMessageAsync(value);
                    }
                    break;

                case BLEChar.AutoOff:
                    if (autooffChar != null)
                    {
                        await autooffChar.WriteMessageAsync(value);
                    }
                    break;

                case BLEChar.Sleep:
                    if (sleepChar != null)
                    {
                        await sleepChar.WriteMessageAsync(value);
                    }
                    break;

                case BLEChar.Prob:
                    if (probChar != null)
                    {
                        probChar.UpdateProbe(value);
                    }
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Error UpdateBLESettings : {0}", ex.Message);
            }
        }
Exemple #3
0
        /// <summary>
        ///     Method for disconnecting device
        /// </summary>
        public void DisConnectDevice()
        {
            try
            {
                if (disConnectPeripheralChar != null)
                {
                    disConnectPeripheralChar.WriteMessageAsync("1");
                }

                StopTemperatureReading();
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Error on DisConnectDevice : {0}", ex.Message);
            }
        }