예제 #1
0
        /// <summary>
        /// Dispose of the internal BLE adaptor based on Nordic Semiconductor BleManager
        /// </summary>
        public void RemoveAdaptor()
        {
            if (ManagerPresent())
            {
                Log("Removing BLE adaptor");

                // Unsubscribe from event handlers
                _bleManager.ClearEventHandlers();

                // Deep logging
                _bleManager.LogEvent -= _bleManager_LogEvent;

                // Nullify our reference to the adaptor
                // Note - not calling Dispose as it may be responsible for the "use of deleted global reference" error that can crash the app
                // _bleManager.Dispose();
                _bleManager = null;
            }
        }
예제 #2
0
        /// <summary>
        /// Create the internal BLE adaptor based on Nordic Semiconductor BleManager
        /// </summary>
        public void CreateAdaptor()
        {
            if (_bleManager == null)
            {
                Log("Creating BLE adaptor");

                // Create the adaptor
                _bleManager = new MyBleManager();

                // Subscribe to event handlers related to device connections
                _bleManager.DeviceConnectedEvent    += _bleManager_DeviceConnectedEvent;
                _bleManager.DeviceReadyEvent        += _bleManager_DeviceReadyEvent;
                _bleManager.DeviceDisconnectedEvent += _bleManager_DeviceDisconnectedEvent;
                _bleManager.MtuChangeEvent          += _bleManager_MtuChangeEvent;
                _bleManager.ServicesDiscoveredEvent += _bleManager_ServicesDiscoveredEvent;

                // Deep logging
                _bleManager.LogEvent += _bleManager_LogEvent;
            }
        }
예제 #3
0
            //public SkfBleManagerGattCallback() : base(IntPtr.Zero, JniHandleOwnership.DoNotTransfer)
            //{

            //}

            /// <summary>
            /// Class constructor
            /// </summary>
            /// <param name="__self">Enclosing <see cref="SkfBleManager"/> instance</param>
            public SkfBleManagerGattCallback(MyBleManager __self) : base(__self)
            {
                _manager = __self;
            }