command void CtpInfo.triggerRouteUpdate() {
// Random time in interval 64-127ms
- uint16_t time = call Random.rand16();
- time &= 0x3f;
- time += 64;
+ uint16_t beaconDelay = call Random.rand16();
+ beaconDelay &= 0x3f;
+ beaconDelay += 64;
if (call BeaconTimer.gett0() + call BeaconTimer.getdt() -
- call BeaconTimer.getNow() >= time) {
+ call BeaconTimer.getNow() >= beaconDelay) {
call BeaconTimer.stop();
- call BeaconTimer.startOneShot(time);
+ call BeaconTimer.startOneShot(beaconDelay);
}
}
command void CtpInfo.triggerImmediateRouteUpdate() {
// Random time in interval 4-11ms
- uint16_t time = call Random.rand16();
- time &= 0x7;
- time += 4;
+ uint16_t beaconDelay = call Random.rand16();
+ beaconDelay &= 0x7;
+ beaconDelay += 4;
call BeaconTimer.stop();
- call BeaconTimer.startOneShot(time);
+ call BeaconTimer.startOneShot(beaconDelay);
}
command void CtpInfo.setNeighborCongested(am_addr_t n, bool congested) {
}
command void Model.putOnAirTo(int dest, message_t* msg, bool ack, sim_time_t endTime, double power) {
- gain_entry_t* link = sim_gain_first(sim_node());
+ gain_entry_t* neighborEntry = sim_gain_first(sim_node());
requestAck = ack;
outgoing = msg;
dbg("CpmModelC", "Node %i transmitting to %i, finishes at %llu.\n", sim_node(), dest, endTime);
- while (link != NULL) {
- int other = link->mote;
+ while (neighborEntry != NULL) {
+ int other = neighborEntry->mote;
sim_gain_put(other, msg, endTime, ack && (other == dest), power + sim_gain_value(sim_node(), other));
- link = sim_gain_next(link);
+ neighborEntry = sim_gain_next(neighborEntry);
}
}
double sensitivity = 4.0;
gain_entry_t* sim_gain_allocate_link(int mote);
-void sim_gain_deallocate_link(gain_entry_t* link);
+void sim_gain_deallocate_link(gain_entry_t* linkToDelete);
gain_entry_t* sim_gain_first(int src) __attribute__ ((C, spontaneous)) {
if (src > TOSSIM_MAX_NODES) {
return connectivity[src];
}
-gain_entry_t* sim_gain_next(gain_entry_t* link) __attribute__ ((C, spontaneous)) {
- return link->next;
+gain_entry_t* sim_gain_next(gain_entry_t* currentLink) __attribute__ ((C, spontaneous)) {
+ return currentLink->next;
}
void sim_gain_add(int src, int dest, double gain) __attribute__ ((C, spontaneous)) {
}
gain_entry_t* sim_gain_allocate_link(int mote) {
- gain_entry_t* link = (gain_entry_t*)malloc(sizeof(gain_entry_t));
- link->next = NULL;
- link->mote = mote;
- link->gain = -10000000.0;
- return link;
+ gain_entry_t* newLink = (gain_entry_t*)malloc(sizeof(gain_entry_t));
+ newLink->next = NULL;
+ newLink->mote = mote;
+ newLink->gain = -10000000.0;
+ return newLink;
}
-void sim_gain_deallocate_link(gain_entry_t* link) __attribute__ ((C, spontaneous)) {
- free(link);
+void sim_gain_deallocate_link(gain_entry_t* linkToDelete) __attribute__ ((C, spontaneous)) {
+ free(linkToDelete);
}
void sim_gain_set_sensitivity(double s) __attribute__ ((C, spontaneous)) {