BLE Comm WIP (#1578)

* Initial BLE Comm commit.
* SCAN_RSP MAC was reversed.
* Added Auto Channel Hop.
* Improvements to Tx to better handle timers.
* Auto channel and more work on timers.
* more advertisement numbers.
This commit is contained in:
Netro 2023-11-16 08:46:45 -05:00 committed by GitHub
parent d2e9a8dc06
commit 8479d2edf0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 697 additions and 82 deletions

View file

@ -337,6 +337,17 @@ std::string to_string_formatted_mac_address(const char* macAddress) {
return formattedAddress;
}
void generateRandomMacAddress(char* macAddress) {
const char hexDigits[] = "0123456789ABCDEF";
// Generate 12 random hexadecimal characters
for (int i = 0; i < 12; i++) {
int randomIndex = rand() % 16;
macAddress[i] = hexDigits[randomIndex];
}
macAddress[12] = '\0'; // Null-terminate the string
}
std::string unit_auto_scale(double n, const uint32_t base_unit, uint32_t precision) {
const uint32_t powers_of_ten[5] = {1, 10, 100, 1000, 10000};
std::string string{""};