Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documentation to include Plugin Programming Guide and Plugin Documentation Template #644

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions examples/tmx-exampleapps/EmptyPlugin/CMakeLists.txt

This file was deleted.

23 changes: 0 additions & 23 deletions examples/tmx-exampleapps/EmptyPlugin/manifest.json

This file was deleted.

217 changes: 0 additions & 217 deletions examples/tmx-exampleapps/EmptyPlugin/src/EmptyPlugin.cpp

This file was deleted.

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)
29 changes: 29 additions & 0 deletions examples/tmx-exampleapps/ExamplePlugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# SampleBSMPlugin

This is an example plugin used for demostrating how to develop new **V2X Hub** plugins. Any developed plugin should include accompanying documentation in the form of a `README.md` with the sections outlined here.

## Documentation Template

### Introduction

A brief introduction to the Plugin and the functionality it introduces. Well developed plugins are modular and function independently.

### Related Plugins

A list of plugins related to the documented plugin. Often to enable Connected Automated Vehicle (CAV) use-cases, requires multiple **V2X-Hub** plugins running conccurently. This section should described other plugins required for end-user functionality and their role.

### Configuration/Deployment

This section should provide documentation about how to configure and deploy the plugin. This should include descriptions of plugin configuration parameters as well as step by step instructions for enabling the plugin.

### Design (Recommended)

This is an optional, but recommended section that can be used to outline the high-level design of your plugin. This should include insights into data-flow, communication sequence and relevant data transforms/translations.

### Messages (Recommended)

This is an optional, but recommended section that is intended to describe the TMX Messages used by the plugin to communicate with other plugins in V2X-Hub

### Testing (Recommended)

This final section is optional, but recommended and is intended to describe methods used to confirm the deployed plugin is functioning correctly. This can include testing scripts used to send mock data through the plugin and/or UI status fields to check to confirm working functionality.
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 examples/tmx-exampleapps/SampleBSMPlugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ PROJECT ( SampleBSMPlugin VERSION 5.0 LANGUAGES CXX )

BuildTmxPlugin ( )

TARGET_LINK_LIBRARIES (${PROJECT_NAME} tmxutils jsoncpp)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing in the sample plugin uses json CPP

TARGET_LINK_LIBRARIES (${PROJECT_NAME} tmxutils)
Loading
Loading