浏览代码

1.webrtc 部分接口验证

huangxiaodong 9 月之前
父节点
当前提交
d7cdbc845a

+ 25 - 10
创维盒子/双子星云手机/Class/Set/view/allVersionView.m

@@ -174,21 +174,26 @@
         {
         {
             case 0:{
             case 0:{
                 cell.detailTextLabel.numberOfLines = 0;
                 cell.detailTextLabel.numberOfLines = 0;
-                cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.ImageVersion;
+                //cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.ImageVersion;
+                cell.detailTextLabel.text = _couldphoneSysInfoMod.data.ImageVersion;
             }
             }
                 break;
                 break;
             case 1:
             case 1:
-                cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.hostImgVer;
+                //cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.hostImgVer;
+                cell.detailTextLabel.text = _couldphoneSysInfoMod.data.hostImgVer;
                 break;
                 break;
             case 2:
             case 2:
-                cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.hostAgentVer;
+                //cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.hostAgentVer;
+                cell.detailTextLabel.text = _couldphoneSysInfoMod.data.hostAgentVer;
                 break;
                 break;
             case 3:
             case 3:
                 cell.detailTextLabel.numberOfLines = 0;
                 cell.detailTextLabel.numberOfLines = 0;
-                cell.detailTextLabel.text = [[NSString alloc] initWithFormat:@"%@(%@)",_couldphoneSysInfoMod.data.data.AgentVersion.versionName,_couldphoneSysInfoMod.data.data.AgentVersion.versionCode];
+                //cell.detailTextLabel.text = [[NSString alloc] initWithFormat:@"%@(%@)",_couldphoneSysInfoMod.data.data.AgentVersion.versionName,_couldphoneSysInfoMod.data.data.AgentVersion.versionCode];
+                cell.detailTextLabel.text = [[NSString alloc] initWithFormat:@"%@(%@)",_couldphoneSysInfoMod.data.AgentVersion.versionName,_couldphoneSysInfoMod.data.AgentVersion.versionCode];
                 break;
                 break;
             case 4:
             case 4:
-                cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.privateTV.versionName;
+                //cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.privateTV.versionName;
+                cell.detailTextLabel.text = _couldphoneSysInfoMod.data.privateTV.versionName;
                 break;
                 break;
             case 5:{
             case 5:{
                 NSString *vers = [iPhone appVersion];
                 NSString *vers = [iPhone appVersion];
@@ -204,21 +209,31 @@
             }
             }
                 break;
                 break;
             case 6:{
             case 6:{
-                if([_couldphoneSysInfoMod.data.data.sn isEqualToString:ksharedAppDelegate.DeviceThirdIdMod.data.sn]){
-                    cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.sn;
+//                if([_couldphoneSysInfoMod.data.data.sn isEqualToString:ksharedAppDelegate.DeviceThirdIdMod.data.sn]){
+//                    cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.sn;
+//                }
+//                else{
+//                    cell.detailTextLabel.numberOfLines = 0;
+//                    cell.detailTextLabel.text = [[NSString alloc] initWithFormat:@"%@(%@)",_couldphoneSysInfoMod.data.data.sn,ksharedAppDelegate.DeviceThirdIdMod.data.sn];
+//                }
+                
+                if([_couldphoneSysInfoMod.data.sn isEqualToString:ksharedAppDelegate.DeviceThirdIdMod.data.sn]){
+                    cell.detailTextLabel.text = _couldphoneSysInfoMod.data.sn;
                 }
                 }
                 else{
                 else{
                     cell.detailTextLabel.numberOfLines = 0;
                     cell.detailTextLabel.numberOfLines = 0;
-                    cell.detailTextLabel.text = [[NSString alloc] initWithFormat:@"%@(%@)",_couldphoneSysInfoMod.data.data.sn,ksharedAppDelegate.DeviceThirdIdMod.data.sn];
+                    cell.detailTextLabel.text = [[NSString alloc] initWithFormat:@"%@(%@)",_couldphoneSysInfoMod.data.sn,ksharedAppDelegate.DeviceThirdIdMod.data.sn];
                 }
                 }
             }
             }
                 break;
                 break;
             case 7:{
             case 7:{
-                cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.AVVersion;
+                //cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.AVVersion;
+                cell.detailTextLabel.text = _couldphoneSysInfoMod.data.AVVersion;
             }
             }
                 break;
                 break;
             case 8:{
             case 8:{
-                cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.MyNewVersion;
+                //cell.detailTextLabel.text = _couldphoneSysInfoMod.data.data.MyNewVersion;
+                cell.detailTextLabel.text = _couldphoneSysInfoMod.data.MyNewVersion;
             }
             }
                 break;
                 break;
             case 9:{
             case 9:{

+ 2 - 1
创维盒子/双子星云手机/CloudPlayer/Model/couldphoneSysInfoModel.h

@@ -57,7 +57,8 @@ NS_ASSUME_NONNULL_BEGIN
 @end
 @end
 
 
 @interface couldphoneSysInfoModel : SuperModel
 @interface couldphoneSysInfoModel : SuperModel
-@property(nonatomic, strong)couldphoneSysInfoDataModel *data;
+//@property(nonatomic, strong)couldphoneSysInfoDataModel *data;
+@property(nonatomic, strong)couldphoneSysInfoDataDataModel *data;
 @property (nonatomic, copy) NSString* type;
 @property (nonatomic, copy) NSString* type;
 @end
 @end
 
 

+ 4 - 1
创维盒子/双子星云手机/NAS/NASViewController.m

@@ -630,7 +630,10 @@
 #pragma mark 获取到云机磁盘相关信息
 #pragma mark 获取到云机磁盘相关信息
 - (void)getExtraFilesDoneFun:(NSNotification*)not
 - (void)getExtraFilesDoneFun:(NSNotification*)not
 {
 {
-    [self setMySpaceDataFun];
+    mainBlock(^{
+        [self setMySpaceDataFun];
+    });
+    
 }
 }
 
 
 #pragma mark  设置我的空间信息
 #pragma mark  设置我的空间信息

+ 8 - 8
创维盒子/双子星云手机/cloudPhone/cloudPhoneViewController.m

@@ -34,7 +34,7 @@
     
     
     [self drawAnyView];
     [self drawAnyView];
     
     
-    [self queryWebRtcMsgFun:NO];
+    //[self queryWebRtcMsgFun:NO];
 }
 }
 
 
 - (void)drawAnyView{
 - (void)drawAnyView{
@@ -200,10 +200,10 @@
         return;
         return;
     }
     }
     
     
-    if (!ksharedAppDelegate.isWebSockLinkOKAginType) {//未链接
-        [[iToast makeText:NSLocalizedString(@"box_link_error_show_tip",nil)] show];
-        return;
-    }
+//    if (!ksharedAppDelegate.isWebSockLinkOKAginType) {//未链接
+//        [[iToast makeText:NSLocalizedString(@"box_link_error_show_tip",nil)] show];
+//        return;
+//    }
     
     
     NSInteger tag = but.tag;
     NSInteger tag = but.tag;
     HLog(@"%ld",tag);
     HLog(@"%ld",tag);
@@ -452,8 +452,8 @@
 {
 {
     if(isPlayerType){
     if(isPlayerType){
         
         
-        if(_webRtcMsgMod && _webRtcMsgMod.data.sn){
-            [self gotoWebRtcVcBy:_webRtcMsgMod];
+        if(ksharedAppDelegate.DeviceWebRtcMsgMod && ksharedAppDelegate.DeviceWebRtcMsgMod.data.sn){
+            [self gotoWebRtcVcBy:ksharedAppDelegate.DeviceWebRtcMsgMod];
             return;
             return;
         }
         }
         
         
@@ -472,7 +472,7 @@
         webRtcMsgModel *curModel = [[webRtcMsgModel alloc] initWithDictionary:responseObject error:nil];
         webRtcMsgModel *curModel = [[webRtcMsgModel alloc] initWithDictionary:responseObject error:nil];
         
         
         if(curModel && curModel.status == 0){
         if(curModel && curModel.status == 0){
-            weakSelf.webRtcMsgMod = curModel;
+            ksharedAppDelegate.DeviceWebRtcMsgMod = curModel;
             if(isPlayerType){
             if(isPlayerType){
                 [weakSelf gotoWebRtcVcBy:curModel];
                 [weakSelf gotoWebRtcVcBy:curModel];
             }
             }

+ 16 - 11
创维盒子/双子星云手机/cloudPhone/websocket/webSocketManager.m

@@ -177,11 +177,12 @@ static webSocketManager *webSocketManagerInstance = nil;
                     NSDictionary *data = dataDict[@"data"];
                     NSDictionary *data = dataDict[@"data"];
                     
                     
                      if([data isKindOfClass:[NSString class]]){
                      if([data isKindOfClass:[NSString class]]){
-                        NSString * dataStr = (NSString*)data;
-                        if([dataStr isEqualToString:@"offline_notification"]){
-                            HLog(@"被别人挤下线了");
-                            [weakSelf LogoutByOtherFun];
-                        }
+                         //暂时屏蔽
+//                        NSString * dataStr = (NSString*)data;
+//                        if([dataStr isEqualToString:@"offline_notification"]){
+//                            HLog(@"被别人挤下线了");
+//                            [weakSelf LogoutByOtherFun];
+//                        }
                          
                          
                          return;
                          return;
                     }
                     }
@@ -538,10 +539,11 @@ static webSocketManager *webSocketManagerInstance = nil;
             curOaidStr = @"";
             curOaidStr = @"";
         }
         }
         
         
-        NSString *commondStr = [[NSString alloc] initWithFormat:@"{\"type\":\"forwardMsg\",\"data\":\"offline_notification\",\"sign\":\"%@\"}",curOaidStr];
-        //NSString *commondStr  = @"{\"type\":\"forwardMsg\",\"data\":\"offline_notification\"}";
-        [self send_data:commondStr];
-        [self addCommandSendTaskFunWithType:@"offline_notification" WithCommandStr:commondStr];
+        //暂时屏蔽
+//        NSString *commondStr = [[NSString alloc] initWithFormat:@"{\"type\":\"forwardMsg\",\"data\":\"offline_notification\",\"sign\":\"%@\"}",curOaidStr];
+//        //NSString *commondStr  = @"{\"type\":\"forwardMsg\",\"data\":\"offline_notification\"}";
+//        [self send_data:commondStr];
+//        [self addCommandSendTaskFunWithType:@"offline_notification" WithCommandStr:commondStr];
         
         
         _didSendfristMsg = YES;
         _didSendfristMsg = YES;
         
         
@@ -727,8 +729,11 @@ static webSocketManager *webSocketManagerInstance = nil;
     couldphoneSysInfoModel *model = [[couldphoneSysInfoModel alloc] initWithDictionary:dataDict error:nil];
     couldphoneSysInfoModel *model = [[couldphoneSysInfoModel alloc] initWithDictionary:dataDict error:nil];
     //[[NSNotificationCenter defaultCenter] postNotificationName:getCouldPhoneSysInfoNotification object:model];
     //[[NSNotificationCenter defaultCenter] postNotificationName:getCouldPhoneSysInfoNotification object:model];
         
         
-    NSString *hostImgVer = model.data.data.hostImgVer;
-    NSString *MyNewVersion = model.data.data.MyNewVersion;
+//    NSString *hostImgVer = model.data.data.hostImgVer;
+//    NSString *MyNewVersion = model.data.data.MyNewVersion;
+    
+    NSString *hostImgVer = model.data.hostImgVer;
+    NSString *MyNewVersion = model.data.MyNewVersion;
 
 
     //test code
     //test code
 //    hostImgVer = @"1.2.3";
 //    hostImgVer = @"1.2.3";

二进制
创维盒子/双子星云手机/webRtc/WebRTC.framework/WebRTC


+ 8 - 0
创维盒子/双子星云手机/webRtc/webRtcManager/webRtcManager.h

@@ -19,6 +19,14 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic, strong) AMediaStream *mediaStream;
 @property (nonatomic, strong) AMediaStream *mediaStream;
 @property (nonatomic, assign) BOOL needToReportWebRtcType;
 @property (nonatomic, assign) BOOL needToReportWebRtcType;
 
 
+@property(nonatomic,assign)BOOL isRebootIngType;//是否重启中
+@property(nonatomic,assign)BOOL isResetingType;//是否恢复出厂中
+@property(nonatomic,assign)BOOL isChangeBoxType;//是否更换盒子
+@property(nonatomic,assign)BOOL isLogoutByOtherType;//被挤下线
+@property(nonatomic,assign)BOOL isWaitShowLogoutAlert;//隐私模式等待被挤下线弹框是否弹出
+
+@property(nonatomic,assign)BOOL isDiDChangePhoneSizeType;//是否修改了分辨率(如果是 进去云机需要重设解码器)
+
 - (void)beginToLinkWebRtcFun;
 - (void)beginToLinkWebRtcFun;
 @end
 @end
 
 

+ 630 - 21
创维盒子/双子星云手机/webRtc/webRtcManager/webRtcManager.m

@@ -7,9 +7,16 @@
 
 
 #import "webRtcManager.h"
 #import "webRtcManager.h"
 #import "webRtcManager+StatisticsReport.h"
 #import "webRtcManager+StatisticsReport.h"
+#import "RcGameWQKeyChain.h"
+#import "errorAlertTool.h"
 
 
 @interface webRtcManager ()<MediaStreamClientEventsDelegate>
 @interface webRtcManager ()<MediaStreamClientEventsDelegate>
+{
+    NSMutableArray *commandSendCheckArr;//需要检测任务是否发出的的指令
+}
 
 
+//第一次链接设备 要发送指令信息 实现单点登录
+@property (nonatomic, assign)BOOL didSendfristMsg;
 @end
 @end
 
 
 @implementation webRtcManager
 @implementation webRtcManager
@@ -54,6 +61,7 @@
    
    
     NSString *roomName = _webRtcMsgMod.data.uniqueIdentifier;
     NSString *roomName = _webRtcMsgMod.data.uniqueIdentifier;
     
     
+    
     NSInteger result = [_mediaStream startUploadChannel:url ice:ice sn:roomName token:@"vclusters"];
     NSInteger result = [_mediaStream startUploadChannel:url ice:ice sn:roomName token:@"vclusters"];
     
     
 //    NSInteger result = [_mediaStream start:url
 //    NSInteger result = [_mediaStream start:url
@@ -78,45 +86,646 @@
     [self beginToLinkWebRtcFun];
     [self beginToLinkWebRtcFun];
 }
 }
 
 
+#pragma mark webrtc P2P通道发送消息
+- (void)send_data:(NSString *)dataStr
+{
+    [_mediaStream sendData:dataStr];
+}
+
+
+#pragma mark 盒子链接成功后需要处理的各种各样事情
+- (void)handlAllMsgAfterDidLinkFun
+{
+    _isRebootIngType = NO;
+    _isResetingType = NO;
+    _isChangeBoxType = NO;
+    
+    ksharedAppDelegate.isWebSockLinkOKAginType = YES;
+    
+    //获取云机尺寸 兼容 720*1080 &1080*1920 不同分辨率的展示和触控
+    NSString *getPhoneSizeStr = [RCCommandHelp getPhoneSizecommand];
+    [self send_data:getPhoneSizeStr];
+    
+    //判断是否为需要改机
+    BOOL isNeedRandomChangeParams = [HWDataManager getBoolWithKey:Const_need_random_Change_Params];
+    if(isNeedRandomChangeParams)
+    {
+        NSString *commondStr  = @"{\"type\":\"randomChangeParams\"}";
+        [self send_data:commondStr];
+        
+        [HWDataManager setBoolWithKey:Const_need_random_Change_Params value:NO];
+    }
+    
+    [self fristConnectNeedGiveAMsgFun];
+    
+    [self updateCopydata];
+
+    //  报链接失败 后面又连接上了
+    [[errorAlertTool shareInstance] dismissErrorAlertFun];
+    
+    //处理相册备份
+    
+    //获取磁盘外挂
+    [self getExtraFilesListFun];
+    
+    [self getBaseInfoFun];
+    
+    [self getTvStatusFun];
+}
+
+#pragma mark 盒子第一次连接成功  给ws发送信息 单点登录 把其他账号挤下去
+- (void)fristConnectNeedGiveAMsgFun{
+    
+    if(!_didSendfristMsg )
+    {
+        [self getSysInfoFun];
+        
+        NSString *curOaidStr = [RcGameWQKeyChain getOaidStringFun];
+        if(!curOaidStr){
+            curOaidStr = @"";
+        }
+        
+        //未调通挤下线
+        NSString *commondStr = [[NSString alloc] initWithFormat:@"{\"type\":\"login\",\"value\":\"%@\"}",curOaidStr];
+        [self send_data:commondStr];
+        [self addCommandSendTaskFunWithType:@"offline_notification" WithCommandStr:commondStr];
+        
+        _didSendfristMsg = YES;
+        
+        [self getPreferredLanguage];
+        
+        NSString *commondStr2  = @"{\"type\":\"TvStatus\"}";
+        [self send_data:commondStr2];
+    }
+}
+
+#pragma mark 语言和市区 同步云机
+-(void)getPreferredLanguage
+{//{"data":{"language":"zh-CN","timeZone":"Etc/GMT+8"},"type":"setLanguages"}
+    // iOS 获取设备当前语言的代码
+    NSString *preferredLanguage = [[[NSBundle mainBundle] preferredLocalizations] firstObject];
+    HLog(@"当前语言:%@", preferredLanguage);
+
+    //en-US 英文 ja-JP 日文
+    
+    NSArray *arLanguages = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"];
+    NSLog(@"arLanguages:%@",arLanguages);
+    ///获取设备当前地区的代码和APP语言环境
+    NSString *languageCode = [NSLocale preferredLanguages][0];
+  
+   
+    //目前支持 中文(简体 繁体) 英文 日语
+    if([languageCode rangeOfString:@"zh-Hans"].location != NSNotFound)
+    {
+        preferredLanguage = @"zh-CN";
+    }
+    else if([languageCode rangeOfString:@"zh-Hant"].location != NSNotFound)
+    {
+        preferredLanguage = @"zh-HK";
+    }
+    else if([languageCode rangeOfString:@"ja-"].location != NSNotFound)
+    {
+        preferredLanguage = @"ja-JP";
+    }
+    else{
+        preferredLanguage = @"en-US";
+    }
+    
+//    if([languageCode  rangeOfString:preferredLanguage].location != NSNotFound){
+//        preferredLanguage = languageCode;
+//    }
+//    else{
+//        preferredLanguage = @"en-US";
+//    }
+    
+    NSString*gmtStr = [self UTCOffset];
+    HLog(@"%@",gmtStr);
+//    //获取名字,如“GMT+08:00
+    
+    NSString *commondStr = [NSString stringWithFormat:@"{\"type\":\"setLanguages\",\"data\":{\"language\":\"%@\",\"timeZone\":\"%@\"}}",preferredLanguage,gmtStr];
+    
+    [self send_data:commondStr];
+    
+}
+
+#pragma mark 获取云机系统镜像等信息
+- (void)getSysInfoFun
+{
+    NSString *commondStr  = @"{\"type\":\"getSysInfo\"}";
+    [self send_data:commondStr];
+}
+
+-(NSString *)UTCOffset {
+    NSTimeZone *localTZ = [NSTimeZone localTimeZone];
+    float offset = localTZ.secondsFromGMT/3600.0;
+    if(offset > 0){
+        return [NSString stringWithFormat:@"Etc/GMT+%g",offset];
+    }
+    return [NSString stringWithFormat:@"Etc/GMT%g",offset];
+}
+
+#pragma mark 收到系统信息消息回调处理
+- (void)getCouldPhoneSysInfoResponseFun:(NSDictionary *)dataDict{
+    couldphoneSysInfoModel *model = [[couldphoneSysInfoModel alloc] initWithDictionary:dataDict error:nil];
+    //[[NSNotificationCenter defaultCenter] postNotificationName:getCouldPhoneSysInfoNotification object:model];
+        
+//    NSString *hostImgVer = model.data.data.hostImgVer;
+//    NSString *MyNewVersion = model.data.data.MyNewVersion;
+    
+    NSString *hostImgVer = model.data.hostImgVer;
+    NSString *MyNewVersion = model.data.MyNewVersion;
+    //test code
+//    hostImgVer = @"1.2.3";
+//    MyNewVersion = @"1.2.0";
+    
+    //判断当前版本号 待更新版本
+    if (!hostImgVer || hostImgVer.length < 3
+        ||!MyNewVersion || MyNewVersion.length < 3) {
+        return;
+    }
+    
+    NSArray *versionArr = [hostImgVer componentsSeparatedByString:@"."];
+    NSArray *MyNewVersionArr = [MyNewVersion componentsSeparatedByString:@"."];
+    
+    NSInteger versionArrCount = versionArr.count;
+    NSInteger MyNewVersionArrCount = MyNewVersionArr.count;
+    NSInteger maxCount =  versionArrCount < MyNewVersionArrCount ? versionArrCount:MyNewVersionArrCount;
+    
+    BOOL isNeedShowType = NO;
+    //判断是否要更新镜像框
+    if(maxCount > 0){
+        for (int i=0; i<maxCount; i++) {
+            NSString * numberStr1 = versionArr[i];
+            NSString * numberStr2 = MyNewVersionArr[i];
+            
+            if(numberStr2.intValue > numberStr1.intValue){
+                isNeedShowType =YES;
+                break;
+            }
+        }
+    }
+    
+    
+    if(isNeedShowType){
+        ksharedAppDelegate.isNeedShowImageNewType = YES;
+    }
+    
+    //是否禁用文件传输 (1.3以及以上的镜像可以使用文件传输)
+    if(versionArr.count >= 3)
+    {
+        NSString * oneStr = versionArr[0];
+        NSString * twoStr = versionArr[1];
+        NSString * threeStr = versionArr[2];
+
+        if(oneStr.integerValue <=1 && twoStr.integerValue <=3 && threeStr.integerValue <=0){//禁用
+            ksharedAppDelegate.DisabledFileTransferType = YES;
+            
+            if(MyNewVersionArr.count >= 3)
+            {
+                NSString * newOneStr = MyNewVersionArr[0];
+                NSString * newTwoStr = MyNewVersionArr[1];
+                NSString * newThreeStr = MyNewVersionArr[2];
+                
+                if(newOneStr.integerValue >=1 && newTwoStr.integerValue >=3 && newThreeStr.integerValue >= 1){
+                    ksharedAppDelegate.isImageNewFor130 = YES;
+                }
+                else{
+                    ksharedAppDelegate.isImageNewFor130 = NO;
+                }
+            }
+        }
+        else{
+            ksharedAppDelegate.DisabledFileTransferType = NO;
+        }
+    }
+    
+    [[NSNotificationCenter defaultCenter] postNotificationName:getCouldPhoneSysInfoNotification object:model];
+}
+
+#pragma mark 添加消息重复机制
+-(void)addCommandSendTaskFunWithType:(NSString*)type WithCommandStr:(NSString*)commandStr
+{
+    if(!commandSendCheckArr){
+        commandSendCheckArr = [NSMutableArray new];
+    }
+    
+    BOOL didAddType = NO;
+        
+    for (commandSendCheckModel *model in commandSendCheckArr) {
+        if([model.type isEqualToString:type]){
+            didAddType = YES;
+            model.reSendNum = 0;
+            model.sendTimerStamp = [iTools getNowTimeStamp];
+            break;
+        }
+    }
+        
+    if(!didAddType){
+        commandSendCheckModel *model = [commandSendCheckModel new];
+        model.commandStr = commandStr;
+        model.type = type;
+        model.reSendNum = 0;
+        model.sendTimerStamp = [iTools getNowTimeStamp];
+        [commandSendCheckArr addObject:model];
+    }
+    
+}
+
+#pragma mark 复制手机消息到云机
+- (void)updateCopydata{
+    UIPasteboard* pasteboard = [UIPasteboard generalPasteboard];
+    NSString *str = [pasteboard string];
+    
+    HLog(@"__________%s______%@____",__func__,str);
+    
+    if ([str rangeOfString:@"CVLUSTERS_NOUSE_"].location != NSNotFound)
+    {
+        str = nil;
+    }
+    
+    if (str && str.length >0)
+    {
+        //HLog(@"hxd111 cutting  %@",str);
+        /*发送数据*/
+        NSString *dataStr = [RCCommandHelp commandCuttingWithContent:str];
+        [self send_data:dataStr];
+        //pasteboard.string = @"";
+    }
+    
+}
+
+#pragma mark 获取云机以及外挂磁盘
+- (void)getExtraFilesListFun
+{
+    NSString *ExtraCommondStr  = [RCCommandHelp getExtraFilesList];
+    [self send_data:ExtraCommondStr];
+}
+
+#pragma mark 获取到云机以及外挂磁盘信息
+- (void)getExtraFilesResponseFun:(NSDictionary *)dataDict
+{
+    cloudPhoneExtraFileListModel *model = [[cloudPhoneExtraFileListModel alloc] initWithDictionary:dataDict error:nil];
+    ksharedAppDelegate.cloudPhoneExtraFileListMod = model;
+    
+    [[NSNotificationCenter defaultCenter] postNotificationName:getExtraFilesDoneNotification object:dataDict];/*发送通知*/
+}
+
+#pragma mark 获取云机基本信息
+- (void)getBaseInfoFun
+{
+    NSString *commondStr  = @"{\"type\":\"getBaseInfo\"}";
+    [self send_data:commondStr];
+}
+
+#pragma mark 获取到云机基本信息
+- (void)getCouldPhoneBaseInfoResponseFun:(NSDictionary *)dataDict
+{
+    couldPhoneBaseInfoModel *model = [[couldPhoneBaseInfoModel alloc] initWithDictionary:dataDict error:nil];
+    [[NSNotificationCenter defaultCenter] postNotificationName:getCouldPhoneBaseInfoNotification object:model];
+}
+
+#pragma mark 获取TV投屏状态
+- (void)getTvStatusFun
+{
+    NSString *commondStr  = @"{\"type\":\"TvStatus\"}";
+    [self send_data:commondStr];
+}
+
+#pragma mark 获取到TV投屏状态
+- (void)getCouldPhoneTvStatusResponseFun:(NSDictionary *)dataDict
+{
+    TvStatusModel *model = [[TvStatusModel alloc] initWithDictionary:dataDict error:nil];
+    ksharedAppDelegate.TvStatusMod = model;
+    
+    [[NSNotificationCenter defaultCenter] postNotificationName:getCouldPhoneTvStatusNotification object:model];
+    
+//    if(![model.msg containsString:@"PushStreamBActivity"])
+//    {
+//        return;
+//    }
+//
+//    UIViewController*topVc = self.navigationController.viewControllers.lastObject;
+//    if([topVc isKindOfClass:[PlayerViewController class]]){
+//        [[iToast makeText:NSLocalizedString(@"tv_p2p_ing",nil)] show];
+//    }
+}
+
+
+#pragma mark 收到的webrtc消息处理
+- (void)handleWebRtcMsgResponseBy:(NSData*)message
+{
+    if([message isKindOfClass:[NSMutableString class]] || [message isKindOfClass:[NSString class]])
+    {
+        message = [(NSString *)message dataUsingEncoding:(NSUTF8StringEncoding)];
+    }
+    
+    NSError *error = nil;
+    NSDictionary *dataDict = [NSJSONSerialization JSONObjectWithData:message options:NSJSONReadingMutableContainers error:&error];
+    HLog(@"webRtc P2P 通道接收消息:------------------%@",dataDict);
+    
+//    if([message isKindOfClass:[NSData class]] && [message length] == 0){
+//        if(type == RCSocketCloudPhoneReceiveTypeForPong)
+//        {
+//            [weakSelf keepWebSocketOKFun];
+//        }
+//        return;
+//    }
+//  
+//    HLog(@"webSocket指令通道接收消息:------------------\n%@",message);
+//    
+//    if([message isKindOfClass:[NSMutableString class]] || [message isKindOfClass:[NSString class]])
+//    {
+//        message = [(NSString *)message dataUsingEncoding:(NSUTF8StringEncoding)];
+//    }
+//    
+//    NSError *error = nil;
+//    NSDictionary *dataDict = [NSJSONSerialization JSONObjectWithData:message options:NSJSONReadingMutableContainers error:&error];
+    
+    if(!dataDict){
+        //[weakSelf handleDownloadResponseFunBy:message];
+        return;
+    }
+    
+    if(![dataDict isKindOfClass:[NSDictionary class]]){
+        //[__NSCFString allKeys] unrecognized selector sent to ins
+        return;
+    }
+    
+    NSString *messageType = dataDict[@"type"];
+    
+    if ([messageType isEqualToString:@"cutting"]) {
+        //[[iToast makeText:@"复制成功"] show];
+    }
+//    else if ([messageType isEqualToString:@"forwardMsgRep"]){/*转发的回复*/
+//        
+//        cloudPhoneCommonModel *model = [[cloudPhoneCommonModel alloc] initWithDictionary:dataDict error:nil];
+//        if(!model){
+//            return;
+//        }
+//        
+//        if([model.data.msg isEqualToString:@"only one socket"]||
+//           [model.data.msg isEqualToString:@"only one socket2"]){
+//            [weakSelf deleteCommandSendTaskFunWith:@"offline_notification"];
+//        }
+//    }
+//    else if ([messageType isEqualToString:@"forwardMsg"]){/*转发*/
+//        /*获取指令类型*/
+//        NSString *code = nil;
+//        if ([[dataDict allKeys] containsObject:@"data"]) {
+//            NSDictionary *data = dataDict[@"data"];
+//            
+//             if([data isKindOfClass:[NSString class]]){
+//                NSString * dataStr = (NSString*)data;
+//                if([dataStr isEqualToString:@"offline_notification"]){
+//                    HLog(@"被别人挤下线了");
+//                    [weakSelf LogoutByOtherFun];
+//                }
+//                 
+//                 return;
+//            }
+//            else if ([data isKindOfClass:[NSDictionary class]] && [[data allKeys] containsObject:@"code"]) {
+//                code = [data objectForKey:@"code"];
+//                
+//                if (![code isKindOfClass:[NSString class]]) {
+//                    code = [NSString stringWithFormat:@"%ld",[code integerValue]];
+//                }
+//            }
+//        }
+//        
+//        /*获取用户名*/
+//        NSString *useName = nil;
+//        if ([[dataDict allKeys] containsObject:@"data"]) {
+//            NSDictionary *data = dataDict[@"data"];
+//            if ([[data allKeys] containsObject:@"userName"]) {
+//                //useName = [data objectForKey:@"userName"];
+//            }
+//        }
+//        
+//        
+//            if ([code isEqualToString:@"phoneSizeChange"]){/*分辨率改变*/
+//            if ([[dataDict allKeys] containsObject:@"data"]) {
+//                NSDictionary *data = dataDict[@"data"];
+//                if ([[data allKeys] containsObject:@"width"]) {
+//                    ksharedAppDelegate.couldPhone_W_PHONE = [[data objectForKey:@"width"] integerValue];
+//                }
+//                if ([[data allKeys] containsObject:@"height"]) {
+//                    ksharedAppDelegate.couldPhone_H_PHONE = [[data objectForKey:@"height"] integerValue];
+//                }
+//                
+//                if (ksharedAppDelegate.couldPhone_W_PHONE > ksharedAppDelegate.couldPhone_H_PHONE) {
+//                    CGFloat temp = ksharedAppDelegate.couldPhone_W_PHONE;
+//                    ksharedAppDelegate.couldPhone_W_PHONE = ksharedAppDelegate.couldPhone_H_PHONE;
+//                    ksharedAppDelegate.couldPhone_H_PHONE = temp;
+//                }
+//            }
+//        }
+//    }
+    else if ([messageType isEqualToString:@"getPhoneSize"] || [messageType isEqualToString:@"setPhoneSize"]){
+        //NSString *sn = nil;
+        
+        if([messageType isEqualToString:@"setPhoneSize"]){
+            self.isDiDChangePhoneSizeType = YES;
+        }
+        
+        if ([[dataDict allKeys] containsObject:@"data"]) {
+            NSDictionary *data = dataDict[@"data"];
+            
+            if ([[data allKeys] containsObject:@"status"]) {
+                NSInteger  status = [[data objectForKey:@"status"] integerValue];
+                
+                if (status == 0) {/*不是当前设备直接返回*/
+                    if ([[data allKeys] containsObject:@"width"]) {
+                        ksharedAppDelegate.couldPhone_W_PHONE = [[data objectForKey:@"width"] integerValue];
+                    }
+                    if ([[data allKeys] containsObject:@"height"]) {
+                        ksharedAppDelegate.couldPhone_H_PHONE = [[data objectForKey:@"height"] integerValue];
+                    }
+                    
+                    if (ksharedAppDelegate.couldPhone_W_PHONE > ksharedAppDelegate.couldPhone_H_PHONE) {
+                        CGFloat temp = ksharedAppDelegate.couldPhone_W_PHONE;
+                        ksharedAppDelegate.couldPhone_W_PHONE = ksharedAppDelegate.couldPhone_H_PHONE;
+                        ksharedAppDelegate.couldPhone_H_PHONE = temp;
+                    }
+                }
+            }
+        }
+    }
+//    else if ([messageType isEqualToString:@"sync_wifi"]){
+//        [weakSelf sync_wifiBackHandleFun];
+//    }
+//    else if ([messageType isEqualToString:@"reProduceText"]){
+//        if ([[dataDict allKeys] containsObject:@"data"]) {
+//            NSDictionary *data = dataDict[@"data"];
+//
+//            if ([[data allKeys] containsObject:@"text"]) {
+//                NSString  *pasteboardStr = [data objectForKey:@"text"];
+//                UIPasteboard* pasteboard = [UIPasteboard generalPasteboard];
+//                pasteboard.string = pasteboardStr;
+//            }
+//        }
+//    }
+//    else if ([messageType isEqualToString:@"downAdnInstallRep"]){
+//        if ([[dataDict allKeys] containsObject:@"data"]) {
+//            NSDictionary *data = dataDict[@"data"];
+//
+//            if ([[data allKeys] containsObject:@"status"]) {
+//                NSString  *status = [data objectForKey:@"status"];
+//                if ([status isEqualToString:@"1"]) {
+//                    mainBlock(^{
+//                       // [[iToast makeText:@"App下载完成"] show];
+//                    });
+//                }else if ([status isEqualToString:@"0"]){
+//                    mainBlock(^{
+//                        //[[iToast makeText:@"App下载中"] show];
+//                    });
+//                }
+//            }
+//        }
+//    }
+//    else if ([messageType isEqualToString:@"shakeit"]){
+//        HLog(@"\n-----摇一摇成功------");
+//    }else if ([messageType isEqualToString:@"keyboardFeedbackBean"]){/*调起键盘*/
+//        HLog(@"\n-----待处理 调起键盘------");
+//       // [weakSelf keyboardFeedbackBeanFun];
+//    }else if ([messageType isEqualToString:@"FileRandomReady"]
+//              ||[messageType isEqualToString:@"FilePartReady"]
+//              ){/*申请文件上传得到答复*/
+//        [weakSelf applyUploadFileServiceResponseFun:dataDict];
+//    }
+//    else if ([messageType isEqualToString:@"uploadFileRandomRet"]
+//             ||[messageType isEqualToString:@"uploadFilePartRet"]
+//             ){/*文件上传得到答复*/
+//        [weakSelf upLoadFileFunServiceResponseFun:dataDict];
+//    }
+//    else if ([messageType isEqualToString:@"backUpFileRandomReady"]
+//             ||[messageType isEqualToString:@"backUpPartReady"]
+//             ){/*文件备份得到答复*/
+//        [weakSelf applyBackupsFileServiceResponseFun:dataDict];
+//    }
+//    else if ([messageType isEqualToString:@"backUpFileRandomRet"]
+//             ||[messageType isEqualToString:@"backUpFilePartRet"]){/*文件备份得到答复*/
+//        [weakSelf backupsFileFunServiceResponseFun:dataDict];
+//    }
+    else if ([messageType isEqualToString:@"getBaseInfo"]){/*获取云机的基本信息*/
+        [self getCouldPhoneBaseInfoResponseFun:dataDict];
+    }
+    else if ([messageType isEqualToString:@"getSysInfo"]){/*获取云机的系统信息*/
+        [self getCouldPhoneSysInfoResponseFun:dataDict];
+    }
+    else if ([messageType isEqualToString:@"TvStatus"]){/*获取TV投屏信息*/
+        [self getCouldPhoneTvStatusResponseFun:dataDict];
+    }
+//    else if ([messageType isEqualToString:@"TvOff"]){/*关闭TV投屏*/
+//        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+//            [weakSelf getTvStatusFun];
+//        });
+//    }
+//    else if ([messageType isEqualToString:@"wakeupTV"]){/*开启TV投屏*/
+//        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+//            [weakSelf getTvStatusFun];
+//        });
+//    }
+//    else if ([messageType isEqualToString:@"reboot"]){/*重启*/
+//        //[weakSelf stopForceStartTimerFun];
+//    }
+//    else if ([messageType isEqualToString:@"mkdir"]){/*创建文件夹*/
+//        [weakSelf createFolderResponseFun:dataDict];
+//    }
+//    else if ([messageType isEqualToString:@"getBackupPath"]){/*创建文件夹*/
+//        [weakSelf getFolderListResponseFun:dataDict];
+//    }
+//    else if ([messageType isEqualToString:@"search"]){/*创建文件夹*/
+//        [weakSelf searchFileListResponseFun:dataDict];
+//    }
+    else if ([messageType isEqualToString:@"getExtraFiles"]){/*获取云机产品信息*/
+        [self getExtraFilesResponseFun:dataDict];
+    }
+//    else if ([messageType isEqualToString:@"extraMediaEvent"]){/*磁盘插拔*/
+//        [weakSelf getExtraMediaEventResponseFun:dataDict];
+//        [weakSelf getExtraFilesListFun];
+//    }
+//    else if ([messageType isEqualToString:@"reset"]){/**/
+//        [weakSelf deleteCommandSendTaskFunWith:@"reset"];
+//    }
+//    
+}
 
 
 #pragma mark WebRTC 回调 MediaStreamClientEventsDelegate
 #pragma mark WebRTC 回调 MediaStreamClientEventsDelegate
 
 
-#pragma mark 链接状态发生变化
+#pragma mark 不能再这里函数判断  这个是推拉流的
 -(void)onChangeConnectionStateFromPeerName:(NSString*)peerName didChangeIceConnectionState:(RTCIceConnectionState)state
 -(void)onChangeConnectionStateFromPeerName:(NSString*)peerName didChangeIceConnectionState:(RTCIceConnectionState)state
 {
 {
     HLog(@"channel onChangeConnectionStateFromPeerName: state:%ld",state)
     HLog(@"channel onChangeConnectionStateFromPeerName: state:%ld",state)
+//    switch (state) {
+//        case RTCIceConnectionStateConnected:{
+//            //链接成功
+//            [self handlAllMsgAfterDidLinkFun];
+//        }
+//            break;
+//        case RTCIceConnectionStateCompleted:
+//            //链接完成
+//            break;
+//        case RTCIceConnectionStateFailed:
+//            //链接失败
+//            break;
+//        case RTCIceConnectionStateDisconnected:
+//            //链接断开
+//            [self relinkWebRtcFun];
+//            break;
+//        case RTCIceConnectionStateClosed:
+//            //链接关闭
+//            break;
+//            
+//        default:
+//            break;
+//    }
+    
+}
+
+#pragma mark 通道连接状态变化监听
+- (void)dataChannelDidChangeFromPeerName:(NSString*)peerName State:(RTCDataChannelState)state
+{
     switch (state) {
     switch (state) {
-        case RTCIceConnectionStateConnected:{
-            //链接成功
-            
-        }
-            break;
-        case RTCIceConnectionStateCompleted:
-            //链接完成
+        case RTCDataChannelStateConnecting:
+            {
+                
+            }
             break;
             break;
-        case RTCIceConnectionStateFailed:
-            //链接失败
+        case RTCDataChannelStateOpen:
+            {
+                //链接成功
+                [self handlAllMsgAfterDidLinkFun];
+            }
             break;
             break;
-        case RTCIceConnectionStateDisconnected:
-            //链接断开
-            [self relinkWebRtcFun];
+        case RTCDataChannelStateClosing:
+            {
+                
+            }
             break;
             break;
-        case RTCIceConnectionStateClosed:
-            //链接关闭
+        case RTCDataChannelStateClosed:
+            {
+                //链接断开
+                [self relinkWebRtcFun];
+            }
             break;
             break;
-            
         default:
         default:
             break;
             break;
     }
     }
-    
-    
 }
 }
 
 
--(void)onIceConnectedFromPeerName:(NSString*)peerName{
-    HLog(@"onIceConnectedFromPeerName:%@",peerName);
-    
+-(void)onChannelDataFromPeerName:(NSString*)peerName buffer:(RTC_OBJC_TYPE(RTCDataBuffer) *)buffer
+{
+    //HLog(@"onIceConnectedFromPeerName:%@",buffer.data);
+    if(buffer && buffer.data){
+        [self handleWebRtcMsgResponseBy:buffer.data];
+    }
 }
 }
 
 
+//-(void)onIceConnectedFromPeerName:(NSString*)peerName{
+//    HLog(@"onIceConnectedFromPeerName:%@",peerName);
+//    
+//}
+
 -(void)didGetStats:(NSString*)peerName stats:(RTC_OBJC_TYPE(RTCStatisticsReport) *)stats
 -(void)didGetStats:(NSString*)peerName stats:(RTC_OBJC_TYPE(RTCStatisticsReport) *)stats
 {
 {
     //HLog(@"didGetStats:%@",stats)
     //HLog(@"didGetStats:%@",stats)