WIP. send a large constant string twice a second, in order to test out the transport with something indicative of our required load.

Dependencies:   FXOS8700CQ NTPClient azure_umqtt_c iothub_mqtt_transport mbed-rtos mbed wolfSSL Socket lwip-eth lwip-sys lwip

Fork of FXOS8700CQ_To_Azure_IoT by Mark Radbourne

Committer:
julianhigginson
Date:
Thu Jan 05 23:40:24 2017 +0000
Revision:
7:0d1a0fe537dc
Parent:
3:c0556ff7b8e3
modified dummy message for minimal data transport

Who changed what in which revision?

UserRevisionLine numberNew contents of line
markrad 3:c0556ff7b8e3 1 // Copyright (c) Microsoft. All rights reserved.
markrad 3:c0556ff7b8e3 2 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
markrad 3:c0556ff7b8e3 3
markrad 3:c0556ff7b8e3 4 #include "azure_c_shared_utility/xlogging.h"
markrad 3:c0556ff7b8e3 5 #include "azure_c_shared_utility/consolelogger.h"
markrad 3:c0556ff7b8e3 6
markrad 3:c0556ff7b8e3 7 #ifndef NO_LOGGING
markrad 3:c0556ff7b8e3 8
markrad 3:c0556ff7b8e3 9
markrad 3:c0556ff7b8e3 10 #ifdef WINCE
markrad 3:c0556ff7b8e3 11 #include <stdarg.h>
markrad 3:c0556ff7b8e3 12
markrad 3:c0556ff7b8e3 13 void consolelogger_log(LOG_CATEGORY log_category, const char* file, const char* func, const int line, unsigned int options, const char* format, ...)
markrad 3:c0556ff7b8e3 14 {
markrad 3:c0556ff7b8e3 15 va_list args;
markrad 3:c0556ff7b8e3 16 va_start(args, format);
markrad 3:c0556ff7b8e3 17
markrad 3:c0556ff7b8e3 18 time_t t = time(NULL);
markrad 3:c0556ff7b8e3 19
markrad 3:c0556ff7b8e3 20 switch (log_category)
markrad 3:c0556ff7b8e3 21 {
markrad 3:c0556ff7b8e3 22 case LOG_INFO:
markrad 3:c0556ff7b8e3 23 (void)printf("Info: ");
markrad 3:c0556ff7b8e3 24 break;
markrad 3:c0556ff7b8e3 25 case LOG_ERROR:
markrad 3:c0556ff7b8e3 26 (void)printf("Error: Time:%.24s File:%s Func:%s Line:%d ", ctime(&t), file, func, line);
markrad 3:c0556ff7b8e3 27 break;
markrad 3:c0556ff7b8e3 28 default:
markrad 3:c0556ff7b8e3 29 break;
markrad 3:c0556ff7b8e3 30 }
markrad 3:c0556ff7b8e3 31
markrad 3:c0556ff7b8e3 32 (void)vprintf(format, args);
markrad 3:c0556ff7b8e3 33 va_end(args);
markrad 3:c0556ff7b8e3 34
markrad 3:c0556ff7b8e3 35 (void)log_category;
markrad 3:c0556ff7b8e3 36 if (options & LOG_LINE)
markrad 3:c0556ff7b8e3 37 {
markrad 3:c0556ff7b8e3 38 (void)printf("\r\n");
markrad 3:c0556ff7b8e3 39 }
markrad 3:c0556ff7b8e3 40 }
markrad 3:c0556ff7b8e3 41 #endif
markrad 3:c0556ff7b8e3 42
markrad 3:c0556ff7b8e3 43 LOGGER_LOG global_log_function = consolelogger_log;
markrad 3:c0556ff7b8e3 44
markrad 3:c0556ff7b8e3 45
markrad 3:c0556ff7b8e3 46 void xlogging_set_log_function(LOGGER_LOG log_function)
markrad 3:c0556ff7b8e3 47 {
markrad 3:c0556ff7b8e3 48 global_log_function = log_function;
markrad 3:c0556ff7b8e3 49 }
markrad 3:c0556ff7b8e3 50
markrad 3:c0556ff7b8e3 51 LOGGER_LOG xlogging_get_log_function(void)
markrad 3:c0556ff7b8e3 52 {
markrad 3:c0556ff7b8e3 53 return global_log_function;
markrad 3:c0556ff7b8e3 54 }
markrad 3:c0556ff7b8e3 55
markrad 3:c0556ff7b8e3 56 #endif