forked from Open-Smartwatch/open-smartwatch-os
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed service iteration & added service toggle
- Loading branch information
1 parent
84b2ca6
commit f94e8ef
Showing
6 changed files
with
31 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
#ifndef OSW_SERVICE_H | ||
#define OSW_SERVICE_H | ||
#include <osw_app.h> | ||
#include <osw_app.h> | ||
|
||
typedef OswApp OswServiceTask; | ||
class OswServiceTask : public OswApp { | ||
public: | ||
OswServiceTask() : OswApp() {} | ||
virtual void setup(OswHal* hal); | ||
bool isRunning(); | ||
virtual void stop(OswHal* hal); | ||
virtual ~OswServiceTask(){}; | ||
|
||
private: | ||
bool taskEnabled = false; | ||
}; | ||
#endif |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include "osw_service.h" | ||
|
||
void OswServiceTask::setup(OswHal* hal) { | ||
this->taskEnabled = true; | ||
} | ||
void OswServiceTask::stop(OswHal* hal) { | ||
this->taskEnabled = false; | ||
} | ||
|
||
bool OswServiceTask::isRunning() { return this->taskEnabled; } |
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 |
---|---|---|
@@ -1,17 +1,16 @@ | ||
#include "./services/OswServiceManager.h" | ||
|
||
#include "./services/OswServiceTasks.h" | ||
|
||
void OswServiceManager::setup(OswHal *hal) { | ||
for (unsigned char i = 0; i < oswServiceTasksCount; i++) | ||
return oswServiceTasks[i]->setup(hal); | ||
for (unsigned char i = 0; i < oswServiceTasksCount; i++) oswServiceTasks[i]->setup(hal); | ||
} | ||
|
||
void OswServiceManager::loop(OswHal *hal) { | ||
for (unsigned char i = 0; i < oswServiceTasksCount; i++) | ||
return oswServiceTasks[i]->loop(hal); | ||
for (unsigned char i = 0; i < oswServiceTasksCount; i++) | ||
if (oswServiceTasks[i]->isRunning()) oswServiceTasks[i]->loop(hal); | ||
} | ||
|
||
void OswServiceManager::stop(OswHal *hal) { | ||
for (unsigned char i = 0; i < oswServiceTasksCount; i++) | ||
return oswServiceTasks[i]->stop(hal); | ||
for (unsigned char i = 0; i < oswServiceTasksCount; i++) oswServiceTasks[i]->stop(hal); | ||
} |
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