| | |
| | | #define AOI_POST_EZ_UpdateAnswerStatus @"/home-wisdom/platform/yingshi/lock/updateAnswerStatus" // 更改门铃通话状态(接听和未接) |
| | | #define API_POST_EZ_GetAiSupportList @"/home-wisdom/platform/yingshi/getAiSupportList"//获取摄像头智能算法列表和状态 |
| | | #define API_POST_EZ_SetAiSupport @"/home-wisdom/platform/yingshi/setAiSupport"//设置摄像头智能算法 |
| | | #define API_POST_EZ_GetDeviceCapacity @"/home-wisdom/platform/yingshi/getDeviceCapacity"//获取设备能力集(获取摄像头反转能力) |
| | | #define API_POST_EZ_SetPtzMiroor @"/home-wisdom/platform/yingshi/setPtzMiroor"//设置设备云台镜像(设置摄像头反转能力) |
| | | |
| | | #pragma mark APP_KEY |
| | | #define APP_KEY @"QWERREWQ" |
| | | #define SECRET_KEY @"CPBUCTRLCPBUABCD" |
| | | #define APP_KEY @"HDL-HOME-APP-TEST" |
| | | #define SECRET_KEY @"WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss" |
| | | |
| | | |
| | | #define TIME_OUT 30.0f |
| | |
| | | }]; |
| | | } |
| | | |
| | | /** |
| | | * @since 获取设备能力集 |
| | | * @param deviceSerial 设备序列号 |
| | | * @param completion 回调block,error为空时表示成功 |
| | | */ |
| | | - (void)getDeviceCapacity:(NSString *)deviceSerial |
| | | completion:(void (^)(ResponseData *responseData))completion { |
| | | //设置请求参数 |
| | | NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; |
| | | [parameters setValue:deviceSerial forKey:@"deviceSerial"]; |
| | | [parameters setValue:@(1) forKey:@"platform"]; |
| | | [parameters setValue:[GlobalKit shareKit].hdlHomeId forKey:@"homeId"]; |
| | | |
| | | parameters = [self GetSignRequestDictionary:parameters]; |
| | | |
| | | NSLog(@"获取设备能力集参数:%@",parameters); |
| | | |
| | | [self requestHttpsPost:API_POST_EZ_GetDeviceCapacity parameters:parameters completion:^(ResponseData *responseData) { |
| | | if (completion) { |
| | | completion (responseData); |
| | | } |
| | | }]; |
| | | } |
| | | |
| | | /** |
| | | * @since 设置设备云台镜像 |
| | | * @param deviceSerial 设备序列号 |
| | | * @param command 命令 0-上下;1-左右;2-中心 |
| | | * @param completion 回调block,error为空时表示成功 |
| | | */ |
| | | - (void)setPtzMiroor:(NSString *)deviceSerial |
| | | command:(NSString *)command |
| | | completion:(void (^)(ResponseData *responseData))completion { |
| | | //设置请求参数 |
| | | NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; |
| | | [parameters setValue:deviceSerial forKey:@"deviceSerial"]; |
| | | [parameters setValue:@(1) forKey:@"platform"]; |
| | | [parameters setValue:[GlobalKit shareKit].hdlHomeId forKey:@"homeId"]; |
| | | [parameters setValue:command forKey:@"command"]; |
| | | |
| | | parameters = [self GetSignRequestDictionary:parameters]; |
| | | |
| | | NSLog(@"设置设备云台镜像参数:%@",parameters); |
| | | |
| | | [self requestHttpsPost:API_POST_EZ_SetPtzMiroor parameters:parameters completion:^(ResponseData *responseData) { |
| | | if (completion) { |
| | | completion (responseData); |
| | | } |
| | | }]; |
| | | } |
| | | |
| | | |
| | | /// 刷新token |
| | | /// @param block 结果 |
| | |
| | | params =[NSMutableDictionary dictionary]; |
| | | } |
| | | UInt64 recordTime = [[NSDate date] timeIntervalSince1970]*1000; |
| | | [params setValue:APP_KEY forKey:@"appKey"]; |
| | | NSString *hdlServerAppKey = [GlobalKit shareKit].hdlServerAppKey; |
| | | if (!hdlServerAppKey || hdlServerAppKey.length == 0) { |
| | | hdlServerAppKey = APP_KEY; |
| | | } |
| | | NSString *hdlServerAppSecret = [GlobalKit shareKit].hdlServerAppSecret; |
| | | if (!hdlServerAppSecret || hdlServerAppSecret.length == 0) { |
| | | hdlServerAppSecret = SECRET_KEY; |
| | | } |
| | | [params setValue:hdlServerAppKey forKey:@"appKey"]; |
| | | [params setValue:[NSString stringWithFormat:@"%llu",recordTime] forKey:@"timestamp"]; |
| | | NSLog(@"##########APPKEY:%@, SECRET_KEY:%@", APP_KEY, SECRET_KEY); |
| | | NSLog(@"##########APPKEY:%@, SECRETKEY:%@", hdlServerAppKey, hdlServerAppSecret); |
| | | //1.对KEY升序 |
| | | NSArray *keyArray = [params allKeys]; |
| | | NSArray *sortKeyArray = [keyArray sortedArrayUsingComparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) { |
| | |
| | | } |
| | | //2.3 拼接SECRET_KEY |
| | | newString = [newString substringToIndex:[newString length] - 1]; |
| | | newString = [newString stringByAppendingString: SECRET_KEY]; |
| | | newString = [newString stringByAppendingString: hdlServerAppSecret]; |
| | | //2.4 MD5转换+转小写 |
| | | if([self stringIsNullOrEmpty:newString]){ |
| | | newString = @""; |