There are n Adhoc nodes that are deployed randomly in field. Because of necessity to a special node I ought to extend new node from AdhocHost and add some parameter like node coordinates.
MySensorNode.ned
import inet.node.inet.AdhocHost;
import inet.node.inet.INetworkNode;
module MySensorNode extends AdhocHost like INetworkNode
{
parameters:
@display("bgb=827.48,663.192;bgu=m;i=misc/transmission_anim");
@class(inet::MySensorNode);
}
MySensorNode.h
#ifndef __INET_MYSENSORNODE_H
#define __INET_MYSENSORNODE_H
namespace inet {
class MySensorNode : public ***????????what should I write here????***
{
public:
bool first_init = true;
MySensorNode();
virtual ~MySensorNode();
virtual void initialize(int stage);
virtual void changecolor();
virtual void handleMessage(cMessage *msg);
?????????others ?????????
};
} // namespace inet
#endif /* __INET_MYSENSORNODE_H */
MySensorNode.cc
#include "MySensorNode.h"
namespace inet {
Define_Module(MySensorNode);
void MySensorNode::initialize(int stage)
{
if(first_init)
{
changecolor();
}
}
void MySensorNode::changecolor()
{
???????????????????
}
} // namespace inet
as the first part of question, I want to change 5% of nodes' color in initialization. How can I do that?
please mention my mistakes in the codes above. Thx