Define OmnipodDashBleManager interface
This commit is contained in:
parent
5db17e735c
commit
2c9e9e7e74
|
@ -1,7 +1,16 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.status.ConnectionStatus
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base.Command
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.Response
|
||||
|
||||
interface OmnipodDashBleManager {
|
||||
|
||||
// TODO should we keep this method?
|
||||
fun activateNewPod()
|
||||
fun sendCommand(cmd: Command): Response;
|
||||
|
||||
fun getStatus(): ConnectionStatus;
|
||||
|
||||
fun connect()
|
||||
|
||||
fun disconnect()
|
||||
}
|
|
@ -13,6 +13,9 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.command.
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.*
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.io.BleIO
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.scan.PodScanner
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.status.ConnectionStatus
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base.Command
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.Response
|
||||
import java.util.concurrent.BlockingQueue
|
||||
import java.util.concurrent.LinkedBlockingDeque
|
||||
import java.util.concurrent.TimeoutException
|
||||
|
@ -26,7 +29,7 @@ class OmnipodDashBleManagerImpl @Inject constructor(private val context: Context
|
|||
private val bluetoothAdapter: BluetoothAdapter = bluetoothManager.adapter
|
||||
|
||||
@Throws(InterruptedException::class, ScanFailException::class, FailedToConnectException::class, CouldNotSendBleException::class, BleIOBusyException::class, TimeoutException::class, CouldNotConfirmWriteException::class, CouldNotEnableNotifications::class, DescriptorNotFoundException::class, CouldNotConfirmDescriptorWriteException::class)
|
||||
override fun activateNewPod() {
|
||||
fun activateNewPod() {
|
||||
aapsLogger.info(LTag.PUMPBTCOMM, "starting new pod activation")
|
||||
val podScanner = PodScanner(aapsLogger, bluetoothAdapter)
|
||||
val podAddress = podScanner.scanForPod(PodScanner.SCAN_FOR_SERVICE_UUID, PodScanner.POD_ID_NOT_ACTIVATED).scanResult.device.address
|
||||
|
@ -64,8 +67,23 @@ class OmnipodDashBleManagerImpl @Inject constructor(private val context: Context
|
|||
bleIO.readyToRead()
|
||||
}
|
||||
|
||||
companion object {
|
||||
override fun sendCommand(cmd: Command): Response {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
override fun getStatus(): ConnectionStatus {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
override fun connect() {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
override fun disconnect() {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val CONNECT_TIMEOUT_MS = 5000
|
||||
private const val CONTROLLER_ID = 4242 // TODO read from preferences or somewhere else.
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.status
|
||||
|
||||
interface ConnectionStatus {
|
||||
}
|
Loading…
Reference in a new issue