Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Wireless Manager API Implementation

Anchor10454111045411µC/TCP-IP supports only wireless devices which include an integrated wireless supplicant (i.e., the client-side software that performs scan and login requests). This kind of hardware requires to send management command to device to accomplish some operation such as scan, join, set MAC address, etc. Some of these management command may take a while to be completed. For those command most of wireless device return the command result via a management frame which must be received like a packet. So, the Wireless Manager must provide mechanisms to send management commands, and then return once the management command is completed. anchor

10290861029086The Wireless Manager API should be implemented as follows:

Anchor1027691 1027691

 

...

rowspan11

...

Listing 7-23 Wireless Manager

L7-23(1) Wireless Manager initialization function pointer

...

L7-23(2) Wireless Manager start function pointer

...

L7-23(3) Wireless Manager stop function pointer

...

L7-23(4) Wireless Manager access point scan pointer

...

L7-23(5) Wireless Manager access point join pointer

...

L7-23(6) Wireless Manager access point leave pointer

...

L7-23(7) Wireless Manager IO control pointer

...

L7-23(8) Wireless Manager device driver management pointer

...

L7-23(9) Wireless Manager signal response signal pointer

...

Anchor10277021027702

μC/TCP-IP provides code that is compatible with most wireless device that embed the wireless supplicant. However, extended functionality must be implemented on a per wireless device basis. If additional functionality is required, it may be necessary to create an application specific Wireless Manager.anchor

10277031027703Note: It is the Wireless Manager developers’ responsibility to ensure that all of the functions listed within the API are properly implemented and that the order of the functions within the API structure is correct. Anchor10277041027704

This sections that follow describe the interactions between the device driver and the Wireless Manager layer provided with µC/TCP-IP. Anchor10277081027708 Image Removed

...

Image Added

Figure 7-18 Interactions between the device driver and the Wireless Manager layer

...

F7-18(1) All management functionality present in the Wireless Manager API uses a simple state machine that uses a state machine context set and updated by the device driver. The state machine context contains some fields use by the state machine to know what it should be done after the call. Basically, the state machine is implemented in NetWiFiMgr_MgmtHadler() that calls NetDev_MgmtExecuteCmd() to start and execute the management command, following the state machine context, the state machine can wait to receive the response and then calls NetDev_MgmtProcessResp() to analyze the response data and rearrange the data.

...

F7-18(2) NetDev_MgmtExecuteCmd() can executes a management command directly if it doesn’t require to received a response or just initialize the management command when a response is needed to complete the command. The function let know to the state machine of what should be done after by setting the state machine context that is passed as pointer argument to the function.

...

F7-18(3) If no response is needed to complete the command then the NetWiFiMgr_MgmtHanlder() returns immediately. If the management command requires a response to complete the command then it returns only if the timeout has expired (i.e. the response not received) or if the Wireless Manager has been signalled and the response is analyzed and translated.

...

F7-18(4) When the response of the management command is received NetDev_MgmtProcessResp() is called to analyze and to translate the data for upper layers. Also this function must update the state machine context to let know if the management command is completed or if more data must be send to complete the current management command.

...

F7-18(5) The device driver can also uses the Wireless Manager to send management command defined within the driver during start and stop of the interface especially when a response is needed to complete the management command such as updating the wireless device firmware. Note that it’s not possible to use the Wireless Manager during the initialization since it’s not possible to receive packet and management frame before the initialization is completed.

...

F7-18(6) When data ready ISR occurs and the interface is signalled, the function NetIF_RxPkt() calls the driver to read the data from the wireless device no matter if its management frame or data packet.

...

F7-18(7) NetDev_Rx() must determine if the data received is a management frame or a packet and must set at least the frame type within the offset of the network buffer. See “Receiving Packets and Management Frames”

...

If the data read is a management frame that it’s not a response, the processing must be done in NetDev_DemuxMgmt() to let the stack increment his statistics.

...

F7-18(8) Once the data is read and the frame type set by the device driver then the buffer is passing to the wireless interface layer to be processed.

...

F7-18(9) NetIF_WiFi_Rx() uses the frame type within the buffer offset and set previously by the device driver to know which layer to call and pass the network buffer.

...

F7-18(10) If the data received is a packet then the 802x layer is called to process the packet as it’s should done for an Ethernet packet.

...

F7-18(11) If the data received is a management frame then 8 is called to determine what to do with the data. If it’s a response for a management command initialized previously then the Wireless Manager must be signalled. If it’s information about the wireless device state, then some operation on the stack could be done such as updating the link state of the interface. Note that the buffer offset section could be used by the device driver to help to determine what kind of data is contained in the data section of the buffer.

...

F7-18(12) When the data is a management response previously initialized then the Wireless Manager must be signalled by using the Wireless Manager API.