forked from blynkkk/blynk-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlynkSimpleYun.h
75 lines (62 loc) · 1.8 KB
/
BlynkSimpleYun.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/**
* @file BlynkSimpleYun.h
* @author Volodymyr Shymanskyy
* @license This project is released under the MIT License (MIT)
* @copyright Copyright (c) 2015 Volodymyr Shymanskyy
* @date Mar 2015
* @brief
*
*/
#ifndef BlynkSimpleYun_h
#define BlynkSimpleYun_h
#ifndef BLYNK_INFO_DEVICE
#define BLYNK_INFO_DEVICE "Arduino Yun"
#endif
#include <Blynk/BlynkProtocol.h>
#include <Adapters/BlynkArduinoClient.h>
#include <YunClient.h>
typedef BlynkArduinoClient BlynkArduinoClientYun;
class BlynkYun
: public BlynkProtocol< BlynkArduinoClientYun >
{
typedef BlynkProtocol< BlynkArduinoClientYun > Base;
public:
BlynkYun(BlynkArduinoClientYun& transp)
: Base(transp)
{}
void config(const char* auth,
const char* domain = BLYNK_DEFAULT_DOMAIN,
uint16_t port = BLYNK_DEFAULT_PORT)
{
Base::begin(auth);
this->conn.begin(domain, port);
}
void config(const char* auth,
IPAddress ip,
uint16_t port = BLYNK_DEFAULT_PORT)
{
Base::begin(auth);
this->conn.begin(ip, port);
}
void begin(const char* auth,
const char* domain = BLYNK_DEFAULT_DOMAIN,
uint16_t port = BLYNK_DEFAULT_PORT)
{
BLYNK_LOG("Bridge init...");
Bridge.begin();
config(auth, domain, port);
}
void begin(const char* auth,
IPAddress ip,
uint16_t port = BLYNK_DEFAULT_PORT)
{
BLYNK_LOG("Bridge init...");
Bridge.begin();
config(auth, ip, port);
}
};
static YunClient _blynkYunClient;
static BlynkArduinoClient _blynkTransport(_blynkYunClient);
BlynkYun Blynk(_blynkTransport);
#include <BlynkWidgets.h>
#endif