Analog Devices Wi-Fi Software Reference Manual  Release 1.0.0
Functions

Radio Module. More...

Functions

ADI_WIFI_RESULT adi_wifi_radio_Init (ADI_CALLBACK pCallbackFunc)
 Initialize Wi-Fi module. More...
 
ADI_WIFI_RESULT adi_wifi_radio_GetConnectionStatus (uint8_t *const pStatus)
 Get information about the connection. More...
 
ADI_WIFI_RESULT adi_wifi_radio_GetAP (uint8_t *const pAPInfo, uint32_t nBufSize)
 Get information on the access point the Wi-Fi module is connected to. More...
 
ADI_WIFI_RESULT adi_wifi_radio_TestAT ()
 Test AT command. More...
 
ADI_WIFI_RESULT adi_wifi_radio_Restart ()
 Restart Wi-Fi module. More...
 
ADI_WIFI_RESULT adi_wifi_radio_GetVersionInfo (uint8_t *const pVersionInfoBuf, uint32_t nBufSize)
 Get the AT command version and SDK version info. More...
 
ADI_WIFI_RESULT adi_wifi_radio_SetWiFiMode (uint32_t nMode)
 Set the Wi-Fi mode. More...
 
ADI_WIFI_RESULT adi_wifi_radio_ConnectToAP (const uint8_t *const pSSID, const uint8_t *const pPassword, const uint8_t *const pBSSID)
 Connect to the access point. More...
 
ADI_WIFI_RESULT adi_wifi_radio_DisconnectFromAP ()
 Disconnect from the access point. More...
 
ADI_WIFI_RESULT adi_wifi_radio_EstablishTCPConnection (ADI_WIFI_TCP_CONNECT_CONFIG *const pTCPConnect)
 Establish TCP connection. More...
 
ADI_WIFI_RESULT adi_wifi_radio_SendData (ADI_WIFI_SEND_DATA_CONFIG *const pSendDataConfig, ADI_WIFI_AT_CMDCODE eCipSendCmd)
 Send data to server. More...
 
ADI_WIFI_RESULT adi_wifi_radio_EnableMultipleConnections (uint8_t nEnable)
 Enable/disable multiple connections. More...
 
ADI_WIFI_RESULT adi_wifi_radio_MQTTConnect (ADI_WIFI_MQTT_CONNECT_CONFIG *const pMQTTConnect)
 Connect to a MQTT broker. More...
 
ADI_WIFI_RESULT adi_wifi_radio_MQTTPublish (ADI_WIFI_PUBLISH_CONFIG *const pPublishConfig)
 Publish MQTT data. More...
 
ADI_WIFI_RESULT adi_wifi_radio_MQTTDisconnect (uint32_t nLinkID)
 Disconnect from the MQTT broker. More...
 
ADI_WIFI_RESULT adi_wifi_radio_MQTTPing (uint32_t nLinkID)
 Ping the MQTT broker. More...
 
ADI_WIFI_RESULT adi_wifi_radio_MQTTSubscribe (ADI_WIFI_SUBSCRIBE_CONFIG *const pSubscribeConfig)
 Subscribe to a topic. More...
 
ADI_WIFI_RESULT adi_wifi_GetEvent (ADI_WIFI_AT_CMDCODE eCommandType)
 Application event interface. More...
 
ADI_WIFI_RESULT adi_wifi_ParseSubscriberData ()
 Parse the +IPD messages received when the Wi-Fi module is acting as an MQTT subscriber. More...
 
void adi_wifi_GetData (uint8_t *const pPacket, uint32_t *nValidBytes)
 Get data packet. More...
 

Detailed Description

Radio Module.

The set of functions in this module provide an interface for applications to interact with the radio. This module provides encoding and decoding of of radio packets and calls into the Transport Abstraction Layer for physical layer communication.

Function Documentation

§ adi_wifi_GetData()

void adi_wifi_GetData ( uint8_t *const  pPacket,
uint32_t *  nValidBytes 
)

Get data packet.

Parameters
[out]pPacket: Data received by the Wi-Fi module. Must be ADI_WIFI_MAX_DATA_SIZE bytes.
[out]nValidBytes: Number of valid bytes in pPacket.

§ adi_wifi_GetEvent()

ADI_WIFI_RESULT adi_wifi_GetEvent ( ADI_WIFI_AT_CMDCODE  eCommandType)

Application event interface.

Parameters
[in]eCommandType: Type of command that is being processed.
Returns
ADI_WIFI_RESULT
  • #ADI_WIFI_SUCCESS is returned upon success.
  • #ADI_WIFI_FAILURE is returned upon failure.

§ adi_wifi_ParseSubscriberData()

ADI_WIFI_RESULT adi_wifi_ParseSubscriberData ( )

Parse the +IPD messages received when the Wi-Fi module is acting as an MQTT subscriber.

Returns
ADI_WIFI_RESULT
  • #ADI_WIFI_SUCCESS is returned if the expected response was received.
  • #ADI_WIFI_FAILURE is returned upon failure.
Note
The data obtained during this command is only valid until another AT command is called.

§ adi_wifi_radio_ConnectToAP()

ADI_WIFI_RESULT adi_wifi_radio_ConnectToAP ( const uint8_t *const  pSSID,
const uint8_t *const  pPassword,
const uint8_t *const  pBSSID 
)

Connect to the access point.

Parameters
[in]pSSID: Access point's SSID.
[in]pPassword: Access point's password.
[in]pBSSID: (optional) Access point's MAC address. Used when there are access points with the same SSID. Set as NULL to ignore.
Returns
ADI_WIFI_RESULT
  • #ADI_WIFI_SUCCESS is returned upon success.
  • #ADI_WIFI_FAILURE is returned upon failure.
Note
: Escape character syntax is needed if SSID or password contains any special characters, such as , or ” or .

§ adi_wifi_radio_DisconnectFromAP()

ADI_WIFI_RESULT adi_wifi_radio_DisconnectFromAP ( )

Disconnect from the access point.

Returns
ADI_WIFI_RESULT
  • #ADI_WIFI_SUCCESS is returned upon success.
  • #ADI_WIFI_FAILURE is returned upon failure.

§ adi_wifi_radio_EnableMultipleConnections()

ADI_WIFI_RESULT adi_wifi_radio_EnableMultipleConnections ( uint8_t  nEnable)

Enable/disable multiple connections.

Parameters
[in]nEnable: Set the state of multiple connections. 1 : Enable. 0 : Disable.
Returns
ADI_WIFI_RESULT
  • #ADI_WIFI_SUCCESS is returned upon success.
  • #ADI_WIFI_FAILURE is returned upon failure.

§ adi_wifi_radio_EstablishTCPConnection()

ADI_WIFI_RESULT adi_wifi_radio_EstablishTCPConnection ( ADI_WIFI_TCP_CONNECT_CONFIG *const  pTCPConnect)

Establish TCP connection.

Parameters
[in]pTCPConnect: Configuration data to establish the connection.
                        - nLinkID is used in the case of multiple connections. It is the ID of the network connection.
                          Can be 0-(#ADI_WIFI_RADIO_MAX_NUM_CONNECTIONS - 1). For a single connection system, set to be ADI_WIFI_RADIO_MAX_NUM_CONNECTIONS.
                    - pType is the type of connection. Should be "TCP" or "SSL".
                    - pIP is the remote server IP address as a string.
                    - pPort is the remote server port.
                    - nTCPKeepAlive is the detection time interval when TCP is kept alive, this function is disabled by default.
                        0 : Disable TCP keep-alive.
                        1 ~ 7200 : Detection time interval, unit: second.
Returns
ADI_WIFI_RESULT
  • #ADI_WIFI_SUCCESS is returned upon success.
  • #ADI_WIFI_FAILURE is returned upon failure.

§ adi_wifi_radio_GetAP()

ADI_WIFI_RESULT adi_wifi_radio_GetAP ( uint8_t *const  pAPInfo,
uint32_t  nBufSize 
)

Get information on the access point the Wi-Fi module is connected to.

The type of this command is "query". It's used to to query the AP to which the Station is already connected.

Parameters
[out]pAPInfo: Information about the access point in which the Wi-Fi module is connected. The format of this packet should resemble: <ssid>,<bssid>,<channel>,<rssi>.
[in]nBufSize: Size of the buffer pAPInfo.
Returns
ADI_WIFI_RESULT
  • #ADI_WIFI_SUCCESS is returned upon success.
  • #ADI_WIFI_FAILURE is returned upon failure.

§ adi_wifi_radio_GetConnectionStatus()

ADI_WIFI_RESULT adi_wifi_radio_GetConnectionStatus ( uint8_t *const  pStatus)

Get information about the connection.

The type of this command is "execute". It's used to get the connection status.

Parameters
[out]pStatus: One byte status of the Wi-Fi module.
  • 2: The Station is connected to an AP and its IP is obtained.
  • 3: The Station has created a TCP or UDP transmission.
  • 4: The TCP or UDP transmission of Station is disconnected.
  • 5: The Station does NOT connect to an AP.
Returns
ADI_WIFI_RESULT
  • #ADI_WIFI_SUCCESS is returned upon success.
  • #ADI_WIFI_FAILURE is returned upon failure.

§ adi_wifi_radio_GetVersionInfo()

ADI_WIFI_RESULT adi_wifi_radio_GetVersionInfo ( uint8_t *const  pVersionInfoBuf,
uint32_t  nBufSize 
)

Get the AT command version and SDK version info.

This AT command is used to check the version of AT commands and SDK, the type of which is "executed".

Parameters
[in]nBufSize: Size of the buffer pVersionInfoBuf.
[out]pVersionInfoBuf: Pointer to the buffer where the version info will be written.
Returns
ADI_WIFI_RESULT
  • #ADI_WIFI_SUCCESS is returned upon success.
  • #ADI_WIFI_FAILURE is returned upon failure.

§ adi_wifi_radio_Init()

ADI_WIFI_RESULT adi_wifi_radio_Init ( ADI_CALLBACK  pCallbackFunc)

Initialize Wi-Fi module.

Initialize the Wi-Fi transport layer driver and register the callback function.

Parameters
[in]pCallbackFunc: Pointer to the callback function to be passed to the transport layer.
Returns
ADI_WIFI_RESULT
  • #ADI_WIFI_SUCCESS is returned upon success.
  • #ADI_WIFI_FAILURE is returned upon failure.

§ adi_wifi_radio_MQTTConnect()

ADI_WIFI_RESULT adi_wifi_radio_MQTTConnect ( ADI_WIFI_MQTT_CONNECT_CONFIG *const  pMQTTConnect)

Connect to a MQTT broker.

Parameters
[in]pMQTTConnectStructure used to configure the MQTT connection.
  • nLinkID is used in the case of multiple connections. It is the ID of the network connection. Can be 0-4. Set to #ADI_WIFI_RADIO_MAX_NUM_CONNECTIONS for single connection mode.
  • nVersion is the MQTT publisher version.
  • pName is a pointer to the data buffer containing the publisher name.
  • nMQTTKeepAlive is the MQTT publisher <-> broker connection keep alive timeout.
Returns
ADI_WIFI_RESULT
  • #ADI_WIFI_SUCCESS is returned upon success.
  • #ADI_WIFI_FAILURE is returned upon failure.

§ adi_wifi_radio_MQTTDisconnect()

ADI_WIFI_RESULT adi_wifi_radio_MQTTDisconnect ( uint32_t  nLinkID)

Disconnect from the MQTT broker.

Parameters
[in]nLinkIDIt is the ID of the network connection in the case of multiple connections. Can be 0-4. Set to #ADI_WIFI_RADIO_MAX_NUM_CONNECTIONS for single connection mode.
Returns
ADI_WIFI_RESULT
  • #ADI_WIFI_SUCCESS is returned upon success.
  • #ADI_WIFI_FAILURE is returned upon failure.

§ adi_wifi_radio_MQTTPing()

ADI_WIFI_RESULT adi_wifi_radio_MQTTPing ( uint32_t  nLinkID)

Ping the MQTT broker.

This command can be used to ping the MQTT broker to keep the connection alive.

Parameters
[in]nLinkIDIt is the ID of the network connection in the case of multiple connections. Can be 0-4. Set to #ADI_WIFI_RADIO_MAX_NUM_CONNECTIONS for single connection mode.
Returns
ADI_WIFI_RESULT
  • #ADI_WIFI_SUCCESS is returned upon success.
  • #ADI_WIFI_FAILURE is returned upon failure.

§ adi_wifi_radio_MQTTPublish()

ADI_WIFI_RESULT adi_wifi_radio_MQTTPublish ( ADI_WIFI_PUBLISH_CONFIG *const  pPublishConfig)

Publish MQTT data.

Parameters
[in]ePublishConfigConfiguration structure to publish data.
                        - nLinkID is used in the case of multiple connections. It is the ID of the network connection. Can be 0-4. Set to #ADI_WIFI_RADIO_MAX_NUM_CONNECTIONS for
                          single connection mode.
                    - nQos is the type of quality of service for the packet. Valid options are 0, 1 and 2.
                    - pMQTTData is a pointer to the MQTT data to publish.
                    - nMQTTDataSize is size of the MQTT data being published.
                    - pTopic is a pointer to the topic to publish to. Must be smaller than #ADI_WIFI_MQTT_PACKET_SIZE -sizeof(ADI_DATA_PACKET) - 2u
                    - nPacketId is the packet id for this packet.
Returns
ADI_WIFI_RESULT
  • #ADI_WIFI_SUCCESS is returned upon success.
  • #ADI_WIFI_FAILURE is returned upon failure.
Note
: When sending \0, please send it as \0.

§ adi_wifi_radio_MQTTSubscribe()

ADI_WIFI_RESULT adi_wifi_radio_MQTTSubscribe ( ADI_WIFI_SUBSCRIBE_CONFIG *const  pSubscribeConfig)

Subscribe to a topic.

Parameters
[in]pSubscribeConfigConfiguration structure to subscribe to a topic.
                        - nLinkID is used in the case of multiple connections. It is the ID of the network connection. Can be 0-4. Set to #ADI_WIFI_RADIO_MAX_NUM_CONNECTIONS for
                          single connection mode.
                    - nQos is the type of quality of service for the packet. Valid options are 0, 1 and 2.
                    - pTopic is a pointer to the topic to subscribe to. Must be smaller than #ADI_WIFI_MQTT_PACKET_SIZE -sizeof(ADI_DATA_PACKET) - 2u
                    - nPacketId is the packet id for this packet.
Returns
ADI_WIFI_RESULT
  • #ADI_WIFI_SUCCESS is returned upon success.
  • #ADI_WIFI_FAILURE is returned upon failure.
Note
: When sending \0, please send it as \0.

§ adi_wifi_radio_Restart()

ADI_WIFI_RESULT adi_wifi_radio_Restart ( )

Restart Wi-Fi module.

The type of this command is "executed". It’s used to restart the module.

Returns
ADI_WIFI_RESULT
  • #ADI_WIFI_SUCCESS is returned upon success.
  • #ADI_WIFI_FAILURE is returned upon failure.

§ adi_wifi_radio_SendData()

ADI_WIFI_RESULT adi_wifi_radio_SendData ( ADI_WIFI_SEND_DATA_CONFIG *const  pSendDataConfig,
ADI_WIFI_AT_CMDCODE  eCipSendCmd 
)

Send data to server.

This command is actually three separate transactions. The first portion sends the length of data that will follow in the second data packet. Each data packet needs to be sent 20ms apart. The third portion of this only applies to packets who have a quality of service level greater than 0. This means that a response is expected to confirm that the data is been received by the server.

Parameters
[in]pSendDataConfigConfiguration structure to send data.
    • nLinkID is used in the case of multiple connections. It is the ID of the network connection. Can be 0-4. Set to #ADI_WIFI_RADIO_MAX_NUM_CONNECTIONS for single connection mode.
  • nDataLength is data length. Maximum is ADI_WIFI_MAX_DATA_SIZE bytes.
  • pData is a pointer to the data buffer to be sent.
Parameters
[in]eCipSendCmdType of data to send to the remote server.
Returns
ADI_WIFI_RESULT
  • #ADI_WIFI_SUCCESS is returned upon success.
  • #ADI_WIFI_FAILURE is returned upon failure.
Note
: When sending \0, please send it as \0.

§ adi_wifi_radio_SetWiFiMode()

ADI_WIFI_RESULT adi_wifi_radio_SetWiFiMode ( uint32_t  nMode)

Set the Wi-Fi mode.

The type of this command is "executed". This setting will be stored in the flash system parameter area. It won’t be erased even when the power is off.

Parameters
[in]nMode: Mode to set. 1: Station mode. 2: SoftAP mode (access point). 3: SoftAP + Station mode.
Returns
ADI_WIFI_RESULT
  • #ADI_WIFI_SUCCESS is returned upon success.
  • #ADI_WIFI_FAILURE is returned upon failure.

§ adi_wifi_radio_TestAT()

ADI_WIFI_RESULT adi_wifi_radio_TestAT ( )

Test AT command.

The type of this command is "executed". It's used to test the hardware setup of the Wi-Fi module.

Returns
ADI_WIFI_RESULT
  • #ADI_WIFI_SUCCESS is returned upon success.
  • #ADI_WIFI_FAILURE is returned upon failure.