RadioLib Universal wireless communication library for Arduino

Print.h
1 #if !defined(_RADIOLIB_PRINT_H)
2 #define _RADIOLIB_PRINT_H
3
4 #include <string.h>
5
6 #include "ITA2String.h"
7
8 // supported encoding schemes
9 #define RADIOLIB_ASCII 0
10 #define RADIOLIB_ASCII_EXTENDED 1
11 #define RADIOLIB_ITA2 2
12
17 class RadioLibPrint {
18 public:
19 virtual size_t write(uint8_t) = 0;
20 size_t write(const char *str) {
21 if (str == NULL) return 0;
22 return write((const uint8_t *)str, strlen(str));
23 }
24 virtual size_t write(const uint8_t *buffer, size_t size);
25 size_t write(const char *buffer, size_t size) {
26 return write((const uint8_t *)buffer, size);
27 }
28
29 size_t print(ITA2String& ita2);
30 size_t println(ITA2String& ita2);
31
32 #if defined(RADIOLIB_BUILD_ARDUINO)
33 size_t print(const __FlashStringHelper *);
34 size_t print(const String &);
35
36 size_t println(const __FlashStringHelper *);
37 size_t println(const String &);
38 #endif
39
40 size_t print(const char[]);
41 size_t print(char);
42 size_t print(unsigned char, int = DEC);
43 size_t print(int, int = DEC);
44 size_t print(unsigned int, int = DEC);
45 size_t print(long, int = DEC);
46 size_t print(unsigned long, int = DEC);
47 size_t print(double, int = 2);
48
49 size_t println(const char[]);
50 size_t println(char);
51 size_t println(unsigned char, int = DEC);
52 size_t println(int, int = DEC);
53 size_t println(unsigned int, int = DEC);
54 size_t println(long, int = DEC);
55 size_t println(unsigned long, int = DEC);
56 size_t println(double, int = 2);
57 size_t println(void);
58
59 #if !RADIOLIB_GODMODE
60 protected:
61 #endif
62 uint8_t encoding = RADIOLIB_ASCII_EXTENDED;
63 const char* lineFeed;
64
65 size_t printNumber(unsigned long, uint8_t);
66 size_t printFloat(double, uint8_t);
67
68 };
69
70 #endif
ITA2String
ITA2-encoded string.
Definition: ITA2String.h:24
RadioLibPrint
Printing class, based on Arduino Print class with additional encodings.
Definition: Print.h:17