source: rtos_arduino/trunk/arduino_lib/libraries/Milkcocoa_Arduino_SDK/include/Adafruit/Adafruit_MQTT_Client.h@ 144

Last change on this file since 144 was 144, checked in by ertl-honda, 8 years ago

Milkcocoa用のMQTTライブラリの追加と,ESP8266用ライブラリの名称変更.

File size: 2.1 KB
Line 
1// The MIT License (MIT)
2//
3// Copyright (c) 2015 Adafruit Industries
4//
5// Permission is hereby granted, free of charge, to any person obtaining a copy
6// of this software and associated documentation files (the "Software"), to deal
7// in the Software without restriction, including without limitation the rights
8// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9// copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in all
13// copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21// SOFTWARE.
22#ifndef _ADAFRUIT_MQTT_CLIENT_H_
23#define _ADAFRUIT_MQTT_CLIENT_H_
24
25#include "Client.h"
26#include "Adafruit_MQTT.h"
27
28
29// How long to delay waiting for new data to be available in readPacket.
30#define MQTT_CLIENT_READINTERVAL_MS 10
31
32
33// MQTT client implementation for a generic Arduino Client interface. Can work
34// with almost all Arduino network hardware like ethernet shield, wifi shield,
35// and even other platforms like ESP8266.
36class Adafruit_MQTT_Client : public Adafruit_MQTT {
37 public:
38 Adafruit_MQTT_Client(Client *client, const char *server, uint16_t port,
39 const char *cid, const char *user,
40 const char *pass):
41 Adafruit_MQTT(server, port, cid, user, pass),
42 client(client)
43 {}
44
45 bool connectServer();
46 bool disconnect();
47 bool connected();
48 uint16_t readPacket(uint8_t *buffer, uint8_t maxlen, int16_t timeout,
49 bool checkForValidPubPacket = false);
50 bool sendPacket(uint8_t *buffer, uint8_t len);
51
52 private:
53 Client* client;
54};
55
56
57#endif
Note: See TracBrowser for help on using the repository browser.