Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: SpwfInterface_NSAPI_Tests HelloWorld_IDW01M1
Fork of X_NUCLEO_IDW01M1 by
SPWFInterface.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 20015 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 /** 00018 ****************************************************************************** 00019 * @file SpwfInterface.h 00020 * @author STMicroelectronics 00021 * @brief Header file of the NetworkStack for the SPWF Device 00022 ****************************************************************************** 00023 * @copy 00024 * 00025 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 00026 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 00027 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 00028 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 00029 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 00030 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 00031 * 00032 * <h2><center>© COPYRIGHT 2016 STMicroelectronics</center></h2> 00033 ****************************************************************************** 00034 */ 00035 00036 #ifndef SPWFSA_INTERFACE_H 00037 #define SPWFSA_INTERFACE_H 00038 00039 #include <vector> 00040 #include <map> 00041 #include "WiFiInterface.h" 00042 #include "SpwfSADevice.h" 00043 00044 #define SPWFSA_SOCKET_COUNT 8 00045 #define SERVER_SOCKET_NO 9 00046 00047 /** SpwfSAInterface class 00048 * Implementation of the NetworkStack for the SPWF Device 00049 */ 00050 class SpwfSAInterface : public NetworkStack, public WiFiInterface 00051 { 00052 public: 00053 00054 SpwfSAInterface(PinName tx, PinName rx, PinName rst, PinName wkup, PinName rts, bool debug = false); 00055 virtual ~SpwfSAInterface(); 00056 00057 // Implementation of WiFiInterface 00058 virtual int connect( 00059 const char *ssid, 00060 const char *pass, 00061 nsapi_security_t security = NSAPI_SECURITY_NONE); 00062 00063 virtual int disconnect(); 00064 virtual const char *get_mac_address(); 00065 void debug(const char * string); 00066 00067 //Implementation of NetworkStack 00068 virtual const char *get_ip_address(); 00069 00070 protected: 00071 //Implementation of NetworkStack 00072 virtual int socket_open(void **handle, nsapi_protocol_t proto); 00073 virtual int socket_close(void *handle); 00074 virtual int socket_bind(void *handle, const SocketAddress &address); //not supported 00075 virtual int socket_listen(void *handle, int backlog); 00076 virtual int socket_connect(void *handle, const SocketAddress &address); 00077 virtual int socket_accept(void **handle, void *server); 00078 virtual int socket_send(void *handle, const void *data, unsigned size); 00079 virtual int socket_recv(void *handle, void *data, unsigned size); 00080 virtual int socket_sendto(void *handle, const SocketAddress &address, const void *data, unsigned size); 00081 virtual int socket_recvfrom(void *handle, SocketAddress *address, void *buffer, unsigned size); 00082 virtual void socket_attach(void *handle, void (*callback)(void *), void *data); 00083 00084 private: 00085 int init(void); 00086 00087 SpwfSADevice _spwf; 00088 bool _ids[SPWFSA_SOCKET_COUNT]; 00089 bool isListening; 00090 bool isInitialized; 00091 multimap <char *, vector <uint16_t> > c_table; 00092 00093 }; 00094 00095 00096 #endif
Generated on Tue Jul 12 2022 16:20:36 by
1.7.2

X-NUCLEO-IDW01M1 Wi-Fi expansion board