Exemplo n.º 1
0
uint8_t RMAC_PutPayload(uint8_t *buf, size_t bufSize, uint8_t payloadSize, RPHY_FlagsType flags) {
  if (flags&RPHY_PACKET_FLAGS_REQ_ACK) {
    RMAC_BUF_TYPE(buf) = RMAC_MSG_TYPE_DATA|RMAC_MSG_TYPE_REQ_ACK;
  } else {
    RMAC_BUF_TYPE(buf) = RMAC_MSG_TYPE_DATA;
  }
  RMAC_ExpectedAckSeqNr = RMAC_SeqNr;
  RMAC_BUF_SEQN(buf) = RMAC_SeqNr++;
  return RPHY_PutPayload(buf, bufSize, payloadSize+RMAC_HEADER_SIZE, flags);
}
Exemplo n.º 2
0
uint8_t RMAC_SendACK(RPHY_PacketDesc *packet) {
  /* send an ack message back: this is is of type ack with src and dst address */
  RMAC_BUF_TYPE(packet->data) = RMAC_MSG_TYPE_ACK; /* set type to ack */
  /* use same sequence number as in the received package, so no change */
  return RPHY_PutPayload(packet->data, packet->dataSize, RMAC_HEADER_SIZE+RNWK_HEADER_SIZE);
}
Exemplo n.º 3
0
uint8_t RMAC_PutPayload(uint8_t *buf, size_t bufSize, uint8_t payloadSize) {
  RMAC_BUF_TYPE(buf) = RMAC_MSG_TYPE_DATA;
  RMAC_ExpectedAckSeqNr = RMAC_SeqNr;
  RMAC_BUF_SEQN(buf) = RMAC_SeqNr++;
  return RPHY_PutPayload(buf, bufSize, payloadSize+RMAC_HEADER_SIZE);
}
Exemplo n.º 4
0
uint8_t RMAC_SendACK(RPHY_PacketDesc *rxPacket, RPHY_PacketDesc *ackPacket) {
  RMAC_BUF_TYPE(ackPacket->phyData) = RMAC_MSG_TYPE_ACK; /* set type to ack */
  RMAC_BUF_SEQN(ackPacket->phyData) = RMAC_BUF_SEQN(rxPacket->phyData);
  /* use same sequence number as in the received package, so no change */
  return RPHY_PutPayload(ackPacket->phyData, ackPacket->phySize, RMAC_HEADER_SIZE+RNWK_HEADER_SIZE, RPHY_PACKET_FLAGS_NONE);
}