A program for IoT demonstration with mbed, EnOcean and MQTT.

Dependencies:   IBMIoTClientEthernetExample C12832 EthernetInterface MQTT USB400Serial USBHost mbed

Fork of IBMIoTClientEthernetExample by IBM Watson IoT

Committer:
samdanbury
Date:
Wed Aug 20 12:45:14 2014 +0000
Revision:
6:37b6d0d56190
Code completely changed to improve the structure, flow and memory usage of the application

Who changed what in which revision?

UserRevisionLine numberNew contents of line
samdanbury 6:37b6d0d56190 1 /* Copyright (C) 2012 mbed.org, MIT License
samdanbury 6:37b6d0d56190 2 *
samdanbury 6:37b6d0d56190 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
samdanbury 6:37b6d0d56190 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
samdanbury 6:37b6d0d56190 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
samdanbury 6:37b6d0d56190 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
samdanbury 6:37b6d0d56190 7 * furnished to do so, subject to the following conditions:
samdanbury 6:37b6d0d56190 8 *
samdanbury 6:37b6d0d56190 9 * The above copyright notice and this permission notice shall be included in all copies or
samdanbury 6:37b6d0d56190 10 * substantial portions of the Software.
samdanbury 6:37b6d0d56190 11 *
samdanbury 6:37b6d0d56190 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
samdanbury 6:37b6d0d56190 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
samdanbury 6:37b6d0d56190 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
samdanbury 6:37b6d0d56190 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
samdanbury 6:37b6d0d56190 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
samdanbury 6:37b6d0d56190 17 */
samdanbury 6:37b6d0d56190 18
samdanbury 6:37b6d0d56190 19 #ifndef LWIPOPTS_H
samdanbury 6:37b6d0d56190 20 #define LWIPOPTS_H
samdanbury 6:37b6d0d56190 21
samdanbury 6:37b6d0d56190 22 #include "lwipopts_conf.h"
samdanbury 6:37b6d0d56190 23
samdanbury 6:37b6d0d56190 24 // Operating System
samdanbury 6:37b6d0d56190 25 #define NO_SYS 0
samdanbury 6:37b6d0d56190 26
samdanbury 6:37b6d0d56190 27 #if NO_SYS == 0
samdanbury 6:37b6d0d56190 28 #include "cmsis_os.h"
samdanbury 6:37b6d0d56190 29
samdanbury 6:37b6d0d56190 30 #define SYS_LIGHTWEIGHT_PROT 1
samdanbury 6:37b6d0d56190 31
samdanbury 6:37b6d0d56190 32 #define LWIP_RAW 0
samdanbury 6:37b6d0d56190 33
samdanbury 6:37b6d0d56190 34 #define TCPIP_MBOX_SIZE 8
samdanbury 6:37b6d0d56190 35 #define DEFAULT_TCP_RECVMBOX_SIZE 8
samdanbury 6:37b6d0d56190 36 #define DEFAULT_UDP_RECVMBOX_SIZE 8
samdanbury 6:37b6d0d56190 37 #define DEFAULT_RAW_RECVMBOX_SIZE 8
samdanbury 6:37b6d0d56190 38 #define DEFAULT_ACCEPTMBOX_SIZE 8
samdanbury 6:37b6d0d56190 39
samdanbury 6:37b6d0d56190 40 #define TCPIP_THREAD_STACKSIZE 1024
samdanbury 6:37b6d0d56190 41 #define TCPIP_THREAD_PRIO (osPriorityNormal)
samdanbury 6:37b6d0d56190 42
samdanbury 6:37b6d0d56190 43 #define DEFAULT_THREAD_STACKSIZE 512
samdanbury 6:37b6d0d56190 44
samdanbury 6:37b6d0d56190 45 #define MEMP_NUM_SYS_TIMEOUT 16
samdanbury 6:37b6d0d56190 46 #endif
samdanbury 6:37b6d0d56190 47
samdanbury 6:37b6d0d56190 48 // 32-bit alignment
samdanbury 6:37b6d0d56190 49 #define MEM_ALIGNMENT 4
samdanbury 6:37b6d0d56190 50
samdanbury 6:37b6d0d56190 51 #define PBUF_POOL_SIZE 5
samdanbury 6:37b6d0d56190 52 #define MEMP_NUM_TCP_PCB_LISTEN 4
samdanbury 6:37b6d0d56190 53 #define MEMP_NUM_TCP_PCB 4
samdanbury 6:37b6d0d56190 54 #define MEMP_NUM_PBUF 8
samdanbury 6:37b6d0d56190 55
samdanbury 6:37b6d0d56190 56 #define TCP_QUEUE_OOSEQ 0
samdanbury 6:37b6d0d56190 57 #define TCP_OVERSIZE 0
samdanbury 6:37b6d0d56190 58
samdanbury 6:37b6d0d56190 59 #define LWIP_DHCP 1
samdanbury 6:37b6d0d56190 60 #define LWIP_DNS 1
samdanbury 6:37b6d0d56190 61
samdanbury 6:37b6d0d56190 62 // Support Multicast
samdanbury 6:37b6d0d56190 63 #include "stdlib.h"
samdanbury 6:37b6d0d56190 64 #define LWIP_IGMP 1
samdanbury 6:37b6d0d56190 65 #define LWIP_RAND() rand()
samdanbury 6:37b6d0d56190 66
samdanbury 6:37b6d0d56190 67 #define LWIP_COMPAT_SOCKETS 0
samdanbury 6:37b6d0d56190 68 #define LWIP_POSIX_SOCKETS_IO_NAMES 0
samdanbury 6:37b6d0d56190 69 #define LWIP_SO_RCVTIMEO 1
samdanbury 6:37b6d0d56190 70 #define LWIP_TCP_KEEPALIVE 1
samdanbury 6:37b6d0d56190 71
samdanbury 6:37b6d0d56190 72 // Debug Options
samdanbury 6:37b6d0d56190 73 // #define LWIP_DEBUG
samdanbury 6:37b6d0d56190 74 #define UDP_LPC_EMAC LWIP_DBG_OFF
samdanbury 6:37b6d0d56190 75 #define SYS_DEBUG LWIP_DBG_OFF
samdanbury 6:37b6d0d56190 76 #define PPP_DEBUG LWIP_DBG_OFF
samdanbury 6:37b6d0d56190 77 #define IP_DEBUG LWIP_DBG_OFF
samdanbury 6:37b6d0d56190 78 #define MEM_DEBUG LWIP_DBG_OFF
samdanbury 6:37b6d0d56190 79 #define MEMP_DEBUG LWIP_DBG_OFF
samdanbury 6:37b6d0d56190 80 #define PBUF_DEBUG LWIP_DBG_OFF
samdanbury 6:37b6d0d56190 81 #define API_LIB_DEBUG LWIP_DBG_OFF
samdanbury 6:37b6d0d56190 82 #define API_MSG_DEBUG LWIP_DBG_OFF
samdanbury 6:37b6d0d56190 83 #define TCPIP_DEBUG LWIP_DBG_OFF
samdanbury 6:37b6d0d56190 84 #define SOCKETS_DEBUG LWIP_DBG_OFF
samdanbury 6:37b6d0d56190 85 #define TCP_DEBUG LWIP_DBG_OFF
samdanbury 6:37b6d0d56190 86 #define TCP_INPUT_DEBUG LWIP_DBG_OFF
samdanbury 6:37b6d0d56190 87 #define TCP_FR_DEBUG LWIP_DBG_OFF
samdanbury 6:37b6d0d56190 88 #define TCP_RTO_DEBUG LWIP_DBG_OFF
samdanbury 6:37b6d0d56190 89 #define TCP_CWND_DEBUG LWIP_DBG_OFF
samdanbury 6:37b6d0d56190 90 #define TCP_WND_DEBUG LWIP_DBG_OFF
samdanbury 6:37b6d0d56190 91 #define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
samdanbury 6:37b6d0d56190 92 #define TCP_RST_DEBUG LWIP_DBG_OFF
samdanbury 6:37b6d0d56190 93 #define TCP_QLEN_DEBUG LWIP_DBG_OFF
samdanbury 6:37b6d0d56190 94 #define ETHARP_DEBUG LWIP_DBG_OFF
samdanbury 6:37b6d0d56190 95 #define NETIF_DEBUG LWIP_DBG_OFF
samdanbury 6:37b6d0d56190 96 #define DHCP_DEBUG LWIP_DBG_OFF
samdanbury 6:37b6d0d56190 97
samdanbury 6:37b6d0d56190 98 #ifdef LWIP_DEBUG
samdanbury 6:37b6d0d56190 99 #define MEMP_OVERFLOW_CHECK 1
samdanbury 6:37b6d0d56190 100 #define MEMP_SANITY_CHECK 1
samdanbury 6:37b6d0d56190 101 #else
samdanbury 6:37b6d0d56190 102 #define LWIP_NOASSERT 1
samdanbury 6:37b6d0d56190 103 #define LWIP_STATS 0
samdanbury 6:37b6d0d56190 104 #endif
samdanbury 6:37b6d0d56190 105
samdanbury 6:37b6d0d56190 106 #define LWIP_PLATFORM_BYTESWAP 1
samdanbury 6:37b6d0d56190 107
samdanbury 6:37b6d0d56190 108 #if LWIP_TRANSPORT_ETHERNET
samdanbury 6:37b6d0d56190 109
samdanbury 6:37b6d0d56190 110 /* MSS should match the hardware packet size */
samdanbury 6:37b6d0d56190 111 #define TCP_MSS 1460
samdanbury 6:37b6d0d56190 112 #define TCP_SND_BUF (2 * TCP_MSS)
samdanbury 6:37b6d0d56190 113 #define TCP_WND (2 * TCP_MSS)
samdanbury 6:37b6d0d56190 114 #define TCP_SND_QUEUELEN (2 * TCP_SND_BUF/TCP_MSS)
samdanbury 6:37b6d0d56190 115
samdanbury 6:37b6d0d56190 116 // Broadcast
samdanbury 6:37b6d0d56190 117 #define IP_SOF_BROADCAST 1
samdanbury 6:37b6d0d56190 118 #define IP_SOF_BROADCAST_RECV 1
samdanbury 6:37b6d0d56190 119
samdanbury 6:37b6d0d56190 120 #define LWIP_BROADCAST_PING 1
samdanbury 6:37b6d0d56190 121
samdanbury 6:37b6d0d56190 122 #define LWIP_CHECKSUM_ON_COPY 1
samdanbury 6:37b6d0d56190 123
samdanbury 6:37b6d0d56190 124 #define LWIP_NETIF_HOSTNAME 1
samdanbury 6:37b6d0d56190 125 #define LWIP_NETIF_STATUS_CALLBACK 1
samdanbury 6:37b6d0d56190 126 #define LWIP_NETIF_LINK_CALLBACK 1
samdanbury 6:37b6d0d56190 127
samdanbury 6:37b6d0d56190 128 #elif LWIP_TRANSPORT_PPP
samdanbury 6:37b6d0d56190 129
samdanbury 6:37b6d0d56190 130 #define TCP_SND_BUF (3 * 536)
samdanbury 6:37b6d0d56190 131 #define TCP_WND (2 * 536)
samdanbury 6:37b6d0d56190 132
samdanbury 6:37b6d0d56190 133 #define LWIP_ARP 0
samdanbury 6:37b6d0d56190 134
samdanbury 6:37b6d0d56190 135 #define PPP_SUPPORT 1
samdanbury 6:37b6d0d56190 136 #define CHAP_SUPPORT 1
samdanbury 6:37b6d0d56190 137 #define PAP_SUPPORT 1
samdanbury 6:37b6d0d56190 138 #define PPP_THREAD_STACKSIZE 4*192
samdanbury 6:37b6d0d56190 139 #define PPP_THREAD_PRIO 0
samdanbury 6:37b6d0d56190 140
samdanbury 6:37b6d0d56190 141 #define MAXNAMELEN 64 /* max length of hostname or name for auth */
samdanbury 6:37b6d0d56190 142 #define MAXSECRETLEN 64
samdanbury 6:37b6d0d56190 143
samdanbury 6:37b6d0d56190 144 #else
samdanbury 6:37b6d0d56190 145 #error A transport mechanism (Ethernet or PPP) must be defined
samdanbury 6:37b6d0d56190 146 #endif
samdanbury 6:37b6d0d56190 147
samdanbury 6:37b6d0d56190 148 #endif /* LWIPOPTS_H_ */