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: X_NUCLEO_IDW01M1_AP_Test
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 int start_access_point( 00058 const char *ap, 00059 const char *pass_phrase, 00060 nsapi_security_t security = NSAPI_SECURITY_NONE, 00061 int channel_num = 6, 00062 unsigned int data_rates = 0x3fffcf); 00063 00064 // Implementation of WiFiInterface 00065 virtual int connect( 00066 const char *ssid, 00067 const char *pass, 00068 nsapi_security_t security = NSAPI_SECURITY_NONE); 00069 00070 virtual int disconnect(); 00071 virtual const char *get_mac_address(); 00072 void debug(const char * string); 00073 00074 //Implementation of NetworkStack 00075 virtual const char *get_ip_address(); 00076 00077 protected: 00078 //Implementation of NetworkStack 00079 virtual int socket_open(void **handle, nsapi_protocol_t proto); 00080 virtual int socket_close(void *handle); 00081 virtual int socket_bind(void *handle, const SocketAddress &address); //not supported 00082 virtual int socket_listen(void *handle, int backlog); 00083 virtual int socket_connect(void *handle, const SocketAddress &address); 00084 virtual int socket_accept(void **handle, void *server); 00085 virtual int socket_send(void *handle, const void *data, unsigned size); 00086 virtual int socket_recv(void *handle, void *data, unsigned size); 00087 virtual int socket_sendto(void *handle, const SocketAddress &address, const void *data, unsigned size); 00088 virtual int socket_recvfrom(void *handle, SocketAddress *address, void *buffer, unsigned size); 00089 virtual void socket_attach(void *handle, void (*callback)(void *), void *data); 00090 00091 private: 00092 int init(void); 00093 WiFi_Priv_Mode convert_security(int security); 00094 00095 SpwfSADevice _spwf; 00096 bool _ids[SPWFSA_SOCKET_COUNT]; 00097 bool isListening; 00098 bool isInitialized; 00099 multimap <char *, vector <uint16_t> > c_table; 00100 00101 }; 00102 00103 00104 #endif
Generated on Tue Jul 12 2022 12:20:21 by
1.7.2
