Mistake on this page? Email us
MbedCloudClientConfigCheck.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // Copyright 2016-2020 ARM Ltd.
3 //
4 // SPDX-License-Identifier: Apache-2.0
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 //
10 // http://www.apache.org/licenses/LICENSE-2.0
11 //
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
17 // ----------------------------------------------------------------------------
18 
19 
20 #ifndef MBED_CLOUD_CONFIG_CHECK_H
21 #define MBED_CLOUD_CONFIG_CHECK_H
22 
30 #ifndef MBED_CLOUD_CLIENT_ENDPOINT_TYPE
31 #error "MBED_CLOUD_CLIENT_ENDPOINT_TYPE must be defined with valid endpoint type"
32 #endif
33 
34 #ifndef MBED_CLOUD_CLIENT_LIFETIME
35 #error "MBED_CLOUD_CLIENT_LIFETIME must be defined with valid non-zero lifetime value in seconds, default is 3600"
36 #endif
37 
38 #if MBED_CLOUD_CLIENT_LIFETIME < 60
39 #error "MBED_CLOUD_CLIENT_LIFETIME must be at least 60 seconds."
40 #endif
41 
42 #ifndef MBED_CLOUD_CLIENT_LISTEN_PORT
43 #error "MBED_CLOUD_CLIENT_LISTEN_PORT must be defined with valid non-zero port number, default is 0"
44 #endif
45 
46 #if !defined(SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE) || (SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE < 16) || (SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE > 1024)
47 #error "SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE must be defined with one of the values from this - 16, 32, 64, 128, 256, 512 or 1024"
48 #endif
49 
50 #if defined (MBED_CLOUD_CLIENT_TRANSPORT_MODE_TCP_QUEUE)
51 #error "TCP queue mode not supported!"
52 #endif
53 
54 #if defined (MBED_CLOUD_CLIENT_TRANSPORT_MODE_UDP) && ( defined(MBED_CLOUD_CLIENT_TRANSPORT_MODE_TCP) || \
55 defined (MBED_CLOUD_CLIENT_TRANSPORT_MODE_UDP_QUEUE) || defined(MBED_CLOUD_CLIENT_TRANSPORT_MODE_TCP_QUEUE))
56 #error "Only one MBED_CLOUD_CLIENT_TRANSPORT_MODE can be defined at a time"
57 #endif
58 
59 #if defined (MBED_CLOUD_CLIENT_TRANSPORT_MODE_TCP) && ( defined(MBED_CLOUD_CLIENT_TRANSPORT_MODE_UDP) || \
60 defined (MBED_CLOUD_CLIENT_TRANSPORT_MODE_UDP_QUEUE) || defined(MBED_CLOUD_CLIENT_TRANSPORT_MODE_TCP_QUEUE))
61 #error "Only one MBED_CLOUD_CLIENT_TRANSPORT_MODE can be defined at a time"
62 #endif
63 
64 #if defined (MBED_CLOUD_CLIENT_TRANSPORT_MODE_UDP_QUEUE) && ( defined(MBED_CLOUD_CLIENT_TRANSPORT_MODE_TCP) || \
65 defined (MBED_CLOUD_CLIENT_TRANSPORT_MODE_UDP) || defined(MBED_CLOUD_CLIENT_TRANSPORT_MODE_TCP_QUEUE))
66 #error "Only one MBED_CLOUD_CLIENT_TRANSPORT_MODE can be defined at a time"
67 #endif
68 
69 #if defined (MBED_CLOUD_CLIENT_TRANSPORT_MODE_TCP_QUEUE) && ( defined(MBED_CLOUD_CLIENT_TRANSPORT_MODE_TCP) || \
70 defined (MBED_CLOUD_CLIENT_TRANSPORT_MODE_UDP_QUEUE) || defined(MBED_CLOUD_CLIENT_TRANSPORT_MODE_UDP))
71 #error "Only one MBED_CLOUD_CLIENT_TRANSPORT_MODE can be defined at a time"
72 #endif
73 
74 #if !defined(MBED_CLOUD_CLIENT_TRANSPORT_MODE_UDP) && !defined(MBED_CLOUD_CLIENT_TRANSPORT_MODE_TCP) \
75 && !defined(MBED_CLOUD_CLIENT_TRANSPORT_MODE_UDP_QUEUE) && !defined(MBED_CLOUD_CLIENT_TRANSPORT_MODE_TCP_QUEUE)
76 #error "One MBED_CLOUD_CLIENT_TRANSPORT_MODE must be defined at a time"
77 #endif
78 
79 #if defined(ARM_UC_PROFILE_MBED_CLIENT_LITE) && (ARM_UC_PROFILE_MBED_CLIENT_LITE==1)
80 #error "Pelion Device Management Client must use ARM_UC_PROFILE_MBED_CLIENT_LITE=0 configuration."
81 #endif
82 
83 #if defined (PAL_MAX_FRAG_LEN) && (PAL_MAX_FRAG_LEN > 4)
84 #error "PAL_MAX_FRAG_LEN must be defined with one of the following values 1, 2, 3 or 4"
85 #endif
86 
87 #if defined (PAL_MAX_FRAG_LEN) && (PAL_MAX_FRAG_LEN == 1) && (SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE > 256)
88 #error "SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE must be 256 or lower."
89 #endif
90 
91 #if defined (PAL_MAX_FRAG_LEN) && (PAL_MAX_FRAG_LEN == 2) && (SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE > 512)
92 #error "SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE must be 512 or lower."
93 #endif
94 
95 #ifndef MBED_CLIENT_EVENT_LOOP_SIZE
96 #error "MBED_CLIENT_EVENT_LOOP_SIZE is mandatory parameter which should be defined always."
97 #endif
98 
99 #if defined (MBED_CONF_MBED_CLIENT_MAX_RECONNECT_TIMEOUT) && (MBED_CONF_MBED_CLIENT_MAX_RECONNECT_TIMEOUT < MAX_RECONNECT_TIMEOUT_LOW)
100 #error "MBED_CONF_MBED_CLIENT_MAX_RECONNECT_TIMEOUT must be at least 300 seconds."
101 #endif
102 
103 #if !defined(MBED_CONF_MBED_CLOUD_CLIENT_DISABLE_CERTIFICATE_ENROLLMENT) && defined(MBED_CLIENT_DISABLE_EST_FEATURE)
104 #error "Certificate enrollment feature must have EST feature enabled."
105 #endif
106 
107 #if !defined (MBED_CONF_MBED_TRACE_ENABLE) && ((MBED_CONF_MBED_CLIENT_DYNAMIC_LOGGING_BUFFER_SIZE) && (MBED_CONF_MBED_CLIENT_DYNAMIC_LOGGING_BUFFER_SIZE > 0))
108 #error "Dynamic logging feature requires mbed-trace to be enabled."
109 #endif
110 
111 #if !defined (MBED_CLOUD_CLIENT_FOTA_ENABLE) && ((MBED_CONF_MBED_CLIENT_DYNAMIC_LOGGING_BUFFER_SIZE) && (MBED_CONF_MBED_CLIENT_DYNAMIC_LOGGING_BUFFER_SIZE > 0) && !defined (MBED_CONF_MBED_CLIENT_DYNAMIC_LOGGING_USE_FILESYSTEM))
112 #error "Dynamic logging feature requires FOTA to be enabled"
113 #endif
114 
115 #if (MBED_CONF_MBED_CLIENT_DYNAMIC_LOGGING_BUFFER_SIZE) && (MBED_CONF_MBED_CLIENT_DYNAMIC_LOGGING_BUFFER_SIZE < 1024)
116 #error "MBED_CONF_MBED_CLIENT_DYNAMIC_LOGGING_BUFFER_SIZE must be at least 1024 bytes"
117 #endif
118 
119 #endif // MBED_CLOUD_CONFIG_CHECK_H