Files
c5-project/ESP32-C5-Toolkit/main/bt_scanner.h
2026-05-03 23:19:51 -07:00

70 lines
1.3 KiB
C

#ifndef BT_SCANNER_H
#define BT_SCANNER_H
#include <stdbool.h>
#include <stdint.h>
// Bluetooth device structure
typedef struct {
uint8_t addr[6];
char name[32];
int8_t rssi;
uint8_t adv_type;
uint32_t timestamp;
} bt_device_t;
/**
* @brief Initialize Bluetooth scanner
*
* @return true if initialized successfully
*/
bool bt_scanner_init(void);
/**
* @brief Start Bluetooth scan
*
* @return true if scan started successfully
*/
bool bt_scan_start(void);
/**
* @brief Stop Bluetooth scan
*
* @return true if scan stopped successfully
*/
bool bt_scan_stop(void);
/**
* @brief Get scanned devices
*
* @param devices Output array for devices
* @param max_devices Maximum number of devices to retrieve
* @return Number of devices found
*/
int bt_get_devices(bt_device_t *devices, int max_devices);
/**
* @brief Start Bluetooth jamming (authorized use only)
*
* @param target_addr Target device address (NULL for all)
* @param duration Duration in seconds
* @return true if jamming started
*/
bool bt_jam_start(uint8_t *target_addr, uint32_t duration);
/**
* @brief Stop Bluetooth jamming
*
* @return true if stopped
*/
bool bt_jam_stop(void);
/**
* @brief Check if jamming is active
*
* @return true if jamming
*/
bool bt_jam_is_active(void);
#endif /* BT_SCANNER_H */