2020-07-14 20:54:14 +02:00
|
|
|
// Copyright 2020 Lukas Haubaum
|
|
|
|
//
|
|
|
|
// Licensed under the GNU Affero General Public License, Version 3;
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
|
|
|
|
// https://www.gnu.org/licenses/agpl-3.0.html
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
2020-07-11 12:11:34 +02:00
|
|
|
#ifndef _ena_BLUETOOTH_SCAN_H_
|
|
|
|
#define _ena_BLUETOOTH_SCAN_H_
|
|
|
|
|
2020-07-15 22:22:54 +02:00
|
|
|
#define ENA_SCAN_LOG "ESP-ENA-scan" // TAG for Logging
|
|
|
|
#define ENA_SCANNING_TIME (CONFIG_ENA_SCANNING_TIME) // time how long a scan should run
|
|
|
|
#define ENA_SCANNING_INTERVAL (CONFIG_ENA_SCANNING_INTERVAL) // interval for next scan to happen
|
2020-07-11 12:11:34 +02:00
|
|
|
|
2020-07-14 20:54:14 +02:00
|
|
|
/**
|
|
|
|
* @brief status of BLE scan
|
|
|
|
*/
|
2020-07-11 12:11:34 +02:00
|
|
|
typedef enum
|
|
|
|
{
|
2020-07-14 20:54:14 +02:00
|
|
|
ENA_SCAN_STATUS_SCANNING = 0, // scan is running
|
|
|
|
ENA_SCAN_STATUS_NOT_SCANNING, // scan is not running
|
|
|
|
ENA_SCAN_STATUS_WAITING, // scan is not running but stopped manually
|
2020-07-11 12:11:34 +02:00
|
|
|
} ena_bluetooth_scan_status;
|
|
|
|
|
2020-07-14 20:54:14 +02:00
|
|
|
/**
|
|
|
|
* @brief initialize the BLE scanning
|
|
|
|
*
|
|
|
|
*/
|
2020-07-11 12:11:34 +02:00
|
|
|
void ena_bluetooth_scan_init(void);
|
|
|
|
|
2020-07-14 20:54:14 +02:00
|
|
|
/**
|
|
|
|
* @brief start BLE scanning for a given duration
|
|
|
|
*
|
|
|
|
* Source documents (Section: Scanning Behavior)
|
|
|
|
*
|
|
|
|
* https://blog.google/documents/70/Exposure_Notification_-_Bluetooth_Specification_v1.2.2.pdf
|
|
|
|
*
|
|
|
|
* https://covid19-static.cdn-apple.com/applications/covid19/current/static/detection-tracing/pdf/ExposureNotification-BluetoothSpecificationv1.2.pdf
|
|
|
|
*
|
|
|
|
* @param[in] duration duration of the scan in seconds
|
|
|
|
*/
|
2020-07-11 12:11:34 +02:00
|
|
|
void ena_bluetooth_scan_start(uint32_t duration);
|
|
|
|
|
2020-07-14 20:54:14 +02:00
|
|
|
/**
|
|
|
|
* @brief stop a running BLE scanning
|
|
|
|
*/
|
2020-07-11 12:11:34 +02:00
|
|
|
void ena_bluetooth_scan_stop(void);
|
|
|
|
|
2020-07-14 20:54:14 +02:00
|
|
|
/**
|
|
|
|
* @brief return the current scanning status
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* current scan status
|
|
|
|
*/
|
2020-07-11 12:11:34 +02:00
|
|
|
int ena_bluetooth_scan_get_status(void);
|
|
|
|
|
|
|
|
#endif
|