The following is an overview of the Wireless LAN library.
Set up wireless LAN
To connect to a wireless LAN, register a wireless LAN profile that specifies the SSID and security of the wireless LAN network in advance. If necessary, register the root certificate and client certificate as well. These settings are made in the WLAN settings in the System menu, so you usually do not need to make any settings in the user application.To configure these settings in your application, use the following Wireless LAN settings functions.
SysSetWLANApInfo function
SysSetWLANApInfoEap function
SysSetWLANConfigValue function
SysSetWLANRootcert function
SysSetWLANClientcert function
You can get the current setting with the following function.
SysGetWLANApInfo function
SysGetWLANApInfoEap function
SysGetWLANConfigValue function
Connect to a wireless LAN network
Use Connection control functions to connect to the wireless LAN network and monitor the connection status.Follow the steps below to connect.
- Enable wireless LAN with SysSetWLANPower function.
- Initialize the wireless LAN with the SysWLANInit function.
- Call SysGetWLANConnectStatus function and wait until the wireless LAN is connected. In the meantime, you need to keep calling the Idle function.
Even after connecting, you need to keep calling the Idle function while the wireless LAN is enabled.
When the communication process is completed, disable the wireless LAN with the SysSetWLANPower function
Sampleint status; ... // Enable WLAN SysSetWLANPower(SYS_WLAN_POWER_AUTO); SysWLANInit(NULL); // Wait for connection while(1){ if (SysGetWLANConnectStatus(&status)){ if (status == SYS_WLAN_STATUS_CONNECTED){ break; } } // Check timeout. ... Idle(); } ... // Disable WLAN SysSetWLANPower(SYS_WLAN_POWER_OFF); ...
You can get the current state with the following functions.
SysGetConnectInfoWlan function
SysGetDhcpInfoWlan function
SysGetWLANSignalLevel function
SysGetWLANPower function
Communicate with socket
There are two types of socket functions in this library: synchronous type and asynchronous type.Synchronous and asynchronous types cannot be used together.
Asynchronous socket functions
When you call an asynchronous function, the callback function notifies you of the response.Write an asynchronous program using the following functions.
InitSc function
RegSocketCallbackSc function
SocketSc function
setsockopt function
ConnectSc function
SendSc function
RecvSc function
SendtoSc function
RecvfromSc function
CloseSc function
BindSc function
ListenSc function
AcceptSc function
gethostbyname function
nmi_inet_addr function
Synchronous socket functions
When you call a synchronous function, it waits for a response in the called function. (Blocking operation)Write a synchronous program using the following functions.
SyncInitSc function
SyncSocketSc function
SyncConnectSc function
SyncSendSc function
SyncRecvSc function
SyncSendtoSc function
SyncRecvfromAddrSc function
SyncCloseSc function
SyncBindSc function
SyncListenSc function
SyncAcceptSc function
SyncGetIp function
SyncPing function
Last updated: 2020/11/23