Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbourelly999 committed Oct 1, 2024
1 parent 799e4dc commit e16048f
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 9 deletions.
19 changes: 18 additions & 1 deletion examples/tmx-exampleapps/ExamplePlugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
PROJECT ( ExamplePlugin VERSION 3.0.0 LANGUAGES CXX )
PROJECT ( ExamplePlugin VERSION 7.6.0 LANGUAGES CXX )

SET (TMX_PLUGIN_NAME "Example")

BuildTmxPlugin ( )

TARGET_LINK_LIBRARIES (${PROJECT_NAME} tmxutils)
#############
## Testing ##
#############
enable_testing()
add_library(${PROJECT_NAME}_lib src/SampleData.cpp)
TARGET_LINK_LIBRARIES(${PROJECT_NAME}_lib PUBLIC tmxutils )

set(BINARY ${PROJECT_NAME}_test)
file(GLOB_RECURSE TEST_SOURCES LIST_DIRECTORIES false test/*.h test/*.cpp)
set(SOURCES ${TEST_SOURCES} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/test)
add_executable(${BINARY} ${TEST_SOURCES})
add_test(NAME ${BINARY} COMMAND ${BINARY})
TARGET_INCLUDE_DIRECTORIES(${BINARY} PUBLIC src/)

target_link_libraries(${BINARY} PUBLIC
${PROJECT_NAME}_lib
gtest)
7 changes: 6 additions & 1 deletion examples/tmx-exampleapps/ExamplePlugin/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name":"@TMX_PLUGIN_NAME@",
"description":"An example plugin for the IVP system.",
"description":"An example plugin for the V2X Hub.",
"version":"@PROJECT_VERSION@",
"exeLocation":"/bin/@PROJECT_NAME@",
"coreIpAddr":"127.0.0.1",
Expand All @@ -13,6 +13,11 @@
}
],
"configuration":[
{
"key":"LogLevel",
"default":"INFO",
"description":"The log level for this plugin"
},
{
"key":"Frequency",
"default":"1000",
Expand Down
12 changes: 6 additions & 6 deletions examples/tmx-exampleapps/ExamplePlugin/src/ExamplePlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Description : Example Plugin
//==========================================================================

#include "PluginClient.h"
#include "PluginClientClockAware.h"
#include "PluginDataMonitor.h"

#include <atomic>
Expand All @@ -25,7 +25,7 @@ namespace ExamplePlugin
/**
* This plugin is an example to demonstrate the capabilities of a TMX plugin.
*/
class ExamplePlugin: public PluginClient
class ExamplePlugin: public PluginClientClockAware
{
public:
ExamplePlugin(std::string);
Expand All @@ -51,7 +51,7 @@ class ExamplePlugin: public PluginClient
*
* @param name The name to give the plugin for identification purposes.
*/
ExamplePlugin::ExamplePlugin(string name): PluginClient(name)
ExamplePlugin::ExamplePlugin(string name): PluginClientClockAware(name)
{
// The log level can be changed from the default here.
FILELog::ReportingLevel() = FILELog::FromString("DEBUG");
Expand Down Expand Up @@ -115,7 +115,7 @@ void ExamplePlugin::HandleMapDataMessage(MapDataMessage &msg, routeable_message

void ExamplePlugin::HandleDecodedBsmMessage(DecodedBsmMessage &msg, routeable_message &routeableMsg)
{
//PLOG(logDEBUG) << "Received Decoded BSM: " << msg;
PLOG(logDEBUG) << "Received Decoded BSM: " << msg;

// Determine if location, speed, and heading are valid.
bool isValid = msg.get_IsLocationValid() && msg.get_IsSpeedValid() && msg.get_IsHeadingValid();
Expand Down Expand Up @@ -148,9 +148,9 @@ int ExamplePlugin::Main()
uint msCount = 0;
while (_plugin->state != IvpPluginState_error)
{
PLOG(logDEBUG4) << "Sleeping 1 ms" << endl;
PLOG(logDEBUG4) << "Sleeping 10 ms" << endl;

this_thread::sleep_for(chrono::milliseconds(10));
PluginClientClockAware::getClock()->sleep_for(10);

msCount += 10;

Expand Down
2 changes: 1 addition & 1 deletion src/v2i-hub/docs/Programming_Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Additional information on the V2X Hub can be found in the following documents. I

## Example Plugin

The Example Plugin showcases the basic functionality needed by a V2X Hub plugin. The plugin has simple API calls to create, route, and decode messages from the V2X Hub Core. Examples for setting status values, retrieving configuration values and writing logs are also in the example. The Example Plugin is a good foundation to modify when creating our own plugin for the V2X Hub. See [SampleBSMPlugin](../../../examples/tmx-exampleapps/SampleBSMPlugin/) for example plugin
The Example Plugin showcases the basic functionality needed by a V2X Hub plugin. The plugin has simple API calls to create, route, and decode messages from the V2X Hub Core. Examples for setting status values, retrieving configuration values and writing logs are also in the example. The Example Plugin is a good foundation to modify when creating our own plugin for the V2X Hub. See [ExamplePlugin](../../../examples/tmx-exampleapps/ExamplePlugin/) for example plugin
> [!NOTE]
> We are currently working to migrate,update and consolidate the SampleBSMPlugin and ExamplePlugin. Both are located under `/examples/tmx-exampleapps` under project root, but this document and the example plugins may currently contain inaccurate/outdated information.
Expand Down

0 comments on commit e16048f

Please sign in to comment.