0

I am new to omnet++ and inet. I want to inherit a compound module like Adhoc Host and then write logic for it. Unfortunately, there is no C++ file with Compound modules.

The behaviour I want to write is what should a host do when it reaches which particular point in the space. For example, host A should send a message to host B only if they are within a certain distance of each other.

halfer
  • 18,701
  • 13
  • 79
  • 158

1 Answers1

0

This is an application behavior so you should write your own application that behaves according to this specification. You can either modify a current application (like UDPBasicApp) or write your own and then install that application in the module. There is no need to derive anything from the AdhocHost as it is possible to exchange certain behaviors (i.e. what application is running in the host) with just modifying parameters in the .ini files:

*.myadhochost.udpApp.typename = "MyUDPApp"
Rudi
  • 4,880
  • 1
  • 14
  • 19
  • Is it possible to write such code in the .ini file? Code with if conditions,for loop etc. – indraneelb1903 May 27 '16 at 16:01
  • Ini files contain parameters and you cannot write "code" there. Limited conditional expressions and some pattern matching is available but that's all. On the other hand, if you are asking whether it's possible to create a simulation that contains adhoc nodes that contain two radios that transmit on different channels, without writing any C++ code, then the answer is yes. If memory serves there is an example like that in INET. It's called 'multiradio' – Rudi May 27 '16 at 20:51
  • have u got any sample code which you could share with me? What I basically want is nodes with mobility being able to exchange customised messages with each other.I cant figure out which module to use and which not to use. The examples also arent helping a lot. – indraneelb1903 May 27 '16 at 23:18