Skip to content

Commit

Permalink
Reverted AirTag Code
Browse files Browse the repository at this point in the history
  • Loading branch information
RogueMaster committed Jan 16, 2023
1 parent 3d65f8b commit 7983c56
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 28 deletions.
1 change: 1 addition & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ This software is for experimental purposes only and is not meant for any illegal
- Added: [NFC: add MIFARE MINI support #2307 (By giacomoferretti)](https://github.com/flipperdevices/flipperzero-firmware/pull/2307)
- Added: [NFC Magic: Add support for Gen4 "ultimate card" in Magic app #2238 (By nullableVoidPtr)](https://github.com/flipperdevices/flipperzero-firmware/pull/2238)
- Updated: [Calculator "2" (By theCow61)](https://github.com/theCow61/calculator)
- Reverted: Bluetooth: Works as an AirTag [(Thanks to culturally)](https://github.com/culturally/flipper-zero-airtag)

<a name="release">

Expand Down
36 changes: 8 additions & 28 deletions firmware/targets/f7/ble_glue/gap.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,6 @@ static void gap_init_svc(Gap* gap) {
}

static void gap_advertise_start(GapState new_state) {
FURI_LOG_E(TAG, "gap_advertise_start");

tBleStatus status;
uint16_t min_interval;
uint16_t max_interval;
Expand All @@ -396,40 +394,22 @@ static void gap_advertise_start(GapState new_state) {
FURI_LOG_D(TAG, "set_non_discoverable success");
}
}

static const uint16_t gap_appearance = 0x0000; //GAP_APPEARANCE_UNKNOWN

status = aci_gatt_update_char_value(
gap->service.gap_svc_handle,
gap->service.gap_svc_handle,
0,
sizeof(gap_appearance),
(uint8_t*)&gap_appearance);

// Configure advertising
status = aci_gap_set_discoverable(
ADV_IND,
min_interval,
max_interval,
PUBLIC_ADDR,
0,
0,
NULL, // Do not use a local name
0,
NULL, // Do not include the service UUID list
strlen(gap->service.adv_name),
(uint8_t*)gap->service.adv_name,
gap->service.adv_svc_uuid_len,
gap->service.adv_svc_uuid,
0,
0);

status = aci_gap_delete_ad_type(AD_TYPE_FLAGS); //Remove AD to free advertising buffer
status = aci_gap_delete_ad_type(AD_TYPE_TX_POWER_LEVEL); //Remove AD to free advertising buffer

const uint8_t airtag_adv[] = {//Data to be advertise simulating AirTag package
0x1E, 0xFF, 0x4C, 0x00, 0x12, 0x19, 0x10, 0x12, 0x12, 0x34,
0x56, 0x78, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56,
0x78, 0x90, 0x12, 0x34, 0x56, 0x12, 0x34, 0x56, 0x12, 0x45};

status = aci_gap_update_adv_data(0x1F, airtag_adv); //Update advertising data

if(status) {
FURI_LOG_E(TAG, "set_discoverable failed %d", status);
}
gap->state = new_state;
GapEvent event = {.type = GapEventTypeStartAdvertising};
gap->on_event_cb(event, gap->context);
Expand Down Expand Up @@ -586,4 +566,4 @@ static int32_t gap_app(void* context) {
}

return 0;
}
}

0 comments on commit 7983c56

Please sign in to comment.