diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.kt b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.kt index 62bbf228e9..4e780cd261 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.kt @@ -64,7 +64,8 @@ class CommandQueue @Inject constructor( private val buildHelper: BuildHelper, private val dateUtil: DateUtil, private val repository: AppRepository, - private val fabricPrivacy: FabricPrivacy + private val fabricPrivacy: FabricPrivacy, + private val config: Config ) : CommandQueueProvider { private val disposable = CompositeDisposable() @@ -79,6 +80,10 @@ class CommandQueue @Inject constructor( .toObservable(EventProfileSwitchChanged::class.java) .observeOn(aapsSchedulers.io) .subscribe({ + if (config.NSCLIENT) { // Effective profileswitch should be synced over NS + rxBus.send(EventNewBasalProfile()) + return@subscribe + } aapsLogger.debug(LTag.PROFILE, "onProfileSwitch") profileFunction.getRequestedProfile()?.let { val nonCustomized = ProfileSealed.PS(it).convertToNonCustomizedProfile(dateUtil) @@ -173,7 +178,7 @@ class CommandQueue @Inject constructor( // After new command added to the queue // start thread again if not already running @Synchronized - open fun notifyAboutNewCommand() { + fun notifyAboutNewCommand() { waitForFinishedThread() if (thread == null || thread!!.state == Thread.State.TERMINATED) { thread = QueueThread(this, context, aapsLogger, rxBus, activePlugin, resourceHelper, sp) @@ -195,7 +200,9 @@ class CommandQueue @Inject constructor( override fun independentConnect(reason: String, callback: Callback?) { aapsLogger.debug(LTag.PUMPQUEUE, "Starting new queue") - val tempCommandQueue = CommandQueue(injector, aapsLogger, rxBus, aapsSchedulers, resourceHelper, constraintChecker, profileFunction, activePlugin, context, sp, buildHelper, dateUtil, repository, fabricPrivacy) + val tempCommandQueue = CommandQueue(injector, aapsLogger, rxBus, aapsSchedulers, resourceHelper, + constraintChecker, profileFunction, activePlugin, context, sp, + buildHelper, dateUtil, repository, fabricPrivacy, config) tempCommandQueue.readStatus(reason, callback) tempCommandQueue.disposable.clear() }