KPN Things Device SDK
defaults.h
Go to the documentation of this file.
1/* _ __ ____ _ _
2 * | |/ / | _ \ | \ | |
3 * | ' / | |_) | | \| |
4 * | . \ | __/ | |\ |
5 * |_|\_\ |_| |_| \_|
6 *
7 * (c) 2020 KPN
8 * License: MIT License.
9 * Author: Joseph Verburg, Jan Bogaerts
10 *
11 * Some defaults to make code run on multiple platforms.
12 *
13 */
14
15#ifndef THINGS_SENML_DEFAULTS
16#define THINGS_SENML_DEFAULTS
17
18// For low ram devices (less then 4KiB, this saves about 400 bytes)
19#ifndef THINGSML_LOW_RAM_DEVICE
20 // See http://electronics4dogs.blogspot.com/2011/01/arduino-predefined-constants.html
21 #if defined(ARDUINO) && defined(__AVR_ATmega168__) // Arduino Decimilia and older
22 #define THINGSML_LOW_RAM_DEVICE 1
23 #elif defined(ARDUINO) && defined(__AVR_ATmega32U4__) // Arduino Leonardo
24 #define THINGSML_LOW_RAM_DEVICE 1
25 #elif defined(ARDUINO) && defined(__AVR_ATmega328P__) // Arduino Duemilanove and Uno
26 #define THINGSML_LOW_RAM_DEVICE 1
27 #endif
28#endif
29
30#ifdef __MBED__
31
32#include "mbed.h"
33#include "sstream"
34#include <string>
35using namespace std;
36#define String string
37
38#elif defined(ARDUINO)
39
40#include "Arduino.h"
41#include <Stream.h>
42
43#else
44
45#include <string>
46using namespace std;
47#define String string
48
49#include <iostream>
50class Stream {
51 public:
52 unsigned char read() {
53 return 0;
54 }
55 void println(String string) {
56 std::cout << string;
57 }
58 int available() {
59 return 0;
60 }
61 void print(char p) {
62 std::cout << p;
63 }
64 void write(const char p[], int len) {
65 std::cout << p;
66 }
67};
68#endif
69
70#include "../util/base64.h"
71
72#endif
Definition: defaults.h:50
int available()
Definition: defaults.h:58
void print(char p)
Definition: defaults.h:61
void println(String string)
Definition: defaults.h:55
void write(const char p[], int len)
Definition: defaults.h:64
unsigned char read()
Definition: defaults.h:52
#define String
Definition: defaults.h:47