added check that outgoing packet was not discarded from simulator
This commit is contained in:
parent
6aafd5582d
commit
7ec1a4f7aa
2 changed files with 14 additions and 9 deletions
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: cooja-radio.c,v 1.3 2007/05/28 15:47:07 fros4943 Exp $
|
||||
* $Id: cooja-radio.c,v 1.4 2007/05/29 12:53:49 fros4943 Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
@ -43,14 +43,14 @@
|
|||
const struct simInterface radio_interface;
|
||||
|
||||
// COOJA variables
|
||||
char simTransmitting;
|
||||
char simReceiving;
|
||||
char simTransmitting = 0;
|
||||
char simReceiving = 0;
|
||||
|
||||
char simInDataBuffer[COOJA_RADIO_BUFSIZE];
|
||||
int simInSize;
|
||||
char simInPolled;
|
||||
int simInSize = 0;
|
||||
char simInPolled = 0;
|
||||
char simOutDataBuffer[COOJA_RADIO_BUFSIZE];
|
||||
int simOutSize;
|
||||
int simOutSize = 0;
|
||||
|
||||
char simRadioHWOn = 1;
|
||||
int simSignalStrength = -200;
|
||||
|
@ -232,6 +232,11 @@ radio_send(const u8_t *payload, u16_t payload_len)
|
|||
return COOJA_RADIO_DROPPED;
|
||||
}
|
||||
|
||||
if(simOutSize <= 0) {
|
||||
inSendFunction = 0;
|
||||
return COOJA_RADIO_DROPPED;
|
||||
}
|
||||
|
||||
// - Initiate transmission -
|
||||
simTransmitting = 1;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: ContikiRadio.java,v 1.13 2007/04/23 11:58:20 fros4943 Exp $
|
||||
* $Id: ContikiRadio.java,v 1.14 2007/05/29 12:53:49 fros4943 Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.contikimote.interfaces;
|
||||
|
@ -348,13 +348,13 @@ public class ContikiRadio extends Radio implements ContikiMoteInterface,
|
|||
if (!isTransmitting && myMoteMemory.getByteValueOf("simTransmitting") == 1) {
|
||||
int size = myMoteMemory.getIntValueOf("simOutSize");
|
||||
if (size <= 0) {
|
||||
logger.warn("Skipping zero sized Contiki packet");
|
||||
logger.warn("Skipping zero sized Contiki packet (no size)");
|
||||
myMoteMemory.setByteValueOf("simTransmitting", (byte) 0);
|
||||
return;
|
||||
}
|
||||
packetFromMote = myMoteMemory.getByteArray("simOutDataBuffer", size);
|
||||
if (packetFromMote == null || packetFromMote.length == 0) {
|
||||
logger.warn("Skipping zero sized Contiki packet");
|
||||
logger.warn("Skipping zero sized Contiki packet (no buffer)");
|
||||
myMoteMemory.setByteValueOf("simTransmitting", (byte) 0);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue