mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-15 04:19:26 -07:00
Refactor some names in continuity lib
This commit is contained in:
@@ -3,12 +3,12 @@
|
||||
|
||||
// Hacked together by @Willy-JL
|
||||
// Structures docs and Nearby Action IDs from https://github.com/furiousMAC/continuity/
|
||||
// Proximity Pairing IDs from https://github.com/ECTO-1A/AppleJuice/
|
||||
// Proximity Pair IDs from https://github.com/ECTO-1A/AppleJuice/
|
||||
// Custom adv logic and Airtag ID from https://techryptic.github.io/2023/09/01/Annoying-Apple-Fans/
|
||||
|
||||
static const char* continuity_type_names[ContinuityTypeCount] = {
|
||||
[ContinuityTypeNearbyAction] = "Nearby Action",
|
||||
[ContinuityTypeProximityPairing] = "Proximity Pairing",
|
||||
[ContinuityTypeProximityPair] = "Proximity Pair",
|
||||
};
|
||||
const char* continuity_get_type_name(ContinuityType type) {
|
||||
return continuity_type_names[type];
|
||||
@@ -16,13 +16,13 @@ const char* continuity_get_type_name(ContinuityType type) {
|
||||
|
||||
static size_t continuity_packet_sizes[ContinuityTypeCount] = {
|
||||
[ContinuityTypeNearbyAction] = 23,
|
||||
[ContinuityTypeProximityPairing] = 31,
|
||||
[ContinuityTypeProximityPair] = 31,
|
||||
};
|
||||
size_t continuity_get_packet_size(ContinuityType type) {
|
||||
return continuity_packet_sizes[type];
|
||||
}
|
||||
|
||||
void continuity_generate_packet(const ContinuityMessage* msg, uint8_t* packet) {
|
||||
void continuity_generate_packet(const ContinuityMsg* msg, uint8_t* packet) {
|
||||
size_t i = 0;
|
||||
packet[i++] = continuity_get_packet_size(msg->type) - 1;
|
||||
packet[i++] = 0xff;
|
||||
@@ -39,7 +39,7 @@ void continuity_generate_packet(const ContinuityMessage* msg, uint8_t* packet) {
|
||||
packet[i++] = 0x0f; // Type (Nearby Action)
|
||||
packet[i++] = 0x05; // Length
|
||||
packet[i++] = 0xc1; // Action Flags
|
||||
packet[i++] = msg->data.nearby_action.action_type;
|
||||
packet[i++] = msg->data.nearby_action.type;
|
||||
packet[i++] = (rand() % 256); // Authentication Tag
|
||||
packet[i++] = (rand() % 256); // ...
|
||||
packet[i++] = (rand() % 256); // ...
|
||||
@@ -50,12 +50,12 @@ void continuity_generate_packet(const ContinuityMessage* msg, uint8_t* packet) {
|
||||
packet[i++] = (rand() % 256); // ...
|
||||
packet[i++] = (rand() % 256); // ...
|
||||
break;
|
||||
case ContinuityTypeProximityPairing:
|
||||
packet[i++] = 0x07; // Type (Proximity Pairing)
|
||||
case ContinuityTypeProximityPair:
|
||||
packet[i++] = 0x07; // Type (Proximity Pair)
|
||||
packet[i++] = 0x19; // Length
|
||||
packet[i++] = 0x01;
|
||||
packet[i++] = msg->data.proximity_pairing.device_model >> 8;
|
||||
packet[i++] = msg->data.proximity_pairing.device_model & 0xFF;
|
||||
packet[i++] = msg->data.proximity_pair.model >> 8;
|
||||
packet[i++] = msg->data.proximity_pair.model & 0xFF;
|
||||
packet[i++] = 0x55; // Status
|
||||
packet[i++] = ((rand() % 10) << 4) + (rand() % 10); // Buds Battery Level
|
||||
packet[i++] = ((rand() % 8) << 4) + (rand() % 10); // Charing Status and Battery Case Level
|
||||
|
||||
Reference in New Issue
Block a user