#ifndef __POKA_CLIENT_H__ #define __POKA_CLIENT_H__ #ifdef __cplusplus extern "C" { #endif #if 1 #define PRODUCTID "LFV1" #define SECUREID "poka" #define SECUREKEY "Poka&Lock12345" #define TMQTT_SERVER "svr.xa-poka.com" #define TMQTT_PORT 1883 #define TCLIENT_ID "LFV1_0102030405060708" #endif #define EVENT_REMOTE_VIDEO "remote_video" #define EVENT_REMOTE_VIDEO_CLOSE "remote_video_close" #define EVENT_UNLOCK_REMOTE "unlock_remote" #define EVENT_UNLOCK_REMOTE_SOS "unlock_remote_sos" #define EVENT_LOCK_REMOTE "lock_remote" #define EVENT_LOCK_OTA_HTTP "http_ota" #define EVENT_LOCK_OTA_HTTPS "https_ota" #define EVENT_AGORA_LINCENSE "agora_license" #define FUNS_OTA "ota" #define FUNS_TAKE_PHOTO "take_photo" #define EVENT_SET_WIFI "set_wifi" #define EVENT_VIDEO_QUALITY "set_video_quality" #define EVENT_HEARBEAT "heart_beat" #define EVENT_DATA_TRANSFER "data_transfer" #define EVENT_DOORBELL "doorbell" #define EVENT_CAMERA_LINK "camera_link" #define EVENT_LOCK "lock_event" #define EVENT_OTA "ota_event" /** * EVENT:未知人脸抓拍事件 */ #define EVENT_ALERT_ERROR_FACE "alert_error_face" #define PROP_LOCK_STATE "lock_state" #define PROP_BATTERY_CAP "battery_cap" #define PROP_BATTERY_STATE "battery_state" #define PROP_DOOR_STATE "door_state" #define PROP_LOCKEDIN_STATE "lockedin_state" #define PROP_ILOCK_VERSION "ilock_version" #define PROP_DISABLE_LOCK "disable_lock" #define PROP_LOCK_PARAM "lock_params" #define TAGS_ILOCK_BODY_VERSION "ilock_body_version" #define FUN_TRUE "true" #define FUN_FALSE "false" typedef struct { int messageid; int data_len; char data_value[128]; } data_transfer_t; typedef struct { char message_id[64]; int timer_timeout; int result_code; } iot_cmd_t; typedef struct poka_client_cb_ops{ void (*event_cloud)(); /** * 应用主动打开视频 */ void (*event_remote_video)(int audio, char* license, char* token); void (*event_agora_license)(char* license,int license_len); /** * 应用主动关闭视频 */ void (*event_remote_video_close)(); /** * 远程开锁 */ void (*event_unlock_remote)(char* uid); /** * 紧急开锁SOS */ void (*event_unlock_remote_sos)(char* uid); /** * 远程关锁 */ void (*event_lock_remote)(char* uid); void (*event_link_state)(int state); /* 来着应用的心跳信息 */ void (*event_hearbeat)(); /** * 数据透传 */ void (*event_data_transfer)(data_transfer_t * data); /** * HTTP_OTA */ void (*event_ota_http)(char * file_url); /** * HTTPS_OTA */ void (*event_ota_https)(char * file_url); /** * 设置配网信息 */ void (*event_set_wifi)(char* ssid,int ssid_len ,char* password ,int password_len); void (*event_set_video_quality)(int video_quality); /** * mcu_OTA */ void (*funs_ota)(int device_type,char * file_url); /** * 抓拍一张图片 */ void (*funs_take_photo)(); }poka_client_cb_ops_t; void poka_client_init(void); void poka_client_set_callback(poka_client_cb_ops_t *cb_ops); void poka_client_deinit(void); char * poka_client_get_device_id(); char * poka_client_get_message_id(); void poka_client_replay_invoke(char* functionId,char*event,char* result,char * output); void poka_client_report_event(char*event,char* data_result); void poka_client_report_event_int(char*event,int result); void poka_client_reconnect(); void poka_client_report_properties2(); void poka_client_report_properties_keyvalue(char* key, char *version); void poka_client_report_properties_keyvalue_int(char* key, int value); void poka_client_report_tags_keyvalue(char* key, char *value); void poka_client_report_device_tags(char* version, char* wifi_mac, char *wifi_ssid,char* wifi_pwd,char* ap_bssid,char* rssi); void poka_client_report_properties(char *version ,int lockedin_state,int door_state,int lock_state,int batt_state, int batt_value,int disable_lock,int power_supply); void poka_stop_reboot_timer(); #ifdef __cplusplus } #endif #endif