Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CyanLight
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fxk8y
CyanLight
Commits
068f773b
Commit
068f773b
authored
2 years ago
by
fxk8y
Browse files
Options
Downloads
Patches
Plain Diff
ST: Couting started services
parent
e2852f43
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CLC-qthing/SiliconTorch/Service/ServiceManager.cpp
+16
-8
16 additions, 8 deletions
CLC-qthing/SiliconTorch/Service/ServiceManager.cpp
CLC-qthing/SiliconTorch/Service/ServiceManager.hpp
+4
-4
4 additions, 4 deletions
CLC-qthing/SiliconTorch/Service/ServiceManager.hpp
with
20 additions
and
12 deletions
CLC-qthing/SiliconTorch/Service/ServiceManager.cpp
+
16
−
8
View file @
068f773b
...
...
@@ -37,13 +37,14 @@ namespace SiliconTorch {
registrationLocked
=
true
;
// TODO: start services!
printServiceTable
();
ESP_LOGI
(
TAG
,
"Starting services…"
);
u32
started
=
startEnabledServices
();
ESP_LOGI
(
TAG
,
"Starting services#[ %d ] done."
,
started
);
}
std
::
vector
<
Service
*>
ServiceManager
::
getServicesInStartOrder
()
{
std
::
vector
<
Service
*>
ServiceManager
::
getServicesInStartOrder
()
const
{
std
::
vector
<
Service
*>
services
;
for
(
const
auto
&
[
_
,
service
]
:
serviceMap
)
...
...
@@ -56,15 +57,22 @@ namespace SiliconTorch {
return
services
;
}
void
ServiceManager
::
startEnabledServices
()
{
u32
ServiceManager
::
startEnabledServices
()
{
std
::
vector
<
Service
*>
services
=
getServicesInStartOrder
();
u32
started
=
0
;
for
(
const
auto
&
service
:
services
)
if
(
service
->
isEnabled
())
service
->
start
();
for
(
const
auto
&
service
:
services
)
{
if
(
service
->
isEnabled
())
{
service
->
start
();
started
++
;
}
}
return
started
;
}
void
ServiceManager
::
printServiceTable
()
{
void
ServiceManager
::
printServiceTable
()
const
{
// burn a few cycles because Espressivs logging is mehr :/
// while (xTaskGetTickCount() * portTICK_PERIOD_MS < 1000) {
...
...
@@ -148,7 +156,7 @@ namespace SiliconTorch {
}
}
bool
ServiceManager
::
getServiceEnabled
(
const
str
&
name
)
{
bool
ServiceManager
::
getServiceEnabled
(
const
str
&
name
)
const
{
if
(
serviceMap
.
count
(
name
)
>
0
)
{
return
serviceMap
.
at
(
name
)
->
isEnabled
();
}
else
{
...
...
This diff is collapsed.
Click to expand it.
CLC-qthing/SiliconTorch/Service/ServiceManager.hpp
+
4
−
4
View file @
068f773b
...
...
@@ -33,15 +33,15 @@ namespace SiliconTorch {
ServiceManager
();
void
startEnabledServices
();
u32
startEnabledServices
();
void
printServiceTable
();
void
printServiceTable
()
const
;
void
setServiceEnabled
(
const
str
&
name
,
bool
enabled
);
bool
getServiceEnabled
(
const
str
&
name
);
bool
getServiceEnabled
(
const
str
&
name
)
const
;
std
::
vector
<
Service
*>
getServicesInStartOrder
();
std
::
vector
<
Service
*>
getServicesInStartOrder
()
const
;
void
registerService
(
Service
*
s
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment