-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement device list user interface
- Loading branch information
1 parent
3db0142
commit 7cd3ba8
Showing
18 changed files
with
411 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
app/src/main/java/dev/niro/cameraremote/bluetooth/DeviceWrapper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package dev.niro.cameraremote.bluetooth | ||
|
||
import dev.niro.cameraremote.bluetooth.enums.BondState | ||
import dev.niro.cameraremote.bluetooth.enums.ConnectionState | ||
|
||
data class DeviceWrapper(val address: String, val name: String, val state: ConnectionState, val bond: BondState) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
app/src/main/java/dev/niro/cameraremote/bluetooth/enums/BondState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package dev.niro.cameraremote.bluetooth.enums | ||
|
||
import android.bluetooth.BluetoothDevice | ||
|
||
enum class BondState { | ||
|
||
BONDED, | ||
BONDING, | ||
UNBOUND, | ||
ERROR; | ||
|
||
companion object { | ||
fun fromBluetoothDevice(state: Int) = when(state) { | ||
BluetoothDevice.BOND_BONDED -> BONDED | ||
BluetoothDevice.BOND_BONDING -> BONDING | ||
BluetoothDevice.BOND_NONE -> UNBOUND | ||
else -> ERROR | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.