|
|
@ -101,14 +101,11 @@ class IConsole : ActiveDriver() { |
|
|
|
logger.info("Checking device...") |
|
|
|
|
|
|
|
val service1 = services.firstOrNull { it.uuid == S1_SERVICE } |
|
|
|
val service2 = services.firstOrNull { it.uuid == S2_SERVICE } |
|
|
|
|
|
|
|
if (service1 != null && service2 != null) { |
|
|
|
if (service1 != null) { |
|
|
|
btCommandInput = service1.getCharacteristic(S1_CHAR_COMMAND_INPUT) |
|
|
|
val s1out = service1.getCharacteristic(S1_CHAR_DATA_OUTPUT) |
|
|
|
val s1mys = service1.getCharacteristic(S1_CHAR_MYSTERY_OUTPUT) |
|
|
|
val s2mys = service2.getCharacteristic(S2_CHAR_MYSTERY_OUTPUT) |
|
|
|
if (btCommandInput == null || s1out == null || s1mys == null || s2mys == null) { |
|
|
|
if (btCommandInput == null || s1out == null) { |
|
|
|
logger.warn("Something is off about this i-CONSOLE device") |
|
|
|
output.emitBlocking(ErrorOccurred("(Maybe) a malfunctioning i-CONSOLE device")) |
|
|
|
peripheral.cancelConnection() |
|
|
@ -117,8 +114,6 @@ class IConsole : ActiveDriver() { |
|
|
|
|
|
|
|
peripheral.setNotify(btCommandInput!!, true) |
|
|
|
peripheral.setNotify(s1out, true) |
|
|
|
peripheral.setNotify(s1mys, true) |
|
|
|
peripheral.setNotify(s2mys, true) |
|
|
|
|
|
|
|
logger.info("Device setup successfully; sending first request...") |
|
|
|
|
|
|
@ -354,10 +349,6 @@ class IConsole : ActiveDriver() { |
|
|
|
private val S1_SERVICE = UUID.fromString("49535343-fe7d-4ae5-8fa9-9fafd205e455") |
|
|
|
private val S1_CHAR_COMMAND_INPUT = UUID.fromString("49535343-8841-43f4-a8d4-ecbe34729bb3") |
|
|
|
private val S1_CHAR_DATA_OUTPUT = UUID.fromString("49535343-1e4d-4bd9-ba61-23c647249616") |
|
|
|
private val S1_CHAR_MYSTERY_OUTPUT = UUID.fromString("49535343-4c8a-39b3-2f49-511cff073b7e") |
|
|
|
|
|
|
|
private val S2_SERVICE = UUID.fromString("49535343-5d82-6099-9348-7aac4d5fbc51") |
|
|
|
private val S2_CHAR_MYSTERY_OUTPUT = UUID.fromString("49535343-026e-3a9b-954c-97daef17e26e") |
|
|
|
|
|
|
|
private val pollDuration: Duration = 500.milliseconds |
|
|
|
} |
|
|
|