sandbox / ESP8266Interface

Dependencies:   ESP8266

Fork of ESP8266Interface by Christopher Haster

Files at this revision

API Documentation at this revision

Comitter:
sam_grove
Date:
Wed Jun 17 20:57:21 2015 +0000
Parent:
9:8c7a42277b0e
Child:
11:288c15b80a26
Commit message:
Giving it a name. Being abstract was making thing confusing

Changed in this revision

ESP8266Interface.cpp Show annotated file Show diff for this revision Revisions of this file
ESP8266Interface.h Show annotated file Show diff for this revision Revisions of this file
WiFiInterface.cpp Show diff for this revision Revisions of this file
WiFiInterface.h Show diff for this revision Revisions of this file
driver.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ESP8266Interface.cpp	Wed Jun 17 20:57:21 2015 +0000
@@ -0,0 +1,77 @@
+/* ESP8266Interface
+ * Copyright (c) 2015 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+#include "ESP8266Interface.h"
+
+ESP8266Interface::ESP8266Interface()
+{
+
+}
+
+ESP8266Interface::ESP8266Interface(const char *ap, const char *pass_phrase, wifi_security_t security, uint32_t timeout_ms)
+{
+
+}
+
+int32_t ESP8266Interface::init(void) const
+{
+    return -1;
+}
+
+int32_t ESP8266Interface::init(const char *ip, const char *mask, const char *gateway) const
+{
+    return -1;
+}
+
+int32_t ESP8266Interface::connect(uint32_t timeout_ms) const
+{
+    return -1;
+}
+
+int32_t ESP8266Interface::connect(const char *ap, const char *pass_phrase, wifi_security_t security, uint32_t timeout_ms) const
+{
+    return -1;
+}
+
+int32_t ESP8266Interface::disconnect(void) const
+{
+    return -1;
+}
+
+char *ESP8266Interface::getIPAddress(void) const
+{
+    return 0;
+}
+
+char *ESP8266Interface::getGateway(void) const
+{
+    return 0;
+}
+
+char *ESP8266Interface::getNetworkMask(void) const
+{
+    return 0;
+}
+
+char *ESP8266Interface::getMACAddress(void) const
+{
+    return 0;
+}
+
+int32_t ESP8266Interface::isConnected(void) const
+{
+    return -1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ESP8266Interface.h	Wed Jun 17 20:57:21 2015 +0000
@@ -0,0 +1,43 @@
+/* ESP8266Interface
+ * Copyright (c) 2015 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ESP8266INTERFACE_H
+#define ESP8266INTERFACE_H
+
+#include "WiFiInterface.h"
+
+/** ESP8266Interface class.
+    This is a interface to the ESP8266 WiFi radio
+ */
+class ESP8266Interface : public WiFiInterface
+{
+public:
+
+    ESP8266Interface();
+    ESP8266Interface(const char *ap, const char *pass_phrase = 0, wifi_security_t security = WI_NONE, uint32_t timeout_ms = 15000);
+    virtual int32_t init(void) const;
+    virtual int32_t init(const char *ip, const char *mask, const char *gateway) const;
+    virtual int32_t connect(uint32_t timeout_ms) const;
+    virtual int32_t connect(const char *ap, const char *pass_phrase = 0, wifi_security_t security = WI_NONE, uint32_t timeout_ms = 15000) const;
+    virtual int32_t disconnect(void) const;
+    virtual char *getIPAddress(void) const;
+    virtual char *getGateway(void) const;
+    virtual char *getNetworkMask(void) const;
+    virtual char *getMACAddress(void) const;
+    virtual int32_t isConnected(void) const;
+};
+
+#endif
--- a/WiFiInterface.cpp	Mon Jun 01 15:50:01 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-/* WiFiInterface Application Interface
- * Copyright (c) 2015 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- 
-#include "WiFiInterface.h" // functions to impliment
-#include "hwnamedriver.h"  // functions to use to impliment WifiInterface
- 
-// TODO: User must impliment WifiInterface functions here. 
\ No newline at end of file
--- a/WiFiInterface.h	Mon Jun 01 15:50:01 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-/* NetworkInterface Base Class
- * Copyright (c) 2015 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef WIFIINTERFACE_H
-#define WIFIINTERFACE_H
-
-#include "NetworkInterface.h"
-
-class WiFiInterface : public NetworkInterface
-{
-public:
-
-    /**
-    * 
-    * WifiInterface Security Types
-    * 
-    * @param NI_NONE    No security for connection
-    * @param NI_WEP     WEP  encryption
-    * @param NI_WPA     WPA  encryption
-    * @param NI_WPA2    WPA2 encryption
-    * 
-    */
-    typedef enum {
-        NI_NONE = 0,
-        NI_WEP,
-        NI_WPA,
-        NI_WPA2,
-    } wifi_security_t;
-
-    /**
-     *    Initialize the network interface with DHCP.
-     *
-     *    \returns 0 on success, a negative number on failure
-     */
-    virtual int init(void) const {
-        return -1;
-    }
-
-    /**
-     *    Initialize the network interface with a static IP address.
-     *
-     *    @param ip The static IP address to use
-     *    @param mask The IP address mask
-     *    @param gateway The gateway to use
-     *
-     *    \returns 0 on success, a negative number on failure
-     */
-    virtual int init(const char *ip, const char *mask, const char *gateway) const {
-        return -1;
-    };
-
-    /**
-     *    Start the interface, using DHCP if needed.
-     *
-     *    @param timeout_ms Time in miliseconds to wait while attempting to connect before timing out
-     *
-     *    \returns 0 on success, a negative number on failure
-     */
-    virtual int connect(const unsigned int timeout_ms=15000) const {
-        return -1;
-    }
-
-    /**
-     *    Start the interface, using DHCP if needed.
-     *
-     *    @param timeout_ms Time in miliseconds to wait while attempting to connect before timing out
-     *
-     *    \returns 0 on success, a negative number on failure
-     */
-    virtual int connect(const char *ap, const char *pass_phrase = 0, const wifi_security_t security = NI_NONE, const unsigned int timeout_ms=15000) const {
-        return -1;
-    }
-
-    /**
-     *    Stop the interface, bringing down dhcp if necessary.
-     *
-     *    \returns 0 on success, a negative number on failure
-     */
-    virtual int disconnect(void) const {
-        return -1;
-    }
-
-    /**
-     *    Get the current IP address.
-     *
-     *    \returns a pointer to a string containing the IP address.
-     */
-    virtual char *getIPAddress(void) const {
-        return 0;
-    }
-
-    /**
-     *    Get the current gateway address.
-     *
-     *    \returns a pointer to a string containing the gateway address.
-     */
-    virtual char *getGateway(void) const {
-        return 0;
-    }
-
-
-    /**
-     *    Get the current network mask.
-     *
-     *    \returns a pointer to a string containing the network mask.
-     */
-    virtual char *getNetworkMask(void) const {
-        return 0;
-    }
-
-    /**
-     *    Get the devices MAC address.
-     *
-     *    \returns a pointer to a string containing the mac address.
-     */
-    virtual char *getMACAddress(void) const {
-        return 0;
-    }
-
-    /**
-     *    Get the current status of the interface connection.
-     *
-     *    \returns true if connected, false otherwise.
-     */
-    virtual int isConnected(void) const {
-        return -1;
-    }
-
-private:
-};
-
-#endif
--- a/driver.lib	Mon Jun 01 15:50:01 2015 -0500
+++ b/driver.lib	Wed Jun 17 20:57:21 2015 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/teams/NetworkSocketAPI/code/driver/tip
+http://developer.mbed.org/teams/NetworkSocketAPI/code/driver/#a517950927fe