wxr
2023-05-29 2265a8478325a04871aab6a86d49c28d7d65443a
HDLLinPhoneSDK£¨OC£©/HDLLinPhoneSDK/HDLLinphoneIntercomVC.m
@@ -53,6 +53,11 @@
    NSString * callingStr;
    NSString * hangUpStr;
    NSString * endOfCallStr;
    NSString * cancelStr;
    NSString * tipMsgStr;
    //    int openDoorTimeout;
    //全局变量
    SystemSoundID sound;
@@ -121,6 +126,8 @@
        unlockSuccessfullyStr = @"开锁成功";
        callingStr = @"来电中...";
        endOfCallStr = @"通话结束";
        cancelStr = @"取消";
        tipMsgStr = @"确定开锁吗?";
    }else{
        tipStr = @"Prompt";
        okStr = @"OK";
@@ -132,6 +139,8 @@
        unlockSuccessfullyStr = @"Unlock successfully";
        callingStr = @"Incoming call";
        endOfCallStr = @"End of call";
        cancelStr = @"Cancel";
        tipMsgStr = @"Are you sure to unlock?";
        
    }
}
@@ -290,7 +299,27 @@
    [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_on_unlock_unselect"] forState:UIControlStateNormal];
    //开锁
    if(self.hdlLinphoneCallDelegate != NULL){
        [self.hdlLinphoneCallDelegate onUnlockAction];
        UIAlertController *alertController = [UIAlertController alertControllerWithTitle:tipStr message:tipMsgStr preferredStyle:UIAlertControllerStyleAlert];
        // æ·»åŠ å–æ¶ˆæŒ‰é’®
        UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:cancelStr style:UIAlertActionStyleCancel handler:nil];
        [alertController addAction:cancelAction];
        // æ·»åŠ ç¡®è®¤æŒ‰é’®
        WEAKSELF_AT
        UIAlertAction *confirmAction = [UIAlertAction actionWithTitle:okStr  style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            [weakSelf_AT.hdlLinphoneCallDelegate onUnlockAction];
        }];
        [alertController addAction:confirmAction];
        // èŽ·å–å½“å‰è§†å›¾æŽ§åˆ¶å™¨
        UIViewController *currentViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
        // æ˜¾ç¤ºå¼¹çª—
        [self presentViewController:alertController animated:YES completion:nil];
    }
}
@@ -357,7 +386,15 @@
    [self stopPlaySystemSound];
    
//    [[HDLCallManager instance] acceptCallByCallID:self.CallId hasVideo:self.hasVideo];
    [[HDLLinphoneManager instance] acceptCall];
    [HDLLinphoneManager.instance enableMicro:true];
    if (self.deviceType==HDLLPType_HDLSR) {
        NSLog(@"反呼");
        [HDLLinphoneManager.instance startCall:self.userName];
    }else{
        NSLog(@"接听");
        [[HDLLinphoneManager instance] acceptCall];
    }
    /// å¼€å¯å¯¹è®²
//    [self startTalk];
    
@@ -475,9 +512,9 @@
/** å¼€å¯å€’计时 */
- (void)startCountdown {
    
    if (_callTimeout > 100) {
        return;
    }
//    if (_callTimeout > 100) {
//        return;
//    }
    _callTimeout = 0;
    // GCD定时器
    dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
@@ -488,24 +525,24 @@
    
    dispatch_source_set_event_handler(_countdownTimer, ^{
        WEAKSELF_AT
        if(weakSelf_AT.callTimeout >= 100 ){// è®¡æ—¶ç»“束
            // å…³é—­å®šæ—¶å™¨
            dispatch_source_cancel(weakSelf_AT.countdownTimer);
            dispatch_async(dispatch_get_main_queue(), ^{
                NSLog(@"超时");
                [weakSelf_AT backAction];
            });
        }else{// è®¡æ—¶ä¸­
//        if(weakSelf_AT.callTimeout >= 100 ){// è®¡æ—¶ç»“束
//            // å…³é—­å®šæ—¶å™¨
//            dispatch_source_cancel(weakSelf_AT.countdownTimer);
//
//            dispatch_async(dispatch_get_main_queue(), ^{
//                NSLog(@"超时");
//                [weakSelf_AT backAction];
//
//            });
//
//        }else{// è®¡æ—¶ä¸­
            weakSelf_AT.callTimeout++;
            dispatch_async(dispatch_get_main_queue(), ^{
                [weakSelf_AT ShowTime:weakSelf_AT.callTimeout];
            });
            
            
        }
//        }
    });
    
    // å¼€å¯å®šæ—¶å™¨