/// <summary>
        /// Notifies the client about the alert
        /// </summary>
        public async void NotifyValue()
        {
            IBuffer buffer = GattServicesHelper.ConvertValueToBuffer(1);
            await newAlert.NotifyValueAsync(buffer);

            await unreadAlertStatus.NotifyValueAsync(buffer);
        }
Exemple #2
0
 /// <summary>
 /// Event handler for notifying the current time characteristics value
 /// </summary>
 public async void NotifyValue()
 {
     await currentTime.NotifyValueAsync(GattServicesHelper.ConvertValueToBuffer(DateTime.Now));
 }
Exemple #3
0
        /// <summary>
        /// Event handler for reading Current time
        /// </summary>
        /// <param name="sender">The source of the Write request</param>
        /// <param name="args">Details about the request</param>
        private async void ReadCharacteristicReadRequested(GattLocalCharacteristic sender, GattReadRequestedEventArgs args)
        {
            var request = await args.GetRequestAsync();

            request.RespondWithValue(GattServicesHelper.ConvertValueToBuffer(DateTime.Now));
        }
        /// <summary>
        /// Override so we can update the value when the value is read
        /// </summary>
        private void UpdateValue()
        {
            int readValue = rand.Next(1, 20);

            Value = GattServicesHelper.ConvertValueToBuffer(Convert.ToByte(readValue));
        }