mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-25 03:29:58 -07:00
Moved Mac Address Gen to API
This commit is contained in:
@@ -18,22 +18,6 @@ function byteToHex(byte) {
|
||||
return hex;
|
||||
}
|
||||
|
||||
function getNextByteValue() {
|
||||
let value = currentByteValue;
|
||||
currentByteValue = (currentByteValue + 1) % 256;
|
||||
return value;
|
||||
}
|
||||
|
||||
function generateRandomMac() {
|
||||
let mac = '';
|
||||
for (let i = 0; i < 6; i++) {
|
||||
if (mac.length) mac += ':';
|
||||
let byte = getNextByteValue();
|
||||
mac += byteToHex(byte);
|
||||
}
|
||||
return mac;
|
||||
}
|
||||
|
||||
function bytesToHexString(bytes) {
|
||||
if (!bytes) {
|
||||
print("Invalid input for bytesToHexString");
|
||||
@@ -66,7 +50,9 @@ function sendRandomModelAdvertisement() {
|
||||
return;
|
||||
}
|
||||
|
||||
bleBeacon.setMac(generateRandomMac());
|
||||
let Mac = bleBeacon.genMac();
|
||||
|
||||
bleBeacon.setMac(Mac);
|
||||
bleBeacon.setData(packetString);
|
||||
bleBeacon.send();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user