2025-05-27 15:37:11 +08:00
|
|
|
#ifndef SCAN_BLUETEETH_H_
|
|
|
|
|
#define SCAN_BLUETEETH_H_
|
|
|
|
|
|
|
|
|
|
typedef signed char int8_t;
|
2025-07-14 20:24:40 +08:00
|
|
|
#include <string>
|
2025-07-23 22:00:44 +08:00
|
|
|
#include <iostream>
|
|
|
|
|
#include <unordered_map>
|
|
|
|
|
#include <chrono>
|
|
|
|
|
#include <thread>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <mutex>
|
|
|
|
|
|
|
|
|
|
using namespace std::chrono;
|
|
|
|
|
struct DeviceInfo {
|
|
|
|
|
double rssi;
|
|
|
|
|
steady_clock::time_point last_seen;
|
|
|
|
|
};
|
2025-05-27 15:37:11 +08:00
|
|
|
class ScanBlueteeth {
|
|
|
|
|
public:
|
|
|
|
|
ScanBlueteeth();
|
|
|
|
|
virtual ~ScanBlueteeth();
|
|
|
|
|
|
|
|
|
|
int InitDevice();
|
|
|
|
|
void StartScan();
|
|
|
|
|
int device_id;
|
|
|
|
|
int sock;
|
|
|
|
|
int retry_count ;
|
|
|
|
|
int max_retries ;
|
2025-07-14 20:24:40 +08:00
|
|
|
std::string current_dev;
|
|
|
|
|
std::string ccurrent_time;
|
2025-05-27 15:37:11 +08:00
|
|
|
|
|
|
|
|
void ParseData(unsigned char *data, int len,int8_t rssi);
|
|
|
|
|
};
|
|
|
|
|
#endif
|