Modified for W5500 Ethernet initialize Added the Ethernet interface re-initialize code Added the connection retry

Dependents:   ThingPlug_Ethernet_Example

Fork of GMMP_mbed by Eric Jung

Committer:
lesmin
Date:
Sun Aug 09 14:11:35 2015 +0000
Revision:
0:7e575e5f88ec
Child:
3:6b4536e1962f
forked from GMMP

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lesmin 0:7e575e5f88ec 1 /** GMMP 공통 정의
lesmin 0:7e575e5f88ec 2 * @file Define.h
lesmin 0:7e575e5f88ec 3 * @date 2015/07/20
lesmin 0:7e575e5f88ec 4 * @version 0.0.1.0
lesmin 0:7e575e5f88ec 5 **/
lesmin 0:7e575e5f88ec 6
lesmin 0:7e575e5f88ec 7 /*
lesmin 0:7e575e5f88ec 8 #include <stdio.h>
lesmin 0:7e575e5f88ec 9 #include <stdlib.h>
lesmin 0:7e575e5f88ec 10 #include <string.h>
lesmin 0:7e575e5f88ec 11 */
lesmin 0:7e575e5f88ec 12
lesmin 0:7e575e5f88ec 13 #ifndef DEFINE_H_
lesmin 0:7e575e5f88ec 14 #define DEFINE_H_
lesmin 0:7e575e5f88ec 15
lesmin 0:7e575e5f88ec 16 #include "mbed.h"
lesmin 0:7e575e5f88ec 17 #define byte unsigned char
lesmin 0:7e575e5f88ec 18
lesmin 0:7e575e5f88ec 19 #include "Define_Operation.h"
lesmin 0:7e575e5f88ec 20 #include "ErrorCode.h"
lesmin 0:7e575e5f88ec 21
lesmin 0:7e575e5f88ec 22 #define true 1
lesmin 0:7e575e5f88ec 23 #define false 0
lesmin 0:7e575e5f88ec 24
lesmin 0:7e575e5f88ec 25 #define MAX_MSG_BODY 256
lesmin 0:7e575e5f88ec 26 #define MAX_SMS_MSG_BODY 38
lesmin 0:7e575e5f88ec 27
lesmin 0:7e575e5f88ec 28 #define LEN_DOMAIN_CODE 10
lesmin 0:7e575e5f88ec 29 #define LEN_GW_ID 16
lesmin 0:7e575e5f88ec 30 #define LEN_DEVICE_ID 16
lesmin 0:7e575e5f88ec 31 #define LEN_AUTH_KEY 16
lesmin 0:7e575e5f88ec 32 #define LEN_AUTH_ID 16
lesmin 0:7e575e5f88ec 33 #define LEN_MANUFACTURE_ID 16
lesmin 0:7e575e5f88ec 34 #define LEN_ENCRYTION_KEY 32
lesmin 0:7e575e5f88ec 35 #define LEN_MULTIMEDIA_URL 256
lesmin 0:7e575e5f88ec 36 #define LEN_MULTIMEDIA_ID 16
lesmin 0:7e575e5f88ec 37 #define LEN_MULTIMEDIA_PW 16
lesmin 0:7e575e5f88ec 38 #define LEN_LOB_ACCESS_KEY 20
lesmin 0:7e575e5f88ec 39 #define LEN_LOB_SECRET_KEY 16
lesmin 0:7e575e5f88ec 40 #define LEN_LOB_DIRECTORY_PATH 16
lesmin 0:7e575e5f88ec 41 #define LEN_LOB_PATH 64
lesmin 0:7e575e5f88ec 42 #define LEN_TID 4
lesmin 0:7e575e5f88ec 43 #define LEN_IP 4
lesmin 0:7e575e5f88ec 44 #define LEN_FILE_NAME 32
lesmin 0:7e575e5f88ec 45
lesmin 0:7e575e5f88ec 46 #define TID_TANGE_MIN 0
lesmin 0:7e575e5f88ec 47 #define TID_TANGE_MAX 99999
lesmin 0:7e575e5f88ec 48
lesmin 0:7e575e5f88ec 49 #define GMMP_ON_LOG true
lesmin 0:7e575e5f88ec 50 #define GMMP_OFF_LOG false
lesmin 0:7e575e5f88ec 51
lesmin 0:7e575e5f88ec 52 #define GMMP_ERROR_LEVEL_ERROR 0
lesmin 0:7e575e5f88ec 53 #define GMMP_ERROR_LEVEL_DEBUG 1
lesmin 0:7e575e5f88ec 54 #define GMMP_ERROR_LEVEL_DEBUG_DATA 2
lesmin 0:7e575e5f88ec 55
lesmin 0:7e575e5f88ec 56 #define GMMP_LOG_MARKET_OPS 0
lesmin 0:7e575e5f88ec 57 #define GMMP_LOG_MARKET_REQ 1
lesmin 0:7e575e5f88ec 58 #define GMMP_LOG_MARKET_RSP 2
lesmin 0:7e575e5f88ec 59 #define GMMP_LOG_MARKET_OPE 3
lesmin 0:7e575e5f88ec 60 #define GMMP_LOG_MARKET_ERR 4
lesmin 0:7e575e5f88ec 61 #define GMMP_LOG_MARKET_NOT 5
lesmin 0:7e575e5f88ec 62
lesmin 0:7e575e5f88ec 63 #define GMMP_LOG_KEY_KEY0 "<Well>"
lesmin 0:7e575e5f88ec 64 #define GMMP_LOG_KEY_KEY1 "<ID:%s_%d>"
lesmin 0:7e575e5f88ec 65 #define GMMP_LOG_KEY_KEY2 "<Marker:OPS>"
lesmin 0:7e575e5f88ec 66 #define GMMP_LOG_KEY_KEY3 "<Marker:REQ>"
lesmin 0:7e575e5f88ec 67 #define GMMP_LOG_KEY_KEY4 "<Marker:RSP>"
lesmin 0:7e575e5f88ec 68 #define GMMP_LOG_KEY_KEY5 "<Marker:OPE>"
lesmin 0:7e575e5f88ec 69 #define GMMP_LOG_KEY_KEY6 "<Marker:ERR>"
lesmin 0:7e575e5f88ec 70
lesmin 0:7e575e5f88ec 71
lesmin 0:7e575e5f88ec 72 #define GMMP_MARKET_LEN 15
lesmin 0:7e575e5f88ec 73
lesmin 0:7e575e5f88ec 74
lesmin 0:7e575e5f88ec 75 #define GMMP_NETWORK_ALYWAYS_OFF 0
lesmin 0:7e575e5f88ec 76 #define GMMP_NETWORK_ALYWAYS_ON 1
lesmin 0:7e575e5f88ec 77
lesmin 0:7e575e5f88ec 78 #define GMMP_GW 0x01
lesmin 0:7e575e5f88ec 79 #define GMMP_Device 0x02
lesmin 0:7e575e5f88ec 80
lesmin 0:7e575e5f88ec 81 #define GMMP_REG 0x01
lesmin 0:7e575e5f88ec 82 #define GMMP_DEREG 0x02
lesmin 0:7e575e5f88ec 83 #define GMMP_PROFILE 0x03
lesmin 0:7e575e5f88ec 84 #define GMMP_DELIVERY 0x04
lesmin 0:7e575e5f88ec 85 #define GMMP_CONTROL 0x05
lesmin 0:7e575e5f88ec 86 #define GMMP_LSENTENCE 0x06
lesmin 0:7e575e5f88ec 87 #define GMMP_FTP 0x07
lesmin 0:7e575e5f88ec 88 #define GMMP_REMOTE 0x08
lesmin 0:7e575e5f88ec 89 #define GMMP_HEARTBEAT 0x09
lesmin 0:7e575e5f88ec 90 #define GMMP_NOTIFICATION 0x0a
lesmin 0:7e575e5f88ec 91 #define GMMP_MULTIMEDIA 0x0b
lesmin 0:7e575e5f88ec 92 #define GMMP_LOB 0x0c
lesmin 0:7e575e5f88ec 93
lesmin 0:7e575e5f88ec 94 #define GMMP_REG_ENCRYPTION_INFO 0x01
lesmin 0:7e575e5f88ec 95 #define GMMP_REG_ENCRYPTION_KEY 0x02
lesmin 0:7e575e5f88ec 96
lesmin 0:7e575e5f88ec 97 #define GMMP_ENCRYPTION_USE 0x01
lesmin 0:7e575e5f88ec 98 #define GMMP_ENCRYPTION_NOT 0x02
lesmin 0:7e575e5f88ec 99
lesmin 0:7e575e5f88ec 100 #define GMMP_LOB_CLOUD 0x01
lesmin 0:7e575e5f88ec 101 #define GMMP_LOB_FTP 0x02
lesmin 0:7e575e5f88ec 102 #define GMMP_LOB_NOTIFICATION 0x03
lesmin 0:7e575e5f88ec 103
lesmin 0:7e575e5f88ec 104 #define U8 unsigned char
lesmin 0:7e575e5f88ec 105
lesmin 0:7e575e5f88ec 106 #define GMMP_VERSION 0x21
lesmin 0:7e575e5f88ec 107
lesmin 0:7e575e5f88ec 108 extern byte g_serverIp[LEN_IP];
lesmin 0:7e575e5f88ec 109 extern int g_nServerPort;
lesmin 0:7e575e5f88ec 110 extern char g_szAuthID[LEN_AUTH_ID];
lesmin 0:7e575e5f88ec 111 extern char g_szAuthKey[LEN_AUTH_KEY];
lesmin 0:7e575e5f88ec 112 extern char g_szDomainCode[LEN_DOMAIN_CODE];
lesmin 0:7e575e5f88ec 113 extern char g_szGWID[LEN_GW_ID];
lesmin 0:7e575e5f88ec 114 extern char g_szDeviceID[LEN_DEVICE_ID];
lesmin 0:7e575e5f88ec 115
lesmin 0:7e575e5f88ec 116 #define LOG_LEVEL 2
lesmin 0:7e575e5f88ec 117 #define LOG_LEVEL_NONE 6
lesmin 0:7e575e5f88ec 118 #define LOG_LEVEL_FATAL 5
lesmin 0:7e575e5f88ec 119 #define LOG_LEVEL_ERROR 4
lesmin 0:7e575e5f88ec 120 #define LOG_LEVEL_WARN 3
lesmin 0:7e575e5f88ec 121 #define LOG_LEVEL_INFO 2
lesmin 0:7e575e5f88ec 122 #define LOG_LEVEL_DEBUG 1
lesmin 0:7e575e5f88ec 123 #define LOG_LEVEL_ALL 0
lesmin 0:7e575e5f88ec 124
lesmin 0:7e575e5f88ec 125 #include <cstdio>
lesmin 0:7e575e5f88ec 126 #define INFO(x, ...) if (LOG_LEVEL <= LOG_LEVEL_INFO) std::printf("[INFO]"x"\r\n", ##__VA_ARGS__);
lesmin 0:7e575e5f88ec 127 #define DBG(x, ...) if (LOG_LEVEL <= LOG_LEVEL_DEBUG) std::printf("[DBG]"x"\r\n", ##__VA_ARGS__);
lesmin 0:7e575e5f88ec 128 #define WARN(x, ...) if (LOG_LEVEL <= LOG_LEVEL_WARN) std::printf("[WARN]"x"\r\n", ##__VA_ARGS__);
lesmin 0:7e575e5f88ec 129 #define ERR(x, ...) if (LOG_LEVEL <= LOG_LEVEL_ERROR) std::printf("[ERR]"x"\r\n", ##__VA_ARGS__);
lesmin 0:7e575e5f88ec 130
lesmin 0:7e575e5f88ec 131 #define fatal(x) if (LOG_LEVEL <= LOG_LEVEL_FATAL) std::printf((x))
lesmin 0:7e575e5f88ec 132 #define fatalln(x) if (LOG_LEVEL <= LOG_LEVEL_FATAL) {std::printf(((x)); std::printf("\r\n");}
lesmin 0:7e575e5f88ec 133 #define fatal2(x, y) if (LOG_LEVEL <= LOG_LEVEL_FATAL) std::printf((x), (y))
lesmin 0:7e575e5f88ec 134 #define fatalln2(x, y) if (LOG_LEVEL <= LOG_LEVEL_FATAL) {std::printf((x), (y)); std::printf("\r\n");}
lesmin 0:7e575e5f88ec 135
lesmin 0:7e575e5f88ec 136 #define error(x) if (LOG_LEVEL <= LOG_LEVEL_ERROR) std::printf((x))
lesmin 0:7e575e5f88ec 137 #define errorln(x) if (LOG_LEVEL <= LOG_LEVEL_ERROR) {std::printf((x)); std::printf("\r\n");}
lesmin 0:7e575e5f88ec 138 #define error2(x, y) if (LOG_LEVEL <= LOG_LEVEL_ERROR) std::printf((x), (y))
lesmin 0:7e575e5f88ec 139 #define errorln2(x, y) if (LOG_LEVEL <= LOG_LEVEL_ERROR) {std::printf((x), (y)); std::printf("\r\n");}
lesmin 0:7e575e5f88ec 140
lesmin 0:7e575e5f88ec 141 #define warn(x) if (LOG_LEVEL <= LOG_LEVEL_WARN) std::printf((x))
lesmin 0:7e575e5f88ec 142 #define warnln(x) if (LOG_LEVEL <= LOG_LEVEL_WARN) {std::printf((x)); std::printf("\r\n");}
lesmin 0:7e575e5f88ec 143 #define warn2(x, y) if (LOG_LEVEL <= LOG_LEVEL_WARN) std::printf((x), (y))
lesmin 0:7e575e5f88ec 144 #define warnln2(x, y) if (LOG_LEVEL <= LOG_LEVEL_WARN) {std::printf((x), (y)); std::printf("\r\n");}
lesmin 0:7e575e5f88ec 145
lesmin 0:7e575e5f88ec 146 #define info(x) if (LOG_LEVEL <= LOG_LEVEL_INFO) std::printf((x))
lesmin 0:7e575e5f88ec 147 #define infoln(x) if (LOG_LEVEL <= LOG_LEVEL_INFO) {std::printf((x)); std::printf("\r\n");}
lesmin 0:7e575e5f88ec 148 #define info2(x, y) if (LOG_LEVEL <= LOG_LEVEL_INFO) std::printf((x), (y))
lesmin 0:7e575e5f88ec 149 #define infoln2(x, y) if (LOG_LEVEL <= LOG_LEVEL_INFO) {std::printf((x), (y)); std::printf("\r\n");}
lesmin 0:7e575e5f88ec 150
lesmin 0:7e575e5f88ec 151 #define debug(x) if (LOG_LEVEL <= LOG_LEVEL_DEBUG) std::printf((x))
lesmin 0:7e575e5f88ec 152 #define debugln(x) if (LOG_LEVEL <= LOG_LEVEL_DEBUG) {std::printf((x)); std::printf("\r\n");}
lesmin 0:7e575e5f88ec 153 #define debug2(x, y) if (LOG_LEVEL <= LOG_LEVEL_DEBUG) std::printf((x), (y))
lesmin 0:7e575e5f88ec 154 #define debugln2(x, y) if (LOG_LEVEL <= LOG_LEVEL_DEBUG) {std::printf((x), (y)); std::printf("\r\n");}
lesmin 0:7e575e5f88ec 155
lesmin 0:7e575e5f88ec 156 #endif /* DEFINE_H_ */
lesmin 0:7e575e5f88ec 157
lesmin 0:7e575e5f88ec 158
lesmin 0:7e575e5f88ec 159
lesmin 0:7e575e5f88ec 160