/** Same as AMPacket.setGroup */
command void setGroup(message_t* msg, am_group_t grp);
+
+ /**
+ * Check if the packet is properly formatted, and if the user
+ * forgot to call Packet.clear then format it properly.
+ * Return SUCCESS if the frame is now properly set up,
+ * or FAIL of the send operation should be aborted.
+ */
+ command error_t checkFrame(message_t* msg);
}
if( len > call Packet.maxPayloadLength() )
return EINVAL;
+ if( call Config.checkFrame(msg) != SUCCESS )
+ return FAIL;
+
call Packet.setPayloadLength(msg, len);
call AMPacket.setSource(msg, call AMPacket.address());
call AMPacket.setGroup(msg, call AMPacket.localGroup());
call Ieee154PacketLayer.setDestPan(msg, grp);
}
+ command error_t ActiveMessageConfig.checkFrame(message_t* msg)
+ {
+ if( ! call Ieee154PacketLayer.isDataFrame(msg) )
+ call Ieee154PacketLayer.createDataFrame(msg);
+
+ return SUCCESS;
+ }
+
/*----------------- CsmaConfig -----------------*/
async command bool CsmaConfig.requiresSoftwareCCA(message_t* msg)
call Ieee154PacketLayer.setDestPan(msg, grp);
}
+ command error_t ActiveMessageConfig.checkFrame(message_t* msg)
+ {
+ if( ! call Ieee154PacketLayer.isDataFrame(msg) )
+ call Ieee154PacketLayer.createDataFrame(msg);
+
+ return SUCCESS;
+ }
+
/*----------------- CsmaConfig -----------------*/
async command bool CsmaConfig.requiresSoftwareCCA(message_t* msg)