Skip to content

Instantly share code, notes, and snippets.

@MounaKaroui
Created October 4, 2018 11:23
Show Gist options
  • Save MounaKaroui/ea65ce3d69975f07f21858a5e8011ffd to your computer and use it in GitHub Desktop.
Save MounaKaroui/ea65ce3d69975f07f21858a5e8011ffd to your computer and use it in GitHub Desktop.
void DenService::verifyStation()
{
cModule* mid=getParentModule();
std::string name= mid->getFullPath();
if(name.find("rsu")!=std::string::npos)
{
sendFromRSU=true;
rsuId=mid->getParentModule()->getId();
}
else
{
sendFromRSU=false;
}
}
void DenService::indicate(const vanetza::btp::DataIndication& indication, std::unique_ptr<vanetza::UpPacket> packet)
{
Asn1PacketVisitor<vanetza::asn1::Denm> visitor;
const vanetza::asn1::Denm* denm = boost::apply_visitor(visitor, *packet);
verifyStation();
long egoStationID;
if(sendFromRSU)
{
egoStationID=rsuId;
}
else
{
egoStationID = getFacilities().get_const<VehicleDataProvider>().station_id();
}
if (denm && (*denm)->header.stationID != egoStationID) {
DenmObject obj = visitor.shared_wrapper;
mMemory->received(obj);
emit(denmReceivedSignal, &obj);
for (auto& use_case : mUseCases) {
use_case.indicate(obj);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment