萤石云 iOSSDK,移植跨平台相关工程
Davin
2023-06-30 3e4be5ed4d2c0395dd60e392baf86c59762059b1
EZSDK/EZSDK/EZ/Global/EZHttpUtil.m
@@ -30,6 +30,9 @@
#define API_POST_EZ_DeleteAlarmMes @"/home-wisdom/platform/yingshi/alarm/delete"//删除报警消息
#define API_POST_EZ_ReadAlarmMes @"/home-wisdom/platform/yingshi/alarm/updateChecked"//标记报警消息已读
#define API_POST_EZ_GetCoverSwitchStaus @"/home-wisdom/platform/yingshi/getCoverSwitchStatus"//获取萤石镜头遮蔽开关状态
#define API_POST_EZ_GetCoverSwitch @"/home-wisdom/platform/yingshi/coverSwitch"//设置萤石镜头遮蔽开关
#pragma mark APP_KEY
#define APP_KEY @"HDL-HOME-APP-TEST"
#define SECRET_KEY @"WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"
@@ -421,6 +424,59 @@
    }];
}
/**
 *  @since 河东获取设备消息
 *  @param deviceId   设备id
 *  @param completion   回调block,error为空时表示成功
 */
- (void)getCoverSwitchStatus:(NSString *)deviceId
                  completion:(void (^)(ResponseData *responseData))completion {
    //设置请求参数
    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
    [parameters setValue:deviceId forKey:@"deviceId"];
    [parameters setValue:@(1) forKey:@"platform"];
    [parameters setValue:[NSString stringWithFormat:@"%@",[GlobalKit shareKit].hdlAppKey] forKey:@"appKey"];
    [parameters setValue:[GlobalKit shareKit].hdlHomeId forKey:@"homeId"];
    parameters = [self GetSignRequestDictionary:parameters];
    NSLog(@"获取设备消息参数:%@",parameters);
    [self requestHttpsPost:API_POST_EZ_GetCoverSwitchStaus parameters:parameters completion:^(ResponseData *responseData) {
        if (completion) {
            completion (responseData);
        }
    }];
}
/**
 *  @since 河东获取设备消息
 *  @param deviceId   设备id
 *  @param enable   隐私遮蔽状态
 *  @param completion   回调block,error为空时表示成功
 */
- (void)getCoverSwitchStatus:(NSString *)deviceId
                      enable:(NSInteger)enable
                  completion:(void (^)(ResponseData *responseData))completion {
    //设置请求参数
    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
    [parameters setValue:deviceId forKey:@"deviceId"];
    [parameters setValue:@(enable) forKey:@"enable"];
    [parameters setValue:@(1) forKey:@"platform"];
    [parameters setValue:[NSString stringWithFormat:@"%@",[GlobalKit shareKit].hdlAppKey] forKey:@"appKey"];
    [parameters setValue:[GlobalKit shareKit].hdlHomeId forKey:@"homeId"];
    parameters = [self GetSignRequestDictionary:parameters];
    NSLog(@"获取设备消息参数:%@",parameters);
    [self requestHttpsPost:API_POST_EZ_GetCoverSwitch parameters:parameters completion:^(ResponseData *responseData) {
        if (completion) {
            completion (responseData);
        }
    }];
}
/// 刷新token
/// @param block 结果
- (void)refreshHDLToken:(void (^)(BOOL isSuccess))block{
@@ -501,6 +557,7 @@
        URL = TestRequestHttpsHost;
    }
    URL = [NSString stringWithFormat:@"%@%@", URL, apiPath];
    NSLog(@"############接口请求url:%@", URL);
    
//    NSURLSessionDataTask * task=nil;
    AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];