Class LocationDataSupplierImpl
-
- All Implemented Interfaces:
-
com.pointrlabs.core.bluetooth.wrapper.BleScannerWrapper.Listener
,com.pointrlabs.core.management.AppStateManager.Listener
,com.pointrlabs.core.management.ConfigurationManager.Listener
,com.pointrlabs.core.management.PTRListener
,com.pointrlabs.core.positioning.internal.gps.GpsTracker.Listener
,com.pointrlabs.core.positioning.internal.interfaces.LocationDataSupplier
,com.pointrlabs.core.receiver.BluetoothStateChangeReceiver.Listener
,com.pointrlabs.core.receiver.GpsGeofenceBroadcastReceiver.Listener
,com.pointrlabs.core.receiver.PointrBroadcastReceiver.Listener
public class LocationDataSupplierImpl implements BleScannerWrapper.Listener, LocationDataSupplier, AppStateManager.Listener, BluetoothStateChangeReceiver.Listener, GpsGeofenceBroadcastReceiver.Listener, ConfigurationManager.Listener, GpsTracker.Listener
This class wraps the bluetooth adapter.
-
-
Constructor Summary
Constructors Constructor Description LocationDataSupplierImpl(CppSharedPtr cppLocationDataSupplier, Context context, ConfigurationManager configurationManager, ConfigurationManager configurationManager1, AppStateManager appStateManager, GpsTracker gpsTracker, BleScannerWrapper bleScannerWrapper)
Instantiates a new LocationDataSupplier
-
Method Summary
Modifier and Type Method Description void
onScanResult(@NotNull() ScanResult scanResult)
Invoked on every scan result void
onCycleEnd()
Invoked when CycledLeScanner finishes cycle period for current cycle. synchronized void
start()
void
registerGeofenceEventsToGoogle(List<GeofenceServiceEvent> listOfGeofenceServiceEvents)
void
onGeofenceEvent(List<String> geofenceIdsTriggered, int event)
synchronized void
stop()
void
onAppStateManagerChangeState(int state, int performanceMode)
void
onConfigurationUpdate()
Configuration updated PositioningTypes.PositioningServiceState
getState()
Current positioning service state (bluetooth status) void
startAndroidOBackgroundScan()
Starts the le scanning cycle for android O and higher This needs to be public, to be called from JobScheduler and JobService void
stopAndroidOBackgroundScan()
Stops the le scanning cycle for android O and lower This needs to be public, to be called from JobScheduler and JobService void
onGpsLocationReceived(@NonNull() Location location)
Invoked when a Location object is obtained from OS void
processBackgroundLeScan(BluetoothDevice device, int rssi, Array<byte> scanRecord)
To process the scan results that are retrieved by job service when on background void
onBluetoothStateChanged(int bluetoothState)
Notifies when bluetooth state is changed void
onBluetoothCorrupted()
Notifies the listeners when the system bluetooth app has entered a bad state, where no new GattClients can be registered, hence no bluetooth scanning can be made. void
onBluetoothRestored()
This is for the case where bluetooth of the device was corrupted but then bluetooth medic was able to resolve the issue by doing a power cycle. void
feedBeaconData(RawBeaconData rawBeaconData)
-
-
Constructor Detail
-
LocationDataSupplierImpl
LocationDataSupplierImpl(CppSharedPtr cppLocationDataSupplier, Context context, ConfigurationManager configurationManager, ConfigurationManager configurationManager1, AppStateManager appStateManager, GpsTracker gpsTracker, BleScannerWrapper bleScannerWrapper)
Instantiates a new LocationDataSupplier
-
-
Method Detail
-
onScanResult
void onScanResult(@NotNull() ScanResult scanResult)
Invoked on every scan result
- Parameters:
scanResult
- details about the scan
-
onCycleEnd
void onCycleEnd()
Invoked when CycledLeScanner finishes cycle period for current cycle.
-
start
synchronized void start()
-
registerGeofenceEventsToGoogle
void registerGeofenceEventsToGoogle(List<GeofenceServiceEvent> listOfGeofenceServiceEvents)
-
onGeofenceEvent
void onGeofenceEvent(List<String> geofenceIdsTriggered, int event)
-
stop
synchronized void stop()
-
onAppStateManagerChangeState
void onAppStateManagerChangeState(int state, int performanceMode)
-
onConfigurationUpdate
void onConfigurationUpdate()
Configuration updated
-
getState
PositioningTypes.PositioningServiceState getState()
Current positioning service state (bluetooth status)
- Returns:
State
-
startAndroidOBackgroundScan
@RequiresApi(api = Build.VERSION_CODES.O) void startAndroidOBackgroundScan()
Starts the le scanning cycle for android O and higher This needs to be public, to be called from JobScheduler and JobService
-
stopAndroidOBackgroundScan
@RequiresApi(api = Build.VERSION_CODES.O) void stopAndroidOBackgroundScan()
Stops the le scanning cycle for android O and lower This needs to be public, to be called from JobScheduler and JobService
-
onGpsLocationReceived
void onGpsLocationReceived(@NonNull() Location location)
Invoked when a Location object is obtained from OS
- Parameters:
location
- Location instance received from FusedLocationProviderClient
-
processBackgroundLeScan
void processBackgroundLeScan(BluetoothDevice device, int rssi, Array<byte> scanRecord)
To process the scan results that are retrieved by job service when on background
-
onBluetoothStateChanged
void onBluetoothStateChanged(int bluetoothState)
Notifies when bluetooth state is changed
- Parameters:
bluetoothState
- state extracted from ACTION_STATE_CHANGED action EXTRA_STATE
-
onBluetoothCorrupted
void onBluetoothCorrupted()
Notifies the listeners when the system bluetooth app has entered a bad state, where no new GattClients can be registered, hence no bluetooth scanning can be made.
Currently there is no comprehensive solution for this, so we notify the third party to act as they please. This error loop is resolved only by deleting the storage of the bluetooth system app from Settings->Apps->System Apps->Bluetooth->Storage->Clear Storage
-
onBluetoothRestored
void onBluetoothRestored()
This is for the case where bluetooth of the device was corrupted but then bluetooth medic was able to resolve the issue by doing a power cycle.
This means that the SDK will be able to scan beacons without any problem
-
feedBeaconData
void feedBeaconData(RawBeaconData rawBeaconData)
-
-
-
-