WIP. send a large constant string twice a second, in order to test out the transport with something indicative of our required load.

Dependencies:   FXOS8700CQ NTPClient azure_umqtt_c iothub_mqtt_transport mbed-rtos mbed wolfSSL Socket lwip-eth lwip-sys lwip

Fork of FXOS8700CQ_To_Azure_IoT by Mark Radbourne

Committer:
julianhigginson
Date:
Thu Jan 05 23:40:24 2017 +0000
Revision:
7:0d1a0fe537dc
Parent:
3:c0556ff7b8e3
modified dummy message for minimal data transport

Who changed what in which revision?

UserRevisionLine numberNew contents of line
markrad 3:c0556ff7b8e3 1 /* EthernetInterface.h */
markrad 3:c0556ff7b8e3 2 /* Copyright (C) 2012 mbed.org, MIT License
markrad 3:c0556ff7b8e3 3 *
markrad 3:c0556ff7b8e3 4 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
markrad 3:c0556ff7b8e3 5 * and associated documentation files (the "Software"), to deal in the Software without restriction,
markrad 3:c0556ff7b8e3 6 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
markrad 3:c0556ff7b8e3 7 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
markrad 3:c0556ff7b8e3 8 * furnished to do so, subject to the following conditions:
markrad 3:c0556ff7b8e3 9 *
markrad 3:c0556ff7b8e3 10 * The above copyright notice and this permission notice shall be included in all copies or
markrad 3:c0556ff7b8e3 11 * substantial portions of the Software.
markrad 3:c0556ff7b8e3 12 *
markrad 3:c0556ff7b8e3 13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
markrad 3:c0556ff7b8e3 14 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
markrad 3:c0556ff7b8e3 15 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
markrad 3:c0556ff7b8e3 16 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
markrad 3:c0556ff7b8e3 17 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
markrad 3:c0556ff7b8e3 18 */
markrad 3:c0556ff7b8e3 19
markrad 3:c0556ff7b8e3 20 #ifndef ETHERNETINTERFACE_H_
markrad 3:c0556ff7b8e3 21 #define ETHERNETINTERFACE_H_
markrad 3:c0556ff7b8e3 22
markrad 3:c0556ff7b8e3 23 #if !defined(TARGET_LPC1768) && !defined(TARGET_LPC4088) && !defined(TARGET_LPC4088_DM) && !defined(TARGET_K64F) && !defined(TARGET_RZ_A1H) && !defined(TARGET_VK_RZ_A1H) && !defined(TARGET_STM32F4)
markrad 3:c0556ff7b8e3 24 #error The Ethernet Interface library is not supported on this target
markrad 3:c0556ff7b8e3 25 #endif
markrad 3:c0556ff7b8e3 26
markrad 3:c0556ff7b8e3 27 #include "rtos.h"
markrad 3:c0556ff7b8e3 28 #include "lwip/netif.h"
markrad 3:c0556ff7b8e3 29
markrad 3:c0556ff7b8e3 30 /** Interface using Ethernet to connect to an IP-based network
markrad 3:c0556ff7b8e3 31 *
markrad 3:c0556ff7b8e3 32 */
markrad 3:c0556ff7b8e3 33 class EthernetInterface {
markrad 3:c0556ff7b8e3 34 public:
markrad 3:c0556ff7b8e3 35 /** Initialize the interface with DHCP.
markrad 3:c0556ff7b8e3 36 * Initialize the interface and configure it to use DHCP (no connection at this point).
markrad 3:c0556ff7b8e3 37 * \return 0 on success, a negative number on failure
markrad 3:c0556ff7b8e3 38 */
markrad 3:c0556ff7b8e3 39 static int init(); //With DHCP
markrad 3:c0556ff7b8e3 40
markrad 3:c0556ff7b8e3 41 /** Initialize the interface with a static IP address.
markrad 3:c0556ff7b8e3 42 * Initialize the interface and configure it with the following static configuration (no connection at this point).
markrad 3:c0556ff7b8e3 43 * \param ip the IP address to use
markrad 3:c0556ff7b8e3 44 * \param mask the IP address mask
markrad 3:c0556ff7b8e3 45 * \param gateway the gateway to use
markrad 3:c0556ff7b8e3 46 * \return 0 on success, a negative number on failure
markrad 3:c0556ff7b8e3 47 */
markrad 3:c0556ff7b8e3 48 static int init(const char* ip, const char* mask, const char* gateway);
markrad 3:c0556ff7b8e3 49
markrad 3:c0556ff7b8e3 50 /** Connect
markrad 3:c0556ff7b8e3 51 * Bring the interface up, start DHCP if needed.
markrad 3:c0556ff7b8e3 52 * \param timeout_ms timeout in ms (default: (15)s).
markrad 3:c0556ff7b8e3 53 * \return 0 on success, a negative number on failure
markrad 3:c0556ff7b8e3 54 */
markrad 3:c0556ff7b8e3 55 static int connect(unsigned int timeout_ms=15000);
markrad 3:c0556ff7b8e3 56
markrad 3:c0556ff7b8e3 57 /** Disconnect
markrad 3:c0556ff7b8e3 58 * Bring the interface down
markrad 3:c0556ff7b8e3 59 * \return 0 on success, a negative number on failure
markrad 3:c0556ff7b8e3 60 */
markrad 3:c0556ff7b8e3 61 static int disconnect();
markrad 3:c0556ff7b8e3 62
markrad 3:c0556ff7b8e3 63 /** Get the MAC address of your Ethernet interface
markrad 3:c0556ff7b8e3 64 * \return a pointer to a string containing the MAC address
markrad 3:c0556ff7b8e3 65 */
markrad 3:c0556ff7b8e3 66 static char* getMACAddress();
markrad 3:c0556ff7b8e3 67
markrad 3:c0556ff7b8e3 68 /** Get the IP address of your Ethernet interface
markrad 3:c0556ff7b8e3 69 * \return a pointer to a string containing the IP address
markrad 3:c0556ff7b8e3 70 */
markrad 3:c0556ff7b8e3 71 static char* getIPAddress();
markrad 3:c0556ff7b8e3 72
markrad 3:c0556ff7b8e3 73 /** Get the Gateway address of your Ethernet interface
markrad 3:c0556ff7b8e3 74 * \return a pointer to a string containing the Gateway address
markrad 3:c0556ff7b8e3 75 */
markrad 3:c0556ff7b8e3 76 static char* getGateway();
markrad 3:c0556ff7b8e3 77
markrad 3:c0556ff7b8e3 78 /** Get the Network mask of your Ethernet interface
markrad 3:c0556ff7b8e3 79 * \return a pointer to a string containing the Network mask
markrad 3:c0556ff7b8e3 80 */
markrad 3:c0556ff7b8e3 81 static char* getNetworkMask();
markrad 3:c0556ff7b8e3 82 };
markrad 3:c0556ff7b8e3 83
markrad 3:c0556ff7b8e3 84 #include "TCPSocketConnection.h"
markrad 3:c0556ff7b8e3 85 #include "TCPSocketServer.h"
markrad 3:c0556ff7b8e3 86
markrad 3:c0556ff7b8e3 87 #include "Endpoint.h"
markrad 3:c0556ff7b8e3 88 #include "UDPSocket.h"
markrad 3:c0556ff7b8e3 89
markrad 3:c0556ff7b8e3 90 #endif /* ETHERNETINTERFACE_H_ */