I am using Veins 4a2 in omnet++4.6. I would like to send the information contained in a function as a message to the neighbor nodes. How can achieve this? the function in .cc looks like this:
void TraCITestApp::append2List(short carId, short firstEmptyArrayIndex, simtime_t messageTime, double theta, std::string vType) {
listedVehicles[firstEmptyArrayIndex].id = carId; // ~~here the Id is changed name to car ID.
listedVehicles[firstEmptyArrayIndex].lastSeenAt = messageTime;
listedVehicles[firstEmptyArrayIndex].vType = vType;
listedVehicles[firstEmptyArrayIndex].theta = theta;
EV << "Appending car with id " << carId <<" type "<< vType << " to the list of known vehicle." << endl;
/* @brief Increase related counting variable
* The total number always increased for each vehicle
*/
currentNumberofTotalDetectedVehicles++;
}
.
void TraCITestApp::showInfo_D(short counter){
EV << "Listed Table for Truthtelling:" << endl;
for (int i = 0; i < counter; i++)
{ EV << "Serial [" << i << "] " <<"ID="<< listedVehicles[i].id << "\tTruthtelling prob.\t" << listedVehicles[i].theta <<endl;
std::ofstream tracefile;
tracefile.open("traceFiledata.txt", std::ios_base::app);
tracefile << "============================================";
tracefile << "MyID=" << getMyID() << ";" <<"Serial [" << i << "] " <<"ID="<< listedVehicles[i].id << ";" << "Time=" << simTime() << ";" << "TTP=" << listedVehicles[i].theta << getMetaData() << std::endl;
tracefile.close();
}
EV << "Total number of detected vehicle\t: " << currentNumberofTotalDetectedVehicles << endl;
}
I can call the method in void TraCITestApp::onData(WaveShortMessage* wsm)
as showInfo_D(currentNumberofVehicles);
But how can i send this information to other neighbor vehicles. I want to send and accumulate the information in each vehicles but only the initial information i.e i dont send all the accumulated information.