/* Interface function to be called by a channel to obtain read access to the reception packet. Returns NULL is the packet is currently not accessible. Can be called when processing the TBX_MB_EVENT_ID_PDU_RECEIVED event.  */
static tTbxMbTpPacket * TbxMbRtuGetRxPacket(tTbxMbTp transport)
/* Interface function to be called by a channel to obtain read access to the reception packet. Returns NULL is the packet is currently not accessible. Can be called when processing the TBX_MB_EVENT_ID_PDU_RECEIVED event.  */
static tTbxMbTpPacket * TbxMbRtuGetRxPacket(tTbxMbTp transport)
{
  tTbxMbTpPacket * result = NULL;
  TBX_ASSERT(transport != NULL);
  if (transport != NULL)
  {
    tTbxMbTpCtx * tpCtx = (tTbxMbTpCtx *)transport;
    TBX_ASSERT(tpCtx->type == TBX_MB_RTU_CONTEXT_TYPE);
    TbxCriticalSectionEnter();
    uint8_t currentState = tpCtx->state;
    TbxCriticalSectionExit();
    if (currentState == TBX_MB_RTU_STATE_VALIDATION)
    {
      result = &tpCtx->rxPacket;
    }
  }
  return result;
}