Line | |
---|
1 | /*
|
---|
2 | Twitter.cpp - Arduino library to Post messages to Twitter using OAuth.
|
---|
3 | Copyright (c) NeoCat 2010-2011. All right reserved.
|
---|
4 |
|
---|
5 | This library is distributed in the hope that it will be useful,
|
---|
6 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
7 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
---|
8 | */
|
---|
9 |
|
---|
10 | // ver1.2 - Use <Udp.h> to support IDE 0019 or later
|
---|
11 | // ver1.3 - Support IDE 1.0
|
---|
12 |
|
---|
13 | #ifndef TWITTER_H
|
---|
14 | #define TWITTER_H
|
---|
15 |
|
---|
16 | #include <inttypes.h>
|
---|
17 | #include <avr/pgmspace.h>
|
---|
18 | #if defined(ARDUINO) && ARDUINO > 18 // Arduino 0019 or later
|
---|
19 | #include <SPI.h>
|
---|
20 | #endif
|
---|
21 | #include <Ethernet2.h>
|
---|
22 | #if defined(ARDUINO) && ARDUINO < 100 // earlier than Arduino 1.0
|
---|
23 | #include <EthernetDNS.h>
|
---|
24 | #endif
|
---|
25 |
|
---|
26 | class Twitter
|
---|
27 | {
|
---|
28 | private:
|
---|
29 | uint8_t parseStatus;
|
---|
30 | int statusCode;
|
---|
31 | const char *token;
|
---|
32 | #if defined(ARDUINO) && ARDUINO < 100
|
---|
33 | Client client;
|
---|
34 | #else
|
---|
35 | EthernetClient client;
|
---|
36 | #endif
|
---|
37 | public:
|
---|
38 | Twitter(const char *user_and_passwd);
|
---|
39 |
|
---|
40 | bool post(const char *msg);
|
---|
41 | bool checkStatus(Print *debug = NULL);
|
---|
42 | int wait(Print *debug = NULL);
|
---|
43 | int status(void) { return statusCode; }
|
---|
44 | };
|
---|
45 |
|
---|
46 | #endif //TWITTER_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.