Files
iris-kit/src/IRbabyIRIS.h

65 lines
2.3 KiB
C
Raw Normal View History

2022-01-12 17:24:18 +08:00
/**
*
* Copyright (c) 2020-2022 IRbaby-IRext
2022-01-12 17:24:18 +08:00
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef IRBABY_IRIS_H
#define IRBABY_IRIS_H
2022-03-13 17:49:22 +08:00
#define CREDENTIAL_MAX (40)
// web http call URL list
#define FETCH_CREDENTIAL_SUFFIX "/irext-collect/credentials/fetch_credential"
#define LOAD_ALIOT_ACCOUNT_SUFFIX "/irext-collect/aliot/load_account"
2022-08-27 08:59:45 +08:00
#define DOWNLOAD_BIN_SUFFIX "/irext-collect/download"
2022-03-13 17:49:22 +08:00
#define DOWNLOAD_PREFIX "http://irext-debug.oss-cn-hangzhou.aliyuncs.com/irda_"
#define DOWNLOAD_SUFFIX ".bin"
2022-10-11 20:08:44 +08:00
// IRext bin code storage
#define SAVE_PATH "/ir/"
2022-03-13 20:04:04 +08:00
// IRIS communication
#define EVENT_NAME_CONNECT "__connect"
#define EVENT_HEART_BEAT_REQ "__hb_request"
2022-07-30 19:59:31 +08:00
typedef int (*eventHandler)(String, String, String);
2022-05-03 18:48:48 +08:00
typedef struct {
const char* event_name;
eventHandler handler;
} event_handler_t;
2022-01-12 17:24:18 +08:00
int getIRISKitVersion(char *buffer, int buffer_size);
int getDeviceID(char* buffer, int buffer_size);
2022-03-13 17:49:22 +08:00
int fetchIrisCredential(String credential_token,
String& product_key,
String& device_name,
2022-03-13 20:04:04 +08:00
String& device_secret,
int& app_id);
2022-03-13 17:49:22 +08:00
void sendIrisKitConnect();
void sendIrisKitHeartBeat();
void handleIrisKitMessage(const char* data, int length);
2022-01-12 17:24:18 +08:00
#endif // IRBABY_IRIS_H