API – BLE Scan Callback Error
NAOSDK integrates a new callback, onBleError
, to notify the application when the SDK is unable to scan BLE measurements.
Currently, this interface includes the error codes from the Android scanCallback
API.”
This callback is integrated into the NAOSensorsListener interface like this
2 | * Sensor state callbacks |
4 | public interface NAOSensorsListener { /** |
5 | * Receives notification that the client app needs to display calibration message to the user. |
7 | void requiresCompassCalibration(); |
10 | * Receives notification that the Wifi needs to be activated on the device |
15 | * Receives notification that the Bluetooth needs to be activated on the device |
20 | * Receives notification that the Localisation needs to be activated on the device |
22 | void requiresLocationOn(); |
25 | * Receives notification when BLE scan failed |
26 | * @param err : the error code from Android API (ScanCallback.class) |
27 | * SCAN_FAILED_ALREADY_STARTED = 1; |
28 | * SCAN_FAILED_APPLICATION_REGISTRATION_FAILED = 2; |
29 | * SCAN_FAILED_FEATURE_UNSUPPORTED = 4; |
30 | * SCAN_FAILED_INTERNAL_ERROR = 3; |
31 | * SCAN_FAILED_OUT_OF_HARDWARE_RESOURCES = 5; |
32 | * SCAN_FAILED_SCANNING_TOO_FREQUENTLY = 6; |
34 | void onBleError( int err); |
Here is the list of errors codes that can be notified
err . | Android code |
---|
1 | SCAN_FAILED_ALREADY_STARTED |
2 | SCAN_FAILED_APPLICATION_REGISTRATION_FAILED |
3 | SCAN_FAILED_FEATURE_UNSUPPORTED |
4 | SCAN_FAILED_INTERNAL_ERROR |
5 | SCAN_FAILED_OUT_OF_HARDWARE_RESOURCES |
6 | SCAN_FAILED_SCANNING_TOO_FREQUENTLY |
Code implementation example when the scan error does not allow BLE sensor to be restarted
2 | public void onBleError( int err) { |
4 | if (err == ScanCallback.SCAN_FAILED_APPLICATION_REGISTRATION_FAILED) { |
Related Articles
Monitoring API
Overview The monitoring API can be used to receive monitoring information about all tags and gateways of a given site, it uses the MQTT protocol with a monitoring topic per site. Notifications by emails also are sent to Tracking managers of the ...
6. Error Handling
Here are the errors you might encounter when using the API. Every error is be returned with a HTTP Status Code (see below) and a JSON body with a root node errors with more details. Code Name Meaning 400 Bad Request The request cannot be processed ...
Oauth2 authentication
NAO Cloud can act as an Oauth2 resource and authorization server. Overview The benefits of Oauth2 authentication is two-fold: Users log in once on NAO Cloud, and automatically get logged-in to your site Your site gets an access token to authenticate ...
Location API
Overview Location API can be used to receive location information about all tags of a given site. Once subscribed to a topic, your application will receive MQTT messages. Each message contains a topic and a payload. Refer ot the “Connection and ...
Getting maps metadata
Each NAO Cloud site has 1 or more buildings. Each building has 1 or more floors. The metadata of each site, building and floor can be retrieved via the REST API. Buildings To get information of all the buildings of the site, use the following API: ...