Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Io_moon by
BlynkProtocolDefs.h
00001 /** 00002 * @file BlynkProtocolDefs.h 00003 * @author Volodymyr Shymanskyy 00004 * @license This project is released under the MIT License (MIT) 00005 * @copyright Copyright (c) 2015 Volodymyr Shymanskyy 00006 * @date Jan 2015 00007 * @brief Blynk protocol definitions 00008 * 00009 */ 00010 00011 #ifndef BlynkProtocolDefs_h 00012 #define BlynkProtocolDefs_h 00013 00014 enum BlynkCmd 00015 { 00016 BLYNK_CMD_RESPONSE = 0, 00017 BLYNK_CMD_REGISTER = 1, 00018 BLYNK_CMD_LOGIN = 2, 00019 BLYNK_CMD_SAVE_PROF = 3, 00020 BLYNK_CMD_LOAD_PROF = 4, 00021 BLYNK_CMD_GET_TOKEN = 5, 00022 BLYNK_CMD_PING = 6, 00023 BLYNK_CMD_ACTIVATE = 7, 00024 BLYNK_CMD_DEACTIVATE = 8, 00025 BLYNK_CMD_REFRESH = 9, 00026 BLYNK_CMD_GET_GRAPH_DATA = 10, 00027 BLYNK_CMD_GET_GRAPH_DATA_RESPONSE = 11, 00028 00029 BLYNK_CMD_TWEET = 12, 00030 BLYNK_CMD_EMAIL = 13, 00031 BLYNK_CMD_NOTIFY = 14, 00032 BLYNK_CMD_BRIDGE = 15, 00033 BLYNK_CMD_HARDWARE_SYNC = 16, 00034 BLYNK_CMD_HARDWARE_INFO = 17, 00035 BLYNK_CMD_SMS = 18, 00036 BLYNK_CMD_HARDWARE = 20, 00037 00038 BLYNK_CMD_CREATE_DASH = 21, 00039 BLYNK_CMD_SAVE_DASH = 22, 00040 BLYNK_CMD_DELETE_DASH = 23, 00041 BLYNK_CMD_LOAD_PROF_GZ = 24, 00042 BLYNK_CMD_SYNC = 25, 00043 BLYNK_CMD_SHARING = 26, 00044 BLYNK_CMD_ADD_PUSH_TOKEN = 27, 00045 00046 //sharing commands 00047 BLYNK_CMD_GET_SHARED_DASH = 29, 00048 BLYNK_CMD_GET_SHARE_TOKEN = 30, 00049 BLYNK_CMD_REFRESH_SHARE_TOKEN = 31, 00050 BLYNK_CMD_SHARE_LOGIN = 32 00051 }; 00052 00053 enum BlynkStatus 00054 { 00055 BLYNK_SUCCESS = 200, 00056 BLYNK_QUOTA_LIMIT_EXCEPTION = 1, 00057 BLYNK_ILLEGAL_COMMAND = 2, 00058 BLYNK_NOT_REGISTERED = 3, 00059 BLYNK_ALREADY_REGISTERED = 4, 00060 BLYNK_NOT_AUTHENTICATED = 5, 00061 BLYNK_NOT_ALLOWED = 6, 00062 BLYNK_NO_CONNECTION = 7, 00063 BLYNK_NO_ACTIVE_DASHBOARD = 8, 00064 BLYNK_INVALID_TOKEN = 9, 00065 BLYNK_DEVICE_WENT_OFFLINE = 10, 00066 BLYNK_ALREADY_LOGGED_IN = 11, 00067 BLYNK_GET_GRAPH_DATA_EXCEPTION = 12, 00068 BLYNK_NO_DATA_EXCEPTION = 17, 00069 BLYNK_DEVICE_WENT_OFFLINE_2 = 18, 00070 BLYNK_SERVER_EXCEPTION = 19, 00071 00072 BLYNK_NTF_INVALID_BODY = 13, 00073 BLYNK_NTF_NOT_AUTHORIZED = 14, 00074 BLYNK_NTF_ECXEPTION = 15, 00075 00076 BLYNK_TIMEOUT = 16 00077 }; 00078 00079 struct BlynkHeader 00080 { 00081 uint8_t type; 00082 uint16_t msg_id; 00083 uint16_t length; 00084 } 00085 BLYNK_ATTR_PACKED; 00086 00087 #if defined(ARDUINO) || defined(ESP8266) || defined(PARTICLE) || defined(MBED_LIBRARY_VERSION) 00088 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 00089 #define htons(x) ( ((x)<<8) | (((x)>>8)&0xFF) ) 00090 #define htonl(x) ( ((x)<<24 & 0xFF000000UL) | \ 00091 ((x)<< 8 & 0x00FF0000UL) | \ 00092 ((x)>> 8 & 0x0000FF00UL) | \ 00093 ((x)>>24 & 0x000000FFUL) ) 00094 #define ntohs(x) htons(x) 00095 #define ntohl(x) htonl(x) 00096 #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ 00097 #define htons(x) (x) 00098 #define htonl(x) (x) 00099 #define ntohs(x) (x) 00100 #define ntohl(x) (x) 00101 #else 00102 #error byte order problem 00103 #endif 00104 #endif 00105 00106 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 00107 #define BLYNK_HW_PM (('p' << 0) | ('m' << 8)) 00108 #define BLYNK_HW_DW (('d' << 0) | ('w' << 8)) 00109 #define BLYNK_HW_DR (('d' << 0) | ('r' << 8)) 00110 #define BLYNK_HW_AW (('a' << 0) | ('w' << 8)) 00111 #define BLYNK_HW_AR (('a' << 0) | ('r' << 8)) 00112 #define BLYNK_HW_VW (('v' << 0) | ('w' << 8)) 00113 #define BLYNK_HW_VR (('v' << 0) | ('r' << 8)) 00114 #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ 00115 #define BLYNK_HW_PM (('p' << 8) | ('m' << 0)) 00116 #define BLYNK_HW_DW (('d' << 8) | ('w' << 0)) 00117 #define BLYNK_HW_DR (('d' << 8) | ('r' << 0)) 00118 #define BLYNK_HW_AW (('a' << 8) | ('w' << 0)) 00119 #define BLYNK_HW_AR (('a' << 8) | ('r' << 0)) 00120 #define BLYNK_HW_VW (('v' << 8) | ('w' << 0)) 00121 #define BLYNK_HW_VR (('v' << 8) | ('r' << 0)) 00122 #else 00123 #error byte order problem 00124 #endif 00125 00126 #endif 00127
Generated on Tue Jul 19 2022 01:01:49 by
1.7.2
