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

« Back to documentation index

Show/hide line numbers m2mconfig.h Source File

m2mconfig.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 M2MCONFIG_H
00017 #define M2MCONFIG_H
00018 
00019 /*! \file m2mconfig.h
00020 * \brief File defining all system build time configuration used by mbed-client.
00021 */
00022 
00023 #include "mbed-client/m2mstring.h"
00024 
00025 #include <stddef.h>
00026 
00027 using namespace m2m;
00028 
00029 /**
00030  * \def MBED_CLIENT_RECONNECTION_COUNT
00031  *
00032  * \brief Sets Reconnection count for mbed Client
00033  * to attempt a reconnection re-tries until
00034  * reaches the defined value either by the application
00035  * or the default value set in Client.
00036  * By default, the value is 3.
00037  */
00038 #undef MBED_CLIENT_RECONNECTION_COUNT  /* 3 */
00039 
00040 /**
00041  * \def MBED_CLIENT_RECONNECTION_INTERVAL
00042  *
00043  * \brief Sets Reconnection interval (in seconds) for
00044  * mbed Client to attempt a reconnection re-tries.
00045  * By default, the value is 5 seconds.
00046  */
00047 #undef MBED_CLIENT_RECONNECTION_INTERVAL  /* 5 */
00048 
00049 /**
00050  * \def MBED_CLIENT_TCP_KEEPALIVE_TIME
00051  *
00052  * \brief Keep alive time (in seconds) to send pings
00053  * in case mbed Client is connected through TCP.
00054  * By default, the value is 300 seconds.
00055  */
00056 #undef MBED_CLIENT_TCP_KEEPALIVE_TIME   /* 300 */
00057 
00058 /**
00059  * \def MBED_CLIENT_RECONNECTION_LOOP
00060  *
00061  * \brief Option whether to continue reconnection
00062  * loop until connection is re-established or stop
00063  * once the maximum re-try count is reached
00064  * By default, the value is 1 to continue reconnection
00065  * in loop, to stop the reconnection loop set value to 0.
00066  */
00067 #undef MBED_CLIENT_RECONNECTION_LOOP    /* 1 */
00068 
00069 /**
00070  * \def MBED_CLIENT_EVENT_LOOP_SIZE
00071  *
00072  * \brief Defines the size of memory allocated for
00073  * event loop (in bytes) for timer and network event
00074  * handling of mbed Client.
00075  * By default, this value is 1024 bytes.This memory is
00076  * allocated from heap
00077  */
00078 #undef MBED_CLIENT_EVENT_LOOP_SIZE      /* 1024 */
00079 
00080 #ifdef YOTTA_CFG_RECONNECTION_COUNT
00081 #define MBED_CLIENT_RECONNECTION_COUNT YOTTA_CFG_RECONNECTION_COUNT
00082 #elif defined MBED_CONF_MBED_CLIENT_RECONNECTION_COUNT
00083 #define MBED_CLIENT_RECONNECTION_COUNT MBED_CONF_MBED_CLIENT_RECONNECTION_COUNT
00084 #endif
00085 
00086 #ifdef YOTTA_CFG_RECONNECTION_INTERVAL
00087 #define MBED_CLIENT_RECONNECTION_INTERVAL YOTTA_CFG_RECONNECTION_INTERVAL
00088 #elif defined MBED_CONF_MBED_CLIENT_RECONNECTION_INTERVAL
00089 #define MBED_CLIENT_RECONNECTION_INTERVAL MBED_CONF_MBED_CLIENT_RECONNECTION_INTERVAL
00090 #endif
00091 
00092 #ifdef YOTTA_CFG_TCP_KEEPALIVE_TIME
00093 #define MBED_CLIENT_TCP_KEEPALIVE_TIME YOTTA_CFG_TCP_KEEPALIVE_TIME
00094 #elif defined MBED_CONF_MBED_CLIENT_TCP_KEEPALIVE_TIME
00095 #define MBED_CLIENT_TCP_KEEPALIVE_TIME MBED_CONF_MBED_CLIENT_TCP_KEEPALIVE_TIME
00096 #endif
00097 
00098 #ifdef YOTTA_CFG_DISABLE_BOOTSTRAP_FEATURE
00099 #define MBED_CLIENT_DISABLE_BOOTSTRAP_FEATURE YOTTA_CFG_DISABLE_BOOTSTRAP_FEATURE
00100 #elif defined MBED_CONF_MBED_CLIENT_DISABLE_BOOTSTRAP_FEATURE
00101 #define MBED_CLIENT_DISABLE_BOOTSTRAP_FEATURE MBED_CONF_MBED_CLIENT_DISABLE_BOOTSTRAP_FEATURE
00102 #endif
00103 
00104 #ifdef YOTTA_CFG_RECONNECTION_LOOP
00105 #define MBED_CLIENT_RECONNECTION_LOOP YOTTA_CFG_RECONNECTION_LOOP
00106 #elif defined MBED_CONF_MBED_CLIENT_RECONNECTION_LOOP
00107 #define MBED_CLIENT_RECONNECTION_LOOP MBED_CONF_MBED_CLIENT_RECONNECTION_LOOP
00108 #endif
00109 
00110 #ifdef YOTTA_CFG_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE
00111 #define SN_COAP_MAX_INCOMING_MESSAGE_SIZE YOTTA_CFG_COAP_MAX_INCOMING_BLOCK_MESSAGE_SIZE
00112 #elif defined MBED_CONF_MBED_CLIENT_SN_COAP_MAX_INCOMING_MESSAGE_SIZE
00113 #define SN_COAP_MAX_INCOMING_MESSAGE_SIZE MBED_CONF_MBED_CLIENT_SN_COAP_MAX_INCOMING_MESSAGE_SIZE
00114 #endif
00115 
00116 #ifdef MBED_CONF_MBED_CLIENT_EVENT_LOOP_SIZE
00117 #define MBED_CLIENT_EVENT_LOOP_SIZE MBED_CONF_MBED_CLIENT_EVENT_LOOP_SIZE
00118 #endif
00119 
00120 #if defined (__ICCARM__)
00121 #define m2m_deprecated
00122 #else
00123 #define m2m_deprecated __attribute__ ((deprecated))
00124 #endif
00125 
00126 // This is valid for mbed-client-mbedtls
00127 // For other SSL implementation there
00128 // can be other
00129 
00130 /*
00131 *\brief A callback function for a random number
00132 * required by the mbed-client-mbedtls module.
00133 */
00134 typedef uint32_t (*random_number_cb)(void) ;
00135 
00136 /*
00137 *\brief An entropy structure for an mbedtls entropy source.
00138 * \param entropy_source_ptr The entropy function.
00139 * \param p_source  The function data.
00140 * \param threshold A minimum required from the source before entropy is released
00141 *                  (with mbedtls_entropy_func()) (in bytes).
00142 * \param strong    MBEDTLS_ENTROPY_SOURCE_STRONG = 1 or
00143 *                  MBEDTSL_ENTROPY_SOURCE_WEAK = 0.
00144 *                  At least one strong source needs to be added.
00145 *                  Weaker sources (such as the cycle counter) can be used as
00146 *                  a complement.
00147 */
00148 typedef struct mbedtls_entropy {
00149     int     (*entropy_source_ptr)(void *, unsigned char *,size_t , size_t *);
00150     void    *p_source;
00151     size_t  threshold;
00152     int     strong;
00153 }entropy_cb;
00154 
00155 #ifdef MBED_CLIENT_USER_CONFIG_FILE
00156 #include MBED_CLIENT_USER_CONFIG_FILE
00157 #endif
00158 
00159 #ifndef MBED_CLIENT_RECONNECTION_COUNT
00160 #define MBED_CLIENT_RECONNECTION_COUNT 3
00161 #endif
00162 
00163 #ifndef MBED_CLIENT_RECONNECTION_INTERVAL
00164 #define MBED_CLIENT_RECONNECTION_INTERVAL 5
00165 #endif
00166 
00167 #ifndef MBED_CLIENT_TCP_KEEPALIVE_TIME
00168 #define MBED_CLIENT_TCP_KEEPALIVE_TIME 300
00169 #endif
00170 
00171 #ifndef MBED_CLIENT_RECONNECTION_LOOP
00172 #define MBED_CLIENT_RECONNECTION_LOOP 1
00173 #endif
00174 
00175 #ifndef MBED_CLIENT_EVENT_LOOP_SIZE
00176 #define MBED_CLIENT_EVENT_LOOP_SIZE 1024
00177 #endif
00178 
00179 #ifndef SN_COAP_MAX_INCOMING_MESSAGE_SIZE
00180 #define SN_COAP_MAX_INCOMING_MESSAGE_SIZE UINT16_MAX
00181 #endif
00182 
00183 #endif // M2MCONFIG_H