Jelajahi Sumber

- MDNS관련 작업중

KaRam Kim 8 tahun lalu
induk
melakukan
bf1ba9b3cb

+ 1 - 1
OneCable/Classes/AppDelegate.m

@@ -68,7 +68,7 @@
     [Fabric with:@[[Crashlytics class]]];
     
     //set logger 
-    [DDLog addLogger:[DDASLLogger sharedInstance]];
+//    [DDLog addLogger:[DDASLLogger sharedInstance]];
     [DDLog addLogger:[DDTTYLogger sharedInstance]];
     
     [[DDTTYLogger sharedInstance] setColorsEnabled:YES];

+ 4 - 1
OneCable/Classes/Common.h

@@ -99,7 +99,10 @@ static const int ddLogLevel = DDLogLevelDebug;
     #define NSLogRect(x)        DDLogDebug(@"%s, %@", __PRETTY_FUNCTION__, NSStringFromCGRect(x))
     #define NSLogFunc()         DDLogDebug(@"%s", __PRETTY_FUNCTION__)
     #define NSLogFuncObj(x)     DDLogDebug(@"%s, %@", __PRETTY_FUNCTION__, x)
-    #define NSLog(format, ...)  DDLogDebug(format, ## __VA_ARGS__)
+    #define NSLog(format, ...)  DDLogDebug(@"[%s(%d)] %@", __PRETTY_FUNCTION__, __LINE__, [NSString stringWithFormat:(format), ##__VA_ARGS__])
+//    #define NSLog(format, ...)  DDLogDebug(format, ## __VA_ARGS__)
+//    #define NSLog( s, ... ) NSLog( @"[%s(%d)] %@", __PRETTY_FUNCTION__, __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )
+//NSLog( @"[%@ %s(%d)] %@", [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __PRETTY_FUNCTION__, __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )
 
     #define NSLogInfo(format, ...)  DDLogDebug((XCODE_COLORS_ESCAPE @"fg0,0,200;" format XCODE_COLORS_RESET), ##__VA_ARGS__)
 //    #define NSLog(format, ...)  DDLogDebug((XCODE_COLORS_ESCAPE @"fg231,76,60;%s[Line %d] " format XCODE_COLORS_RESET), __PRETTY_FUNCTION__, __LINE__, ## __VA_ARGS__)

+ 21 - 5
OneCable/Classes/Handler/NetworkServiceHandler.m

@@ -24,7 +24,7 @@
 
 
 - (BOOL)startSearchBonjourServices {
-    NSLog(@"%s\n currentReachabilityStatus= %zd", __PRETTY_FUNCTION__, _reachability.currentReachabilityStatus);
+    NSLog(@"currentReachabilityStatus= %zd", _reachability.currentReachabilityStatus);
     
 //    _isNotFirstLoading = NO;
     if (_reachability.currentReachabilityStatus != ReachableViaWiFi) {
@@ -42,14 +42,17 @@
         _netServiceBrowser = [[NSNetServiceBrowser alloc] init];
         _netServiceBrowser.delegate = self;
         
-        browseType = @"_services._dns-sd._udp.";
+//        browseType = @"_services._dns-sd._udp.";
+        browseType = @"_ntelshub._tcp.";
+//        browseType = @"_ntelshub._tcp.local.";
+        NSLog(@"Serch BrowseType : %@", browseType);
         [_netServiceBrowser searchForServicesOfType:browseType inDomain:@""];
     } else {
         [self publishNetService];
 //        NSString *fullDomainName = [NSString stringWithFormat:@"%@.%@", _netService.name, _netService.type];
 //        NSArray *domainNameParts = [fullDomainName componentsSeparatedByString:@"."];
-//        NSLog(@"%s\n %@, %@", __PRETTY_FUNCTION__, [domainNameParts objectAtIndex:0], [domainNameParts objectAtIndex:1]);
-//
+//        NSLog(@"%@, %@", [domainNameParts objectAtIndex:0], [domainNameParts objectAtIndex:1]);
+
 //        browseType = [NSString stringWithFormat:@"%@.%@.", [domainNameParts objectAtIndex:0], [domainNameParts objectAtIndex:1]];
 //        browseType = _netService.type;
     }
@@ -61,7 +64,7 @@
     NSLog(@"%s\n %@", __PRETTY_FUNCTION__, [JDFacade facade].deviceHostName);
     
     if (!_netService) {
-        _netService = [[NSNetService alloc] initWithDomain:@"" type:@"_ntels._tcp" name:[JDFacade facade].deviceHostName port:7979];
+        _netService = [[NSNetService alloc] initWithDomain:@"" type:@"_ntelshub._tcp" name:[JDFacade facade].deviceHostName port:7979];
         _netService.delegate = self;
     }
     
@@ -78,6 +81,19 @@
 
 - (void)netServiceBrowser:(NSNetServiceBrowser *)browser didFindService:(NSNetService *)service moreComing:(BOOL)moreComing {
 
+
+
+    NSMutableDictionary *info = [NSMutableDictionary dictionary];
+    info[@"name"] = service.name;
+    info[@"domain"] = service.domain;
+    info[@"type"] = service.type;
+    info[@"hostName"] = service.hostName;
+    info[@"Data"] = service.type;
+    info[@"Address"] = service.addresses;
+//    info[@"port"] = service.port;
+        NSLog(@"Finish :  %@", info   );
+    NSLog(@"Port :  %i", service.port   );
+    
     if (!_isNotFirstLoading) {    
         [self publishNetService];
         _isNotFirstLoading = YES;

+ 10 - 5
OneCable/Classes/ViewControllers/MainScreens/IntroViewController.m

@@ -55,7 +55,7 @@
         splashImage = [UIImage imageNamed:@"Brand Assets-700-568h"];
     }
     
-//    [_imgvSplash setImage:splashImage];
+    [_imgvSplash setImage:splashImage];
 }
 
 - (void)prepareViewDidLoad {
@@ -66,9 +66,14 @@
 - (void)viewDidAppear:(BOOL)animated {
     [super viewDidAppear: animated];
     
-    if ([NetworkServiceHandler.handler startSearchBonjourServices]) {
+    if ([NetworkServiceHandler.handler startSearchBonjourServices])
+    {
+        NSLog(@"mdns 찾기");
         NetworkServiceHandler.handler.delegate = self;
-    } else {
+    }
+    else
+    {
+        NSLog(@"mdns 찾기2");
         [self requestVersionInfo];
     }
 }
@@ -117,8 +122,8 @@
                 }];
             } else {
                 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-                    UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"LoginViewController" storyboardName:@"Main"];
-                    [JDFacade facade].appDelegate.window.rootViewController = vc;
+//                    UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"LoginViewController" storyboardName:@"Main"];
+//                    [JDFacade facade].appDelegate.window.rootViewController = vc;
                 });
             }
         }

+ 30 - 27
OneCable/Classes/ViewControllers/ThingsScreens/ModifyDeviceNamePopupView.xib

@@ -1,8 +1,12 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_0" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
         <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
@@ -13,26 +17,26 @@
             <subviews>
                 <view alpha="0.29999999999999999" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="4c3-gb-BwR" userLabel="maskView">
                     <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
-                    <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
+                    <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                 </view>
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Wpz-PG-lDk" userLabel="popUpView">
-                    <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+                    <rect key="frame" x="15" y="178" width="290" height="212"/>
                     <subviews>
                         <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BnX-4G-EA9" userLabel="ContainerView">
-                            <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+                            <rect key="frame" x="0.0" y="0.0" width="290" height="212"/>
                             <subviews>
                                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Vyg-lF-Oo6" userLabel="View - Title">
-                                    <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+                                    <rect key="frame" x="0.0" y="0.0" width="290" height="58"/>
                                     <subviews>
                                         <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="이름 변경" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="c0q-8E-eGK" customClass="CustomLabel">
-                                            <rect key="frame" x="0.0" y="-21" width="42" height="21"/>
+                                            <rect key="frame" x="15" y="0.0" width="275" height="58"/>
                                             <constraints>
                                                 <constraint firstAttribute="height" constant="64" id="WT0-mT-u12">
                                                     <variation key="heightClass=regular-widthClass=compact" constant="58"/>
                                                 </constraint>
                                             </constraints>
                                             <fontDescription key="fontDescription" type="system" pointSize="19"/>
-                                            <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                            <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                             <nil key="highlightedColor"/>
                                             <variation key="default">
                                                 <mask key="constraints">
@@ -46,7 +50,7 @@
                                             </variation>
                                         </label>
                                     </subviews>
-                                    <color key="backgroundColor" red="0.16078431369999999" green="0.55294117649999996" blue="0.80392156859999997" alpha="1" colorSpace="calibratedRGB"/>
+                                    <color key="backgroundColor" red="0.16078431369999999" green="0.55294117649999996" blue="0.80392156859999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                     <constraints>
                                         <constraint firstItem="c0q-8E-eGK" firstAttribute="top" secondItem="Vyg-lF-Oo6" secondAttribute="top" id="5Mc-gG-GQW">
                                             <variation key="heightClass=regular-widthClass=compact" constant="0.0"/>
@@ -85,10 +89,10 @@
                                     </variation>
                                 </view>
                                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="K2x-vI-pnz" userLabel="View - message">
-                                    <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+                                    <rect key="frame" x="0.0" y="58" width="290" height="102"/>
                                     <subviews>
                                         <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="center" minimumFontSize="17" background="img_input_round_bg_default" translatesAutoresizingMaskIntoConstraints="NO" id="IfD-X3-70g" userLabel="txt - pwd" customClass="CustomTextField2">
-                                            <rect key="frame" x="40" y="205" width="200" height="32"/>
+                                            <rect key="frame" x="35" y="35" width="220" height="32"/>
                                             <constraints>
                                                 <constraint firstAttribute="height" constant="32" id="SLJ-0l-P6n">
                                                     <variation key="heightClass=regular-widthClass=compact" constant="32"/>
@@ -97,7 +101,7 @@
                                                     <variation key="heightClass=regular-widthClass=compact" constant="220"/>
                                                 </constraint>
                                             </constraints>
-                                            <color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
+                                            <color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                             <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                             <textInputTraits key="textInputTraits"/>
                                             <userDefinedRuntimeAttributes>
@@ -120,7 +124,7 @@
                                             </variation>
                                         </textField>
                                     </subviews>
-                                    <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                    <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                     <constraints>
                                         <constraint firstAttribute="bottom" secondItem="IfD-X3-70g" secondAttribute="bottom" constant="40" id="MG8-8o-IBd">
                                             <variation key="heightClass=regular-widthClass=compact" constant="35"/>
@@ -152,11 +156,11 @@
                                     </variation>
                                 </view>
                                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="8M7-gg-LCe" userLabel="View - Buttons">
-                                    <rect key="frame" x="-20" y="282" width="338" height="90"/>
+                                    <rect key="frame" x="0.0" y="160" width="290" height="52"/>
                                     <subviews>
                                         <button opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="249" placeholderIntrinsicWidth="144" placeholderIntrinsicHeight="51" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="o3L-5c-QN3" customClass="CustomButton">
-                                            <rect key="frame" x="170" y="20" width="148" height="50"/>
-                                            <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                            <rect key="frame" x="146" y="1" width="144" height="51"/>
+                                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                             <constraints>
                                                 <constraint firstAttribute="height" constant="44" id="BB8-U2-fTZ">
                                                     <variation key="heightClass=regular-widthClass=compact" constant="50"/>
@@ -164,11 +168,11 @@
                                             </constraints>
                                             <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                             <state key="normal" title="취소">
-                                                <color key="titleColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
-                                                <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+                                                <color key="titleColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                <color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                             </state>
                                             <state key="highlighted">
-                                                <color key="titleColor" red="0.18039215689999999" green="0.55294117649999996" blue="0.80392156859999997" alpha="1" colorSpace="calibratedRGB"/>
+                                                <color key="titleColor" red="0.18039215689999999" green="0.55294117649999996" blue="0.80392156859999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                             </state>
                                             <variation key="default">
                                                 <mask key="constraints">
@@ -185,8 +189,8 @@
                                             </connections>
                                         </button>
                                         <button opaque="NO" contentMode="scaleToFill" placeholderIntrinsicWidth="145" placeholderIntrinsicHeight="51" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5YZ-ir-0oi" customClass="CustomButton">
-                                            <rect key="frame" x="20" y="20" width="149" height="50"/>
-                                            <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                            <rect key="frame" x="0.0" y="1" width="145" height="51"/>
+                                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                             <constraints>
                                                 <constraint firstAttribute="height" constant="70" id="WCm-EC-Sdq">
                                                     <variation key="heightClass=regular-widthClass=compact" constant="51"/>
@@ -197,11 +201,11 @@
                                             </constraints>
                                             <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                             <state key="normal" title="확인">
-                                                <color key="titleColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
-                                                <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+                                                <color key="titleColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                <color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                             </state>
                                             <state key="highlighted">
-                                                <color key="titleColor" red="0.18039215689999999" green="0.55294117649999996" blue="0.80392156859999997" alpha="1" colorSpace="calibratedRGB"/>
+                                                <color key="titleColor" red="0.18039215689999999" green="0.55294117649999996" blue="0.80392156859999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                             </state>
                                             <variation key="default">
                                                 <mask key="constraints">
@@ -220,7 +224,7 @@
                                             </connections>
                                         </button>
                                     </subviews>
-                                    <color key="backgroundColor" red="0.73333333333333328" green="0.73333333333333328" blue="0.73333333333333328" alpha="1" colorSpace="calibratedRGB"/>
+                                    <color key="backgroundColor" red="0.73333333333333328" green="0.73333333333333328" blue="0.73333333333333328" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                     <constraints>
                                         <constraint firstAttribute="trailing" secondItem="o3L-5c-QN3" secondAttribute="trailing" id="6GK-iY-cBv"/>
                                         <constraint firstItem="o3L-5c-QN3" firstAttribute="leading" secondItem="5YZ-ir-0oi" secondAttribute="trailing" constant="1" id="88p-Pt-1xF"/>
@@ -372,7 +376,6 @@
                 <constraint firstAttribute="bottom" secondItem="4c3-gb-BwR" secondAttribute="bottom" id="uc7-M6-ZYJ"/>
                 <constraint firstItem="4c3-gb-BwR" firstAttribute="leading" secondItem="qLf-va-EAG" secondAttribute="leading" id="wPB-Gl-TgQ"/>
             </constraints>
-            <simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
             <variation key="default">
                 <mask key="subviews">
                     <exclude reference="4c3-gb-BwR"/>