Ejemplo n.º 1
0
 private void InitializeBluetoothServer()
 {
     _bluetoothServer = BluetoothServer.Instance;
     GattServerObserver.Instance.ServiceAdded +=
         (status, service) =>
         DialogView.ShowDialog("Server service uuid: " + BluetoothServiceFactory.ServiceUuid, this);
 }
        private void InitializeView()
        {
            var connectionHandler = BluetoothClient.Instance.ConnectionHandler;

            _notifyHandler  = new DeviceNotifyingHandler(connectionHandler.GattValue, GattClientObserver.Instance);
            _characteristic = GetCharacteristic(connectionHandler.GetServiceList());

            _notifyHandler.ValueChanged += NotifyOnValueChanged;
            _notifyHandler.Subscribe(_characteristic,
                                     result => DialogView.ShowDialog(result ? "Successfuly subscribed" : "Failed to subscribe", this));
        }
Ejemplo n.º 3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.ServiceListView);

            DialogView.ShowDialog("Discovering services...", this);
            BluetoothClient.Instance.ConnectionHandler.DiscoverServices(status =>
            {
                if (status == GattStatus.Success)
                {
                    DialogView.CloseDialog(this);
                    RunOnUiThread(() => ShowServicesAndCharacteristics(BluetoothClient.Instance.ConnectionHandler));
                }
                else
                {
                    DialogView.ShowDialog("Failed to discover. Return and try again", this);
                }
            });
        }
Ejemplo n.º 4
0
 private void ShowDialog(string message)
 {
     DialogView.ShowDialog(message, this);
 }