boting ren / Mbed OS BLEClient_mbedDevConn
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers m2mconstants.h Source File

m2mconstants.h

Go to the documentation of this file.
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 int32_t MINIMUM_REGISTRATION_TIME = 60; //in seconds
00030 const uint64_t ONE_SECOND_TIMER = 1;
00031 const uint16_t MAX_ALLOWED_STRING_LENGTH = 64;
00032 const uint16_t OPTIMUM_LIFETIME = 3600;
00033 const uint16_t REDUCE_LIFETIME = 900;
00034 const float REDUCTION_FACTOR = 0.75f;
00035 
00036 // XXX:
00037 //                               <name></><inst-id></><res-name>
00038 //#define MAX_OBJECT_INSTANCE_NAME (255 + 1 + 5 + 1 + 255 + 1 + 5)
00039 //                           <name></><inst-id></><inst-id><zero-terminator>
00040 #define MAX_OBJECT_PATH_NAME (255 + 1 + 5 + 1 + 5 + 1)
00041 
00042 // values per: draft-ietf-core-observe-16
00043 // OMA LWM2M CR ref.
00044 #define START_OBSERVATION 0
00045 #define STOP_OBSERVATION 1
00046 
00047 #define COAP "coap://"
00048 #define COAPS  "coaps://"
00049 #define BOOTSTRAP_URI "bs"
00050 // PUT attributes to be checked from server
00051 #define EQUAL  "="
00052 #define AMP  "&"
00053 #define PMIN  "pmin"
00054 #define PMAX  "pmax"
00055 #define GT  "gt"
00056 #define LT  "lt"
00057 #define ST_SIZE  "st"
00058 #define STP  "stp"
00059 #define CANCEL  "cancel"
00060 
00061 // just a helper for "String default_value = "";" pattern
00062 extern const String EMPTY;
00063 
00064 //LWM2MOBJECT NAME/ID
00065 #define M2M_SECURITY_ID  "0"
00066 #define M2M_SERVER_ID  "1"
00067 #define M2M_ACCESS_CONTROL_ID  "2"
00068 #define M2M_DEVICE_ID  "3"
00069 #define M2M_CONNECTIVITY_MONITOR_ID  "4"
00070 #define M2M_FIRMWARE_ID  "5"
00071 #define M2M_LOCATION_ID  "6"
00072 #define M2M_CONNECTIVITY_STATISTICS_ID  "7"
00073 #define RESERVED_ID  "8"
00074 
00075 //OMA RESOURCE TYPE
00076 #define OMA_RESOURCE_TYPE  "" //oma.lwm2m
00077 
00078 //DEVICE RESOURCES
00079 #define DEVICE_MANUFACTURER  "0"
00080 #define DEVICE_DEVICE_TYPE  "17"
00081 #define DEVICE_MODEL_NUMBER  "1"
00082 #define DEVICE_SERIAL_NUMBER  "2"
00083 #define DEVICE_HARDWARE_VERSION  "18"
00084 #define DEVICE_FIRMWARE_VERSION  "3"
00085 #define DEVICE_SOFTWARE_VERSION  "19"
00086 #define DEVICE_REBOOT  "4"
00087 #define DEVICE_FACTORY_RESET  "5"
00088 #define DEVICE_AVAILABLE_POWER_SOURCES  "6"
00089 #define DEVICE_POWER_SOURCE_VOLTAGE  "7"
00090 #define DEVICE_POWER_SOURCE_CURRENT  "8"
00091 #define DEVICE_BATTERY_LEVEL  "9"
00092 #define DEVICE_BATTERY_STATUS  "20"
00093 #define DEVICE_MEMORY_FREE  "10"
00094 #define DEVICE_MEMORY_TOTAL  "21"
00095 #define DEVICE_ERROR_CODE  "11"
00096 #define DEVICE_RESET_ERROR_CODE  "12"
00097 #define DEVICE_CURRENT_TIME  "13"
00098 #define DEVICE_UTC_OFFSET  "14"
00099 #define DEVICE_TIMEZONE  "15"
00100 #define DEVICE_SUPPORTED_BINDING_MODE  "16"
00101 #define BINDING_MODE_UDP  "U"
00102 #define BINDING_MODE_UDP_QUEUE  "UQ"
00103 #define BINDING_MODE_SMS  "S"
00104 #define BINDING_MODE_SMS_QUEUE  "SQ"
00105 #define ERROR_CODE_VALUE  "0"
00106 
00107 //SECURITY RESOURCES
00108 #define SECURITY_M2M_SERVER_URI  "0"
00109 #define SECURITY_BOOTSTRAP_SERVER  "1"
00110 #define SECURITY_SECURITY_MODE  "2"
00111 #define SECURITY_PUBLIC_KEY  "3"
00112 #define SECURITY_SERVER_PUBLIC_KEY  "4"
00113 #define SECURITY_SECRET_KEY  "5"
00114 #define SECURITY_SMS_SECURITY_MODE  "6"
00115 #define SECURITY_SMS_BINDING_KEY  "7"
00116 #define SECURITY_SMS_BINDING_SECRET_KEY  "8"
00117 #define SECURITY_M2M_SERVER_SMS_NUMBER  "9"
00118 #define SECURITY_SHORT_SERVER_ID  "10"
00119 #define SECURITY_CLIENT_HOLD_OFF_TIME  "11"
00120 
00121 //SERVER RESOURCES
00122 #define SERVER_SHORT_SERVER_ID  "0"
00123 #define SERVER_LIFETIME  "1"
00124 #define SERVER_DEFAULT_MIN_PERIOD  "2"
00125 #define SERVER_DEFAULT_MAX_PERIOD  "3"
00126 #define SERVER_DISABLE  "4"
00127 #define SERVER_DISABLE_TIMEOUT  "5"
00128 #define SERVER_NOTIFICATION_STORAGE  "6"
00129 #define SERVER_BINDING  "7"
00130 #define SERVER_REGISTRATION_UPDATE  "8"
00131 
00132 //FIRMWARE RESOURCES
00133 #define FIRMWARE_PATH_PREFIX "5/0/"
00134 #define FIRMWARE_PACKAGE  "0"
00135 #define FIRMWARE_PACKAGE_URI  "1"
00136 #define FIRMWARE_UPDATE  "2"
00137 #define FIRMWARE_STATE  "3"
00138 #define FIRMWARE_UPDATE_SUPPORTED_OBJECTS  "4"
00139 #define FIRMWARE_UPDATE_RESULT  "5"
00140 #define FIRMWARE_PACKAGE_NAME  "6"
00141 #define FIRMWARE_PACKAGE_VERSION  "7"
00142 
00143 // TLV serializer / deserializer
00144 const uint8_t TYPE_RESOURCE = 0xC0;
00145 const uint8_t TYPE_MULTIPLE_RESOURCE = 0x80;
00146 const uint8_t TYPE_RESOURCE_INSTANCE = 0x40;
00147 const uint8_t TYPE_OBJECT_INSTANCE = 0x0;
00148 
00149 const uint8_t ID8 = 0x0;
00150 const uint8_t ID16 = 0x20;
00151 
00152 const uint8_t LENGTH8 = 0x08;
00153 const uint8_t LENGTH16 = 0x10;
00154 const uint8_t LENGTH24 = 0x18;
00155 
00156 const uint8_t COAP_CONTENT_OMA_PLAIN_TEXT_TYPE = 0;
00157 const uint8_t COAP_CONTENT_OMA_TLV_TYPE = 99;
00158 const uint8_t COAP_CONTENT_OMA_JSON_TYPE = 100;
00159 const uint8_t COAP_CONTENT_OMA_OPAQUE_TYPE = 42;
00160 
00161 const uint16_t MAX_UNINT_16_COUNT = 65535;
00162 
00163 #endif // M2MCONSTANTS_H