Marco Hsu / WIFI_API_32kRAM
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers wifi_api.h Source File

wifi_api.h

00001 
00002 
00003 #ifndef WIFI_API_H
00004 #define WIFI_API_H
00005 
00006 #include <stdbool.h>
00007 #include <stdint.h>
00008 
00009 /* @file
00010 * @brief Wi-Fi Connection API for NNN40.
00011 *
00012 *
00013 * @defgroup lib_driver_spi_master Software controlled SPI Master driver
00014 * @{
00015 * @ingroup nrf_drivers
00016 * @brief Software controlled SPI Master driver.
00017 *
00018 * Supported features:
00019 * - Operate two SPI masters independently or in parallel.
00020 * - Transmit and Receive given size of data through SPI.
00021 * - configure each SPI module separately through @ref spi_master_init.
00022 */
00023 
00024 #define SSID_MAX_LENGTH 32
00025 #define SCAN_SSID_MAX_NUM 20
00026 
00027 #define ticker_internal 20
00028 #define wait_ms_internal 1
00029 
00030 /**
00031  *  Wi-Fi Init
00032  */
00033 int wifi_init(void); 
00034 int wifi_apConnect(void);
00035 void wifi_ssid_pw_set(uint8_t* SSID, uint8_t* PW, uint8_t priority);
00036 uint8_t wifi_scan(void);
00037 int wifi_connect(unsigned int timeout_ms);
00038 int wifi_static_ip_set(const char * ip, const char * netmask, const char * gateway);
00039 int wifi_disconnect(void);
00040 
00041 int wifi_UDP_server_init(const int port);
00042 int wifi_TCP_server_init(const int port);
00043 int wifi_UDP_client_init(void);
00044 int wifi_TCP_client_init(const char *ipv4_addr, const int port, bool new_socket);
00045 int wifi_send_UDP(char *data, int length, uint8_t cid, const char *ipv4_addr, const int port);
00046 int wifi_send_TCP(char *data, uint8_t cid);
00047 
00048 
00049 
00050 
00051 #ifdef __cplusplus
00052 extern "C" {
00053 #endif
00054 void start_socket_routine(void);    
00055 int wifi_receive_UDP_callback(uint8_t *data, uint8_t cid);  
00056 int wifi_receive_TCP_callback(uint8_t *data, uint8_t cid);
00057 void Socket_Close_All(void);
00058 int wifi_ipconfig(unsigned int timeout_ms);
00059     
00060 #ifdef __cplusplus
00061 }
00062 #endif
00063 
00064 #endif