Data Structures | Defines | Functions

wlp_api.h File Reference

oWL Pico API More...

#include <stdint.h>
#include "wlp_proto.h"

Go to the source code of this file.

Data Structures

struct  wlp_network_t
struct  wlp_network_list

Defines

#define WLP_FAILURE   -1
#define WLP_ERR_PARAM   -2
#define WLP_ERR_MEM   -3
#define WLP_ERR_CONN   -4
#define WLP_ERR_STATE   -5
#define WLP_ERR_PARSE   -6
#define WLP_ERR_PATH   -7
#define WLP_ERR_TYPE   -8
#define WLP_ERR_PERM   -9
#define WLP_ERR_NOTSUPP   -10
#define WLP_ERR_RANGE   -11
#define WLP_ERR_SIZE   -12
#define WLP_ERR_AGAIN   -13
#define WLP_ERR_BUSY   -14
#define WLP_ERR_DISABLED   -15
#define WLP_ERR_PROTO   -16
#define WLP_ERR_TIMEOUT   -17
#define WLP_ERR_IGNORED   -18
#define WLP_ERR_CANCEL   -19
#define WLP_ERR_SYNC   -20
#define WLP_ERR_ABORT   -21
#define WLP_ERR_INUSE   -22
#define WLP_INVALID_SOCKET_ID   0
#define WLP_INTERFACE_UART   0
#define WLP_INTERFACE_SPI   1

Functions

int wlp_init (int interface, int(*readf)(void *ctx, void *data, int len), int(*writef)(void *ctx, const void *data, int len), void(*selectf)(void *ctx, int select), void *ctx)
 Initialize the wifi device.
void wlp_set_yield_cb (void(*yieldf)(void *ctx), void *ctx)
 Register a callback that will be invoked when wlp_api is idle.
void wlp_irq (void)
 Handler for interrupts from device.
int wlp_set_baudrate (uint32_t baudrate, uint8_t rtscts)
 Change the baudrate of the device.
int wlp_reset (void)
int wlp_fw_upgrade (uint8_t method, struct ip_addr *addr, uint16_t port, const char *path)
 Prepare the device for a firmware upgrade operation.
int wlp_get_fw_version (uint32_t *code, char *build, int build_len, char *hw_rev, int hw_rev_len)
 Get the firmware version.
int wlp_get_fw_caps (uint8_t *cap_flags)
 Get WiFi device capabilities.
int wlp_scan (struct wl_ssid_t *ssid, void(*complete_cb)(void *ctx, int cnt), void *ctx)
int wlp_get_network_list (struct wlp_network_list **netlist)
void wlp_set_link_cb (void(*link_cb)(void *ctx, int link), void *ctx)
 Set a wifi link status callback function.
int wlp_linkup (struct wl_ssid_t *ssid, const char *key, enum wlp_auth_mode auth)
 Connect the wifi link.
int wlp_linkdown (void)
 Disconnect the wifi link.
int wlp_get_hwaddr (struct wl_mac_addr_t *hwaddr)
 Get the interface MAC address.
int wlp_get_network (struct wlp_network_t *net)
 Get the 802.11 network.
void wlp_set_ipaddr_cb (void(*addr_cb)(void *ctx, const struct ip_addr *addr), void *ctx)
 Register a callback that will be invoked when an IP address is set.
int wlp_set_ipaddr (const struct ip_addr *ip, const struct ip_addr *netmask, const struct ip_addr *gw, const struct ip_addr *dns)
 Set a static IP address.
int wlp_get_ipaddr (struct ip_addr *ip, struct ip_addr *netmask, struct ip_addr *gw, struct ip_addr *dns)
 Get the current IP address parameters.
int wlp_set_dhcp (int enable)
 Request or release IP address through DHCP.
int wlp_get_dhcp (int *enabled)
 Get the current DHCP configuration.
int wlp_set_dhcpd (int enable)
 Start or stop the device DHCP server.
int wlp_socket (int type, int proto)
 Creates an endpoint for communication and returns a socket id.
int wlp_set_conn_cb (int sockid, void(*conn_cb)(void *ctx, int sockid, int connected), void *ctx)
 Register a connection status callback.
int wlp_set_recv_cb (int sockid, void(*recv_cb)(void *ctx, int sockid, int len), void *ctx)
 Register a data pending callback.
int wlp_bind (int sockid, const struct ip_addr *addr, uint16_t port)
 Assign an address for a socket.
int wlp_listen (int sockid, int backlog, void(*listen_cb)(void *ctx, int sockid), void *ctx)
 Configure the socket to listen for incoming connections.
int wlp_connect (int sockid, const struct ip_addr *ip, uint16_t port)
 Initiate a connection on a socket.
int wlp_accept (int sockid)
 Accept a connection on a socket.
int wlp_close (int sockid)
 Close a socket.
int wlp_recv (int sockid, char *buf, int16_t len)
 Read data from a socket.
int wlp_send (int sockid, const char *buf, int16_t len)
 Send data to a socket.
int wlp_sendto (int sockid, const char *buf, int16_t len, const struct ip_addr *ip, uint16_t port)
 Send data to a specified address from a socket.
int wlp_get_peeraddr (int sockid, struct ip_addr *peer)
 Get name of connected peer socket.
int wlp_get_hostbyname (const char *host, void(*lookup_cb)(void *ctx, const struct ip_addr *ip), void *ctx)
 Get network address given a dns name.
void wlp_poll (void)
 Event progress function.
int wlp_set_mode (uint8_t mode)
 Set the Wi-Fi mode to AP or STA.
int wlp_get_mode (uint8_t *mode)
 Check if the device is currently in AP or STA mode.
int wlp_set_channel (uint8_t channel)
 Set the channel. Only supported when mode is WLP_MODE_AP.
int wlp_set_wakeup_cb (void(*wakeupf)(void *ctx, int enable), void *ctx)
 Register a callback that will be called to wakeup the wifi device.
int wlp_set_ps (int enable)
 Enable or disable WiFi power save.
int wlp_conf_ps (uint8_t use_ps_poll, uint32_t ps_traffic_timeout, uint32_t ps_delay, uint8_t rx_all_dtim, uint16_t listen_interval)
 Configure WiFi power save parameters.
int wlp_set_led (int enable)
 Enable/disable LEDs on the device.
int wlp_set_heartbeat (uint32_t ms_period)
 Configure the link heartbeat.
int wlp_set_poll_period (uint32_t ms_period)
 Configure the device IP-stack poll frequency.

Detailed Description

oWL Pico API

Author:
H&D Wireless AB

Introduction

This is the documentation for the oWL Pico API.


Define Documentation

#define WLP_ERR_ABORT   -21

Aborted

#define WLP_ERR_AGAIN   -13

Retry later

#define WLP_ERR_BUSY   -14

Busy

#define WLP_ERR_CANCEL   -19

Canceled by remote

#define WLP_ERR_CONN   -4

No connection

#define WLP_ERR_DISABLED   -15

Function is disabled

#define WLP_ERR_IGNORED   -18

Ignored, no effect

#define WLP_ERR_INUSE   -22

Already in use

#define WLP_ERR_MEM   -3

Out of memory

#define WLP_ERR_NOTSUPP   -10

Operation not supported

#define WLP_ERR_PARAM   -2

Parameter error

#define WLP_ERR_PARSE   -6

Input parsing error

#define WLP_ERR_PATH   -7

Path not found

#define WLP_ERR_PERM   -9

No permission

#define WLP_ERR_PROTO   -16

Protocol error

#define WLP_ERR_RANGE   -11

Out of range

#define WLP_ERR_SIZE   -12

Bad size

#define WLP_ERR_STATE   -5

Invalid state

#define WLP_ERR_SYNC   -20

Sync error

#define WLP_ERR_TIMEOUT   -17

Timeout

#define WLP_ERR_TYPE   -8

Incompatible type

#define WLP_FAILURE   -1

General failure