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
13 // based on Arduino Print class
14 class RadioLibPrint {
15 public:
16 virtual size_t write(uint8_t) = 0;
17 size_t write(const char *str) {
18 if (str == NULL) return 0;
19 return write((const uint8_t *)str, strlen(str));
20 }
21 virtual size_t write(const uint8_t *buffer, size_t size);
22 size_t write(const char *buffer, size_t size) {
23 return write((const uint8_t *)buffer, size);
24 }
25
26 size_t print(ITA2String& ita2);
27 size_t println(ITA2String& ita2);
28
29 #if defined(RADIOLIB_BUILD_ARDUINO)
30 size_t print(const __FlashStringHelper *);
31 size_t print(const String &);
32
33 size_t println(const __FlashStringHelper *);
34 size_t println(const String &);
35 #endif
36
37 size_t print(const char[]);
38 size_t print(char);
39 size_t print(unsigned char, int = DEC);
40 size_t print(int, int = DEC);
41 size_t print(unsigned int, int = DEC);
42 size_t print(long, int = DEC);
43 size_t print(unsigned long, int = DEC);
44 size_t print(double, int = 2);
45
46 size_t println(const char[]);
47 size_t println(char);
48 size_t println(unsigned char, int = DEC);
49 size_t println(int, int = DEC);
50 size_t println(unsigned int, int = DEC);
51 size_t println(long, int = DEC);
52 size_t println(unsigned long, int = DEC);
53 size_t println(double, int = 2);
54 size_t println(void);
55
56 #if !defined(RADIOLIB_GODMODE)
57 protected:
58 #endif
59 uint8_t encoding = RADIOLIB_ASCII_EXTENDED;
60 const char* lineFeed;
61
62 size_t printNumber(unsigned long, uint8_t);
63 size_t printFloat(double, uint8_t);
64
65 };
66
67 #endif
ITA2String
ITA2-encoded string.
Definition: ITA2String.h:24
RadioLibPrint
Definition: Print.h:14