• Main Page
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

wlp_api.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2012, H&D Wireless AB All rights reserved.
00003  *
00004  * The license to use this software in whole and in part and to
00005  * redistribute it in any form follows with the WiFi HW module from H&D
00006  * Wireless and is granted under the following restrictions:
00007  * 
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  *
00011  * 2. Redistributions in binary form must reproduce the above copyright
00012  *    notice, this list of conditions and the following disclaimer in the
00013  *    documentation and/or other materials provided with the distribution.
00014  *
00015  * 3. The name of H&D Wireless AB may not be used to endorse or promote
00016  *    products derived from this software without specific prior written
00017  *    permission.
00018  *
00019  * 4. The software may only be used together with hardware from H&D
00020  *    Wireless all other use is prohibited.
00021  *
00022  * 5. The license to use and redistribute the software is granted
00023  *    together with the purchase of a hardware platform on a one to one
00024  *    basis.
00025  *
00026  * 6. The binary code may not be reversed engineered or by other means
00027  *    copied to circumvent this license.
00028  * 
00029  * THIS SOFTWARE IS PROVIDED BY H&D WIRELESS AB ``AS IS'' AND ANY
00030  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00031  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00032  * PURPOSE ARE EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT
00033  * SHALL HD WIRELESS AB BE LIABLE FOR ANY DIRECT, INDIRECT,
00034  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00035  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00036  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00037  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
00038  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00039  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
00040  * OF THE POSSIBILITY OF SUCH DAMAGE.
00041  *
00042  * For more information regarding this software license Contact H&D
00043  * Wireless AB (support@hd-wireless.se).
00044  *
00045  */
00046 
00047 
00130 #ifndef WLP_API_H
00131 #define WLP_API_H
00132 
00133 #include <stdint.h>
00134 
00135 #include "wlp_proto.h"
00136 
00137 
00138 #define WLP_FAILURE      -1  
00139 #define WLP_ERR_PARAM    -2  
00140 #define WLP_ERR_MEM      -3  
00141 #define WLP_ERR_CONN     -4  
00142 #define WLP_ERR_STATE    -5  
00143 #define WLP_ERR_PARSE    -6  
00144 #define WLP_ERR_PATH     -7  
00145 #define WLP_ERR_TYPE     -8  
00146 #define WLP_ERR_PERM     -9  
00147 #define WLP_ERR_NOTSUPP  -10 
00148 #define WLP_ERR_RANGE    -11 
00149 #define WLP_ERR_SIZE     -12 
00150 #define WLP_ERR_AGAIN    -13 
00151 #define WLP_ERR_BUSY     -14 
00152 #define WLP_ERR_DISABLED -15 
00153 #define WLP_ERR_PROTO    -16 
00154 #define WLP_ERR_TIMEOUT  -17 
00155 #define WLP_ERR_IGNORED  -18 
00156 #define WLP_ERR_CANCEL   -19 
00157 #define WLP_ERR_SYNC     -20 
00158 #define WLP_ERR_ABORT    -21 
00159 #define WLP_ERR_INUSE    -22 
00162 #define WLP_INVALID_SOCKET_ID 0
00163 
00165 #define WLP_INTERFACE_UART 0
00166 #define WLP_INTERFACE_SPI  1
00167 
00173 struct wlp_network_t {
00174         struct wl_ssid_t ssid;          
00175         struct wl_mac_addr_t bssid;     
00176         int16_t rssi;                   
00178         int16_t snr;                    
00181         enum wlp_auth_mode auth;
00182         uint8_t channel;
00183         enum wl_conn_type_t type;
00184 };
00185 
00186 
00187 
00188 struct wlp_network_list {
00189         int cnt;
00190         struct wlp_network_t *net;
00191 };
00192 
00250 int wlp_init(int interface,
00251              int (*readf)(void *ctx, void *data, int len),
00252              int (*writef)(void *ctx, const void *data, int len),
00253              void (*selectf)(void *ctx, int select),
00254              void *ctx);
00255 
00274 void wlp_set_yield_cb(void (*yieldf)(void *ctx), void *ctx);
00275 
00276 
00290 void wlp_irq(void);
00291 
00292 
00360 int wlp_set_baudrate(uint32_t baudrate, uint8_t rtscts);
00361     
00362 
00372 int wlp_reset(void);
00373 
00374 #if WLP_STACK_OFFLOAD
00375 
00393 int wlp_fw_upgrade(uint8_t method, 
00394                    struct ip_addr *addr, 
00395                    uint16_t port,
00396                    const char *path);
00397 #endif /* WLP_STACK_OFFLOAD */
00398 
00433 int wlp_get_fw_version(uint32_t *code, 
00434                        char *build, 
00435                        int build_len,
00436                        char *hw_rev, 
00437                        int hw_rev_len);
00438 
00479 int wlp_get_fw_caps(uint8_t *cap_flags);
00480 
00481 
00482 
00495 int wlp_scan(struct wl_ssid_t *ssid,
00496              void (*complete_cb)(void *ctx, int cnt), void *ctx);
00497 
00498 int wlp_get_network_list(struct wlp_network_list **netlist);
00499 
00530 void wlp_set_link_cb(void (*link_cb)(void *ctx, int link), void *ctx);
00531 
00532 
00595 int wlp_linkup(struct wl_ssid_t *ssid, const char *key, enum wlp_auth_mode auth);
00596 
00597 
00628 int wlp_linkdown(void);
00629 
00630 
00641 int wlp_get_hwaddr(struct wl_mac_addr_t *hwaddr);
00642 
00643 
00666 int wlp_get_network(struct wlp_network_t *net);
00667 
00671 #if WLP_STACK_OFFLOAD
00672 
00711 void wlp_set_ipaddr_cb(void (*addr_cb)(void *ctx, const struct ip_addr *addr),
00712                        void *ctx);
00713 
00714 
00734 int wlp_set_ipaddr(const struct ip_addr *ip, const struct ip_addr *netmask,
00735                    const struct ip_addr *gw, const struct ip_addr *dns);
00736 
00737 
00761 int wlp_get_ipaddr(struct ip_addr *ip, struct ip_addr *netmask,
00762                    struct ip_addr *gw, struct ip_addr *dns);
00763 
00764 
00789 int wlp_set_dhcp(int enable);
00790 
00791 
00808 int wlp_get_dhcp(int *enabled);
00809 
00810 
00847 int wlp_set_dhcpd(int enable);
00848 
00849     
00915 int wlp_socket(int type, int proto);
00916 
00917 
00948 int wlp_set_conn_cb(int sockid,
00949                     void (*conn_cb)(void *ctx, int sockid, int connected),
00950                     void *ctx);
00951 
00976 int wlp_set_recv_cb(int sockid,
00977                     void (*recv_cb)(void *ctx, int sockid, int len),
00978                     void *ctx);
00979 
00980 
01024 int wlp_bind(int sockid, const struct ip_addr *addr, uint16_t port);
01025 
01026 
01064 int wlp_listen(int sockid, int backlog,
01065                void (*listen_cb)(void *ctx, int sockid),
01066                void *ctx);
01067 
01126 int wlp_connect(int sockid, const struct ip_addr *ip, uint16_t port);
01127 
01160 int wlp_accept(int sockid);
01161 
01162 
01182 int wlp_close(int sockid);
01183 
01184 
01258 int wlp_recv(int sockid, char *buf, int16_t len);
01259 
01260 
01323 int wlp_send(int sockid, const char *buf, int16_t len);
01324 
01325 
01365 int wlp_sendto(int sockid, const char *buf, int16_t len,
01366                const struct ip_addr *ip, uint16_t port);
01367 
01368 
01388 int wlp_get_peeraddr(int sockid, struct ip_addr *peer);
01389 
01414 int wlp_get_hostbyname(const char *host,
01415                        void (*lookup_cb)(void *ctx, const struct ip_addr *ip),
01416                        void *ctx);
01417 
01418 #endif /* WLP_STACK_OFFLOAD */
01419 
01440 void wlp_poll(void);
01441 
01471 int wlp_set_mode(uint8_t mode);
01472 
01473 
01474 
01490 int wlp_get_mode(uint8_t *mode);
01491 
01492 
01493 
01507 int wlp_set_channel(uint8_t channel);
01508 
01509 
01731 int wlp_set_wakeup_cb(void (*wakeupf)(void *ctx, int enable),
01732                       void *ctx);
01733 
01748 int wlp_set_ps(int enable);
01749 
01806 int wlp_conf_ps(uint8_t use_ps_poll,
01807                 uint32_t ps_traffic_timeout,
01808                 uint32_t ps_delay,
01809                 uint8_t rx_all_dtim,
01810                 uint16_t listen_interval);
01811 
01812 
01830 int wlp_set_led(int enable);
01831 
01860 int wlp_set_heartbeat(uint32_t ms_period);
01861 
01891 int wlp_set_poll_period(uint32_t ms_period);
01892 
01895 #endif /* WLP_API_H */

Generated on Fri Jul 6 2012 16:56:25 for API Reference Manual by  doxygen 1.7.1