-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #125 from openbase/119-implement-low-battery-notif…
…ication-system 119 implement low battery notification system
- Loading branch information
Showing
78 changed files
with
2,514 additions
and
1,610 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
Submodule jul
updated
33 files
Submodule type
updated
2 files
+3 −3 | src/main/proto/openbase/type/domotic/communication/UserMessage.proto | |
+6 −0 | src/main/proto/proto.lock |
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
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
50 changes: 50 additions & 0 deletions
50
...in/java/org/openbase/bco/api/graphql/subscriptions/MessageRegistrySubscriptionObserver.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,50 @@ | ||
package org.openbase.bco.api.graphql.subscriptions | ||
|
||
import com.google.common.collect.ImmutableList | ||
import org.openbase.bco.api.graphql.error.ServerError | ||
import org.openbase.bco.api.graphql.schema.RegistrySchemaModule | ||
import org.openbase.bco.registry.remote.Registries | ||
import org.openbase.jul.pattern.provider.DataProvider | ||
import org.openbase.type.domotic.communication.UserMessageType | ||
import org.openbase.type.domotic.registry.MessageRegistryDataType | ||
|
||
class MessageRegistrySubscriptionObserver() : | ||
Check warning Code scanning / detekt Empty block of code detected. As they serve no purpose they should be removed. Warning
An empty default constructor can be removed.
|
||
AbstractObserverMapper<DataProvider<MessageRegistryDataType.MessageRegistryData>, MessageRegistryDataType.MessageRegistryData, List<UserMessageType.UserMessage>>() { | ||
Check warning Code scanning / detekt Line detected that is longer than the defined maximum line length in the code style. Warning
Line detected that is longer than the defined maximum line length in the code style.
|
||
private val userMessages: MutableList<UserMessageType.UserMessage> | ||
|
||
init { | ||
Registries.getMessageRegistry( | ||
ServerError.BCO_TIMEOUT_SHORT, | ||
ServerError.BCO_TIMEOUT_TIME_UNIT | ||
) | ||
userMessages = ArrayList( | ||
RegistrySchemaModule.getUserMessages() | ||
) | ||
} | ||
|
||
@Throws(Exception::class) | ||
override fun update( | ||
source: DataProvider<MessageRegistryDataType.MessageRegistryData>, | ||
target: MessageRegistryDataType.MessageRegistryData, | ||
) { | ||
val newUserMessages: ImmutableList<UserMessageType.UserMessage> = | ||
RegistrySchemaModule.getUserMessages() | ||
if (newUserMessages == userMessages) { | ||
// nothing has changed | ||
return | ||
} | ||
|
||
// store update | ||
userMessages.clear() | ||
userMessages.addAll(newUserMessages) | ||
super.update(source, target) | ||
} | ||
|
||
@Throws(Exception::class) | ||
override fun mapData( | ||
source: DataProvider<MessageRegistryDataType.MessageRegistryData>, | ||
data: MessageRegistryDataType.MessageRegistryData, | ||
): List<UserMessageType.UserMessage> { | ||
return userMessages | ||
} | ||
} |
Oops, something went wrong.