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 5 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.

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)
29 changes: 29 additions & 0 deletions examples/tmx-exampleapps/SampleBSMPlugin/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.
27 changes: 20 additions & 7 deletions examples/tmx-exampleapps/SampleBSMPlugin/src/SampleBSMPlugin.cpp
dan-du-car marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
/**
* Copyright (C) 2024 LEIDOS.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this 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 "SampleBSMPlugin.h"
using namespace tmx;
using namespace tmx::utils;
using namespace tmx::messages;

namespace SampleBSMPluginNS
{
SampleBSMPlugin::SampleBSMPlugin(std::string name) : PluginClient(name)
SampleBSMPlugin::SampleBSMPlugin(std::string name) : PluginClientClockAware(name)
{
AddMessageFilter<BsmMessage>(this, &SampleBSMPlugin::HandleBasicSafetyMessage);
SubscribeToMessages();
Expand All @@ -31,7 +47,6 @@ namespace SampleBSMPluginNS

routeable_message *rMsg = dynamic_cast<routeable_message *>(&bsmEncodeMessage);
BroadcastMessage(*rMsg);
PLOG(logERROR) << " SampleBSMPlugind :: Broadcast BSM:: " << bsmEncodeMessage.get_payload_str();
free(frame_msg.get_j2735_data().get());
delete bsmMessage;

Expand Down Expand Up @@ -63,7 +78,7 @@ namespace SampleBSMPluginNS
bsmEncoded.refresh_timestamp();
routeable_message *rMsg = dynamic_cast<routeable_message *>(&bsmEncoded);
BroadcastMessage(*rMsg);
PLOG(logERROR) << " SampleBSMPlugin :: Broadcast CREATED BSM:: " << bsmEncoded.get_payload_str();
PLOG(logINFO) << "Broadcasted CREATED BSM : " << bsmEncoded.get_payload_str();
}
}

Expand Down Expand Up @@ -111,12 +126,10 @@ namespace SampleBSMPluginNS
bsm->coreData.size.length = 500;
bsm->coreData.size.width = 300;

std::cout << "createAndSendBSM 7" << std::endl;
PLOG(logINFO) << "Create and Send BSM." ;
BsmMessage* bsmMessage = new BsmMessage(bsm);
MessageFrameMessage messageFrame( bsmMessage->get_j2735_data() );
std::cout << "createAndSendBSM 7.1" << std::endl;
bsmEncoded.set_data( TmxJ2735EncodedMessage<BasicSafetyMessage>::encode_j2735_message<codec::uper<MessageFrameMessage>>(messageFrame) );
std::cout << "createAndSendBSM 7.2" << std::endl;
free(bsm);
free(messageFrame.get_j2735_data().get());
}
Expand All @@ -125,7 +138,7 @@ namespace SampleBSMPluginNS

int SampleBSMPlugin::Main()
{
FILE_LOG(logINFO) << "Starting plugin";
PLOG(logINFO) << "Starting plugin";
while (_plugin->state != IvpPluginState_error)
{
if (IsPluginState(IvpPluginState_registered))
Expand Down
Loading
Loading