I have to build a bit different message set. Thus I had to drift away from DemoBaseAppLayer and had to use directly BaseApplLayer. My ned files are almost sane, as provided by Vienes. I have to build App ned, used Car and Scenario from Viens. I subscribe to BaseMobility::mobilityStateChangedSignal. Methods like handlePositionUpdate and handleSelfMessage work fine. They work fine. They build a message and send it down.
However, handleLowerMessage does not get activated even once. What could I have missing? Your thoughts will be appreciated.
Minimal Reproducibale code
`
#ifndef BSMAPP_H_
#define BSMAPP_H_
#include <map>
#include "veins/modules/world/annotations/AnnotationManager.h"
#include "veins/base/modules/BaseApplLayer.h"
#include "veins/modules/utility/Consts80211p.h"
#include "veins/modules/messages/BaseFrame1609_4_m.h"
#include "veins/base/connectionManager/ChannelAccess.h"#include"veins/modules/mac/ieee80211p/DemoBaseApplLayerToMac1609_4Interface.h"
#include "veins/modules/mobility/traci/TraCIMobility.h"
#include "veins/modules/mobility/traci/TraCICommandInterface.h"
namespace veins {
using veins::AnnotationManager;
using veins::AnnotationManagerAccess;
using veins::TraCICommandInterface;
using veins::TraCIMobility;
using veins::TraCIMobilityAccess;
//using namespace Veins;
class BSMApp: public BaseApplLayer {
public:
BSMApp();
virtual ~BSMApp() override;
void initialize(int stage) override;
void finish() override;
void receiveSignal(cComponent* source, simsignal_t signalID, cObject* obj,
cObject* details) override;
enum BaseApplMessageKinds {
SEND_BEACON_EVT,
//SEND_WSA_EVT
};
protected:
bool isSelfMsgSent;
void handleSelfMsg(cMessage* msg) override;
virtual void handleLowerMsg(cMessage* msg) override;
virtual simtime_t computeAsynchronousSendingTime(simtime_t interval, ChannelType chantype);
cMessage* sendBeaconEvt;
virtual void handlePositionUpdate(cObject* obj) ;
TraCIMobility* mobility;
TraCICommandInterface* traci;
TraCICommandInterface::Vehicle* traciVehicle;
AnnotationManager* annotations;
DemoBaseApplLayerToMac1609_4Interface* mac;
}`
and cc file
`using namespace veins;
Define_Module(veins::BSMApp);
void BSMApp::receiveSignal(cComponent* source, simsignal_t signalID, cObject* obj,
cObject* details){
//EV_DEBUG << "BSMApp::receiveSignal start " << endl;
EV << "BSMApp::receiveSignal start " << endl;
cout<< "BSMApp::receiveSignal start"<<endl;
Enter_Method_Silent();
if (signalID == BaseMobility::mobilityStateChangedSignal) {
handlePositionUpdate(obj);
EV_DEBUG << "BSMApp::receiveSignal updated position " << endl;
}else{
EV_DEBUG << "BSMApp::receiveSignal NOT of type mobility state change signal " << endl;
}
EV_DEBUG << "BSMApp::receiveSignal end " << endl;
}
void BSMApp::initialize(int stage){
//Almost same as Demo App
}
void BSMApp::handleLowerMsg(cMessage* msg) {
cout << "BSMApp::handleLowerMsg start " << endl;
}
void BSMApp::handleSelfMsg(cMessage* msg) {
cout << "BSMApp::handleSelfMsg start " << endla
isSelfMsgSent=true;;
}
void BSMApp::handlePositionUpdate(cObject* obj) {
if(!isSelfMsgSent){
cout<<"Trying to set isSelfMsgSent"<<endl;
this->handleSelfMsg(sendBeaconEvt);
}
}`
Thank you. Regards, sj