| 1 | ''' |
| 2 | Module of Android API for plyer.bluetooth. |
| 3 | ''' |
| 4 | |
| 5 | from jnius import autoclass |
| 6 | from plyer.platforms.android import activity |
| 7 | from plyer.facades import Bluetooth |
| 8 | |
| 9 | Global = autoclass('android.provider.Settings$Global') |
| 10 | |
| 11 | |
| 12 | class AndroidBluetooth(Bluetooth): |
| 13 | ''' |
| 14 | Implementation of Android Bluetooth API. |
| 15 | ''' |
| 16 | |
| 17 | def _get_info(self): |
| 18 | bluetooth_enabled = Global.getString( |
| 19 | activity.getContentResolver(), |
| 20 | Global.BLUETOOTH_ON |
| 21 | ) |
| 22 | status = 'off' |
| 23 | if bluetooth_enabled: |
| 24 | status = 'on' |
| 25 | return status |
| 26 | |
| 27 | |
| 28 | def instance(): |
| 29 | ''' |
| 30 | Instance for facade proxy. |
| 31 | ''' |
| 32 | return AndroidBluetooth() |