16 #ifndef M2MCONSTANTS_H 17 #define M2MCONSTANTS_H 26 const int MAX_VALUE_LENGTH = 256;
27 const int BUFFER_LENGTH = 1152;
29 const uint8_t MINIMUM_REGISTRATION_TIME = 60;
30 const uint8_t ONE_SECOND_TIMER = 1;
31 const uint8_t MAX_ALLOWED_STRING_LENGTH = 64;
32 const uint8_t MAX_ALLOWED_ERROR_STRING_LENGTH = 64;
33 const uint16_t CONFIG_BOOLEAN_ITEM_SIZE = 4;
34 const uint16_t MAX_FIRMWARE_PACKAGE_URI_PATH_LEN = 255;
35 const uint32_t HANDSHAKE_TIMEOUT_MSECS = (30 * 60 * 1000);
41 #define MAX_OBJECT_PATH_NAME (255 + 1 + 5 + 1 + 5 + 1) 45 #define START_OBSERVATION 0 46 #define STOP_OBSERVATION 1 48 #define COAP "coap://" 49 #define COAPS "coaps://" 50 #define BOOTSTRAP_URI "bs" 59 #define CANCEL "cancel" 62 #define QUERY_PARAM_IEP "iep" 63 #define QUERY_PARAM_EST "est" 64 #define QUERY_PARAM_AID "aid" 67 #define QUERY_VALUE_TRUE "true" 70 #define M2M_SECURITY_ID "0" 71 #define M2M_SERVER_ID "1" 72 #define M2M_ACCESS_CONTROL_ID "2" 73 #define M2M_DEVICE_ID "3" 74 #define M2M_CONNECTIVITY_MONITOR_ID "4" 75 #define M2M_FIRMWARE_ID "5" 76 #define M2M_LOCATION_ID "6" 77 #define M2M_CONNECTIVITY_STATISTICS_ID "7" 78 #define RESERVED_ID "8" 81 #define OMA_RESOURCE_TYPE "" //oma.lwm2m 84 #define DEVICE_MANUFACTURER "0" 85 #define DEVICE_DEVICE_TYPE "17" 86 #define DEVICE_MODEL_NUMBER "1" 87 #define DEVICE_SERIAL_NUMBER "2" 88 #define DEVICE_HARDWARE_VERSION "18" 89 #define DEVICE_FIRMWARE_VERSION "3" 90 #define DEVICE_SOFTWARE_VERSION "19" 91 #define DEVICE_REBOOT "4" 92 #define DEVICE_FACTORY_RESET "5" 93 #define DEVICE_AVAILABLE_POWER_SOURCES "6" 94 #define DEVICE_POWER_SOURCE_VOLTAGE "7" 95 #define DEVICE_POWER_SOURCE_CURRENT "8" 96 #define DEVICE_BATTERY_LEVEL "9" 97 #define DEVICE_BATTERY_STATUS "20" 98 #define DEVICE_MEMORY_FREE "10" 99 #define DEVICE_MEMORY_TOTAL "21" 100 #define DEVICE_ERROR_CODE "11" 101 #define DEVICE_RESET_ERROR_CODE "12" 102 #define DEVICE_CURRENT_TIME "13" 103 #define DEVICE_UTC_OFFSET "14" 104 #define DEVICE_TIMEZONE "15" 105 #define DEVICE_SUPPORTED_BINDING_MODE "16" 106 #define BINDING_MODE_UDP "U" 107 #define BINDING_MODE_UDP_QUEUE "UQ" 108 #define BINDING_MODE_SMS "S" 109 #define BINDING_MODE_SMS_QUEUE "SQ" 110 #define ERROR_CODE_VALUE "0" 113 #define SECURITY_M2M_SERVER_URI "0" 114 #define SECURITY_BOOTSTRAP_SERVER "1" 115 #define SECURITY_SECURITY_MODE "2" 116 #define SECURITY_PUBLIC_KEY "3" 117 #define SECURITY_SERVER_PUBLIC_KEY "4" 118 #define SECURITY_SECRET_KEY "5" 119 #define SECURITY_SMS_SECURITY_MODE "6" 120 #define SECURITY_SMS_BINDING_KEY "7" 121 #define SECURITY_SMS_BINDING_SECRET_KEY "8" 122 #define SECURITY_M2M_SERVER_SMS_NUMBER "9" 123 #define SECURITY_SHORT_SERVER_ID "10" 124 #define SECURITY_CLIENT_HOLD_OFF_TIME "11" 126 #define SECURITY_OPEN_CERTIFICATE_CHAIN "12" 127 #define SECURITY_CLOSE_CERTIFICATE_CHAIN "13" 128 #define SECURITY_READ_CERTIFICATE_CHAIN "14" 131 #define SERVER_PATH_PREFIX "1/0/" 132 #define SERVER_SHORT_SERVER_ID "0" 133 #define SERVER_LIFETIME "1" 134 #define SERVER_DEFAULT_MIN_PERIOD "2" 135 #define SERVER_DEFAULT_MAX_PERIOD "3" 136 #define SERVER_DISABLE "4" 137 #define SERVER_DISABLE_TIMEOUT "5" 138 #define SERVER_NOTIFICATION_STORAGE "6" 139 #define SERVER_BINDING "7" 140 #define SERVER_REGISTRATION_UPDATE "8" 141 #define SERVER_LIFETIME_PATH SERVER_PATH_PREFIX SERVER_LIFETIME 144 #define FIRMWARE_PATH_PREFIX "5/0/" 145 #define FIRMWARE_PACKAGE "0" 146 #define FIRMWARE_PACKAGE_URI "1" 147 #define FIRMWARE_UPDATE "2" 148 #define FIRMWARE_STATE "3" 149 #define FIRMWARE_UPDATE_SUPPORTED_OBJECTS "4" 150 #define FIRMWARE_UPDATE_RESULT "5" 151 #define FIRMWARE_PACKAGE_NAME "6" 152 #define FIRMWARE_PACKAGE_VERSION "7" 153 #define FIRMWARE_PACKAGE_URI_PATH FIRMWARE_PATH_PREFIX FIRMWARE_PACKAGE_URI 157 #define ERROR_REASON_1 "No security object found for Bootstrap" 158 #define ERROR_REASON_3 "Bootstrap feature is disabled" 159 #define ERROR_REASON_4 "No security object found for Registration" 160 #define ERROR_REASON_5 "Registration not allowed for now, try later" 161 #define ERROR_REASON_6 "Unregistration not allowed for now, try later" 162 #define ERROR_REASON_7 "Client is not connected, cannot send data now" 163 #define ERROR_REASON_8 "LWM2M server rejected client registration" 164 #define ERROR_REASON_9 "Client in reconnection mode %s" 165 #define ERROR_REASON_10 "Client cannot connect anymore %s" 166 #define ERROR_REASON_13 "LWM2M server URL is not correctly formed" 167 #define ERROR_REASON_14 "LWM2M server address is not set correctly in client" 168 #define ERROR_REASON_15 "Failed to do full registration because of missing parameters in registration" 169 #define ERROR_REASON_16 "Cannot unregister as client is not registered" 170 #define ERROR_REASON_17 "Incoming CoAP message parsing failed" 171 #define ERROR_REASON_18 "Sending reg-update failed as lifetime is less than 60 sec" 172 #define ERROR_REASON_19 "LWM2M server URL is not correctly formed" 173 #ifndef MBED_CLIENT_DISABLE_BOOTSTRAP_FEATURE 174 #define ERROR_REASON_2 "Bootstrap not allowed for now, try later" 175 #define ERROR_REASON_11 "Bootstrap server URL is not correctly formed" 176 #define ERROR_REASON_12 "Bootstrap resource is not correctly formed" 177 #define ERROR_REASON_20 "BS PUT fails :%s" 178 #define ERROR_REASON_21 "BS DEL fails :%s" 179 #define ERROR_REASON_22 "BS FIN fails :%s" 180 #define ERROR_REASON_23 "Bootstrap SecureConnection failed" 181 #define ERROR_REASON_26 "BS FIN fails: missing EST iep param" 183 #define ERROR_REASON_24 "Unregistration failed" 184 #define ERROR_REASON_25 "Failed to allocate registration message" 185 #define ERROR_REASON_27 "Call already in progress" 186 #define ERROR_REASON_28 "Message sending timed out" 187 #define ERROR_REASON_29 "Call not allowed for now, wrong state" 189 #define COAP_ERROR_REASON_1 "bad-request" 190 #define COAP_ERROR_REASON_2 "bad-option" 191 #define COAP_ERROR_REASON_3 "request-entity-incomplete" 192 #define COAP_ERROR_REASON_4 "precondition-failed" 193 #define COAP_ERROR_REASON_5 "request-entity-too-large" 194 #define COAP_ERROR_REASON_6 "unsupported-content-format" 195 #define COAP_ERROR_REASON_7 "response-unauthorized" 196 #define COAP_ERROR_REASON_8 "response-forbidden" 197 #define COAP_ERROR_REASON_9 "not-acceptable" 198 #define COAP_ERROR_REASON_10 "not-found" 199 #define COAP_ERROR_REASON_11 "method-not-allowed" 200 #define COAP_ERROR_REASON_12 "message-sending-failed" 201 #define COAP_ERROR_REASON_13 "service-unavailable" 202 #define COAP_ERROR_REASON_14 "internal-server-error" 203 #define COAP_ERROR_REASON_15 "bad-gateway" 204 #define COAP_ERROR_REASON_16 "gateway-timeout" 205 #define COAP_ERROR_REASON_17 "proxying-not-supported" 206 #define COAP_NO_ERROR "no-error" 208 #define ERROR_SECURE_CONNECTION "SecureConnectionFailed" 209 #define ERROR_DNS "DnsResolvingFailed" 210 #define ERROR_NETWORK "NetworkError" 211 #define ERROR_NO "No error" 212 #define ERROR_NO_MEMORY "Memory allocation failed" 213 #define ERROR_FAILED_TO_READ_CREDENTIALS "Failed to read credentials" 215 #define MAX_RECONNECT_TIMEOUT_LOW 300 // 5 minutes 217 #define RECONNECT_INCREMENT_FACTOR 2 219 #define AUTO_OBS_TOKEN_MIN 1 220 #define AUTO_OBS_TOKEN_MAX 1023 222 #define RESPONSE_RANDOM_FACTOR 1.5 224 #define DEFAULT_M2MVERSION "1.0" 227 const uint8_t TYPE_RESOURCE = 0xC0;
228 const uint8_t TYPE_MULTIPLE_RESOURCE = 0x80;
229 const uint8_t TYPE_RESOURCE_INSTANCE = 0x40;
230 const uint8_t TYPE_OBJECT_INSTANCE = 0x0;
232 const uint8_t ID8 = 0x0;
233 const uint8_t ID16 = 0x20;
235 const uint8_t LENGTH8 = 0x08;
236 const uint8_t LENGTH16 = 0x10;
237 const uint8_t LENGTH24 = 0x18;
239 const uint8_t COAP_CONTENT_OMA_PLAIN_TEXT_TYPE = 0;
240 const uint8_t COAP_CONTENT_OMA_TLV_TYPE_OLD = 99;
241 const uint16_t COAP_CONTENT_OMA_TLV_TYPE = 11542;
242 const uint16_t COAP_CONTENT_OMA_JSON_TYPE = 11543;
243 const uint8_t COAP_CONTENT_OMA_OPAQUE_TYPE = 42;
244 const uint8_t COAP_CONTENT_OMA_LINK_FORMAT_TYPE = 40;
246 #endif // M2MCONSTANTS_H File defining all system build time configuration used by mbed-client.