0

In a project, I have to use a custom beacon message. The parameters it require, differ from the parameters that are in WaveShortMessage. I defined .msg file and was able to generate _m.cc and _m.h files. To use custom message in TraCIDemo11p, I thought of replacing WSM object parameter with that of custom messages's object parameter in onBeacon() function. But that won't work as BaseWaveApplLayer too have used WSM object only.

So I created another MyAppLayer.ned, whose content was same as that of TraCIDemo11p.ned, except "sendWhileParking" parameter (which I removed in MyAppLayer.ned) and I wrote corresponding .h and .cc files for MyAppLayer.ned by looking at the structure of TraCIDemo11p.h/.cc files. Also, I carefully included all the relevant header files, including custom message's _m.h file. But it has generated lot of errors like-

  1. scheduleAt() not defined in the scope
  2. "MyMsg" is not defined in the scope . . . and similar.

Please help me with how to use custom message in TraCIDemo11p in place of WSM. Thank you.

  • `scheduleAt` is part of the OMNeT++ API, not of VEINS. Could you post which version of the tools you're using, and check that you correctly include the OMNeT++ libraries? Also, in case you're using OMNeT++ 5, make sure that you're using a compatible VEINS version, and check that the namespacing is set correctly. – Rens van der Heijden Mar 31 '16 at 12:06
  • OMNeT++ 4.6 and Veins 3.0 along with MiXiM 2.3 and SUMO 0.21.0. OMNeT++ header file is included. – Yashika Jain Mar 31 '16 at 14:16
  • But is it included at compile time? The errors you have imply that it cannot find the omnetpp.h file. The same goes for you own generated _m.h files, although those should normally be generated wherever the .msg file is, and should thus also be included correctly. – Rens van der Heijden Apr 01 '16 at 12:12
  • I assume I have included the files appropriately. In the case of _m.h, complete path is specified. Well, I'll give it a try again and see if the problem goes. And in the worst case if it persists I'll ask again with may be some more information. Thanks.! – Yashika Jain Apr 02 '16 at 04:41
  • I'm not sure whether it helps, but I'm using [this](https://github.com/namnatulco/dotfiles/blob/a87feaef82881d540bf035d26e42a73f6f9a90b7/bashrc#L146,L163) to switch between OMNeT++ 4.6 and 5.0. Does VEINS' configure script run correctly? – Rens van der Heijden Apr 03 '16 at 08:31

1 Answers1

1

first of all, you should add following code into your file

#include omnetpp.h 

and

using namespace omnetpp;

Finally you should inherit cSimpleModule class in order to recognize your methods such as scheduleAt().

For example:

class className : cSimpleModule{
...
}
piet.t
  • 11,718
  • 21
  • 43
  • 52
sepideh
  • 61
  • 7