serializationomnet++veinsinet

Cannot find serializer for VeinsinetSampleMessage


I am attempting to implement a PCAP recorded into the Veins_Inet example simulation to export a reading from each node for each event. However, the above is the error I am getting when running the simulation. How do I find such a serializer?

This is the .ini file as it stands currently:

# UDPBasicApp
*.node[*].numApps = 1
*.node[*].app[0].typename = "vanet.veins_inet.VeinsInetSampleApplication"
*.node[*].app[0].interface = "wlan0"

# Ieee80211Interface
*.node[*].wlan[0].opMode = "p"
*.node[*].wlan[0].radio.typename = "Ieee80211DimensionalRadio"
*.node[*].wlan[0].radio.bandName = "5.9 GHz"
*.node[*].wlan[0].radio.channelNumber = 3
*.node[*].wlan[0].radio.transmitter.power = 20mW
*.node[*].wlan[0].radio.bandwidth = 10 MHz
*.node[*].wlan[*].radio.antenna.mobility.typename = "AttachedMobility"
*.node[*].wlan[*].radio.antenna.mobility.mobilityModule = "^.^.^.^.mobility"
*.node[*].wlan[*].radio.antenna.mobility.offsetX = -2.5m
*.node[*].wlan[*].radio.antenna.mobility.offsetZ = 1.5m
*.node[*].wlan[*].radio.antenna.mobility.constraintAreaMinX = 0m
*.node[*].wlan[*].radio.antenna.mobility.constraintAreaMaxX = 0m
*.node[*].wlan[*].radio.antenna.mobility.constraintAreaMinY = 0m
*.node[*].wlan[*].radio.antenna.mobility.constraintAreaMaxY = 0m
*.node[*].wlan[*].radio.antenna.mobility.constraintAreaMinZ = 0m
*.node[*].wlan[*].radio.antenna.mobility.constraintAreaMaxZ = 0m
*.node[*].numPcapRecorders = 1
*.node[*].pcapRecorder[*].pcapLinkType = 105 # 802.11
*.node[0].pcapRecorder[*].pcapFile = "results/node0.pcap"
*.node[1].pcapRecorder[*].pcapFile = "results/node1.pcap"
*.node[2].pcapRecorder[*].pcapFile = "results/node2.pcap"

**.crcMode="computed"
**.fcsMode="computed"
**.pcapRecorder[*].verbose = true # is this needed? doesnt seem to work ok
**.pcapRecorder[*].alwaysFlush = true
**.pcapRecorder[*].packetFilter = "ping* or Ping*"

# HostAutoConfigurator
*.node[*].ipv4.configurator.typename = "HostAutoConfigurator"
*.node[*].ipv4.configurator.interfaces = "wlan0"
*.node[*].ipv4.configurator.mcastGroups = "224.0.0.1"

# VeinsInetMobility
*.node[*].mobility.typename = "VeinsInetMobility"

# VeinsInetManager
*.manager.updateInterval = 0.1s
*.manager.host = "localhost"
*.manager.port = 9999
*.manager.autoShutdown = true
*.manager.launchConfig = xmldoc("square.launchd.xml")
*.manager.moduleType = "vanet.veins_inet.VeinsInetCar"

# PhysicalEnvironment
*.physicalEnvironment.config = xmldoc("obstacles.xml")
*.radioMedium.obstacleLoss.typename = "IdealObstacleLoss"

# Misc
**.vector-recording = true

[Config plain]

[Config canvas]
extends = plain
description = "Enable enhanced 2D visualization"

# IntegratedCanvasVisualizer (2D)
*.visualizer.*.obstacleLossVisualizer.displayIntersections = true
*.visualizer.*.obstacleLossVisualizer.displayFaceNormalVectors = true
*.visualizer.*.obstacleLossVisualizer.intersectionLineColor = "yellow"
*.visualizer.*.mediumVisualizer.signalPropagationAnimationSpeed = 500/3e8
*.visualizer.*.mediumVisualizer.signalTransmissionAnimationSpeed = 50000/3e8
*.visualizer.*.mediumVisualizer.displaySignals = true
*.visualizer.canvasVisualizer.mediumVisualizer.displaySignalDepartures = false
*.visualizer.canvasVisualizer.mediumVisualizer.displaySignalArrivals = false
*.visualizer.*.physicalLinkVisualizer.displayLinks = true
#*.visualizer.*.mobilityVisualizer.displayPositions = true
#*.visualizer.*.mobilityVisualizer.displayOrientations = true
#*.visualizer.*.mobilityVisualizer.displayVelocities = true
#*.visualizer.*.mobilityVisualizer.displayMovementTrails = true
#*.visualizer.*.mobilityVisualizer.moduleFilter = "**.antenna.mobility"

*.visualizer.osgVisualizer.typename = ""

[Config osg]
extends = canvas
description = "Enable enhanced 2D and 3D visualization using OSG"

*.useOsg = true

# IntegratedOsgVisualizer (3D)
*.visualizer.osgVisualizer.typename = IntegratedOsgVisualizer
*.node[*].osgModel = "veins_inet/node/car.obj.-5e-1,0e-1,5e-1.trans.450e-2,180e-2,150e-2.scale" # offset .5 back and .5 up (position is front bumper at road level), make 450cm long, 180m wide, 150m high

I'm assuming I would perhaps include the serializer here, but I need to know where to find such a thing.


Solution

  • There is no serializer for VeinsInetSampleMessage in Veins, so it must be created. Add these two files, VeinsInetSampleMessageSerializer.h and VeinsInetSampleMessageSerializer.cc in /home/veins/src/veins/subprojects/veins_inet/src/veins_inet and recompile Veins.

    // VeinsInetSampleMessageSerializer.h
    #ifndef __VEINSINETSAMPLEMESSAGESERIALIZER_H
    #define __VEINSINETSAMPLEMESSAGESERIALIZER_H
    
    #include "inet/common/packet/serializer/FieldsChunkSerializer.h"
    
    class VeinsInetSampleMessageSerializer : public inet::FieldsChunkSerializer {
      protected:
        virtual void serialize(inet::MemoryOutputStream& stream, const inet::Ptr<const inet::Chunk>& chunk) const override;
        virtual const inet::Ptr<inet::Chunk> deserialize(inet::MemoryInputStream& stream) const override;
    
      public:
        VeinsInetSampleMessageSerializer() : FieldsChunkSerializer() {}
    };
    
    #endif // __VEINSINETSAMPLEMESSAGESERIALIZER_H
    
    // VeinsInetSampleMessageSerializer.cc
    #include "VeinsInetSampleMessageSerializer.h"
    #include "VeinsInetSampleMessage_m.h"
    #include "inet/common/packet/serializer/ChunkSerializerRegistry.h"
    
    using namespace inet;
    
    Register_Serializer(VeinsInetSampleMessage, VeinsInetSampleMessageSerializer);
    
    void VeinsInetSampleMessageSerializer::serialize(MemoryOutputStream& stream, const Ptr<const Chunk>& chunk) const {
        const auto& sampleMsg = staticPtrCast<const VeinsInetSampleMessage>(chunk);
        std::string roadId(sampleMsg->getRoadId());
        stream.writeString(roadId);
    }
    
    const Ptr<Chunk> VeinsInetSampleMessageSerializer::deserialize(MemoryInputStream& stream) const {
        auto sampleMsg = makeShared<VeinsInetSampleMessage>();
        sampleMsg->setRoadId(stream.readString().c_str());
        return sampleMsg;
    }