All Projects → pzmarzly → Ancs4linux

pzmarzly / Ancs4linux

Licence: mit
iOS/iPadOS notification service client for Linux desktop (notifications on your desktop, over Bluetooth Low Energy)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Ancs4linux

IoT-iBeacon
An Ionic app for indoor localization and navigation using BLE iBeacons.
Stars: ✭ 39 (-17.02%)
Mutual labels:  ble, bluetooth-low-energy
Esp32 ble wedo
A library to control LEGO wedo 2.0 with the ESP32 through Bluetooth low energy
Stars: ✭ 16 (-65.96%)
Mutual labels:  ble, bluetooth-low-energy
JDY-08
JDY-08 Bluetooth transparent transmission module, with resource for KiCAD
Stars: ✭ 48 (+2.13%)
Mutual labels:  ble, bluetooth-low-energy
ruuvitag-demo
Demo of reading Bluetooth Low Energy sensor measurements of RuuviTag environmental sensors and feeding them to MQTT, a database and dashboards
Stars: ✭ 14 (-70.21%)
Mutual labels:  ble, bluetooth-low-energy
Btle
Bluetooth Low Energy (BLE) packet sniffer and transmitter for both standard and non standard (raw bit) based on Software Defined Radio (SDR).
Stars: ✭ 411 (+774.47%)
Mutual labels:  ble, bluetooth-low-energy
stm32wb55
Implementation of bluetooth-hci for STM32WB5x wireless SoC
Stars: ✭ 18 (-61.7%)
Mutual labels:  ble, bluetooth-low-energy
Gattlib
Library to access GATT information from BLE (Bluetooth Low Energy) devices
Stars: ✭ 281 (+497.87%)
Mutual labels:  ble, bluetooth-low-energy
Arduino-BLE-MIDI
MIDI over Bluetooth Low Energy (BLE-MIDI) 1.0 for Arduino
Stars: ✭ 133 (+182.98%)
Mutual labels:  ble, bluetooth-low-energy
Flutterblelib
Bluetooth Low Energy library for Flutter with support for simulating peripherals
Stars: ✭ 393 (+736.17%)
Mutual labels:  ble, bluetooth-low-energy
Bleunlock
Lock/unlock your Mac with your iPhone, Apple Watch, or any other Bluetooth LE devices
Stars: ✭ 383 (+714.89%)
Mutual labels:  ble, bluetooth-low-energy
ESP32 BLE OTA Arduino
OTA update on ESP32 via BLE
Stars: ✭ 41 (-12.77%)
Mutual labels:  ble, bluetooth-low-energy
Android Dfu Library
A library with DFU feature for Android 4.3+.
Stars: ✭ 532 (+1031.91%)
Mutual labels:  ble, bluetooth-low-energy
ble-utilities-unreal
This is Unreal Engine plugin that allows to scan for BLE devices with Cycling Power service running, connect to one of them and subscribe for its notifications.
Stars: ✭ 48 (+2.13%)
Mutual labels:  ble, bluetooth-low-energy
IOS-DFU-Library
OTA DFU Library for Mac and iOS, compatible with nRF5x SoCs
Stars: ✭ 400 (+751.06%)
Mutual labels:  ble, bluetooth-low-energy
android-ble-made-easy
An Android Library for handling Bluetooth Low Energy on Android Easy
Stars: ✭ 34 (-27.66%)
Mutual labels:  ble, bluetooth-low-energy
Rxandroidble
An Android Bluetooth Low Energy (BLE) Library with RxJava2 interface
Stars: ✭ 3,025 (+6336.17%)
Mutual labels:  ble, bluetooth-low-energy
goble
Bluetooth Low Energy for Go
Stars: ✭ 43 (-8.51%)
Mutual labels:  ble, bluetooth-low-energy
bluetooth-manager
Java Bluetooth Manager. A library/framework for managing bluetooth adapters, bluetooth devices, GATT services and characteristics
Stars: ✭ 75 (+59.57%)
Mutual labels:  ble, bluetooth-low-energy
Ios Pods Dfu Library
OTA DFU Library for Mac and iOS, compatible with nRF5x SoCs
Stars: ✭ 349 (+642.55%)
Mutual labels:  ble, bluetooth-low-energy
Android Scanner Compat Library
A compat library for Bluetooth Low Energy scanning on Android.
Stars: ✭ 462 (+882.98%)
Mutual labels:  ble, bluetooth-low-energy

iOS/iPadOS notification service client for Linux desktop

This project lets you receive iOS and iPadOS notifications on your Linux desktop/laptop. No jailbreak needed. Work in progress. Feedback needed. Reddit thread.

Photo of running script

It uses Apple Notification Center Service (ANCS) - the same protocol that smartwatches use. I'm also considering implementing Apple Media Service (AMS), which allows controlling media playing on the phone, and redirecting phone audio to PC. Please let me know if it would be useful to anyone. I think redirecting calls to PC should also be possible (by having PC act as headset), but I don't have the need for that much tinkering.

Alternatives:

Installation and usage

  1. Install Python 3.7 and python3-dbus (Ubuntu) / python-dbus (Arch). You probably have that library already installed. I'm not sure whether Python 3.7 is necessary, but I haven't tested the program with earlier versions.
  2. Download main.py and make it executable. You may also want to download/configure handlers directory and its content (but the script will run without it just fine, though).
  3. Pair and connect your phone with your PC (see #Pairing).
  4. Start ./main.py (current working directory matters) and watch for its output to see if there's anything wrong. If nothing comes out, you may need to wait ~30 seconds for a timeout error that will hopefully contain the details you'll need to solve the problem.
  5. Try sending yourself a notification. Shortcuts app is a great way to do it.

Pairing

The most reliable method I found:

  • Unpair your devices ("Forget this device" in iOS Settings).
  • Download and unpack bluez-5.43 source.
  • Start blueman (Bluetooth Manager).
  • If you have multiple Bluetooth cards: edit the for loop in find_adapter in /test/example-advertisement.
  • Use the free nRF Connect app to connect to your PC (it will advertise itself as a heart sensor). It should look like this, click Connect there.
  • blueman will now handle pairing (compare PINs).
  • You are connected now, you can run ./main.py, the phone will display a popup whether to grant notification access to the PC.

The success rate and pairing steps depend on your Bluetooth card. My Intel Wireless-AC 9462 card does not work, so I bought ASUS USB-BT400 card, it works fine. My previous Intel WiFi+BT card worked, but I don't remember the model and I sold that laptop already.

Since it's Bluetooth we are talking about, it works only when the stars are aligned correctly. If it worked yesterday but you can't even see your device today, restart both your PC and your phone. On a positive side, though, you can be connected to many BLE devices at once. I don't have Apple Watch to test it, but at least the AirPods still work when using this script.

It looks like iOS will forget about PC permissions/capabilities after a while (a week?), so the pairing has to be repeated.

I found that I can sometimes initiate the connection from PC side by connecting to iOS random BLE address. I was using hcitool blescan to do that (put the device close to the PC and it will become obvious which device is yours).

Configuration

There are currently 2 options you can tweak:

./main.py -h
usage: main.py [-h] [--hci INT] [--resolution INT]

optional arguments:
  -h, --help        show this help message and exit
  --hci INT         use Bluetooth hciX (default 0, see `hcitool dev')
  --resolution INT  polling rate (default 20 per second)

If you have only 1 Bluetooth card in your laptop/PC, you will probably be fine with default (0) hci index. Resolution is due to polling main loop (it doesn't need to shouldn't be there). On my CPU (Intel i5-6300HQ), setting resolution to 100 causes 2% CPU usage. I found 20 to be nice balance between CPU usage and notification drop rate (I don't get notifications less that 5 ms apart of each other too often, only WhatsApp is a potential "danger").

You can put executable files in handlers directory. Currently there are 2 handlers supported - battery and notification. These files can be absent, and are searched for based on the current working directory. Check out the default handlers - they are simple shell scripts.

You may want to run main.py in an infinite loop, as it will quit on error. For example:

while true; do ./main.py; sleep 5; done

Contributing

The code is a mess and I started a total rewrite. Ruby dbus gem is much more pleasant than Python's lib. But before that, I would like to understand iOS Bluetooth stack more.

Initially I tried using bluepy, but I couldn't get iPhone to pair (setSecurityLevel("medium")).

Useful tools: bluetoothctl (menu gatt), qdbusviewer (part of qt5-tools on Arch).

The pairing process needs to be integrated. We can either do whatever example-advertisement does, or salvage the ble-ancs project.

Sending iMessage messages would be useful too, and it should be possible over "regular" (2.0) Bluetooth via Message Access Profile.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].