Ejemplo n.º 1
0
        /// <summary>
        /// Event called when beacon 1 data written
        /// </summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">Event args indicating success</param>
        private void EddystoneWriteEvent(object sender, CharacteristicWriteEventArgs e)
        {
            if (e.Success)
            {
                Debug.WriteLine(String.Format("Uri Beacon Data written: {0} bytes", e.NumberOfBytesWritten));

                // Read it again
                var readResult = _ble.ReadCharacteristic(SERVICE_FOR_EDDYSTONE, CHARACTERISTIC_FOR_URI_BEACON1, EddystoneReadEvent);
            }
            else
            {
                Application.Current.MainPage.DisplayAlert("ERROR", string.Format("Error writing Eddystone data: {0}", e.Message), "Close");
                _ = DisconnectDevice();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Event called when password data written
        /// </summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">Event args indicating success</param>
        private void PassWordWrittenEvent(object sender, CharacteristicWriteEventArgs e)
        {
            if (e.Success)
            {
                AdaptorState = string.Format("Password write: {0} bytes written", e.NumberOfBytesWritten);

                // Read UUID
                var readResult = _ble.ReadCharacteristic(SERVICE_FOR_BEACON, CHARACTERISTIC_FOR_UUIDD, UUIDReadEvent);
            }
            else
            {
                Application.Current.MainPage.DisplayAlert("ERROR", string.Format("Error writing password: {0}", e.Message), "Close");
                _ = DisconnectDevice();
            }
        }