Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface NTPClient SHTx iothub_amqp_transport iothub_client mbed-rtos mbed proton-c-mbed serializer wolfSSL
Fork of remote_monitoring by
Diff: main.cpp
- Revision:
- 19:b9caa9eede4f
- Parent:
- 18:99b21c7c3599
- Child:
- 20:ea66de0f1a06
diff -r 99b21c7c3599 -r b9caa9eede4f main.cpp
--- a/main.cpp Wed Sep 30 00:09:59 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-
-#include <stdio.h>
-#include "EthernetInterface.h"
-#include "mbed/logging.h"
-#include "mbed/mbedtime.h"
-#include "remote_monitoring.h"
-#include "NTPClient.h"
-
-int setupRealTime(void)
-{
- int result;
-
- (void)printf("setupRealTime begin\r\n");
- if (EthernetInterface::connect())
- {
- (void)printf("Error initializing EthernetInterface.\r\n");
- result = __LINE__;
- }
- else
- {
- (void)printf("setupRealTime NTP begin\r\n");
- NTPClient ntp;
- if (ntp.setTime("0.pool.ntp.org") != 0)
- {
- (void)printf("Failed setting time.\r\n");
- result = __LINE__;
- }
- else
- {
- (void)printf("set time correctly!\r\n");
- result = 0;
- }
- (void)printf("setupRealTime NTP end\r\n");
- EthernetInterface::disconnect();
- }
- (void)printf("setupRealTime end\r\n");
-
- return result;
-}
-
-int main(void)
-{
- (void)printf("Initializing mbed specific things...\r\n");
-
- /* These are needed in order to initialize the time provider for Proton-C */
- mbed_log_init();
- mbedtime_init();
-
- if (EthernetInterface::init())
- {
- (void)printf("Error initializing EthernetInterface.\r\n");
- return -1;
- }
-
- if (setupRealTime() != 0)
- {
- (void)printf("Failed setting up real time clock\r\n");
- return -1;
- }
-
- if (EthernetInterface::connect())
- {
- (void)printf("Error connecting EthernetInterface.\r\n");
- return -1;
- }
-
- remote_monitoring_run();
-
- (void)EthernetInterface::disconnect();
-
- return 0;
-}
