Skip to content

Commit

Permalink
Add the maintenance state and the order of the states to Coffee Machi…
Browse files Browse the repository at this point in the history
…ne example (#90)
  • Loading branch information
otso authored Sep 5, 2023
1 parent 7e40200 commit 650a7fd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion examples/Qt/coffee/coffee_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ CoffeeMachineManager::CoffeeMachineManager(QObject *parent)
{
emit enableMachine();
}
else if (oldVal == realm::experimental::CoffeeMachine::State::OK && newVal == realm::experimental::CoffeeMachine::State::NEEDS_ATTENTION)
else if (oldVal == realm::experimental::CoffeeMachine::State::MAINTENANCE_MODE && newVal == realm::experimental::CoffeeMachine::State::OK)
{
emit enableMachine();
}
else if (oldVal == realm::experimental::CoffeeMachine::State::OK && (newVal == realm::experimental::CoffeeMachine::State::NEEDS_ATTENTION ||
newVal == realm::experimental::CoffeeMachine::State::MAINTENANCE_MODE))
{
emit disableMachine();
}
Expand Down
3 changes: 2 additions & 1 deletion examples/Qt/coffee/realm_models.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ namespace realm::experimental {

struct CoffeeMachine {
enum class State {
NEEDS_ATTENTION,
OK,
NEEDS_ATTENTION
MAINTENANCE_MODE
};
primary_key<realm::object_id> _id;
std::string location;
Expand Down

0 comments on commit 650a7fd

Please sign in to comment.