leachApp under mannasim extension

View: New views
1 Messages — Rating Filter:   Alert me  

leachApp under mannasim extension

by K.manel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi ns-users ,

 Please, Can someone explain  to me  this part of LeachApp.cc code .
And , plz  where shall found the declaration  and initialization of sensor_node (pointer on  chadv structure leachApp.h )  

Void LeachApp::start()
{
    if (agent_ == NULL)
    {
        char agentName[32];

        printf("Warning! LeachApp::start() => agent_ of %d is null! Creating a RCAgent!\n", sensor_node_->nodeid()); // exactly this line

        sprintf(agentName, "__rcagent%d", sensor_node_->nodeid());  

        agent_ = new RCAgent();
        agent_->name(agentName);

        Tcl::instance().enter(agent_);

        printf("%s attach %s", name(), agent_->name());
        Tcl::instance().evalf("%s attach %s", name(), agent_->name());
    }

    sensedData_->node_id() == sensor_node_->nodeid();

    mac_ = (MacSensor *) ((RCAgent *) agent_)->getMAC();
    mac_->node_num() = sensor_node_->nodeid();
    decideClusterHead();

    CommonNodeApp::start();
}

Many thanks