Skip to content

Commit 2c1c4a8

Browse files
Marcelo SalazarMarcelo Salazar
authored andcommitted
Move and merge files
1 parent 870cbbf commit 2c1c4a8

File tree

8 files changed

+106
-166
lines changed

8 files changed

+106
-166
lines changed

main.cpp

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
// limitations under the License.
1717
// ----------------------------------------------------------------------------
1818
#ifndef MBED_TEST_MODE
19-
#include "simplem2mclient.h"
2019
#include "mbed.h"
21-
#include "mcc_common.h"
20+
#include "simplem2mclient.h"
21+
#include "platform_setup.h"
2222

2323
#ifndef MBED_CONF_MBED_CLOUD_CLIENT_DISABLE_CERTIFICATE_ENROLLMENT
2424
#include "certificate_enrollment_user_cb.h"
@@ -53,6 +53,7 @@ void blink_callback(void *)
5353
blink_res->send_delayed_post_response();
5454
}
5555

56+
// TODO: move somewhere in the helper folder
5657
void notification_status_callback(const M2MBase& object,
5758
const M2MBase::MessageDeliveryStatus status,
5859
const M2MBase::MessageType /*type*/)
@@ -115,23 +116,17 @@ int main(void)
115116
return -1;
116117
}
117118

118-
// Initialize storage
119-
if (mcc_platform_storage_init() != 0) {
120-
printf("Failed to initialize storage\n" );
121-
return -1;
122-
}
123-
124119
// Initialize platform-specific components
125-
if(mcc_platform_init() != 0) {
120+
if(platform_init() != 0) {
126121
printf("ERROR - platform_init() failed!\n");
127122
return -1;
128123
}
129124

130125
// Print platform information
131-
mcc_platform_sw_build_info();
126+
platform_info();
132127

133128
// Initialize network
134-
if (!mcc_platform_init_connection()) {
129+
if (!platform_init_connection()) {
135130
printf("Network initialized, registering...\n");
136131
} else {
137132
return -1;
@@ -148,12 +143,9 @@ int main(void)
148143
// SimpleClient is used for registering and unregistering resources to a server.
149144
SimpleM2MClient mbedClient;
150145

151-
// application_init() runs the following initializations:
152-
// 1. platform initialization
153-
// 2. print memory statistics if MBED_HEAP_STATS_ENABLED is defined
154-
// 3. FCC initialization.
155-
if (!application_init()) {
156-
printf("Initialization failed, exiting application!\n");
146+
// Factory Config Client initialization
147+
if (application_init_fcc() != 0) {
148+
printf("Failed initializing FCC, exiting application!\n");
157149
return -1;
158150
}
159151

mbed_cloud_client_user_config.h renamed to pelion-app-helper/mbed_cloud_client_user_config.h

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,19 @@
2424

2525
#define MBED_CLOUD_CLIENT_LIFETIME 3600
2626

27-
#ifdef __FREERTOS__
28-
#define SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE 512
29-
#define MBED_CLOUD_CLIENT_TRANSPORT_MODE_TCP
30-
#elif defined(__SXOS__)
31-
#define SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE 512
32-
#define MBED_CLOUD_CLIENT_TRANSPORT_MODE_UDP_QUEUE
33-
#else
3427
#ifdef MBED_CONF_MBED_CLIENT_SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
3528
#define SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE MBED_CONF_MBED_CLIENT_SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
3629
#else
3730
#define SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE 1024
3831
#endif
39-
#define MBED_CLOUD_CLIENT_TRANSPORT_MODE_TCP
40-
#endif
4132

42-
/* set flag to enable update support in Pelion Device Management Client */
43-
#if defined(__linux__) || defined(TARGET_LIKE_MBED) || defined(__SXOS__)
44-
#define MBED_CLOUD_CLIENT_SUPPORT_UPDATE
45-
#endif
46-
/* set download buffer size in bytes (min. 1024 bytes) */
33+
#define MBED_CLOUD_CLIENT_TRANSPORT_MODE_TCP
4734

48-
/* Use larger buffers in Linux */
49-
#ifdef __linux__
50-
#define MBED_CLOUD_CLIENT_UPDATE_BUFFER (2 * 1024 * 1024)
51-
#else
35+
/* Enable update support in Pelion Device Management Client */
36+
#define MBED_CLOUD_CLIENT_SUPPORT_UPDATE
37+
38+
/* set download buffer size in bytes (min. 1024 bytes) */
5239
#define MBED_CLOUD_CLIENT_UPDATE_BUFFER 2048
53-
#endif
5440

5541
/* Developer flags for Update feature */
5642
#if MBED_CONF_APP_DEVELOPER_MODE == 1
File renamed without changes.

pelion-app-helper/memory_tests.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
// limitations under the License.
1717
// ----------------------------------------------------------------------------
1818

19-
20-
#ifdef TARGET_LIKE_MBED
21-
2219
#if defined (MBED_HEAP_STATS_ENABLED) || (MBED_STACK_STATS_ENABLED)
2320
// used by print_heap_stats only
2421
#include "mbed_stats.h"
@@ -238,4 +235,4 @@ void print_stack_statistics()
238235
printf("*****************************\n\n");
239236
}
240237
#endif // MBED_STACK_STATS_ENABLED
241-
#endif // TARGET_LIKE_MBED
238+

0 commit comments

Comments
 (0)