Host library for controlling a WiConnect enabled Wi-Fi module.

Dependents:   wiconnect-ota_example wiconnect-web_setup_example wiconnect-test-console wiconnect-tcp_server_example ... more

Embed: (wiki syntax)

« Back to documentation index

Miscellaneous Methods

Miscellaneous Methods
[Socket]

Miscellaneous socket methods. More...

Functions

WiconnectResult closeAllSockets ()
 Close all opened sockets.
WiconnectResult registerSocketIrqHandler (Pin irqPin, const Callback &handler)
 Register a host pin as an external interrupt.
WiconnectResult unregisterSocketIrqHandler (Pin irqPin)
 Unregister a previously registered IRQ pin.
WiconnectResult connect (WiconnectSocket &socket, SocketType type, const char *host, uint16_t remortPort, uint16_t localPort, const void *args GPIO_IRQ_ARG)
 Connect to remote server.

Detailed Description

Miscellaneous socket methods.


Function Documentation

WiconnectResult closeAllSockets (  ) [inherited]

Close all opened sockets.

Note:
This closes all open sockets on the MODULE side. Socket objects on the HOST side will be still open until issuing a read/write command to the module using the socket handle.
Returns:
Result of method. See WiconnectResult
WiconnectResult connect ( WiconnectSocket socket,
SocketType  type,
const char *  host,
uint16_t  remortPort,
uint16_t  localPort,
const void *args  GPIO_IRQ_ARG 
) [inherited]

Connect to remote server.

This is the base method used by all the other connect methods.

Parameters:
[out]socketWiconnectSocket object of opened connection.
[in]typeThe SocketType of connection to open
[in]hostThe host/IP address of the remote server
[in]remortPortThe port of the remote server
[in]localPortThe port of the module's side of the connection
[in]argsDepedent on the connection type
[in]irqPinData available external interrupt pin. See registerSocketIrqHandler() for more info
Returns:
Result of method. See WiconnectResult
WiconnectResult registerSocketIrqHandler ( Pin  irqPin,
const Callback handler 
) [inherited]

Register a host pin as an external interrupt.

When the external interrupt is triggered, the supplied callback is executed.

Note:
WICONNECT_GPIO_IRQ_ENABLED must be defined to use this feature

This should be called before calling one of the connect methods below with an irqPin parameter.

Basically how this works is: 1. The supplied irqPin is configured as an external interrupt pin. 2. A connection is opened and configured with the same irqPin. This irqPin physically connected to a GPIO on the WiFi module. 3. When the WiFi module has data to send to the HOST it asserts the irqPin. 4. The irqPin interrupt executes and calls the supplied handler. 5. The handler should notify the HOST that the given irqPin has triggered and have the associated socket read data from the module.

Note:
arg1 of the handler contains the irqPin
Parameters:
[in]irqPinThe HOST pin to configure as an external interrupt. This pin should be physically connected to a module GPIO.
[in]handlerCallback to be executed with the external irqPin interrupt triggers
Returns:
Result of method. See WiconnectResult
WiconnectResult unregisterSocketIrqHandler ( Pin  irqPin ) [inherited]

Unregister a previously registered IRQ pin.

This disables the given irqPin as an external interrupt. Refer to registerSocketIrqHandler() for more information.

Parameters:
[in]irqPinThe HOST pin to unregister
Returns:
Result of method. See WiconnectResult