Demo application for using the AT&T IoT Starter Kit Powered by AWS.

Dependencies:   SDFileSystem

Fork of ATT_AWS_IoT_demo by Anthony Phillips

IoT Starter Kit Powered by AWS Demo

This program demonstrates the AT&T IoT Starter Kit sending data directly into AWS IoT. It's explained and used in the Getting Started with the IoT Starter Kit Powered by AWS on starterkit.att.com.

What's required

  • AT&T IoT LTE Add-on (also known as the Cellular Shield)
  • NXP K64F - for programming
  • microSD card - used to store your AWS security credentials
  • AWS account
  • Python, locally installed

If you don't already have an IoT Starter Kit, you can purchase a kit here. The IoT Starter Kit Powered by AWS includes the LTE cellular shield, K64F, and a microSD card.

AWS_openssl/aws_iot_src/utils/aws_iot_log.h

Committer:
rfinn
Date:
2017-02-07
Revision:
27:2f486c766854
Parent:
15:6f2798e45099

File content as of revision 27:2f486c766854:

/*
 * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */

/**
 * @file aws_iot_log.h
 * @brief Logging macros for the SDK.
 * This file defines common logging macros with log levels to be used within the SDK.
 * These macros can also be used in the IoT application code as a common way to output
 * logs.  The log levels can be tuned by modifying the makefile.  Removing (commenting
 * out) the IOT_* statement in the makefile disables that log level.
 *
 * It is expected that the macros below will be modified or replaced when porting to
 * specific hardware platforms as printf may not be the desired behavior.
 */
 
// Change to a number between 1 and 4 to debug the TLS connection 
// WARNING: the large number of prints may cause timeouts during the connection.
#define DEBUG_LEVEL 0

#ifndef _IOT_LOG_H
#define _IOT_LOG_H

#include <stdio.h>
#include <stdlib.h>
#include "platform.h"

// Exposes USB Serial function
void pc_print(const char * format, ...);

/**
 * @brief Debug level logging macro.
 *
 * Macro to expose function, line number as well as desired log message.
 */
#ifdef IOT_DEBUG
#define DEBUG(...)    \
    {\
    printf("DEBUG:   %s L#%d ", __PRETTY_FUNCTION__, __LINE__);  \
    printf(__VA_ARGS__); \
    printf("\n"); \
    }
#else

#if DEBUG_LEVEL > 0
#define DEBUG(...)  pc_print(__VA_ARGS__); \
                    pc_print("\r\n");   
#else
#define DEBUG(...)  
#endif

#endif

/**
 * @brief Info level logging macro.
 *
 * Macro to expose desired log message.  Info messages do not include automatic function names and line numbers.
 */
#ifdef IOT_INFO
#define INFO(...)    \
    {\
    printf(__VA_ARGS__); \
    printf("\n"); \
    }
#else
#define INFO(...) pc_print(__VA_ARGS__); \
                  pc_print("\r\n");
#endif

/**
 * @brief Warn level logging macro.
 *
 * Macro to expose function, line number as well as desired log message.
 */
#ifdef IOT_WARN
#define WARN(...)   \
    { \
    printf("WARN:  %s L#%d ", __PRETTY_FUNCTION__, __LINE__);  \
    printf(__VA_ARGS__); \
    printf("\n"); \
    }
#else
#define WARN(...) pc_print("WARN: ");  \
                  pc_print(__VA_ARGS__); \
                  pc_print("\r\n");
#endif

/**
 * @brief Error level logging macro.
 *
 * Macro to expose function, line number as well as desired log message.
 */
#ifdef IOT_ERROR
#define ERROR(...)  \
    { \
    printf("ERROR: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \
    printf(__VA_ARGS__); \
    printf("\n"); \
    }
#else
#define ERROR(...)  pc_print("ERROR: ");  \
                    pc_print(__VA_ARGS__); \
                    pc_print("\r\n");
#endif

#endif // _IOT_LOG_H