-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into feature/config_cleanup
- Loading branch information
Showing
13 changed files
with
602 additions
and
252 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
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
104 changes: 104 additions & 0 deletions
104
ecal/core/src/registration/ecal_process_registration.cpp
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,104 @@ | ||
/* ========================= eCAL LICENSE ================================= | ||
* | ||
* Copyright (C) 2016 - 2024 Continental Corporation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* ========================= eCAL LICENSE ================================= | ||
*/ | ||
|
||
/** | ||
* @brief Functions to generate Process Registration / Unregistration samples. | ||
* | ||
**/ | ||
|
||
#include "ecal_process_registration.h" | ||
|
||
#include <ecal/ecal_init.h> | ||
#include <ecal/ecal_process.h> | ||
#include "ecal_global_accessors.h" | ||
#include "ecal_globals.h" | ||
#include "time/ecal_timegate.h" | ||
|
||
eCAL::Registration::Sample eCAL::Registration::GetProcessRegisterSample() | ||
{ | ||
Registration::Sample process_sample; | ||
process_sample.cmd_type = bct_reg_process; | ||
auto& process_sample_process = process_sample.process; | ||
process_sample_process.hname = eCAL::Process::GetHostName(); | ||
process_sample_process.hgname = eCAL::Process::GetHostGroupName(); | ||
process_sample_process.pid = eCAL::Process::GetProcessID(); | ||
process_sample_process.pname = eCAL::Process::GetProcessName(); | ||
process_sample_process.uname = eCAL::Process::GetUnitName(); | ||
process_sample_process.pparam = eCAL::Process::GetProcessParameter(); | ||
process_sample_process.state.severity = static_cast<Registration::eProcessSeverity>(g_process_severity); | ||
process_sample_process.state.severity_level = static_cast<Registration::eProcessSeverityLevel>(g_process_severity_level); | ||
process_sample_process.state.info = g_process_info; | ||
#if ECAL_CORE_TIMEPLUGIN | ||
if (g_timegate() == nullptr) | ||
{ | ||
process_sample_process.tsync_state = Registration::eTSyncState::tsync_none; | ||
} | ||
else | ||
{ | ||
if (!g_timegate()->IsSynchronized()) | ||
{ | ||
process_sample_process.tsync_state = Registration::eTSyncState::tsync_none; | ||
} | ||
else | ||
{ | ||
switch (g_timegate()->GetSyncMode()) | ||
{ | ||
case CTimeGate::eTimeSyncMode::realtime: | ||
process_sample_process.tsync_state = Registration::eTSyncState::tsync_realtime; | ||
break; | ||
case CTimeGate::eTimeSyncMode::replay: | ||
process_sample_process.tsync_state = Registration::eTSyncState::tsync_replay; | ||
break; | ||
default: | ||
process_sample_process.tsync_state = Registration::eTSyncState::tsync_none; | ||
break; | ||
} | ||
} | ||
process_sample_process.tsync_mod_name = g_timegate()->GetName(); | ||
} | ||
#endif | ||
|
||
// eCAL initialization state | ||
const unsigned int comp_state(g_globals()->GetComponents()); | ||
process_sample_process.component_init_state = static_cast<int32_t>(comp_state); | ||
std::string component_info; | ||
if ((comp_state & eCAL::Init::Publisher) != 0u) component_info += "|pub"; | ||
if ((comp_state & eCAL::Init::Subscriber) != 0u) component_info += "|sub"; | ||
if ((comp_state & eCAL::Init::Logging) != 0u) component_info += "|log"; | ||
if ((comp_state & eCAL::Init::TimeSync) != 0u) component_info += "|time"; | ||
if (!component_info.empty()) component_info = component_info.substr(1); | ||
process_sample_process.component_init_info = component_info; | ||
|
||
process_sample_process.ecal_runtime_version = eCAL::GetVersionString(); | ||
|
||
return process_sample; | ||
} | ||
|
||
eCAL::Registration::Sample eCAL::Registration::GetProcessUnregisterSample() | ||
{ | ||
Registration::Sample process_sample; | ||
process_sample.cmd_type = bct_unreg_process; | ||
auto& process_sample_process = process_sample.process; | ||
process_sample_process.hname = eCAL::Process::GetHostName(); | ||
process_sample_process.pid = eCAL::Process::GetProcessID(); | ||
process_sample_process.pname = eCAL::Process::GetProcessName(); | ||
process_sample_process.uname = eCAL::Process::GetUnitName(); | ||
|
||
return process_sample; | ||
} |
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,37 @@ | ||
/* ========================= eCAL LICENSE ================================= | ||
* | ||
* Copyright (C) 2016 - 2024 Continental Corporation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* ========================= eCAL LICENSE ================================= | ||
*/ | ||
|
||
/** | ||
* @brief Functions to generate Process Registration / Unregistration samples. | ||
* | ||
**/ | ||
|
||
#pragma once | ||
|
||
#include "serialization/ecal_struct_sample_registration.h" | ||
|
||
namespace eCAL | ||
{ | ||
namespace Registration | ||
{ | ||
Sample GetProcessRegisterSample(); | ||
|
||
Sample GetProcessUnregisterSample(); | ||
} | ||
} |
Oops, something went wrong.