-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Messaging] Message buffers not created by WPEProcess will no longer …
…be missed by Thunder (#1474) * Adding test which first establishes a messaging client and then a server to test validation of message buffers * Adding Validate to MessageDispatcher and calling it in MessageClient::PopMessagesAndCall to avoid an issue when client is created before the server * Formatting changes * Updating the cyclicbuffer test by renaming Validate to Open
- Loading branch information
1 parent
9097e77
commit 38b37d7
Showing
11 changed files
with
246 additions
and
19 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
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
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
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,34 @@ | ||
# If not stated otherwise in this file or this component's license file the | ||
# following copyright and licenses apply: | ||
# | ||
# Copyright 2020 Metrological | ||
# | ||
# 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. | ||
|
||
add_executable(MessageBufferTest | ||
Module.cpp | ||
main.cpp) | ||
|
||
target_link_libraries(MessageBufferTest | ||
PRIVATE | ||
${NAMESPACE}Core::${NAMESPACE}Core | ||
${NAMESPACE}COM::${NAMESPACE}COM | ||
${NAMESPACE}Messaging::${NAMESPACE}Messaging | ||
) | ||
|
||
set_target_properties(MessageBufferTest PROPERTIES | ||
CXX_STANDARD 11 | ||
CXX_STANDARD_REQUIRED YES | ||
) | ||
|
||
install(TARGETS MessageBufferTest DESTINATION bin) |
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,22 @@ | ||
/* | ||
* If not stated otherwise in this file or this component's LICENSE file the | ||
* following copyright and licenses apply: | ||
* | ||
* Copyright 2021 Metrological | ||
* | ||
* 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. | ||
*/ | ||
|
||
#include "Module.h" | ||
|
||
MODULE_NAME_DECLARATION(BUILD_REFERENCE) |
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,31 @@ | ||
/* | ||
* If not stated otherwise in this file or this component's LICENSE file the | ||
* following copyright and licenses apply: | ||
* | ||
* Copyright 2021 Metrological | ||
* | ||
* 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. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#ifndef MODULE_NAME | ||
#define MODULE_NAME MessageBufferTest | ||
#endif | ||
|
||
#include <core/core.h> | ||
#include <com/com.h> | ||
#include <messaging/messaging.h> | ||
|
||
#undef EXTERNAL | ||
#define EXTERNAL |
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,120 @@ | ||
#include "Module.h" | ||
|
||
namespace WPEFramework { | ||
namespace Test { | ||
|
||
static Core::NodeId GetConnectionNode() | ||
{ | ||
string nodeName; | ||
Core::SystemInfo::GetEnvironment(string(_T("COMMUNICATOR_CONNECTOR")), nodeName); | ||
return (Core::NodeId(nodeName.c_str())); | ||
} | ||
|
||
static class PluginHost { | ||
private: | ||
PluginHost(const PluginHost&) = delete; | ||
PluginHost& operator=(const PluginHost&) = delete; | ||
|
||
public: | ||
PluginHost() | ||
: _engine(WPEFramework::Core::ProxyType<WPEFramework::RPC::InvokeServerType<2, 0, 4>>::Create()) | ||
, _comClient(Core::ProxyType<RPC::CommunicatorClient>::Create(GetConnectionNode(), Core::ProxyType<Core::IIPCServer>(_engine))) | ||
{ | ||
} | ||
~PluginHost() | ||
{ | ||
Deinitialize(); | ||
} | ||
|
||
public: | ||
void Initialize() | ||
{ | ||
uint32_t result = _comClient->Open(RPC::CommunicationTimeOut); | ||
|
||
if (result != Core::ERROR_NONE) { | ||
TRACE(Trace::Error, (_T("Could not open connection to node %s. Error: %s"), _comClient->Source().RemoteId(), Core::NumberType<uint32_t>(result).Text())); | ||
} else { | ||
Messaging::MessageUnit::Instance().Open(_comClient->ConnectionId()); | ||
} | ||
} | ||
|
||
void Deinitialize() | ||
{ | ||
if (_comClient.IsValid() == true) { | ||
_comClient.Release(); | ||
} | ||
if (_engine.IsValid() == true) { | ||
_engine.Release(); | ||
} | ||
Core::Singleton::Dispose(); | ||
} | ||
|
||
void Trace() | ||
{ | ||
TRACE(Trace::Information, (_T("test trace"))); | ||
} | ||
|
||
void Syslog() | ||
{ | ||
SYSLOG(Logging::Notification,(_T("test syslog"))); | ||
} | ||
|
||
private: | ||
Core::ProxyType<RPC::InvokeServerType<2, 0, 4> > _engine; | ||
Core::ProxyType<RPC::CommunicatorClient> _comClient; | ||
} _wpeFrameworkClient; | ||
|
||
} | ||
} | ||
|
||
void help() { | ||
printf ("I -> Initialize the connection\n"); | ||
printf ("D -> Deinitialize the connection\n"); | ||
printf ("T -> Trace\n"); | ||
printf ("S -> Syslog\n"); | ||
printf ("Q -> Quit\n>"); | ||
} | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
{ | ||
int element; | ||
|
||
help(); | ||
do { | ||
element = toupper(getchar()); | ||
|
||
switch (element) { | ||
case 'I': { | ||
WPEFramework::Test::_wpeFrameworkClient.Initialize(); | ||
fprintf(stdout, "PluginHost initialized..\n"); | ||
fflush(stdout); | ||
break; | ||
} | ||
case 'D': { | ||
WPEFramework::Test::_wpeFrameworkClient.Deinitialize(); | ||
fprintf(stdout, "PluginHost deinitialized..\n"); | ||
fflush(stdout); | ||
break; | ||
} | ||
case 'T': { | ||
WPEFramework::Test::_wpeFrameworkClient.Trace(); | ||
fprintf(stdout, "Trace sent..\n"); | ||
fflush(stdout); | ||
break; | ||
} | ||
case 'S': { | ||
WPEFramework::Test::_wpeFrameworkClient.Syslog(); | ||
fprintf(stdout, "Syslog sent..\n"); | ||
fflush(stdout); | ||
break; | ||
} | ||
case 'Q': break; | ||
default: { | ||
} | ||
} | ||
} while (element != 'Q'); | ||
} | ||
|
||
return (0); | ||
} |
Oops, something went wrong.