Ignore:
Timestamp:
Mar 28, 2016, 2:28:23 PM (8 years ago)
Author:
ertl-honda
Message:

ESP8266のライブラリの更新に伴う変更

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rtos_arduino/trunk/arduino_lib/libraries/Milkcocoa_Arduino_SDK/Milkcocoa.h

    r144 r180  
    3232
    3333#define MILKCOCOA_SUBSCRIBERS 8
     34#define MILKCOCOA_CONNECT_DELAY_MS 5000
     35
     36#define MILKCOCOA_PUSH_ERRORNO -2
     37#define MILKCOCOA_SEND_ERRORNO -2
     38
     39//#define MILKCOCOA_DEBUG
     40
     41#define DEBUG_PRINTER Serial
     42
     43#ifdef MILKCOCOA_DEBUG
     44  #define MILKCOCOA_DEBUG_PRINT(...) { DEBUG_PRINTER.print(__VA_ARGS__); }
     45  #define MILKCOCOA_DEBUG_PRINTLN(...) { DEBUG_PRINTER.println(__VA_ARGS__); }
     46  #define MILKCOCOA_DEBUG_PRINTBUFFER(buffer, len) { printBuffer(buffer, len); }
     47#else
     48  #define MILKCOCOA_DEBUG_PRINT(...) {}
     49  #define MILKCOCOA_DEBUG_PRINTLN(...) {}
     50  #define MILKCOCOA_DEBUG_PRINTBUFFER(buffer, len) {}
     51#endif
    3452
    3553class DataElement {
     
    4260    void setValue(const char *key, double v);
    4361    char *toCharArray();
    44     char *getString(const char *key);
    45     int getInt(const char *key);
    46     float getFloat(const char *key);
     62    bool getString(const char *key, char **pdata);
     63    bool getInt(const char *key, int *pdata);
     64    bool getFloat(const char *key, float *pdata);
    4765   
    4866  private:
     
    6785  Milkcocoa(Client *client, const char *host, uint16_t port, const char *_app_id, const char *client_id, const char *_session);
    6886  static Milkcocoa* createWithApiKey(Client *client, const char *host, uint16_t port, const char *app_id, const char *client_id, const char *key, const char *secret);
    69   void connect();
    70   void loop();
    71   bool push(const char *path, DataElement *pdataelement);
    72   bool send(const char *path, DataElement *pdataelement);
     87  int8_t connect(int32_t tmout = 0);
     88  int8_t loop(uint16_t timeout = 0);
     89  int8_t push(const char *path, DataElement *pdataelement, uint16_t timeout = 0);
     90  int8_t send(const char *path, DataElement *pdataelement, uint16_t timeout = 0);
    7391  bool on(const char *path, const char *event, GeneralFunction cb);
    74 
     92  const __FlashStringHelper* connectErrorString(int8_t code) {return mqtt->connectErrorString(code);};
     93  const __FlashStringHelper* pushErrorString(int8_t code) {if(code == MILKCOCOA_PUSH_ERRORNO) return F("Push error"); return mqtt->connectErrorString(code);};
    7594
    7695private:
Note: See TracChangeset for help on using the changeset viewer.