public BeaconService(ISQLiteConnectionProvider sqliteConnectionProvider)
        {
            _connection = sqliteConnectionProvider.GetConnection();
            _connection.CreateTable <BeaconDataModel>();

            _beaconTransmitter = new CBPeripheralManager();
            _beaconTransmitter.StateUpdated += DidStateUpdated;

            _listOfCLBeaconRegion = new List <CLBeaconRegion>();
            _fieldRegion          = new CLBeaconRegion(new NSUuid(AppConstants.iBeaconAppUuid), "");
            _fieldRegion.NotifyEntryStateOnDisplay = true;
            _fieldRegion.NotifyOnEntry             = true;
            _fieldRegion.NotifyOnExit = true;

            // Monitoring
            _locationManager = new CLLocationManager();
            if (CLLocationManager.LocationServicesEnabled)
            {
                _locationManager.Delegate = this;
                _locationManager.PausesLocationUpdatesAutomatically = false;
                _locationManager.ShowsBackgroundLocationIndicator   = true;
                _locationManager.DistanceFilter = 1.0;
                _locationManager.AllowsBackgroundLocationUpdates = true;
                _locationManager.DidRangeBeacons      += DidRangeBeconsInRegionComplete;
                _locationManager.AuthorizationChanged += HandleAuthorizationChanged;
                _locationManager.RequestAlwaysAuthorization();
            }
        }
Beispiel #2
0
 /// <summary>
 /// Ctor
 /// Initializes a new instance of the <see cref="T:LiteX.Cache.SQLite.SQLiteCachingProvider" /> class.
 /// </summary>
 /// <param name="perRequestCacheManager">per request cacheManager</param>
 /// <param name="connectionWrapper">Connection wrapper</param>
 /// <param name="config">Config options</param>
 /// <param name="loggerFactory">Logger Factory</param>
 public SQLiteCacheManager(ICacheManager perRequestCacheManager, ISQLiteConnectionProvider connectionWrapper, SQLiteConfig config, ILiteXLoggerFactory loggerFactory = null)
 {
     if (string.IsNullOrEmpty(config.FileName))
     {
         throw new Exception("FileName is empty");
     }
     if (string.IsNullOrEmpty(config.FilePath))
     {
         throw new Exception("FilePath is empty");
     }
     _config = config;
     _perRequestCacheManager = perRequestCacheManager;
     _connectionWrapper      = connectionWrapper;
     _connection             = _connectionWrapper.GetConnection();
     _logger = (loggerFactory?.CreateLogger(this) ?? new LiteXNullLoggerFactory().CreateLogger(this));
 }
 public BeaconService(HttpDataService httpDataService, ISQLiteConnectionProvider sqliteConnectionProvider)
 {
     _httpDataService = httpDataService;
     _connection      = sqliteConnectionProvider.GetConnection();
     _connection.CreateTable <BeaconDataModel>();
 }
Beispiel #4
0
 public BatFamilyService(ISQLiteConnectionProvider connectionProvider)
 {
     ConnectionProvider = connectionProvider;
     Connection         = ConnectionProvider.GetConnection();
     Connection.CreateTableAsync <BatFamily>();
 }