Exemplo n.º 1
0
        private void OnBLEConnection_StateChange(ConnectionState connectionState)
        {
            if ((ConnectionState.Connected != connectionState) && (ConnectionState.Connecting != connectionState))
            {
                if (null != g_BLEAdapterObj_connectionGattServer)
                {
                    g_BLEAdapterObj_connectionGattServer.Disconnect();
                }
            }

            g_activityBLEConnStateChangeCb(connectionState);
        }
        private async Task CloseConnection()
        {
            IsBusy = true;
            if (m_gattServer != null)
            {
                Log.Trace("Closing connection to GATT Server. state={0:g}", m_gattServer?.State);
                await m_gattServer.Disconnect();

                m_gattServer = null;
            }

            Services.Clear();
            IsBusy = false;
        }