예제 #1
0
 public void Disconnect()
 {
     if (Ble != null)
     {
         //unsubscribe
         Ble.ConnectionStatusChanged -= StatusChanged;
         //sources(services)
         AudioLevelSource.Dispose();
         AccGyroMagSource.Dispose();
         ActivityRecognitionSource.Dispose();
         BatteryStatusSource.Dispose();
         CarryPositionSource.Dispose();
         CompassSource.Dispose();
         EnvironmentalSource.Dispose();
         GestureRecognitionSource.Dispose();
         LEDStateConfigSource.Dispose();
         LightSensorSource.Dispose();
         OrientationSource.Dispose();
         ProximitySource.Dispose();
         SmokeSensorSource.Dispose();
         LEDStateConfigSource.Dispose();
         UltraVioletSource.Dispose();
         //device
         Ble.Dispose();
         GC.Collect();
         GC.WaitForPendingFinalizers();
         Ble = null;
     }
 }
예제 #2
0
 public void Activate()
 {
     if (EnviromentalSource.IsAvailable)
     {
         EnviromentalSource.Enable();
     }
     if (LightSensorSource.IsAvailable)
     {
         LightSensorSource.Enable();
     }
     if (AudioLevelSource.IsAvailable)
     {
         AudioLevelSource.Enable();
     }
 }