Support RADIO_PARAM_LAST_PACKET_TIMESTAMP with get_object()
This commit is contained in:
parent
ca715fdd6b
commit
33e86042e5
|
@ -55,6 +55,7 @@ const struct simInterface radio_interface;
|
||||||
char simReceiving = 0;
|
char simReceiving = 0;
|
||||||
char simInDataBuffer[COOJA_RADIO_BUFSIZE];
|
char simInDataBuffer[COOJA_RADIO_BUFSIZE];
|
||||||
int simInSize = 0;
|
int simInSize = 0;
|
||||||
|
rtimer_clock_t simLastPacketTimestamp = 0;
|
||||||
char simOutDataBuffer[COOJA_RADIO_BUFSIZE];
|
char simOutDataBuffer[COOJA_RADIO_BUFSIZE];
|
||||||
int simOutSize = 0;
|
int simOutSize = 0;
|
||||||
char simRadioHWOn = 1;
|
char simRadioHWOn = 1;
|
||||||
|
@ -287,7 +288,13 @@ set_value(radio_param_t param, radio_value_t value)
|
||||||
static radio_result_t
|
static radio_result_t
|
||||||
get_object(radio_param_t param, void *dest, size_t size)
|
get_object(radio_param_t param, void *dest, size_t size)
|
||||||
{
|
{
|
||||||
return RADIO_RESULT_NOT_SUPPORTED;
|
if(param == RADIO_PARAM_LAST_PACKET_TIMESTAMP) {
|
||||||
|
if(size != sizeof(rtimer_clock_t) || !dest) {
|
||||||
|
return RADIO_RESULT_INVALID_VALUE;
|
||||||
|
}
|
||||||
|
*(rtimer_clock_t *)dest = (rtimer_clock_t)simLastPacketTimestamp;
|
||||||
|
return RADIO_RESULT_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static radio_result_t
|
static radio_result_t
|
||||||
|
|
|
@ -62,6 +62,7 @@ import org.contikios.cooja.util.CCITT_CRC;
|
||||||
* <p>
|
* <p>
|
||||||
* <li>int simInSize (size of received data packet)
|
* <li>int simInSize (size of received data packet)
|
||||||
* <li>byte[] simInDataBuffer (data of received data packet)
|
* <li>byte[] simInDataBuffer (data of received data packet)
|
||||||
|
* <li>int64_t simLastPacketTimestamp (timestamp of the last received data packet)
|
||||||
* <p>
|
* <p>
|
||||||
* <li>int simOutSize (size of transmitted data packet)
|
* <li>int simOutSize (size of transmitted data packet)
|
||||||
* <li>byte[] simOutDataBuffer (data of transmitted data packet)
|
* <li>byte[] simOutDataBuffer (data of transmitted data packet)
|
||||||
|
@ -190,6 +191,8 @@ public class ContikiRadio extends Radio implements ContikiMoteInterface, PolledA
|
||||||
lastEventTime = mote.getSimulation().getSimulationTime();
|
lastEventTime = mote.getSimulation().getSimulationTime();
|
||||||
lastEvent = RadioEvent.RECEPTION_STARTED;
|
lastEvent = RadioEvent.RECEPTION_STARTED;
|
||||||
|
|
||||||
|
myMoteMemory.setInt64ValueOf("simLastPacketTimestamp", lastEventTime);
|
||||||
|
|
||||||
this.setChanged();
|
this.setChanged();
|
||||||
this.notifyObservers();
|
this.notifyObservers();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue