文档

lv_cloud_event_cb

更新时间:
一键部署

调用该接口,回调云智能告警事件的通知。

接口详情

typedef int (*lv_cloud_event_cb)(const lv_device_auth_s *auth, const lv_cloud_event_param_s *param)

接口中相关参数说明如下。

参数

类型

说明

auth

const lv_device_auth_s*

设备认证信息。

message

const lv_cloud_event_param_s*

消息结构体。

示例代码

说明

示例代码仅供参考,完整内容,请参见SDK中的实际代码。

//Demo中定义了回调函数cloud_event_cb,作为lv_cloud_event_cb的实现
callback.cloud_event_cb = cloud_event_cb;

//Demo中定义了回调函数linkkit_message_publish_cb
static int cloud_event_cb(const lv_device_auth_s *auth, const lv_cloud_event_param_s *param) {
    printf("cloud_event_cb: %d \n", param->event_type);
    if (param->event_type == LV_CLOUD_EVENT_DOWNLOAD_FILE) {
        printf("cloud_event_cb %d %s %s\n", param->file_download.file_type, param->file_download.file_name, param->file_download.url);
    } else if (param->event_type == LV_CLOUD_EVENT_UPLOAD_FILE) {
        printf("cloud_event_cb %d %s %s\n", param->file_upload.file_type, param->file_upload.file_name, param->file_upload.url);
    }
    return 0;
}
  • 本页导读 (1)
文档反馈