Browse Source

1.同步sn bug

huangxiaodong 1 year ago
parent
commit
5bbcbff902

+ 17 - 1
创维盒子/双子星云手机/AppDelegate/SceneDelegate.m

@@ -125,6 +125,7 @@
     KWeakSelf
     //有设备了先去做链接准备  // 80bec9c5
     NSString *SNStr = deviceDict[@"Const_Have_Add_Device_SN"];
+    //SNStr = @"0333933700222490012925";
     NSString *sdnId = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.sdnId;
     if(SNStr && !sdnId){
         [[connectDeviceManager shareInstance] getThridMsgBySN:SNStr needReconnect:YES didNetEnd:^(NSInteger didSuc) {
@@ -133,10 +134,17 @@
                 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                     mainBlock(^{
                         [weakSelf showNetErrorAlertFun];
+                        [weakSelf enterMainVCFromSceneSecondStepFun];
                     });
                 });
             }
-            [weakSelf enterMainVCFromSceneSecondStepFun];
+            else if(didSuc == 2){
+                [weakSelf gotoScanAginByThridMsgErrorFun];
+            }
+            else{
+                [weakSelf enterMainVCFromSceneSecondStepFun];
+            }
+            
         }];
     }
     else{
@@ -752,4 +760,12 @@
      }];
 }
 
+- (void)gotoScanAginByThridMsgErrorFun
+{
+    /*扫码界面*/
+    TipsQRCodeViewController *qrCodeVC = [[TipsQRCodeViewController alloc] init];
+    qrCodeVC.isNeedToShowAleatType = YES;
+    BaseNavigationController *qrCodeVCNav = [[BaseNavigationController alloc] initWithRootViewController:qrCodeVC];
+    self.window.rootViewController = qrCodeVCNav;
+}
 @end

+ 1 - 1
创维盒子/双子星云手机/Class/Guide/AuthCodeView/AuthCodeInputView.m

@@ -155,7 +155,7 @@
 // 调用接口验证验证码正确性
 -(void)checkAuthcode
 {
-    NSString *snStr = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.sn;
+    NSString *snStr = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.changeSn;
     NSString *secretkey  = [RSATool sha256_8:snStr];
     
     NSString*inputCodeStr = [self.codeStr uppercaseString];

+ 8 - 2
创维盒子/双子星云手机/Class/Guide/QRCodeScanViewController.m

@@ -299,10 +299,16 @@ bool isDownType = YES;
     
     KWeakSelf
     [[connectDeviceManager shareInstance] getThridMsgBySN:sn needReconnect:NO didNetEnd:^(NSInteger didSuc) {
-        if(didSuc){
+        if(didSuc == 1){
             [weakSelf gotoGuideViewFunBy:sn];
         }else{
-            [[iToast makeText:NSLocalizedString(@"guide_qrcoede_tips_get_SdnID_fail",nil)] show];
+            if(didSuc == 2){
+                [[iToast makeText:NSLocalizedString(@"scan_sn_data_error_tip",nil)] show];
+            }
+            else{
+                [[iToast makeText:NSLocalizedString(@"guide_qrcoede_tips_get_SdnID_fail",nil)] show];
+            }
+            
             dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                 [self.navigationController popViewControllerAnimated:YES];
             });

+ 1 - 1
创维盒子/双子星云手机/Class/Guide/TipsQRCodeViewController.h

@@ -10,7 +10,7 @@
 NS_ASSUME_NONNULL_BEGIN
 
 @interface TipsQRCodeViewController : BaseViewController
-
+@property(nonatomic,assign)BOOL isNeedToShowAleatType;
 @end
 
 NS_ASSUME_NONNULL_END

+ 9 - 2
创维盒子/双子星云手机/Class/Set/ChangeDevice/QRCodeScanForChangeDeviceViewController.m

@@ -310,7 +310,7 @@ bool isDownType22 = YES;
             
             [self removeNewIndicatorHaveStr];
             
-            if(didSuc){
+            if(didSuc == 1){
                 
                 NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithDictionary:deviceDict];
                 [dict setObject:resStr forKey:Const_Have_Add_Device_SN];
@@ -319,7 +319,14 @@ bool isDownType22 = YES;
                 [self.navigationController popToRootViewControllerAnimated:NO];
                 [[NSNotificationCenter defaultCenter] postNotificationName:GuideOkNotification object:nil];
             }else{
-                [[iToast makeText:NSLocalizedString(@"guide_qrcoede_tips_get_SdnID_fail",nil)] show];
+                
+                if(didSuc == 2){
+                    [[iToast makeText:NSLocalizedString(@"scan_sn_data_error_tip",nil)] show];
+                }
+                else{
+                    [[iToast makeText:NSLocalizedString(@"guide_qrcoede_tips_get_SdnID_fail",nil)] show];
+                }
+                
                 
                 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                     mainBlock(^{

+ 1 - 1
创维盒子/双子星云手机/Class/Set/MySetViewController.m

@@ -514,7 +514,7 @@
 {
     KWeakSelf
     //瑞云发起重连
-    NSString *snStr = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.sn;
+    NSString *snStr = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.changeSn;
     if(snStr){
         [[connectDeviceManager shareInstance] getThridMsgBySN:snStr needReconnect:YES didNetEnd:^(NSInteger didSuc) {
             if(didSuc){

+ 1 - 1
创维盒子/双子星云手机/Class/Set/privacyMode/privacyModeTipViewController.m

@@ -164,7 +164,7 @@
     [self showNewIndicatorWithCanBack:YES canTouch:NO];
 
     BOOL haveOpenMask = YES;
-    NSString* curSn = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.sn;
+    NSString* curSn = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.changeSn;
     
     NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
     [paraDict setValue:curSn forKey:@"sn"];

+ 1 - 1
创维盒子/双子星云手机/Class/Set/privacyMode/privacyModeViewController.m

@@ -284,7 +284,7 @@
     [self showNewIndicatorWithCanBack:YES canTouch:NO];
 
     BOOL haveOpenMask = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.isPrivacyMode;
-    NSString* curSn = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.sn;
+    NSString* curSn = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.changeSn;
     
     NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
     [paraDict setValue:curSn forKey:@"sn"];

+ 1 - 1
创维盒子/双子星云手机/CloudPlayer/PlayerViewController+otherDelegate.mm

@@ -86,7 +86,7 @@
 - (void)updateForceStartFun{
     
     
-    NSString* curSn = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.sn;
+    NSString* curSn = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.changeSn;
     
     NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
     [paraDict setValue:curSn forKey:@"sn"];

+ 1 - 1
创维盒子/双子星云手机/CloudPlayer/PlayerViewController.mm

@@ -2169,7 +2169,7 @@ NSDate *lastVideoTome;/*上一帧数据时间*/
     if([[connectDeviceManager shareInstance] curConnectDeviceState] <= 3)
     {
         //瑞云发起重连
-        NSString *snStr = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.sn;
+        NSString *snStr = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.changeSn;
         if(snStr){
             _checkThridConnectNum = 1;
             [[connectDeviceManager shareInstance] getThridMsgBySN:snStr needReconnect:YES didNetEnd:^(NSInteger didSuc) {

+ 2 - 2
创维盒子/双子星云手机/CloudPlayer/View/playerShowSecretkeyView.m

@@ -87,7 +87,7 @@
     [grayBgView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(copyKeyFun)]];
     
     
-    NSString *snStr = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.sn;
+    NSString *snStr = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.changeSn;
     NSString *secretkey  = [RSATool sha256_8:snStr];
 
     UILabel *secretKeyLab = [[UILabel alloc] init];
@@ -195,7 +195,7 @@
 #pragma mark 复制
 - (void)copyKeyFun
 {
-    NSString *snStr = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.sn;
+    NSString *snStr = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.changeSn;
     NSString *secretkey  = [RSATool sha256_8:snStr];
     
     UIPasteboard * Pasteboard = [UIPasteboard generalPasteboard];

+ 65 - 65
创维盒子/双子星云手机/connectDeviceManager/connectDeviceManager.m

@@ -31,9 +31,9 @@ WHPingDelegate
 
 @property (nonatomic, strong) NSTimer *connectCheckTimer;
 
-@property (nonatomic, strong) GCDAsyncSocket *socket;
+//@property (nonatomic, strong) GCDAsyncSocket *socket;
 
-@property (nonatomic, strong) GCDAsyncSocket *serverSocket;
+//@property (nonatomic, strong) GCDAsyncSocket *serverSocket;
 
 @property (nonatomic, assign) BOOL sdnConnected;
 @property (nonatomic, assign) BOOL peerConnected;
@@ -120,7 +120,7 @@ static connectDeviceManager *connectDeviceManagerInstance = nil;
             
         }
         else{
-            didNetEndIsOK(NO);
+            didNetEndIsOK(2);
         }
         
         
@@ -218,12 +218,12 @@ static connectDeviceManager *connectDeviceManagerInstance = nil;
     
     
     /// 作为服务端时,启动端口监听
-    self.serverSocket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()];
-    
-    if ([self.serverSocket acceptOnPort:0 error:NULL]) {
-        //self.serverPortLab.text = [NSString stringWithFormat: @"server port: %d", self.serverSocket.localPort];
-        NSLog(@"accept ok %d",self.serverSocket.localPort);
-    }
+//    self.serverSocket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()];
+//
+//    if ([self.serverSocket acceptOnPort:0 error:NULL]) {
+//        //self.serverPortLab.text = [NSString stringWithFormat: @"server port: %d", self.serverSocket.localPort];
+//        NSLog(@"accept ok %d",self.serverSocket.localPort);
+//    }
     
 }
 
@@ -256,7 +256,7 @@ static connectDeviceManager *connectDeviceManagerInstance = nil;
     
 
     
-    self.socket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()];
+    //self.socket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()];
     
 
    
@@ -288,7 +288,7 @@ static connectDeviceManager *connectDeviceManagerInstance = nil;
 //        return;
 //    }
     
-    [self.socket writeData:[@"111" dataUsingEncoding:NSUTF8StringEncoding] withTimeout:-1 tag:0];
+    //[self.socket writeData:[@"111" dataUsingEncoding:NSUTF8StringEncoding] withTimeout:-1 tag:0];
     
 }
 
@@ -329,13 +329,13 @@ static connectDeviceManager *connectDeviceManagerInstance = nil;
         /// 6. 等待连接成功回调,创建 TCP socket 连接 HttpService 的端口
          NSError *error;
         
-        NSString*log1 =  [[NSString alloc] initWithFormat:@"onProxyConnected connectToHost begin %ld", (long)self.tcpPort];
-        [cachesFileManager writeLogsWithMsg:log1];
-        
-        [self.socket connectToHost:@"127.0.0.1" onPort:self.tcpPort error:&error];
-        
-        NSString*log2 =  [[NSString alloc] initWithFormat:@"onProxyConnected connectToHost end %ld, self.socket = %@ error = %@", (long)self.tcpPort, self.socket, error];
-        [cachesFileManager writeLogsWithMsg:log2];
+//        NSString*log1 =  [[NSString alloc] initWithFormat:@"onProxyConnected connectToHost begin %ld", (long)self.tcpPort];
+//        [cachesFileManager writeLogsWithMsg:log1];
+//
+//        [self.socket connectToHost:@"127.0.0.1" onPort:self.tcpPort error:&error];
+//
+//        NSString*log2 =  [[NSString alloc] initWithFormat:@"onProxyConnected connectToHost end %ld, self.socket = %@ error = %@", (long)self.tcpPort, self.socket, error];
+//        [cachesFileManager writeLogsWithMsg:log2];
         
         _curConnectDeviceState = DeviceConnectDeciceOk;
         _Pre_sdnId = self.DeviceThirdIdMod.data.sdnId;
@@ -413,53 +413,53 @@ static connectDeviceManager *connectDeviceManagerInstance = nil;
     
 }
 
-- (void)socket:(GCDAsyncSocket *)sock didConnectToHost:(NSString *)host port:(uint16_t)port {
-    
-    NSLog(@"didConnectToHost %d", port);
-    
-    NSThread *thread = [[NSThread alloc] initWithBlock:^{
-        while (true) {
-
-            [self.socket readDataWithTimeout:-1 tag:0];
-            [NSThread sleepForTimeInterval:0.1];
-
-        }
-    }];
-
-    [thread start];
-    
-    /// 7. Socket 连接成功后,通过 socket  发送, self.peerPortTF 为对端服务端口
-    //[sock writeData:[[NSString stringWithFormat:@"CONNECT 127.0.0.1:%@ HTTP/1.0\r\n\r\n", @"9100"] dataUsingEncoding:NSUTF8StringEncoding] withTimeout:-1 tag:0];
-
-    NSLog(@"readDataToData");
-    
-    [cachesFileManager writeLogsWithMsg:@"didConnectToHost writeData"];
-}
-
-- (void)socket:(GCDAsyncSocket *)sock didWriteDataWithTag:(long)tag
-{
-    NSLog(@"socket:%p didWriteDataWithTag:%ld", sock, tag);
-}
-
-- (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag {
-    
-    
-    if (tag == 0) {
-        
-        NSString *str = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
-        
-        /// 8. 收到包含 `HTTP/1.0 200`的字符串,则认为连接成功。可以正常给对端发消息了
-        if ([str containsString:@"HTTP/1.0 200"]) {
-            NSLog(@"Connected");
-            self.peerConnected = YES;
-//            self.connectBtn.enabled = YES;
-//            [self.connectBtn setTitle:@"断开连接" forState:UIControlStateNormal];
-        }
-        
-    }
-    
-    //self.revcLab.text = [NSString stringWithFormat:@"接收:%@", [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]];
-}
+//- (void)socket:(GCDAsyncSocket *)sock didConnectToHost:(NSString *)host port:(uint16_t)port {
+//    
+//    NSLog(@"didConnectToHost %d", port);
+//    
+//    NSThread *thread = [[NSThread alloc] initWithBlock:^{
+//        while (true) {
+//
+//            [self.socket readDataWithTimeout:-1 tag:0];
+//            [NSThread sleepForTimeInterval:0.1];
+//
+//        }
+//    }];
+//
+//    [thread start];
+//    
+//    /// 7. Socket 连接成功后,通过 socket  发送, self.peerPortTF 为对端服务端口
+//    //[sock writeData:[[NSString stringWithFormat:@"CONNECT 127.0.0.1:%@ HTTP/1.0\r\n\r\n", @"9100"] dataUsingEncoding:NSUTF8StringEncoding] withTimeout:-1 tag:0];
+//
+//    NSLog(@"readDataToData");
+//    
+//    [cachesFileManager writeLogsWithMsg:@"didConnectToHost writeData"];
+//}
+//
+//- (void)socket:(GCDAsyncSocket *)sock didWriteDataWithTag:(long)tag
+//{
+//    NSLog(@"socket:%p didWriteDataWithTag:%ld", sock, tag);
+//}
+//
+//- (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag {
+//    
+//    
+//    if (tag == 0) {
+//        
+//        NSString *str = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
+//        
+//        /// 8. 收到包含 `HTTP/1.0 200`的字符串,则认为连接成功。可以正常给对端发消息了
+//        if ([str containsString:@"HTTP/1.0 200"]) {
+//            NSLog(@"Connected");
+//            self.peerConnected = YES;
+////            self.connectBtn.enabled = YES;
+////            [self.connectBtn setTitle:@"断开连接" forState:UIControlStateNormal];
+//        }
+//        
+//    }
+//    
+//    //self.revcLab.text = [NSString stringWithFormat:@"接收:%@", [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]];
+//}
 
 
 

+ 2 - 0
创维盒子/双子星云手机/connectDeviceManager/model/DeviceThirdIdModel.h

@@ -23,6 +23,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 /**sn*/
 @property (nonatomic,copy) NSString *sn; //
+/**changeSn*/
+@property (nonatomic,copy) NSString *changeSn; //
 /***/
 @property (nonatomic,copy) NSString *firstTimeUpdatePassword; //
 /***/

+ 3 - 0
创维盒子/双子星云手机/en.lproj/Localizable.strings

@@ -314,3 +314,6 @@
 //1.2.3 新增
 "upload_did_select_num_tip"   = "selected";
 "upload_path_way_tip"   = "Upload Path";
+
+"my_set_about_version_tap_newVersion"   = "Image version to be updated";
+"scan_sn_data_error_tip"   = "Device info not found. Scan to bind a new one.";

+ 3 - 0
创维盒子/双子星云手机/ja.lproj/Localizable.strings

@@ -312,3 +312,6 @@
 //1.2.3 新增
 "upload_did_select_num_tip"   = "選択済み";
 "upload_path_way_tip"   = "アップロードパス";
+
+"my_set_about_version_tap_newVersion"   = "更新されるミラーバージョン";
+"scan_sn_data_error_tip"   = "デバイス情報未確認。新デバイスをスキャンして繋ぐる。";

+ 3 - 0
创维盒子/双子星云手机/zh-Hans.lproj/Localizable.strings

@@ -311,3 +311,6 @@
 //1.2.3 新增
 "upload_did_select_num_tip"   = "已选";
 "upload_path_way_tip"   = "上传路径";
+
+"my_set_about_version_tap_newVersion"   = "待更新镜像版本";
+"scan_sn_data_error_tip"   = "设备信息不存在,请扫码绑定新设备";

+ 3 - 0
创维盒子/双子星云手机/zh-Hant.lproj/Localizable.strings

@@ -313,3 +313,6 @@
 //1.2.3 新增
 "upload_did_select_num_tip"   = "已選";
 "upload_path_way_tip"   = "上傳路徑";
+
+"my_set_about_version_tap_newVersion"   = "待更新鏡像版本";
+"scan_sn_data_error_tip"   = "設備資訊不存在,請掃碼綁定新設備";