Skip to content

Commit

Permalink
Immediate Forward Plugin Configurable Channel (#433)
Browse files Browse the repository at this point in the history
* modified:   README.md
	modified:   src/v2i-hub/DsrcImmediateForwardPlugin/manifest.json
	modified:   src/v2i-hub/DsrcImmediateForwardPlugin/src/DsrcMessageManagerPlugin.cpp

* modified:   examples/tmx-exampleapps/SampleBSMPlugin/src/SampleBSMPlugin.cpp
	modified:   src/tmx/TmxApi/tmx/IvpMessage.c
	modified:   src/tmx/TmxApi/tmx/messages/routeable_message.hpp
	modified:   src/v2i-hub/CARMACloudPlugin/src/CARMACloudPlugin.cpp
	modified:   src/v2i-hub/CARMAStreetsPlugin/src/CARMAStreetsPlugin.cpp
	modified:   src/v2i-hub/CswPlugin/src/CswPlugin.cpp
	modified:   src/v2i-hub/MapPlugin/src/MapPlugin.cpp
	modified:   src/v2i-hub/PedestrianPlugin/src/PedestrianPlugin.cpp
	modified:   src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp
	modified:   src/v2i-hub/RtcmPlugin/src/RtcmPlugin.cpp
	modified:   src/v2i-hub/SpatPlugin/src/SpatPlugin.cpp
	modified:   src/v2i-hub/TimPlugin/src/TimPlugin.cpp
  • Loading branch information
jwillmartin authored Nov 21, 2022
1 parent 0af3898 commit e81fbbb
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 27 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ The V2X Hub system reduces time needed to create and deploy a roadside based V2X
* DMS Plugin – The Dynamic Message Sign (DMS) Plugin will receive messages from other plugins and translate the information to NTCIP 1203 for display on a DMS
* MAP Plugin – Produces intersection geometry in J2735 MAP format.
* SPAT Plugin – Communicates with a traffic signal controller (TSC) using NTCIP 1202, and creates a J2735 SPaT Message.
* DSRC Immediate Forward Plugin – Sends all J2735 traffic to the 4.1 RSU for transmission out the DSRC radio.
* Immediate Forward Plugin – Sends all J2735 traffic to the 4.1 RSU for transmission out the V2X radio.
* Message Receiver Plugin – Receives all J2735 traffic incoming from the 4.1 RSU for consumption by other V2X Hub plugins.
* Location Plugin – Communicates with GPS devices producing location information and optionally the NMEA GP* sentences for the V2X Hub system.
* RTCM Plugin – Communicates with a NTRIP network to create J2735 RTCM position correction messages.
* ODE Plugin – Pushes data to an operational data environment server using a known IP address and port.
* ODE Forward Plugin – Pushes data to an operational data environment server using a known IP address and port.
* Pedestrian Plugin – Creates a PSM using information obtained from nomadic devices (ex. cell phones) through a local webserver.
* Preemption Plugin – Calls a preemption table on a controller using NTCIP 1202 V3 commands to provide passage to an emergency vehicle upon request through BSMs
* Preemption Plugin – Calls a preemption table on a controller using NTCIP 1202 V3 commands to provide passage to an emergency vehicle upon request through BSMs
* SPAT Logger Plugin – Logs V2X Hub generated, UPER-encoded SPAT messages in a .csv file along with a system timestamp
* TIM Plugin – Creates and broadcasts a TIM message from an .xml file based on user input through GUI or local webserver
* BSM Logger Plugin – Decodes and logs BSMs received by the Message Receiver Plugin to a .csv file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace SampleBSMPluginNS
MessageFrameMessage frame_msg(bsmMessage->get_j2735_data());
bsmEncodeMessage.set_data(TmxJ2735EncodedMessage<BasicSafetyMessage>::encode_j2735_message<codec::uper<MessageFrameMessage>>(frame_msg));
bsmEncodeMessage.set_flags(IvpMsgFlags_RouteDSRC);
bsmEncodeMessage.addDsrcMetadata(172, 0x20);
bsmEncodeMessage.addDsrcMetadata(0x20);
bsmEncodeMessage.refresh_timestamp();

routeable_message *rMsg = dynamic_cast<routeable_message *>(&bsmEncodeMessage);
Expand Down Expand Up @@ -59,7 +59,7 @@ namespace SampleBSMPluginNS

//Broadcast BSM
bsmEncoded.set_flags(IvpMsgFlags_RouteDSRC);
bsmEncoded.addDsrcMetadata(172, 0x20);
bsmEncoded.addDsrcMetadata(0x20);
bsmEncoded.refresh_timestamp();
routeable_message *rMsg = dynamic_cast<routeable_message *>(&bsmEncoded);
BroadcastMessage(*rMsg);
Expand Down
2 changes: 1 addition & 1 deletion src/tmx/TmxApi/tmx/IvpMessage.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ IvpMessage *ivpMsg_create(const char *type, const char *subtype, const char *enc
return newIvpMessage;
}

IvpMessage *ivpMsg_addDsrcMetadata(IvpMessage *msg, int channel, int psid)
IvpMessage *ivpMsg_addDsrcMetadata(IvpMessage *msg, int psid, int channel)
{
assert(msg != NULL);
if (msg == NULL)
Expand Down
8 changes: 4 additions & 4 deletions src/tmx/TmxApi/tmx/messages/routeable_message.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,12 +452,12 @@ class tmx_routeable_message: public tmx_message<Format>

/**
* Add DSRC metadata attributes
* @param channel The DSRC channel
* @param psid The DSRC psid
* @param channel The V2X channel, default set to 172. Configurable in Immediate Forward Plugin.
* @param psid The V2X psid
*/
void addDsrcMetadata(int channel, int psid)
void addDsrcMetadata(int psid, int channel = 172)
{
ivpMsg_addDsrcMetadata(ivpMsg, channel, psid);
ivpMsg_addDsrcMetadata(ivpMsg, psid, channel);
_dsrcChannel.bind(ivpMsg->dsrcMetadata->channel);
_dsrcPsid.bind(ivpMsg->dsrcMetadata->psid);
}
Expand Down
2 changes: 1 addition & 1 deletion src/v2i-hub/CARMACloudPlugin/src/CARMACloudPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ void CARMACloudPlugin::BroadcastTCM(tsm5EncodedMessage& tsm5ENC) {
msg->set_payload(tsm5ENC.get_payload_str());
msg->set_encoding(enc);
msg->set_flags(IvpMsgFlags_RouteDSRC);
msg->addDsrcMetadata(172, 0x8003);
msg->addDsrcMetadata(0x8003);
msg->refresh_timestamp();
routeable_message *rMsg = dynamic_cast<routeable_message *>(msg.get());
BroadcastMessage(*rMsg);
Expand Down
6 changes: 3 additions & 3 deletions src/v2i-hub/CARMAStreetsPlugin/src/CARMAStreetsPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ void CARMAStreetsPlugin::SubscribeSchedulingPlanKafkaTopic()
if( getEncodedtsm3 (&tsm3EncodedMsgs, metadata, payload_json) )
{
tsm3EncodedMsgs.set_flags( IvpMsgFlags_RouteDSRC );
tsm3EncodedMsgs.addDsrcMetadata( 172, 0xBFEE );
tsm3EncodedMsgs.addDsrcMetadata(0xBFEE );
PLOG(logDEBUG) << "tsm3EncodedMsgs: " << tsm3EncodedMsgs;
BroadcastMessage(static_cast<routeable_message &>( tsm3EncodedMsgs ));
}
Expand All @@ -543,7 +543,7 @@ void CARMAStreetsPlugin::SubscribeSchedulingPlanKafkaTopic()
if( getEncodedtsm3 (&tsm3EncodedMsgs, metadata, payload_json) )
{
tsm3EncodedMsgs.set_flags( IvpMsgFlags_RouteDSRC );
tsm3EncodedMsgs.addDsrcMetadata( 172, 0xBFEE );
tsm3EncodedMsgs.addDsrcMetadata(0xBFEE);
PLOG(logDEBUG) << "tsm3EncodedMsgs: " << tsm3EncodedMsgs;
BroadcastMessage(static_cast<routeable_message &>( tsm3EncodedMsgs ));
}
Expand Down Expand Up @@ -610,7 +610,7 @@ void CARMAStreetsPlugin::SubscribeSpatKafkaTopic(){

//Broadcast the encoded SPAT message
spatEncodedMsg.set_flags(IvpMsgFlags_RouteDSRC);
spatEncodedMsg.addDsrcMetadata(172, 0x8002);
spatEncodedMsg.addDsrcMetadata(0x8002);
BroadcastMessage(static_cast<routeable_message &>(spatEncodedMsg));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/v2i-hub/CswPlugin/src/CswPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ int CswPlugin::Main() {
timEncMsg.initialize(timMsg);

timEncMsg.set_flags(IvpMsgFlags_RouteDSRC);
timEncMsg.addDsrcMetadata(172, 0x8003);
timEncMsg.addDsrcMetadata(0x8003);

routeable_message *rMsg = dynamic_cast<routeable_message *>(&timEncMsg);
if (rMsg) BroadcastMessage(*rMsg);
Expand Down
10 changes: 5 additions & 5 deletions src/v2i-hub/DsrcImmediateForwardPlugin/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@
"configuration": [
{
"key": "Messages_Destination_1",
"default": "{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\" },{ \"TmxType\": \"TMSG03-P\", \"SendType\": \"TMSG03-P\", \"PSID\": \"0xBFEE\" }] }",
"description": "JSON data defining the message types and PSIDs for messages forwarded to the V2X radio at destination 1."
"default": "{ \"Messages\": [ { \"TmxType\": \"SPAT-P\", \"SendType\": \"SPAT\", \"PSID\": \"0x8002\", \"Channel\": \"172\" }, { \"TmxType\": \"MAP-P\", \"SendType\": \"MAP\", \"PSID\": \"0x8002\", \"Channel\": \"172\" }, { \"TmxType\": \"PSM\", \"SendType\": \"PSM\", \"PSID\": \"0x8002\", \"Channel\": \"172\" } ,{ \"TmxType\": \"TMSG07\", \"SendType\": \"TMSG07\", \"PSID\": \"0x8002\", \"Channel\": \"172\" },{ \"TmxType\": \"TMSG03-P\", \"SendType\": \"TMSG03-P\", \"PSID\": \"0xBFEE\", \"Channel\": \"172\" }] }",
"description": "JSON data defining the message types, PSIDs, and channel number for messages forwarded to the V2X radio at destination 1."
},
{
"key": "Messages_Destination_2",
"default": "{ \"Messages\": [ ] }",
"description": "JSON data defining the message types and PSIDs for messages forwarded to the V2X radio at destination 2."
"description": "JSON data defining the message types, PSIDs, and channel number for messages forwarded to the V2X radio at destination 2."
},
{
"key": "Messages_Destination_3",
"default": "{ \"Messages\": [ ] }",
"description": "JSON data defining the message types and PSIDs for messages forwarded to the V2X radio at destination 3."
"description": "JSON data defining the message types, PSIDs, and channel number for messages forwarded to the V2X radio at destination 3."
},
{
"key": "Messages_Destination_4",
"default": "{ \"Messages\": [ ] }",
"description": "JSON data defining the message types and PSIDs for messages forwarded to the V2X radio at destination 4."
"description": "JSON data defining the message types, PSIDs, and channel number for messages forwarded to the V2X radio at destination 4."
},
{
"key": "Destination_1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ void DsrcMessageManagerPlugin::SendMessageToRadio(IvpMessage *msg)
else
os << "Priority=7" << "\n" << "TxMode=CONT" << "\n" << "TxChannel=" << _messageConfigMap[configIndex].Channel << "\n";
os << "TxInterval=0" << "\n" << "DeliveryStart=\n" << "DeliveryStop=\n";
os << "Signature= "<< _signature << "\n" << "Encryption=False\n";
os << "Signature="<< _signature << "\n" << "Encryption=False\n";
os << "Payload=" << payloadbyte << "\n";

string message = os.str();
Expand Down
2 changes: 1 addition & 1 deletion src/v2i-hub/MapPlugin/src/MapPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ int MapPlugin::Main() {
msg->set_payload(byteStr);
msg->set_encoding(enc);
msg->set_flags(IvpMsgFlags_RouteDSRC);
msg->addDsrcMetadata(172, 0x8002);
msg->addDsrcMetadata(0x8002);

activeAction = temp;
PLOG(logINFO) << "Map for action " << activeAction << " will be sent";
Expand Down
2 changes: 1 addition & 1 deletion src/v2i-hub/PedestrianPlugin/src/PedestrianPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ void PedestrianPlugin::BroadcastPsm(char * psmJson) { //overloaded
msg->set_payload(psmENC.get_payload_str());
msg->set_encoding(enc);
msg->set_flags(IvpMsgFlags_RouteDSRC);
msg->addDsrcMetadata(172, 0x8002);
msg->addDsrcMetadata(0x8002);
msg->refresh_timestamp();

routeable_message *rMsg = dynamic_cast<routeable_message *>(msg.get());
Expand Down
2 changes: 1 addition & 1 deletion src/v2i-hub/PortDrayagePlugin/src/PortDrayagePlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void PortDrayagePlugin::HandleMobilityOperationMessage(tsm3Message &msg, routeab
msg->set_payload(mobilityENC.get_payload_str());
msg->set_encoding(enc);
msg->set_flags(IvpMsgFlags_RouteDSRC);
msg->addDsrcMetadata(172,0xBFEE);
msg->addDsrcMetadata(0xBFEE);
msg->refresh_timestamp();
routeable_message *rMsg = dynamic_cast<routeable_message *>(msg.get());
BroadcastMessage(*rMsg);
Expand Down
2 changes: 1 addition & 1 deletion src/v2i-hub/RtcmPlugin/src/RtcmPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void RtcmPlugin::BroadcastRTCMMessage(TmxRtcmMessage &msg, routeable_message &ro
RtcmMessage rtcm = msg.get_RtcmMessage();
RtcmEncodedMessage encMsg;
encMsg.initialize(rtcm, "", 0, IvpMsgFlags_RouteDSRC);
encMsg.addDsrcMetadata(172, 0x8000);
encMsg.addDsrcMetadata(0x8000);

const routeable_message &rMsg = encMsg;
this->BroadcastMessage(rMsg);
Expand Down
2 changes: 1 addition & 1 deletion src/v2i-hub/SpatPlugin/src/SpatPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ int SpatPlugin::Main() {
sc.getEncodedSpat(&spatEncodedMsg, pedZones);

spatEncodedMsg.set_flags(IvpMsgFlags_RouteDSRC);
spatEncodedMsg.addDsrcMetadata(172, 0x8002);
spatEncodedMsg.addDsrcMetadata(0x8002);

//PLOG(logDEBUG) << spatEncodedMsg;

Expand Down
2 changes: 1 addition & 1 deletion src/v2i-hub/TimPlugin/src/TimPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ int TimPlugin::Main() {
//PLOG(logERROR) <<"encoded timEncMsg..."<< timEncMsg<<std::endl;

timEncMsg.set_flags(IvpMsgFlags_RouteDSRC);
timEncMsg.addDsrcMetadata(172, 0x8003);
timEncMsg.addDsrcMetadata(0x8003);

routeable_message *rMsg = dynamic_cast<routeable_message *>(&timEncMsg);
if (rMsg) BroadcastMessage(*rMsg);
Expand Down

0 comments on commit e81fbbb

Please sign in to comment.