123
Fork of WizFi250Interface_1 by
Revision 1:046a828fe0d2, committed 2017-08-18
- Comitter:
- cliff1
- Date:
- Fri Aug 18 05:52:17 2017 +0000
- Parent:
- 0:e3dc9e54a15b
- Child:
- 2:13aeb8e94fed
- Commit message:
- Test 5.5(1)
Changed in this revision
| WizFi250Interface.cpp | Show annotated file Show diff for this revision Revisions of this file |
| WizFi250Interface.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/WizFi250Interface.cpp Tue Aug 30 00:05:24 2016 +0000
+++ b/WizFi250Interface.cpp Fri Aug 18 05:52:17 2017 +0000
@@ -16,6 +16,7 @@
#include "WizFi250Interface.h"
+#include "mbed_debug.h"
// Various timeouts for different WizFi250 operations
#define WizFi250_CONNECT_TIMEOUT 15000
@@ -33,10 +34,17 @@
memset(_ids, 0, sizeof(_ids));
}
+
+int WizFi250Interface::connect()
+{
+ return 0;
+}
+
int WizFi250Interface::connect(
const char *ssid,
const char *pass,
- nsapi_security_t security)
+ nsapi_security_t security,
+ uint8_t channel )
{
if (!_wizfi250.startup())
{
@@ -55,6 +63,16 @@
return 0;
}
+int WizFi250Interface::set_credentials(const char *ssid, const char *pass, nsapi_security_t security)
+{
+ return 0;
+}
+
+int WizFi250Interface::set_channel(uint8_t channel)
+{
+ return NSAPI_ERROR_UNSUPPORTED;
+}
+
int WizFi250Interface::disconnect()
{
if ( _wizfi250.cmdWLEAVE() == -1 ) return NSAPI_ERROR_DEVICE_ERROR;
@@ -161,7 +179,12 @@
return 0;
}
-int WizFi250Interface::socket_accept(void **handle, void *server)
+//int WizFi250Interface::socket_accept(void **handle, void *server)
+//{
+// return NSAPI_ERROR_UNSUPPORTED;
+//}
+
+int WizFi250Interface::socket_accept(void *server, void **socket, SocketAddress *addr)
{
return NSAPI_ERROR_UNSUPPORTED;
}
--- a/WizFi250Interface.h Tue Aug 30 00:05:24 2016 +0000
+++ b/WizFi250Interface.h Fri Aug 18 05:52:17 2017 +0000
@@ -17,7 +17,7 @@
#ifndef WIZFI250_INTERFACE_H
#define WIZFI250_INTERFACE_H
-#include "WiFiInterface.h"
+#include "mbed.h"
#include "WizFi250.h"
#define WIZFI250_SOCKET_COUNT 8
@@ -29,15 +29,23 @@
{
public:
WizFi250Interface(PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, PinName alarm, int baud=115200 );
+
+ virtual int connect();
virtual int connect(
const char *ssid,
const char *pass,
- nsapi_security_t security = NSAPI_SECURITY_NONE);
+ nsapi_security_t security = NSAPI_SECURITY_NONE,
+ uint8_t channel = 0);
/** Stop the interface
* @return 0 on success, negative on failure
*/
+
+ virtual int set_credentials(const char *ssid, const char *pass, nsapi_security_t security = NSAPI_SECURITY_NONE);
+
+ virtual int set_channel(uint8_t channel);
+
virtual int disconnect();
/** Get the internally stored IP address
@@ -49,6 +57,18 @@
* @return MAC address of the interface
*/
virtual const char *get_mac_address();
+
+ virtual const char *get_gateway() { };
+
+ virtual const char *get_netmask() { };
+
+ virtual int8_t get_rssi() { };
+
+
+ virtual int scan(WiFiAccessPoint *res, unsigned count) { };
+
+ using NetworkInterface::gethostbyname;
+ using NetworkInterface::add_dns_server;
protected:
/** Open a socket
@@ -95,7 +115,8 @@
* @note This call is not-blocking, if this call would block, must
* immediately return NSAPI_ERROR_WOULD_WAIT
*/
- virtual int socket_accept(void **handle, void *server);
+ //virtual int socket_accept(void **handle, void *server);
+ virtual int socket_accept(void *handle, void **socket, SocketAddress *address);
/** Send data to the remote host
* @param handle Socket handle
@@ -148,6 +169,11 @@
* @note Callback may be called in an interrupt context.
*/
virtual void socket_attach(void *handle, void (*callback)(void *), void *data);
+
+ virtual NetworkStack *get_stack()
+ {
+ return this;
+ }
private:
WizFi250 _wizfi250;
