-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathb64.h
45 lines (37 loc) · 1.15 KB
/
b64.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef _B64_H
#define _B64_H
#ifdef SPARK
#include "application.h"
#include "pgmspace.h"
#else
#include "Arduino.h"
#include "avr/pgmspace.h"
#include "Client.h"
#endif
//#define B64_DEBUG
#ifdef B64_DEBUG
#define DBGCN( ... ) Serial.println( __VA_ARGS__ )
#define DBGC( ... ) Serial.print( __VA_ARGS__ )
#define DBGCSN( ... ) Serial.println( F(__VA_ARGS__) )
#define DBGCS( ... ) Serial.print( F(__VA_ARGS__) )
#else
#define DBGCN( ... )
#define DBGC( ... )
#define DBGCSN( ... )
#define DBGCS( ... )
#endif
class b64 {
public:
// static void decode(char *src, Stream &stream);
static uint8_t decode(char *src, size_t size, Stream &stream);
static uint8_t decode(Stream &from, Stream &to);
static uint8_t decode(Stream &from, Stream &to, size_t max);
static uint8_t encode(Stream &from, Stream &to, size_t max);
static uint8_t encode(const uint8_t *buf, size_t size, Stream &out);
static uint8_t encode(Stream &from, Stream &to);
static uint8_t encode(Stream &stream, char *buf, size_t max);
static uint8_t encodeLength(size_t max);
static char lookup(const char c);
static char reverselookup(const char c);
};
#endif // _B64_H