import asyncio
from bleak import BleakScanner, BleakClient

async def get_device_uuids(device_address):
    async with BleakClient(device_address) as client:
        if client.is_connected:
            print(f"Connected to {device_address}")
            
            # Discover services and their characteristics
            for service in client.services:
                print(f"Service UUID: {service.uuid}")
                for char in service.characteristics:
                    print(f"  Characteristic UUID: {char.uuid}")
                    print(f"  Characteristic Description: {char.description}")
                    print(f"  Characteristic Properties: {char.properties}")

async def main():
    # Option 1: Scan for devices to find the address (e.g., on Windows/Linux, you'll see MAC addresses)
    print("Scanning for Bluetooth LE devices...")
    devices = await BleakScanner.discover()
    for device in devices:
        print(f"Found device: {device.name} - {device.address}")
        # If you know the name of your device, you can filter here
        # if device.name == "MyDeviceName":
        #     target_address = device.address
        #     break
    
    # Replace with the actual address of your device
    target_address = "DC:0D:30:16:B2:2F" # Replace with your device's MAC address or UUID (for macOS)

    if target_address:
        await get_device_uuids(target_address)
    else:
        print("Target device not found or address not specified.")

if __name__ == "__main__":
    asyncio.run(main())