Bluetooth Automation
====================

BAM framework wrapper and controller.  Loads the BluetoothAutomation.framework
bridgesupport to make objects available in python, and provides `bam` CLI to
activate and deactivate bluetooth automation daemons.

Install
=======
**note: if using `pip install --user`, you will need to add your `~/Library/Python/2.7/bin` to your shell PATH.**

`pip install bluetoothautomation -i https://pypi.apple.com/simple`

Install Troubleshooting
=======================
If you get SSL errors when trying to install from https://pypi.apple.com/simple, then you might
be missing the internal Apple Corporate Root CA.  Patch the python cacerts.pem to include
our internal Apple Corpororate Root CA.
```
sudo python -m pip install --upgrade certifi -i https://pypi.apple.com/simple
sudo python -m pip install --upgrade recertifi -i https://pypi.apple.com/simple
sudo python -m recertifi_cli --patch
```

If you continue to get SSL errors after adding the internal Apple Corpororate Root CA, then add
`--trusted-host pypi.apple.com` to the pip install command.

One Time Setup
==============
1. Activate BAM. Activation persists between reboots.
    
    `bam activate`
2. Configure the bluetooth host controller switch behavior.
    
    `sudo bam btkiller activate`
3. Restart for bluetooth host controller changes to take effect.
    
    `sudo shutdown -r now`


Disable BAM
===========
1. Deactivate BAM for root and current user. De-activation persists between reboots.

    `sudo bam deactivate`
    `bam deactivate`
2. Reset the bluetooth hsot controller switch behavior.
    
    `sudo bam btkiller deactivate`
3. Restart for bluetooth host controller changes to take effect.

    `sudo shutdown -r now`


Developing
==========
1. always increment the version number in _metadata.py before merging PRs
    - major - breaks backward compat, or SUPER EXCITING
    - minor - feature/enhancement, visible change
    - micro - bugfixes, small "oopsies"
2. `pip install --user --upgrade -e ./` to get a developer install
3. use `make` within the python_libraries dir to publish
    latest to pypi (or do it the hard way) 
    - `make publish` to push to pypi 
