mirror of
https://github.com/eclipse-openvehicle-api/openvehicle-api.git
synced 2026-08-30 04:15:10 +00:00
connection between 2 systems and bug fixes (#14)
This commit is contained in:
@@ -25,8 +25,6 @@ add_library(ipc_com SHARED
|
||||
"com_channel.cpp"
|
||||
"marshall_object.h"
|
||||
"marshall_object.cpp"
|
||||
|
||||
#"scheduler.cpp"
|
||||
)
|
||||
if(UNIX)
|
||||
target_link_libraries(ipc_com rt ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT})
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <support/serdes.h>
|
||||
#include <support/local_service_access.h>
|
||||
#include <interfaces/serdes/core_ps_serdes.h>
|
||||
#include "../../global/scheduler/scheduler.cpp"
|
||||
#include "../../global/scheduler/scheduler.h"
|
||||
|
||||
CChannelConnector::CChannelConnector(CCommunicationControl& rcontrol, uint32_t uiIndex, sdv::IInterfaceAccess* pChannelEndpoint) :
|
||||
m_rcontrol(rcontrol), m_ptrChannelEndpoint(pChannelEndpoint),
|
||||
|
||||
@@ -95,8 +95,8 @@ public:
|
||||
* @brief Sends data consisting of multiple data chunks via the IPC connection.
|
||||
* @param[in] tProxyID Marshall ID of the proxy (source).
|
||||
* @param[in] tStubID Marshall ID of the stub (target).
|
||||
* @param[in] rseqInputData Sequence of data buffers to be sent. May be altered during processing to add/change the sequence content
|
||||
* without having to copy the data.
|
||||
* @param[in] rseqInputData Sequence of data buffers to be sent. May be altered during processing to add/change the sequence
|
||||
* content without having to copy the data.
|
||||
* @return Returns the results of the call or throws a marshall exception.
|
||||
*/
|
||||
sdv::sequence<sdv::pointer<uint8_t>> MakeCall(sdv::ps::TMarshallID tProxyID, sdv::ps::TMarshallID tStubID,
|
||||
@@ -155,7 +155,9 @@ private:
|
||||
sdv::ipc::IDataSend* m_pDataSend = nullptr; ///< Pointer to the send interface.
|
||||
std::mutex m_mtxCalls; ///< Call map protection.
|
||||
std::map<uint64_t, SCallEntry&> m_mapCalls; ///< call map.
|
||||
CTaskScheduler m_scheduler; ///< Scheduler to process incoming calls.
|
||||
CTaskScheduler<sdv::core::secure_thread> m_scheduler; ///< Scheduler to process incoming calls.
|
||||
sdv::core::IPermissionControl* m_pPermissionControl = nullptr; ///< Pointer to the permission control interface of the
|
||||
///< target system.
|
||||
};
|
||||
|
||||
#endif // !defined COM_CHANNEL_H
|
||||
@@ -16,6 +16,8 @@
|
||||
#include <support/toml.h>
|
||||
#include "com_channel.h"
|
||||
#include "marshall_object.h"
|
||||
#include <support/app_control.h>
|
||||
#include <support/any.h>
|
||||
|
||||
thread_local CChannelConnector* CCommunicationControl::m_pConnectorContext = nullptr;
|
||||
|
||||
@@ -40,7 +42,7 @@ void CCommunicationControl::OnShutdown()
|
||||
std::unique_lock<std::mutex> lock(m_mtxChannels);
|
||||
auto vecInitialConnectMon = std::move(m_vecInitialConnectMon);
|
||||
lock.unlock();
|
||||
for (std::thread& rthread : vecInitialConnectMon)
|
||||
for (sdv::core::secure_thread& rthread : vecInitialConnectMon)
|
||||
{
|
||||
if (rthread.joinable())
|
||||
rthread.join();
|
||||
@@ -63,10 +65,11 @@ sdv::com::TConnectionID CCommunicationControl::CreateServerConnection(/*in*/ sdv
|
||||
switch (eChannelType)
|
||||
{
|
||||
case sdv::com::EChannelType::local_channel:
|
||||
ssChannelServer = "LocalChannelControl";
|
||||
ssChannelServer = static_cast<std::string>(sdv::app::GetAppSettingsAttribute("Communication.DefaultProvider"));
|
||||
break;
|
||||
case sdv::com::EChannelType::remote_channel:
|
||||
ssChannelServer = "RemoteChannelControl";
|
||||
// Currently not supported
|
||||
ssChannelServer = "UnknownComProvider";
|
||||
break;
|
||||
default:
|
||||
return {};
|
||||
|
||||
@@ -196,7 +196,7 @@ public:
|
||||
private:
|
||||
std::mutex m_mtxChannels; ///< Protect the channel map.
|
||||
std::vector<std::shared_ptr<CChannelConnector>> m_vecChannels; ///< Channel vector.
|
||||
std::vector<std::thread> m_vecInitialConnectMon; ///< Initial connection monitor.
|
||||
std::vector<sdv::core::secure_thread> m_vecInitialConnectMon; ///< Initial connection monitor.
|
||||
std::recursive_mutex m_mtxObjects; ///< Protect object vectors.
|
||||
std::vector<std::weak_ptr<CMarshallObject>> m_vecMarshallObjects; ///< Vector with marshall objects; lifetime is handled by channel.
|
||||
std::map<sdv::interface_t, std::shared_ptr<CMarshallObject>> m_mapStubObjects; ///< Map of interfaces to stub objects
|
||||
|
||||
Reference in New Issue
Block a user