Skip to content

Commit

Permalink
modified: src/tmx/TmxApi/tmx/IvpMessage.h
Browse files Browse the repository at this point in the history
	modified:   src/tmx/TmxApi/tmx/TmxApiMessages.h
	modified:   src/v2i-hub/ImmediateForwardPlugin/src/ImmediateForwardPlugin.cpp
	modified:   src/v2i-hub/MessageReceiverPlugin/manifest.json
	modified:   src/v2i-hub/MessageReceiverPlugin/src/MessageReceiverPlugin.cpp
  • Loading branch information
jwillmartin committed Jun 30, 2023
1 parent 32b1c05 commit 43c8739
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/tmx/TmxApi/tmx/IvpMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ typedef unsigned int IvpMsgFlags;
#define IvpMsgFlags_RouteDSRC 0x01

typedef struct IvpDsrcMetadata {
int channel;
int psid;
int channel;
} IvpDsrcMetadata;

typedef struct IvpMessage {
Expand Down Expand Up @@ -64,7 +64,7 @@ typedef enum {
*/
IvpMessage *ivpMsg_create(const char *type, const char *subtype, const char *encoding, IvpMsgFlags flags, cJSON *payload);

IvpMessage *ivpMsg_addDsrcMetadata(IvpMessage *msg, int channel, int psid);
IvpMessage *ivpMsg_addDsrcMetadata(IvpMessage *msg, int psid, int channel);

/*!
* Creates a new IvpMessage from a json string.
Expand Down
51 changes: 50 additions & 1 deletion src/tmx/TmxApi/tmx/TmxApiMessages.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,56 @@ static CONSTEXPR const char *STATUS_STARTED_STRING = "Started, waiting for conne
static CONSTEXPR const char *STATUS_RUNNING_STRING = "Running";
static CONSTEXPR const char *STATUS_STALE_STRING = "Connection going stale";
static CONSTEXPR const char *STATUS_STOPPED_STRING = "Stopped / Disconnected";


enum msgPSID
{
None_PSID = 0x00,
mapData_PSID = 0x8002,
signalPhaseAndTimingMessage_PSID = 0x8002,
basicSafetyMessage_PSID = 0x20,
commonSafetyRequest_PSID = 0x20,
emergencyVehicleAlert_PSID = 0x8005,
intersectionCollision_PSID = 0x8002,
nmeaCorrections_PSID = 0x8000,
probeDataManagement_PSID = 0x8004,
probeVehicleData_PSID = 0x8004,
roadSideAlert_PSID = 0x8003,
rtcmCorrections_PSID = 0x8000,
signalRequestMessage_PSID = 0xE0000016,
signalStatusMessage_PSID = 0x8002,
travelerInformation_PSID = 0x8003,
personalSafetyMessage_PSID = 0x27,
testMessage00_PSID = 0xBFEE,
testMessage01_PSID = 0xBFEE,
testMessage02_PSID = 0xBFEE,
testMessage03_PSID = 0xBFEE,
testMessage04_PSID = 0x8003,
testMessage05_PSID = 0x8003
};

static CONSTEXPR const char *MSGPSID_NONE_PSID_STRING = "None";
static CONSTEXPR const char *MSGPSID_MAPDATA_PSID_STRING = "0x8002";
static CONSTEXPR const char *MSGPSID_SIGNALPHASEANDTIMINGMESSAGE_PSID_STRING = "0x8002";
static CONSTEXPR const char *MSGPSID_BASICSAFETYMESSAGE_PSID_STRING = "0x20";
static CONSTEXPR const char *MSGPSID_COMMONSAFETYREQUEST_PSID_STRING = "0x20";
static CONSTEXPR const char *MSGPSID_EMERGENCYVEHICLEALERT_PSID_STRING = "0x8005";
static CONSTEXPR const char *MSGPSID_INTERSECTIONCOLLISION_PSID_STRING = "0x8002";
static CONSTEXPR const char *MSGPSID_NMEACORRECTIONS_PSID_STRING = "0x8000";
static CONSTEXPR const char *MSGPSID_PROBEDATAMANAGEMENT_PSID_STRING = "0x8004";
static CONSTEXPR const char *MSGPSID_PROBEVEHICLEDATA_PSID_STRING = "0x8004";
static CONSTEXPR const char *MSGPSID_ROADSIDEALERT_PSID_STRING = "0x8003";
static CONSTEXPR const char *MSGPSID_RTCMCORRECTIONS_PSID_STRING = "0x8000";
static CONSTEXPR const char *MSGPSID_SIGNALREQUESTMESSAGE_PSID_STRING = "0xE0000016";
static CONSTEXPR const char *MSGPSID_SIGNALSTATUSMESSAGE_PSID_STRING = "0x8002";
static CONSTEXPR const char *MSGPSID_TRAVELERINFORMATION_PSID_STRING = "0x8003";
static CONSTEXPR const char *MSGPSID_PERSONALSAFETYMESSAGE_PSID_STRING = "0x27";
static CONSTEXPR const char *MSGPSID_TESTMESSAGE00_PSID_STRING = "0xBFEE";
static CONSTEXPR const char *MSGPSID_TESTMESSAGE01_PSID_STRING = "0xBFEE";
static CONSTEXPR const char *MSGPSID_TESTMESSAGE02_PSID_STRING = "0xBFEE";
static CONSTEXPR const char *MSGPSID_TESTMESSAGE03_PSID_STRING = "0xBFEE";
static CONSTEXPR const char *MSGPSID_TESTMESSAGE04_PSID_STRING = "0x8003";
static CONSTEXPR const char *MSGPSID_TESTMESSAGE05_PSID_STRING = "0x8003";

} /* End namespace api */

} /* End namespace messages */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ void ImmediateForwardPlugin::SendMessageToRadio(IvpMessage *msg)
if (!foundMessageType)
{
SetStatus<uint>(Key_SkippedNoMessageRoute, ++_skippedNoMessageRoute);
PLOG(logWARNING)<<" WARNINNG TMX Subtype not found in configuration. Message Ignored: " <<
PLOG(logWARNING)<<" WARNING TMX Subtype not found in configuration. Message Ignored: " <<
"Type: " << msg->type << ", Subtype: " << msg->subtype;
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/v2i-hub/MessageReceiverPlugin/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"description":"Port for the incoming message network connection."
},
{
"key":"RouteMessage",
"key":"RouteJ2735",
"default":"false",
"description":"Set the flag to route/broadcast a received J2735 message to TMX Core."
},
Expand Down
10 changes: 4 additions & 6 deletions src/v2i-hub/MessageReceiverPlugin/src/MessageReceiverPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void MessageReceiverPlugin::OnMessageReceived(routeable_message &msg)
BsmEncodedMessage encodedBsm;
SrmEncodedMessage encodedSrm;

uint16_t msgPSID = NULL;
char msgPSID;

if (msg.get_type() == "Unknown" && msg.get_subtype() == "Unknown")
{
Expand Down Expand Up @@ -263,7 +263,7 @@ void MessageReceiverPlugin::OnMessageReceived(routeable_message &msg)
}

sendMsg = encode(encodedBsm, bsm);
msgPSID = 0x20;
msgPSID = api::msgPSID::basicSafetyMessage_PSID;
if (!simBSM) return;
}
break;
Expand All @@ -281,8 +281,7 @@ void MessageReceiverPlugin::OnMessageReceived(routeable_message &msg)
ntohl(*((uint32_t*)&(bytes.data()[24]))),
ntohl(*((uint32_t*)&(bytes.data()[28]))));
sendMsg = encode(encodedSrm, srm);
msgPSID = 0xE0000016;

msgPSID = api::msgPSID::signalRequestMessage_PSID;
}
break;
default:
Expand Down Expand Up @@ -348,7 +347,7 @@ void MessageReceiverPlugin::UpdateConfigSettings()
lock_guard<mutex> lock(syncLock);

// Atomic flags
GetConfigValue("RouteMessage", routeDsrc);
GetConfigValue("RouteJ2735", routeDsrc);
GetConfigValue("EnableSimulatedBSM", simBSM);
GetConfigValue("EnableSimulatedSRM", simSRM);
GetConfigValue("EnableSimulatedLocation", simLoc);
Expand Down Expand Up @@ -468,7 +467,6 @@ int MessageReceiverPlugin::Main()
SetStatus<uint>(Key_SkippedSignVerifyError, ++_skippedSignVerifyErrorResponse);
PLOG(logERROR) << "Error parsing Messages: " << ex.what();
continue;
;
}
PLOG(logDEBUG1) << "SCMS Contain response = " << result << std::endl;
cJSON *root = cJSON_Parse(result.c_str());
Expand Down

0 comments on commit 43c8739

Please sign in to comment.