Simulated product dispenser
Fork of mbed-cloud-workshop-connect-HTS221 by
m2mconstants.h
00001 /* 00002 * Copyright (c) 2015 ARM Limited. All rights reserved. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * Licensed under the Apache License, Version 2.0 (the License); you may 00005 * not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an AS IS BASIS, WITHOUT 00012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #ifndef M2MCONSTANTS_H 00017 #define M2MCONSTANTS_H 00018 00019 /*! \file m2mconstants.h 00020 * \brief File defining all the constants used across mbed-client. 00021 */ 00022 00023 #include <stdint.h> 00024 #include "m2mconfig.h" 00025 00026 const int MAX_VALUE_LENGTH = 256; 00027 const int BUFFER_LENGTH = 1152; 00028 00029 const uint8_t MINIMUM_REGISTRATION_TIME = 60; //in seconds 00030 const uint8_t ONE_SECOND_TIMER = 1; 00031 const uint8_t MAX_ALLOWED_STRING_LENGTH = 64; 00032 const uint8_t MAX_ALLOWED_ERROR_STRING_LENGTH = 64; 00033 const uint16_t OPTIMUM_LIFETIME = 3600; 00034 const uint16_t REDUCE_LIFETIME = 900; 00035 const float REDUCTION_FACTOR = 0.75f; 00036 const uint16_t MAX_CERTIFICATE_SIZE = 1024; 00037 const uint16_t CONFIG_BOOLEAN_ITEM_SIZE = 4; 00038 00039 // XXX: 00040 // <name></><inst-id></><res-name> 00041 //#define MAX_OBJECT_INSTANCE_NAME (255 + 1 + 5 + 1 + 255 + 1 + 5) 00042 // <name></><inst-id></><inst-id><zero-terminator> 00043 #define MAX_OBJECT_PATH_NAME (255 + 1 + 5 + 1 + 5 + 1) 00044 00045 // values per: draft-ietf-core-observe-16 00046 // OMA LWM2M CR ref. 00047 #define START_OBSERVATION 0 00048 #define STOP_OBSERVATION 1 00049 00050 #define COAP "coap://" 00051 #define COAPS "coaps://" 00052 #define BOOTSTRAP_URI "bs" 00053 // PUT attributes to be checked from server 00054 #define EQUAL "=" 00055 #define AMP "&" 00056 #define PMIN "pmin" 00057 #define PMAX "pmax" 00058 #define GT "gt" 00059 #define LT "lt" 00060 #define ST_SIZE "st" 00061 #define STP "stp" 00062 #define CANCEL "cancel" 00063 00064 // Different query parameters 00065 #define QUERY_PARAM_IEP "iep" 00066 #define QUERY_PARAM_EST "est" 00067 #define QUERY_PARAM_AID "aid" 00068 00069 // Different query parameter values 00070 #define QUERY_VALUE_TRUE "true" 00071 00072 // just a helper for "String default_value = "";" pattern 00073 extern const String EMPTY; 00074 00075 //LWM2MOBJECT NAME/ID 00076 #define M2M_SECURITY_ID "0" 00077 #define M2M_SERVER_ID "1" 00078 #define M2M_ACCESS_CONTROL_ID "2" 00079 #define M2M_DEVICE_ID "3" 00080 #define M2M_CONNECTIVITY_MONITOR_ID "4" 00081 #define M2M_FIRMWARE_ID "5" 00082 #define M2M_LOCATION_ID "6" 00083 #define M2M_CONNECTIVITY_STATISTICS_ID "7" 00084 #define RESERVED_ID "8" 00085 00086 //OMA RESOURCE TYPE 00087 #define OMA_RESOURCE_TYPE "" //oma.lwm2m 00088 00089 //DEVICE RESOURCES 00090 #define DEVICE_MANUFACTURER "0" 00091 #define DEVICE_DEVICE_TYPE "17" 00092 #define DEVICE_MODEL_NUMBER "1" 00093 #define DEVICE_SERIAL_NUMBER "2" 00094 #define DEVICE_HARDWARE_VERSION "18" 00095 #define DEVICE_FIRMWARE_VERSION "3" 00096 #define DEVICE_SOFTWARE_VERSION "19" 00097 #define DEVICE_REBOOT "4" 00098 #define DEVICE_FACTORY_RESET "5" 00099 #define DEVICE_AVAILABLE_POWER_SOURCES "6" 00100 #define DEVICE_POWER_SOURCE_VOLTAGE "7" 00101 #define DEVICE_POWER_SOURCE_CURRENT "8" 00102 #define DEVICE_BATTERY_LEVEL "9" 00103 #define DEVICE_BATTERY_STATUS "20" 00104 #define DEVICE_MEMORY_FREE "10" 00105 #define DEVICE_MEMORY_TOTAL "21" 00106 #define DEVICE_ERROR_CODE "11" 00107 #define DEVICE_RESET_ERROR_CODE "12" 00108 #define DEVICE_CURRENT_TIME "13" 00109 #define DEVICE_UTC_OFFSET "14" 00110 #define DEVICE_TIMEZONE "15" 00111 #define DEVICE_SUPPORTED_BINDING_MODE "16" 00112 #define BINDING_MODE_UDP "U" 00113 #define BINDING_MODE_UDP_QUEUE "UQ" 00114 #define BINDING_MODE_SMS "S" 00115 #define BINDING_MODE_SMS_QUEUE "SQ" 00116 #define ERROR_CODE_VALUE "0" 00117 00118 //SECURITY RESOURCES 00119 #define SECURITY_M2M_SERVER_URI "0" 00120 #define SECURITY_BOOTSTRAP_SERVER "1" 00121 #define SECURITY_SECURITY_MODE "2" 00122 #define SECURITY_PUBLIC_KEY "3" 00123 #define SECURITY_SERVER_PUBLIC_KEY "4" 00124 #define SECURITY_SECRET_KEY "5" 00125 #define SECURITY_SMS_SECURITY_MODE "6" 00126 #define SECURITY_SMS_BINDING_KEY "7" 00127 #define SECURITY_SMS_BINDING_SECRET_KEY "8" 00128 #define SECURITY_M2M_SERVER_SMS_NUMBER "9" 00129 #define SECURITY_SHORT_SERVER_ID "10" 00130 #define SECURITY_CLIENT_HOLD_OFF_TIME "11" 00131 00132 #define SECURITY_OPEN_CERTIFICATE_CHAIN "12" 00133 #define SECURITY_CLOSE_CERTIFICATE_CHAIN "13" 00134 #define SECURITY_READ_CERTIFICATE_CHAIN "14" 00135 00136 //SERVER RESOURCES 00137 #define SERVER_PATH_PREFIX "1/0/" 00138 #define SERVER_SHORT_SERVER_ID "0" 00139 #define SERVER_LIFETIME "1" 00140 #define SERVER_DEFAULT_MIN_PERIOD "2" 00141 #define SERVER_DEFAULT_MAX_PERIOD "3" 00142 #define SERVER_DISABLE "4" 00143 #define SERVER_DISABLE_TIMEOUT "5" 00144 #define SERVER_NOTIFICATION_STORAGE "6" 00145 #define SERVER_BINDING "7" 00146 #define SERVER_REGISTRATION_UPDATE "8" 00147 #define SERVER_LIFETIME_PATH SERVER_PATH_PREFIX SERVER_LIFETIME 00148 00149 //FIRMWARE RESOURCES 00150 #define FIRMWARE_PATH_PREFIX "5/0/" 00151 #define FIRMWARE_PACKAGE "0" 00152 #define FIRMWARE_PACKAGE_URI "1" 00153 #define FIRMWARE_UPDATE "2" 00154 #define FIRMWARE_STATE "3" 00155 #define FIRMWARE_UPDATE_SUPPORTED_OBJECTS "4" 00156 #define FIRMWARE_UPDATE_RESULT "5" 00157 #define FIRMWARE_PACKAGE_NAME "6" 00158 #define FIRMWARE_PACKAGE_VERSION "7" 00159 #define FIRMAWARE_PACKAGE_URI_PATH FIRMWARE_PATH_PREFIX FIRMWARE_PACKAGE_URI 00160 00161 // Error Strings 00162 00163 #define ERROR_REASON_1 "No security object found for Bootstrap" 00164 #define ERROR_REASON_2 "Bootstrap not allowed for now, try later" 00165 #define ERROR_REASON_3 "Bootstrap feature is disabled" 00166 #define ERROR_REASON_4 "No security object found for Registration" 00167 #define ERROR_REASON_5 "Registration not allowed for now, try later" 00168 #define ERROR_REASON_6 "Unregistration not allowed for now, try later" 00169 #define ERROR_REASON_7 "Client is not connected, cannot send data now" 00170 #define ERROR_REASON_8 "LWM2M server rejected client registration" 00171 #define ERROR_REASON_9 "Client in reconnection mode %s" 00172 #define ERROR_REASON_10 "Client cannot connect anymore %s" 00173 #define ERROR_REASON_11 "Bootstrap server URL is not correctly formed" 00174 #define ERROR_REASON_12 "Bootstrap resource is not correctly formed" 00175 #define ERROR_REASON_13 "LWM2M server URL is not correctly formed" 00176 #define ERROR_REASON_14 "LWM2M server address is not set correctly in client" 00177 #define ERROR_REASON_15 "Failed to do full registration because of missing parameters in registration" 00178 #define ERROR_REASON_16 "Cannot unregister as client is not registered" 00179 #define ERROR_REASON_17 "Incoming CoAP message parsing failed" 00180 #define ERROR_REASON_18 "Sending reg-update failed as lifetime is less than 60 sec" 00181 #define ERROR_REASON_19 "LWM2M server URL is not correctly formed" 00182 #define ERROR_REASON_20 "BS PUT fails :%s" 00183 #define ERROR_REASON_21 "BS DEL fails :%s" 00184 #define ERROR_REASON_22 "BS FIN fails :%s" 00185 #define ERROR_REASON_23 "Bootstrap SecureConnection failed" 00186 #define ERROR_REASON_24 "LWM2M server rejected client unregistration (not-found)" 00187 #define ERROR_REASON_25 "Failed to allocate registration message" 00188 #define ERROR_REASON_26 "BS FIN fails: missing EST iep param" 00189 #define ERROR_REASON_27 "Call already in progress" 00190 00191 #define COAP_ERROR_REASON_1 "bad-request" 00192 #define COAP_ERROR_REASON_2 "bad-option" 00193 #define COAP_ERROR_REASON_3 "request-entity-incomplete" 00194 #define COAP_ERROR_REASON_4 "precondition-failed" 00195 #define COAP_ERROR_REASON_5 "request-entity-too-large" 00196 #define COAP_ERROR_REASON_6 "unsupported-content-format" 00197 #define COAP_ERROR_REASON_7 "response-unauthorized" 00198 #define COAP_ERROR_REASON_8 "response-forbidden" 00199 #define COAP_ERROR_REASON_9 "not-acceptable" 00200 #define COAP_ERROR_REASON_10 "not-found" 00201 #define COAP_ERROR_REASON_11 "method-not-allowed" 00202 #define COAP_ERROR_REASON_12 "message-sending-failed" 00203 #define COAP_ERROR_REASON_13 "service-unavailable" 00204 #define COAP_ERROR_REASON_14 "internal-server-error" 00205 #define COAP_ERROR_REASON_15 "bad-gateway" 00206 #define COAP_ERROR_REASON_16 "gateway-timeout" 00207 #define COAP_ERROR_REASON_17 "proxying-not-supported" 00208 #define COAP_NO_ERROR "no-error" 00209 00210 #define ERROR_SECURE_CONNECTION "SecureConnectionFailed" 00211 #define ERROR_DNS "DnsResolvingFailed" 00212 #define ERROR_NETWORK "NetworkError" 00213 #define ERROR_NO "No error" 00214 00215 #define MAX_RECONNECT_TIMEOUT 604800 00216 #define RECONNECT_INCREMENT_FACTOR 2 00217 00218 #define AUTO_OBS_TOKEN_MIN 1 00219 #define AUTO_OBS_TOKEN_MAX 1023 00220 00221 #define RESPONSE_RANDOM_FACTOR 1.5 /**< Resending random factor, value is specified in IETF CoAP specification */ 00222 00223 // TLV serializer / deserializer 00224 const uint8_t TYPE_RESOURCE = 0xC0; 00225 const uint8_t TYPE_MULTIPLE_RESOURCE = 0x80; 00226 const uint8_t TYPE_RESOURCE_INSTANCE = 0x40; 00227 const uint8_t TYPE_OBJECT_INSTANCE = 0x0; 00228 00229 const uint8_t ID8 = 0x0; 00230 const uint8_t ID16 = 0x20; 00231 00232 const uint8_t LENGTH8 = 0x08; 00233 const uint8_t LENGTH16 = 0x10; 00234 const uint8_t LENGTH24 = 0x18; 00235 00236 const uint8_t COAP_CONTENT_OMA_PLAIN_TEXT_TYPE = 0; 00237 const uint8_t COAP_CONTENT_OMA_TLV_TYPE_OLD = 99; 00238 const uint16_t COAP_CONTENT_OMA_TLV_TYPE = 11542; 00239 const uint16_t COAP_CONTENT_OMA_JSON_TYPE = 11543; 00240 const uint8_t COAP_CONTENT_OMA_OPAQUE_TYPE = 42; 00241 00242 const uint16_t MAX_UNINT_16_COUNT = 65535; 00243 00244 #endif // M2MCONSTANTS_H
Generated on Tue Jul 12 2022 19:12:12 by 1.7.2