1.8.1.3 UDP Responder

The UDP responder application file (app_udp_responder.c) opens an UDP server socket and handles the messages defined in G3 Conformance certification tests.

The state machine is implemented in the APP_UDP_RESPONDER_Tasks() function. The different states are:
  • APP_UDP_RESPONDER_STATE_WAIT_TCPIP_READY: TCP/IP stack status is checked and when it is ready, the state is changed to APP_UDP_RESPONDER_STATE_OPENING_SERVER.
  • APP_UDP_RESPONDER_STATE_OPENING_SERVER: An UDP server socket is opened with the UDP port used in G3 Conformance certification tests (0xF0BF), using TCPIP_UDP_ServerOpen() function. A callback is registered using TCPIP_UDP_SignalHandlerRegister() function in order to be called when a new UDP packet is received.
  • APP_UDP_RESPONDER_STATE_SERVING_CONNECTION: UDP server socket is opened and received messages are handled, according to G3 Conformance certification tests. There is nothing more to do because received UDP packets are notified through _APP_UDP_RESPONDER_UdpRxCallback() callback function. In FreeRTOS mode the task is suspended forever using a semaphore.
  • APP_UDP_RESPONDER_STATE_ERROR: There was an error during TCP/IP stack initialization.
One TCP/IP stack callback is registered:
  • _APP_UDP_RESPONDER_UdpRxCallback(): A new UDP packet has been received. It is handled according to G3 Conformance certification tests and a response is sent if needed.