eunmi.kim 8 лет назад
Родитель
Сommit
564f0221ad
18 измененных файлов с 463 добавлено и 191 удалено
  1. 33 5
      OneCable/Base.lproj/HomeHub.storyboard
  2. 15 9
      OneCable/Classes/Handler/BLEServiceHandler.h
  3. 142 79
      OneCable/Classes/Handler/BLEServiceHandler.m
  4. 2 1
      OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubConnectWifiViewController.h
  5. 37 6
      OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubConnectWifiViewController.m
  6. 5 3
      OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubSearchFailViewController.m
  7. 3 3
      OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubSearchSuccessViewController.m
  8. 41 21
      OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubSearchViewController.m
  9. 28 1
      OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubUpdateCompleteViewController.m
  10. 8 3
      OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubViewController.m
  11. 85 11
      OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubWifiPasswdInputViewController.m
  12. 3 0
      OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubWifiSearchFailViewController.m
  13. 15 5
      OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubWifiSearchSuccessViewController.m
  14. 38 42
      OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubWifiSearchViewController.m
  15. 1 0
      OneCable/Classes/ViewControllers/MainScreens/HomeModeMovementViewController.m
  16. 1 1
      OneCable/Classes/ViewControllers/MainScreens/LoginViewController.m
  17. 3 1
      OneCable/Classes/ViewControllers/MainScreens/ManagementViewController.m
  18. 3 0
      OneCable/Classes/ViewControllers/SignUpScreens/SignUpTypeSelectViewController.m

+ 33 - 5
OneCable/Base.lproj/HomeHub.storyboard

@@ -1907,7 +1907,7 @@
                                                 <rect key="frame" x="0.0" y="0.0" width="320" height="50"/>
                                                 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
                                                 <fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
-                                                <state key="normal" title="뒤로" backgroundImage="common_button_bg">
+                                                <state key="normal" title="취소" backgroundImage="common_button_bg">
                                                     <color key="titleColor" red="0.53333333329999999" green="0.56078431370000004" blue="0.6588235294" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                                 </state>
                                                 <state key="highlighted" backgroundImage="common_button_bg_press"/>
@@ -2228,7 +2228,7 @@
                                         <rect key="frame" x="0.0" y="518" width="320" height="50"/>
                                         <subviews>
                                             <button opaque="NO" contentMode="scaleToFill" placeholderIntrinsicWidth="160" placeholderIntrinsicHeight="70" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Ucm-Wu-dQm" customClass="CustomButton">
-                                                <rect key="frame" x="0.0" y="0.0" width="320" height="50"/>
+                                                <rect key="frame" x="0.0" y="0.0" width="160" height="50"/>
                                                 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
                                                 <fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
                                                 <state key="normal" title="취소" backgroundImage="common_button_left_bg">
@@ -2240,16 +2240,40 @@
                                                         <color key="value" red="0.53333333329999999" green="0.56078431370000004" blue="0.6588235294" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                                     </userDefinedRuntimeAttribute>
                                                 </userDefinedRuntimeAttributes>
+                                                <connections>
+                                                    <action selector="btnCloseTouched:" destination="WjN-iT-zYP" eventType="touchUpInside" id="EPw-Ih-csk"/>
+                                                </connections>
+                                            </button>
+                                            <button opaque="NO" contentMode="scaleToFill" placeholderIntrinsicWidth="160" placeholderIntrinsicHeight="70" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="UcE-DJ-Zfn" customClass="CustomButton">
+                                                <rect key="frame" x="160" y="0.0" width="160" height="50"/>
+                                                <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+                                                <fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
+                                                <state key="normal" title="설정" backgroundImage="common_button_left_bg">
+                                                    <color key="titleColor" red="0.01176470588" green="0.60392156860000001" blue="0.87450980389999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                </state>
+                                                <state key="highlighted" backgroundImage="common_button_bg_press"/>
+                                                <userDefinedRuntimeAttributes>
+                                                    <userDefinedRuntimeAttribute type="color" keyPath="placeHolderColor">
+                                                        <color key="value" red="0.01176470588" green="0.60392156860000001" blue="0.87450980389999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                                    </userDefinedRuntimeAttribute>
+                                                </userDefinedRuntimeAttributes>
+                                                <connections>
+                                                    <action selector="btnNextTouched:" destination="WjN-iT-zYP" eventType="touchUpInside" id="ZHa-UP-9Y2"/>
+                                                </connections>
                                             </button>
                                         </subviews>
                                         <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
                                         <constraints>
+                                            <constraint firstAttribute="trailing" secondItem="UcE-DJ-Zfn" secondAttribute="trailing" id="Dvg-iA-tyt"/>
+                                            <constraint firstItem="UcE-DJ-Zfn" firstAttribute="top" secondItem="huX-q3-iOJ" secondAttribute="top" id="OVt-XK-SH8"/>
                                             <constraint firstItem="Ucm-Wu-dQm" firstAttribute="top" secondItem="huX-q3-iOJ" secondAttribute="top" id="Qfo-je-fe3"/>
                                             <constraint firstAttribute="height" constant="70" id="Rn3-z6-HCP">
                                                 <variation key="heightClass=regular-widthClass=compact" constant="50"/>
                                             </constraint>
+                                            <constraint firstItem="UcE-DJ-Zfn" firstAttribute="leading" secondItem="Ucm-Wu-dQm" secondAttribute="trailing" id="ZPz-LO-TlW"/>
+                                            <constraint firstItem="UcE-DJ-Zfn" firstAttribute="width" secondItem="Ucm-Wu-dQm" secondAttribute="width" id="aX8-xI-1lI"/>
                                             <constraint firstAttribute="bottom" secondItem="Ucm-Wu-dQm" secondAttribute="bottom" id="jh1-Bh-l8z"/>
-                                            <constraint firstAttribute="trailing" secondItem="Ucm-Wu-dQm" secondAttribute="trailing" id="pg7-Y1-5Yp"/>
+                                            <constraint firstAttribute="bottom" secondItem="UcE-DJ-Zfn" secondAttribute="bottom" id="riW-v6-Pfx"/>
                                             <constraint firstItem="Ucm-Wu-dQm" firstAttribute="leading" secondItem="huX-q3-iOJ" secondAttribute="leading" id="uxV-oi-al6"/>
                                         </constraints>
                                         <variation key="default">
@@ -2315,6 +2339,7 @@
                     <connections>
                         <outlet property="btnAgainSearch" destination="yjV-e8-pJt" id="5Zo-94-tca"/>
                         <outlet property="btnCancel" destination="Ucm-Wu-dQm" id="Zmj-VT-vG6"/>
+                        <outlet property="lbTitle" destination="6Ui-Fm-Pzt" id="v00-Gs-vgc"/>
                         <outlet property="lblSSID" destination="d6D-RG-Old" id="g6q-79-Lwi"/>
                     </connections>
                 </viewController>
@@ -2491,6 +2516,9 @@
                                                         <color key="value" red="0.53333333329999999" green="0.56078431370000004" blue="0.6588235294" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                                     </userDefinedRuntimeAttribute>
                                                 </userDefinedRuntimeAttributes>
+                                                <connections>
+                                                    <action selector="btnCloseTouched:" destination="89c-Vi-4De" eventType="touchUpInside" id="3oc-YA-9l1"/>
+                                                </connections>
                                             </button>
                                         </subviews>
                                         <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
@@ -2601,7 +2629,7 @@
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="C9h-an-U2I" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="3578" y="40"/>
+            <point key="canvasLocation" x="3568" y="39"/>
         </scene>
         <!--Home Hub Wifi Search Success View Controller-->
         <scene sceneID="KNn-yP-4ss">
@@ -3591,7 +3619,7 @@
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="6UJ-SN-Rw7" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="4939" y="38"/>
+            <point key="canvasLocation" x="4938.75" y="36.971830985915496"/>
         </scene>
         <!--Home Hub Update Complete View Controller-->
         <scene sceneID="nHg-dv-4D2">

+ 15 - 9
OneCable/Classes/Handler/BLEServiceHandler.h

@@ -26,6 +26,7 @@ static NSString *kBLEChrStSetApply = @"APPLY_CHR_UUID";
 static NSString *kBLEChrRdConInfo = @"CONNECTION_CHR_UUID";
 static NSString *kBLEChrRdSSID = @"SSID_CHR_UUID";
 static NSString *kBLEChrRdBSSID = @"BSSID_CHR_UUID";
+static NSString *kBLEChrRnIpSet = @"WF_IP_SET_CHR_UUID";
 static NSString *kBLEChrRnIpAddr = @"WF_IP_ADDR_CHR_UUID";
 
 
@@ -39,9 +40,11 @@ static NSString *kBLEChrRnIpAddr = @"WF_IP_ADDR_CHR_UUID";
 - (void) BLEConnected:(BTLEDeivceModel *)info;
 - (void) BLEDisConnected:(BTLEDeivceModel *)info;
 - (void) BLEUpldateDevice:(BTLEDeivceModel *)info;
-- (void) BLEWiFiSSIDRead:(NSString*)ssid;
-- (void) BLEWiFiDHCPRead:(id)data;
-- (void) BLEWiFiConnectionInfoUpdate:(CBCharacteristic *)info;
+- (void) BLEWLanUpdateWithKey:(NSString*)kBLEChr result:(NSString*)result;
+- (void) BLEWiFiSSIDUpdate:(NSString*)ssid;
+- (void) BLEWiFiDHCPUpdate:(id)data;
+- (void) BLEWiFiConnectionUpdate:(CBCharacteristic *)info;
+- (void) BLEWiFiConnectionInfoUpdateWithKey:(NSString*)kBLEChr result:(NSString*)result;
 
 @end
 
@@ -55,14 +58,14 @@ static NSString *kBLEChrRnIpAddr = @"WF_IP_ADDR_CHR_UUID";
 
 
 - (void)connect:(BTLEDeivceModel *)info;
-
 - (void)disConnect;
-
+- (BOOL) checkBLEStatus;
 - (void) startScan;
 - (void) stopScan;
 
 - (NSMutableArray *)getDeviceList;
-
+- (NSString*)getStringValueForCharacteristicWithKey:(NSString*)key;
+    
 -(CBCharacteristic *)getChrInfo:(NSString *)name;
 -(NSString *)getChrName:(CBCharacteristic *)info;
 -(NSString *)getStrUUID:(CBCharacteristic *)info;
@@ -74,9 +77,6 @@ static NSString *kBLEChrRnIpAddr = @"WF_IP_ADDR_CHR_UUID";
 
 
 //WiFi Setting관련 메뉴
-
--(void)readAndNotifyCharacteristicUUID:(NSString *)uuid
-                              isNotify:(BOOL)isNotify;
 // WiFi Ap 스캔
 -(void)scanWiFiList;
 // WiFi 스캔결과 조회
@@ -90,5 +90,11 @@ static NSString *kBLEChrRnIpAddr = @"WF_IP_ADDR_CHR_UUID";
 
 // 설정한 정보를 이용해서 AP에 접속 / IP받아오기
 -(void)applyWiFiSettingInfo;
+//
+-(void)readAndNotifyCharacteristicUUID:(NSString *)uuid
+                              isNotify:(BOOL)isNotify;
+
+// connection 후에 정보 확인 ssid bssid ipset ipaddr
+- (void)readConnectionWiFiInfo;
 
 @end

+ 142 - 79
OneCable/Classes/Handler/BLEServiceHandler.m

@@ -59,11 +59,12 @@
 
 - (void)connect:(BTLEDeivceModel *)info
 {
-    if (info.peripheralRef.state != CBPeripheralStateDisconnected) {
-        [_manager cancelPeripheralConnection:info.peripheralRef];
-    } else {
-        [_manager connectPeripheral:info.peripheralRef options:nil];
-    }
+    [_manager connectPeripheral:info.peripheralRef options:nil];
+//    if (info.peripheralRef.state != CBPeripheralStateDisconnected) {
+//        [_manager cancelPeripheralConnection:info.peripheralRef];
+//    } else {
+//        [_manager connectPeripheral:info.peripheralRef options:nil];
+//    }
 }
 
 - (void)disConnect
@@ -76,9 +77,8 @@
     [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=Bluetooth"]];
 }
 
-
-- (void) startScan
-{
+- (BOOL) checkBLEStatus {
+    
     if (_manager.state == CBCentralManagerStatePoweredOff) {
         
         [[JDFacade facade] confirmTitle:@"Notice"
@@ -86,15 +86,25 @@
                              btnOKLabel:@"OK"
                          btnCancelLabel:@"Cancel"
                              completion:^(CustomAlertView *alertView, NSInteger buttonIndex) {
+                                 
                                  if (buttonIndex == 1) {
                                      
                                      [self openBluetoothSettings];
                                  }
-        }];
+                             }];
         
-        return;
+        return NO;
     }
     
+    return YES;
+}
+
+
+- (void) startScan
+{
+    if (![self checkBLEStatus])
+        return;
+
     _devices = [NSMutableArray array];
     
     if (_scanTimer) [_scanTimer invalidate];
@@ -105,7 +115,7 @@
     
     [_manager scanForPeripheralsWithServices:nil options:nil];
     
-    _scanTimer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(stopScan:) userInfo:@"Y" repeats:NO];
+    _scanTimer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(stopScan:) userInfo:@"Y" repeats:NO];
 }
 
 
@@ -191,7 +201,7 @@
 
 - (NSString*)hexStringValue:(CBCharacteristic *)input {
     if (!input.value) return @"-";
-    //    NSLog(@"hexString : %@", self.value);
+
     NSString *raw = [NSString stringWithFormat:@"0x%@", input.value];
     raw = [raw stringByReplacingOccurrencesOfString:@"<" withString:@""];
     raw = [raw stringByReplacingOccurrencesOfString:@">" withString:@""];
@@ -228,12 +238,7 @@
 //WiFi Setting관련 메뉴
 -(void)scanWiFiList
 {
-    NSLog(@"scanWiFiList : %@", [self getChrInfo:kBLEChrStWiFiScan]) ;
-
     [self sendData:[self getChrInfo:kBLEChrStWiFiScan] str:@"1"];
-    
-    // todo : Timer 돌면서 List 1~3까지 채워지는지 체크할것
-    
 }
 
 -(NSString *)getWLanList:(BLEWlanListType)type
@@ -242,26 +247,47 @@
     NSString *result = @"";
     switch (type) {
         case BLEWlanListType1:
-            result = [self asciiStringValue:[self getChrInfo:kBLEChrRdWiFiList1]];
+            [self readAndNotifyCharacteristicUUID:kBLEChrRdWiFiList1 isNotify:NO];
+            //result = [self asciiStringValue:[self getChrInfo:kBLEChrRdWiFiList1]];
             break;
         case BLEWlanListType2:
-            result = [self asciiStringValue:[self getChrInfo:kBLEChrRdWiFiList2]];
+            [self readAndNotifyCharacteristicUUID:kBLEChrRdWiFiList2 isNotify:NO];
+            //result = [self asciiStringValue:[self getChrInfo:kBLEChrRdWiFiList2]];
             break;
         case BLEWlanListType3:
-            result = [self asciiStringValue:[self getChrInfo:kBLEChrRdWiFiList3]];
+            [self readAndNotifyCharacteristicUUID:kBLEChrRdWiFiList3 isNotify:NO];
+            //result = [self asciiStringValue:[self getChrInfo:kBLEChrRdWiFiList3]];
             break;
             
         default:
             break;
     }
+    
     return result;
 }
 
+
 -(void)setWiFiSSID:(NSString *)ssid
 {
     [self sendData:[self getChrInfo:kBLEChrStSSIDArg] str:ssid];
 }
 
+-(void)setWiFiPwd:(NSString *)pwd
+{
+    [self sendData:[self getChrInfo:kBLEChrStPWDArg] str:pwd];
+}
+
+-(void)enableDHCP
+{
+    [self sendData:[self getChrInfo:kBLEChrStDHCPArg] str:@"1"];
+}
+
+-(void)applyWiFiSettingInfo
+{
+    [self sendData:[self getChrInfo:kBLEChrStSetApply] str:@"1"];
+    // todo : Connection정보가 notify로 들어오면, delegate를 통해서 알리기
+}
+
 -(void)readAndNotifyCharacteristicUUID:(NSString *)uuid
                               isNotify:(BOOL)isNotify
 {
@@ -272,13 +298,10 @@
             
             if ([characteristic.UUID.UUIDString isEquestToIgnoreCase:[self getGatewayDicUUIDForKey:uuid]]) {
                 
-                if (isNotify) {
-                    
+                if (isNotify)
                     [_conDevice.peripheralRef setNotifyValue:YES forCharacteristic:characteristic];
-                }
-                else {
+                else
                     [_conDevice.peripheralRef readValueForCharacteristic:characteristic];
-                }
                 
                 break;
             }
@@ -286,23 +309,19 @@
     }
 }
 
--(void)setWiFiPwd:(NSString *)pwd
-{
-    [self sendData:[self getChrInfo:kBLEChrStPWDArg] str:pwd];
-}
-
--(void)enableDHCP
-{
-    [self sendData:[self getChrInfo:kBLEChrStDHCPArg] str:@"1"];
+- (void)readConnectionWiFiInfo {
+    
+    [self readAndNotifyCharacteristicUUID:kBLEChrRdSSID isNotify:NO];
+    [self readAndNotifyCharacteristicUUID:kBLEChrRdBSSID isNotify:NO];
+    [self readAndNotifyCharacteristicUUID:kBLEChrRnIpSet isNotify:NO];
+    [self readAndNotifyCharacteristicUUID:kBLEChrRnIpAddr isNotify:NO];
 }
 
--(void)applyWiFiSettingInfo
-{
-    [self sendData:[self getChrInfo:kBLEChrStSetApply] str:@"1"];
-    // todo : Connection정보가 notify로 들어오면, delegate를 통해서 알리기
+- (NSString*)getStringValueForCharacteristicWithKey:(NSString*)key {
+    
+   return [self asciiStringValue:[self getChrInfo:key]];
 }
 
-
 -(NSString *)getServiceName:(NSString *)uuid
 {
     NSString *result = nil;
@@ -420,7 +439,7 @@
 
 - (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI {
     
-    NSLog(@"2Periphiral discovered: %@, %@, signal strength: %d", peripheral.name, peripheral.identifier, RSSI.intValue);
+    //NSLog(@"2Periphiral discovered: %@, %@, signal strength: %d", peripheral.name, peripheral.identifier, RSSI.intValue);
     
     for (BTLEDeivceModel *device in _devices) {
         
@@ -438,7 +457,6 @@
                 
                 [_devices addObject:device];
             }
-            
         }
     }
 }
@@ -447,6 +465,7 @@
     
     NSLog(@"Periphiral connected name : %@", peripheral.name);
 
+    _isConnected = YES;
     [peripheral discoverServices:nil] ;
     
 }
@@ -454,10 +473,12 @@
 - (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error {
     
     NSLog(@"Periphiral disconnected: %@", peripheral.name);
+    
     if( _delegate && [_delegate respondsToSelector:@selector(BLEDisConnected:)] ) {
         [_delegate BLEDisConnected:_conDevice] ;
     }
     
+    _isConnected = NO;
     _conDevice = nil;
 }
 
@@ -470,15 +491,12 @@
 - (void)peripheral:(CBPeripheral *)peripheral didDiscoverServices:(NSError *)error {
     
     NSLog(@"\nServices dicovered for peripheral %@:", peripheral.name);
-    //NSLog(@"Services dicovered for peripheral : %@", peripheral.services);
-    //NSLog(@"error dicovered for peripheral %@:", error);
-    
+
     
     lastService = [peripheral.services lastObject];
 
     for (CBService *service in peripheral.services) {
-        //NSLog(@"%@", service.UUID);
-        
+
         [peripheral discoverCharacteristics:nil forService:service];
     }
 }
@@ -486,7 +504,6 @@
 - (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error {
     
     NSLog(@"\ncharacteristics dicovered for service : %@", service.UUID);
-    //NSLog(@"characteristics dicovered for service : %@", peripheral.services);
 
     if ([lastService.UUID isEqual:service.UUID]) {
         
@@ -501,7 +518,7 @@
     for (CBCharacteristic *characteristic in service.characteristics) {
         //NSLog(@"characteristic : %@", characteristic.UUID);
 
-        [self readValueSetNotifyValueForCharacteristic:characteristic peripheral:peripheral];
+//        [self readValueSetNotifyValueForCharacteristic:characteristic peripheral:peripheral];
 //        [peripheral setNotifyValue:YES forCharacteristic:characteristic];
 //        [peripheral readValueForCharacteristic:characteristic];
     }
@@ -511,31 +528,13 @@
 
 - (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error {
     
-    NSLog(@"Incoming: [%@] %@ %@", [self getChrName:characteristic],[self asciiStringValue:characteristic], [self hexStringValue:characteristic]);
+    NSLog(@"Incoming: [%@], %@, %@, %@",
+          [self getChrName:characteristic],
+          characteristic.value,
+          [self asciiStringValue:characteristic],
+          [self hexStringValue:characteristic]);
     
-    if ([[self getStrUUID:characteristic] isEquestToIgnoreCase:
-         [self getServiceUUID:kBLEChrRdConInfo]]) {
-        
-        if( _delegate && [_delegate respondsToSelector:@selector(BLEWiFiConnectionInfoUpdate:)] ) {
-            [_delegate BLEWiFiConnectionInfoUpdate:characteristic];
-        }
-    }
-    //ssid 읽음
-    else if ([[self getStrUUID:characteristic] isEquestToIgnoreCase:
-              [self getServiceUUID:kBLEChrStSSIDArg]]) {
-        
-        if( _delegate && [_delegate respondsToSelector:@selector(BLEWiFiSSIDRead:)] ) {
-            [_delegate BLEWiFiSSIDRead:[self asciiStringValue:characteristic]];
-        }
-    }
-    //dhcp 읽음
-    else if ([[self getStrUUID:characteristic] isEquestToIgnoreCase:
-              [self getServiceUUID:kBLEChrStDHCPArg]]) {
-
-        if( _delegate && [_delegate respondsToSelector:@selector(BLEWiFiDHCPRead:)] ) {
-            [_delegate BLEWiFiDHCPRead:nil];
-        }
-    }
+    [self updateValueForDelegateWithCharacteristic:characteristic];
 }
 
 -(void)peripheral:(CBPeripheral *)peripheral didModifyServices:(NSArray<CBService *> *)invalidatedServices
@@ -549,25 +548,89 @@
 
 - (void)peripheral:(CBPeripheral *)peripheral didWriteValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error {
     
+    //_conDevice.peripheralRef = peripheral;
+    
     NSLog(@"didWriteValueForCharacteristic : %@", characteristic.value) ;
 
 }
 
 
-//characteristic 에 맞춰서 read or notify
-- (void)readValueSetNotifyValueForCharacteristic:(CBCharacteristic*)characteristic
-                                      peripheral:(CBPeripheral *)peripheral {
+//update characteristic 데이터 처리
+- (void)updateValueForDelegateWithCharacteristic:(CBCharacteristic*)characteristic {
+
+    //wlan list
+    if ([self isReadWlanForCharacteristic:characteristic]) {
+        
+        if( _delegate && [_delegate respondsToSelector:@selector(BLEWLanUpdateWithKey:result:)] ) {
+            [_delegate BLEWLanUpdateWithKey:[self getChrName:characteristic]
+                            result:[self asciiStringValue:characteristic]];
+        }
+    }
+    //ssid argument 읽음
+    else if ([[self getStrUUID:characteristic] isEquestToIgnoreCase:
+              [self getServiceUUID:kBLEChrStSSIDArg]]) {
+        
+        if( _delegate && [_delegate respondsToSelector:@selector(BLEWiFiSSIDUpdate:)] ) {
+            [_delegate BLEWiFiSSIDUpdate:[self asciiStringValue:characteristic]];
+        }
+    }
+    //dhcp 읽음
+    else if ([[self getStrUUID:characteristic] isEquestToIgnoreCase:
+              [self getServiceUUID:kBLEChrStDHCPArg]]) {
+        
+        if( _delegate && [_delegate respondsToSelector:@selector(BLEWiFiDHCPUpdate:)] ) {
+            [_delegate BLEWiFiDHCPUpdate:nil];
+        }
+    }
+    //wifi connection
+    else if ([[self getStrUUID:characteristic] isEquestToIgnoreCase:
+              [self getServiceUUID:kBLEChrRdConInfo]]) {
+        
+        if( _delegate && [_delegate respondsToSelector:@selector(BLEWiFiConnectionUpdate:)] ) {
+            [_delegate BLEWiFiConnectionUpdate:characteristic];
+        }
+    }
+    //ssid
+    else if ([self isReadConInfoForCharacteristic:characteristic]) {
+        
+        if( _delegate && [_delegate respondsToSelector:@selector(BLEWiFiConnectionInfoUpdateWithKey:result:)] ) {
+            [_delegate BLEWiFiConnectionInfoUpdateWithKey:[self getChrName:characteristic]
+                                                   result:[self asciiStringValue:characteristic]];
+        }
+    }
+    
+}
+
+
+
+//wlan list read 인지 판단
+- (BOOL)isReadWlanForCharacteristic:(CBCharacteristic*)characteristic {
     
     NSString *uuid = characteristic.UUID.UUIDString;
     
     BOOL rdWiFi = [uuid isEquestToIgnoreCase:[self getGatewayDicUUIDForKey:kBLEChrRdWiFiList1]] ||
     [uuid isEquestToIgnoreCase:[self getGatewayDicUUIDForKey:kBLEChrRdWiFiList2]] ||
     [uuid isEquestToIgnoreCase:[self getGatewayDicUUIDForKey:kBLEChrRdWiFiList3]];
-
-    if (rdWiFi) {
-        
-        [peripheral readValueForCharacteristic:characteristic];
-    }
+    
+    return rdWiFi;
 }
 
+//wlan list read 인지 판단
+- (BOOL)isReadConInfoForCharacteristic:(CBCharacteristic*)characteristic {
+    
+    NSString *uuid = characteristic.UUID.UUIDString;
+
+    //    static NSString *kBLEChrRdSSID = @"SSID_CHR_UUID";
+    //    static NSString *kBLEChrRdBSSID = @"BSSID_CHR_UUID";
+    //    static NSString *kBLEChrRnIpSet = @"WF_IP_SET_CHR_UUID";
+    //    static NSString *kBLEChrRnIpAddr = @"WF_IP_ADDR_CHR_UUID";
+    
+    
+    BOOL conInfo = [uuid isEquestToIgnoreCase:[self getGatewayDicUUIDForKey:kBLEChrRdSSID]] ||
+    [uuid isEquestToIgnoreCase:[self getGatewayDicUUIDForKey:kBLEChrRdBSSID]] ||
+    [uuid isEquestToIgnoreCase:[self getGatewayDicUUIDForKey:kBLEChrRnIpSet]] ||
+    [uuid isEquestToIgnoreCase:[self getGatewayDicUUIDForKey:kBLEChrRnIpAddr]] ;
+    
+    return conInfo;
+}
 @end

+ 2 - 1
OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubConnectWifiViewController.h

@@ -8,8 +8,9 @@
 
 #import "JDViewController.h"
 
-@interface HomeHubConnectWifiViewController : JDViewController
+@interface HomeHubConnectWifiViewController : JDViewController <BLEServiceHandlerDelegate>
 
+@property (weak, nonatomic) IBOutlet UILabel *lbTitle;
 @property (weak, nonatomic) IBOutlet CustomLabel *lblSSID;  // SSID 명
 @property (weak, nonatomic) IBOutlet CustomButton *btnAgainSearch; // 홈허브 재검색
 @property (weak, nonatomic) IBOutlet CustomButton *btnCancel;  // 취소 버튼

+ 37 - 6
OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubConnectWifiViewController.m

@@ -17,26 +17,57 @@
 
 - (void)viewDidLoad {
     [super viewDidLoad];
-
+    
+    [self initUI];
+    [self prepareViewDidLoad];
 }
 
 
-
-
 - (void)didReceiveMemoryWarning {
     [super didReceiveMemoryWarning];
+    
+}
 
+- (void)initUI {
+    
+    _lbTitle.text = @"선택하신 홈허브에\n등록된 Wi-Fi정보가 없습니다.";
+    _lblSSID.hidden = YES;
+}
+
+- (void)prepareViewDidLoad {
+    
+    
 }
 
 
-- (IBAction)btnAgainSearchTouched:(id)sender {
+#pragma mark - ble delegate
+- (void)BLEWiFiSSIDUpdate:(NSString *)ssid {
+    
+    _lbTitle.text = @"선택하신 홈허브에\n현재 연결된 Wi-Fi입니다.";
+    _lblSSID.text = [NSString stringWithFormat:@"SSID : %@", ssid];
+    _lblSSID.hidden = NO;
+    
+}
+
+
+#pragma mark - User Event
+- (IBAction)btnNextTouched:(id)sender {
     
     HomeHubWifiSearchViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"HomeHubWifiSearchViewController" storyboardName:@"HomeHub"];
-    [self presentViewController:vc animated:YES completion:nil];
+    
+    [self.navigationController pushViewController:vc animated:YES];
+    
+}
+
+- (IBAction)btnAgainSearchTouched:(id)sender {
+    
+    UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"HomeHubSearchViewController" storyboardName:@"HomeHub"];
+    
+    [self.navigationController pushViewController:vc animated:YES];
 }
 
 - (IBAction)btnCloseTouched:(id)sender {
-    [self dismissViewControllerAnimated:YES completion:nil];
+    [self.navigationController popToRootViewControllerAnimated:YES];
 }
 
 @end

+ 5 - 3
OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubSearchFailViewController.m

@@ -7,7 +7,7 @@
 //
 
 #import "HomeHubSearchFailViewController.h"
-
+#import "HomeHubSearchViewController.h"
 @interface HomeHubSearchFailViewController ()
 
 @end
@@ -20,16 +20,18 @@
 }
 
 - (IBAction)btnAgainSearchTouched:(id)sender {
-    
+
+    [self.navigationController popViewControllerAnimated:YES];
 }
 
 - (IBAction)btnBackTouched:(id)sender {
     
+    [self.navigationController popToRootViewControllerAnimated:YES];
 }
 
 - (void)didReceiveMemoryWarning {
     [super didReceiveMemoryWarning];
-
+    
 }
 
 @end

+ 3 - 3
OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubSearchSuccessViewController.m

@@ -119,14 +119,14 @@
         [bleService setConDevice:selectedModel];
         
         HomeHubConnectWifiViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"HomeHubConnectWifiViewController" storyboardName:@"HomeHub"];
-        //vc.selectedBTLEDeviceModel = selectedModel;
-        [self presentViewController:vc animated:YES completion:nil];
+
+        [self.navigationController pushViewController:vc animated:YES];
     }
 
 }
 
 - (IBAction)btnCloseTouched:(id)sender {
-    [self dismissViewControllerAnimated:YES completion:nil];
+    [self.navigationController popToRootViewControllerAnimated:YES];
 }
 
 @end

+ 41 - 21
OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubSearchViewController.m

@@ -9,10 +9,11 @@
 #import "HomeHubSearchViewController.h"
 
 @interface HomeHubSearchViewController () {
-
+    
     NSTimer *_timer;
     NSInteger _elapsedSeconds;
-
+    
+    BLEServiceHandler *bleService;
 }
 
 @end
@@ -21,31 +22,36 @@
 
 - (void)viewDidLoad {
     [super viewDidLoad];
-
-    [self initUI];
-    [self prepareViewDidLoad];
     
+    [self prepareViewDidLoad];
 }
 
 
 - (void)didReceiveMemoryWarning {
     [super didReceiveMemoryWarning];
+    
+}
 
+- (void)viewWillAppear:(BOOL)animated {
+    [super viewWillAppear:animated];
+    
+    [self initUI];
 }
 
 
 - (void)initUI {
-   
+    
     [self startLoading:YES];
+    [bleService startScan];
 }
 
 - (void)prepareViewDidLoad {
     
+    
     //ble
-    BLEServiceHandler *bleService = [BLEServiceHandler sharedManager];
+    bleService = [BLEServiceHandler sharedManager];
     bleService.delegate = self;
     
-    [bleService startScan];
 }
 
 
@@ -93,36 +99,50 @@
 
 - (void)updateInclusionStatus {
     
-        dispatch_async(dispatch_get_main_queue(), ^(void) {
-    
-            _elapsedSeconds--;
-            _lblTimer.text = [NSString stringWithFormat:@"%zd", _elapsedSeconds];
-            
-//            if (_elapsedSeconds == 0) {
-//                [self finishDeviceDel:NO];
-//            }
-        });
+    dispatch_async(dispatch_get_main_queue(), ^(void) {
+        
+        _elapsedSeconds--;
+        _lblTimer.text = [NSString stringWithFormat:@"%zd", _elapsedSeconds];
+        
+        //            if (_elapsedSeconds == 0) {
+        //                [self finishDeviceDel:NO];
+        //            }
+    });
 }
 
 
 #pragma mark - ble service delegate
 - (void)BLEEndScan:(NSMutableArray *)devices {
     
+    [self startLoading:NO];
+    
+    
     UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"HomeHubSearchSuccessViewController" storyboardName:@"HomeHub"];
-
+    
     if (devices.count == 0) {
         
         vc = [CommonUtil instantiateViewControllerWithIdentifier:@"HomeHubSearchFailViaewController" storyboardName:@"HomeHub"];
+        
+        [self.navigationController pushViewController:vc animated:YES];
+    }
+    else if(devices.count > 1) {
+        
+        [[JDFacade facade] alertTitle:@"Notice"
+                              message:@"홈허브 여러대 검색"
+                     completionHander:^{
+                         
+                         [self.navigationController popViewControllerAnimated:YES];
+                     }];
+        return;
     }
     
-    
-    [self presentViewController:vc animated:YES completion:nil];
+    [self.navigationController pushViewController:vc animated:YES];
 }
 
 
 #pragma mark - User Event
 - (IBAction)btnCloseTouched:(id)sender {
-    [self dismissViewControllerAnimated:YES completion:nil];
+    [self.navigationController popToRootViewControllerAnimated:YES];
 }
 
 @end

+ 28 - 1
OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubUpdateCompleteViewController.m

@@ -17,9 +17,18 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
 
+    [self initUI];
+    [self prepareViewDidLoad];
 }
 
-- (IBAction)btnConfirmTouched:(id)sender {
+- (void)initUI {
+    
+
+}
+
+- (void)prepareViewDidLoad {
+    
+    
 }
 
 - (void)didReceiveMemoryWarning {
@@ -27,4 +36,22 @@
 
 }
 
+- (IBAction)btnConfirmTouched:(id)sender {
+
+    UIViewController *vc = vc = [CommonUtil instantiateViewControllerWithIdentifier:@"HomeHubViewController" storyboardName:@"Main"];
+    
+    //멀티 홈허브일때
+    if ([[JDFacade facade].loginUser isMultiHomeHub]) {
+        
+        vc = [CommonUtil instantiateViewControllerWithIdentifier:@"MultiHomeHubViewController" storyboardName:@"Main"];
+    }
+    
+
+    [self.navigationController popToRootViewControllerAnimated:YES];
+    
+    //    UINavigationController *m_navi =[[UINavigationController alloc]initWithRootViewController:vc];
+    //    [self presentViewController:m_navi animated:YES completion:nil];
+    
+}
+
 @end

+ 8 - 3
OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubViewController.m

@@ -61,6 +61,12 @@
 
 - (void)initUI {
 
+    UIView *statusBar = [[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"] valueForKey:@"statusBar"];
+    statusBar.backgroundColor = [UIColor whiteColor];
+    
+    [self.navigationController.navigationBar setHidden:YES];
+    self.navigationController.interactivePopGestureRecognizer.enabled = NO;
+    
     [self initTableViewAsDefaultStyle:_tableView];
 }
 
@@ -193,12 +199,11 @@
     if (bleState) {
         
         UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"HomeHubSearchViewController" storyboardName:@"HomeHub"];
-        [self presentViewController:vc animated:YES completion:nil];
-        
+         [self.navigationController pushViewController:vc animated:YES];
     }
     else {
         
-        [[BLEServiceHandler sharedManager] startScan] ;
+       [[BLEServiceHandler sharedManager] checkBLEStatus] ;
     }
 }
 

+ 85 - 11
OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubWifiPasswdInputViewController.m

@@ -7,10 +7,17 @@
 //
 
 #import "HomeHubWifiPasswdInputViewController.h"
+#import "HomeHubConnectWifiViewController.h"
 
 @interface HomeHubWifiPasswdInputViewController () {
     
     BLEServiceHandler *bleService;
+
+    BOOL updateSSID;
+    BOOL updateBSSID;
+    BOOL updateIPSet;
+    BOOL updateIPAddr;
+    
     
 }
 
@@ -20,7 +27,7 @@
 
 - (void)viewDidLoad {
     [super viewDidLoad];
-
+    
     [self initUI];
     [self prepareViewDidLoad];
     
@@ -38,20 +45,35 @@
     bleService = [BLEServiceHandler sharedManager];
     bleService.delegate = self;
     
-   
+    updateSSID = updateBSSID = updateIPSet = updateIPAddr = NO;
+    
 }
 
 - (void)didReceiveMemoryWarning {
     [super didReceiveMemoryWarning];
-
+    
 }
 
 #pragma mark - User Event
 - (IBAction)btnAgainTouched:(id)sender {
     
-    UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"HomeHubConnectWifiViewController" storyboardName:@"HomeHub"];
-
-    [self presentViewController:vc animated:YES completion:nil];
+    BOOL find = NO;
+    
+    for (UIViewController *vc in self.navigationController.viewControllers) {
+        
+        if ([vc isKindOfClass:HomeHubConnectWifiViewController.class]) {
+            
+            find = YES;
+            [self.navigationController popToViewController:vc animated:YES];
+        }
+    }
+    
+    if (!find) {
+        
+        UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"HomeHubConnectWifiViewController" storyboardName:@"HomeHub"];
+        [self.navigationController pushViewController:vc animated:YES];
+    }
+    
 }
 
 - (IBAction)btnConnectTouched:(id)sender {
@@ -64,25 +86,77 @@
         return;
     }
     
-    NSLog(@"pass : %@", pass);
-    
+ 
     [bleService setWiFiPwd:pass];
     [bleService enableDHCP];
     [bleService readAndNotifyCharacteristicUUID:kBLEChrStDHCPArg isNotify:NO];
+    
+    updateSSID = updateBSSID = updateIPSet = updateIPAddr = NO;
 }
 
 - (IBAction)btnCancelTouched:(id)sender {
     
-    [self dismissViewControllerAnimated:YES completion:nil];
+    [self.navigationController popToRootViewControllerAnimated:YES];
 }
 
 
 #pragma mark - ble delegate
-- (void)BLEWiFiDHCPRead:(id)data {
+//enableDHCP
+- (void)BLEWiFiDHCPUpdate:(id)data {
     
-    NSLog(@"BLEWiFiDHCPRead") ;
     [bleService applyWiFiSettingInfo];
     [bleService readAndNotifyCharacteristicUUID:kBLEChrRdConInfo isNotify:YES];
+
+}
+
+//kBLEChrRdConInfo
+- (void)BLEWiFiConnectionUpdate:(CBCharacteristic *)info {
+    
+    NSLog(@"Connection Update!");
+    
+    NSString *value = [bleService hexStringValue:info] ;
+    
+    NSLog(@"value : %@", value) ;
+    NSLog(@"value : %@", [value substringFromIndex:value.length-1]) ;
+    
+    if (value.length > 0 &&
+        EQUALS([value substringFromIndex:value.length-1], @"1")) {
+        
+        [bleService readConnectionWiFiInfo];
+    }
+
 }
 
+//readConnectionWiFiInfo
+- (void)BLEWiFiConnectionInfoUpdateWithKey:(NSString *)kBLEChr
+                                    result:(NSString *)result {
+    
+    NSLog(@"Connection Info Update!") ;
+    
+    
+    if (EQUALS(kBLEChr, kBLEChrRdSSID)) {
+        updateSSID = YES;
+    }
+    else if(EQUALS(kBLEChr, kBLEChrRdBSSID)) {
+        updateBSSID = YES;
+    }
+    else if(EQUALS(kBLEChr, kBLEChrRnIpSet)) {
+        updateIPSet = YES;
+    }
+    else if(EQUALS(kBLEChr, kBLEChrRnIpAddr)) {
+        updateIPAddr = YES;
+    }
+    
+    // 연결 확인 완료
+    if (updateSSID && updateBSSID && updateIPSet && updateIPAddr) {
+ 
+        UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"HomeHubUpdateCompleteViewController" storyboardName:@"HomeHub"];
+        
+        [self.navigationController pushViewController:vc animated:YES];
+        
+    }
+}
+
+
+
 @end

+ 3 - 0
OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubWifiSearchFailViewController.m

@@ -7,6 +7,7 @@
 //
 
 #import "HomeHubWifiSearchFailViewController.h"
+#import "HomeHubWifiSearchViewController.h"
 
 @interface HomeHubWifiSearchFailViewController ()
 
@@ -21,10 +22,12 @@
 
 - (IBAction)btnAgainTouched:(id)sender {
     
+    [self.navigationController popViewControllerAnimated:YES];
 }
 
 - (IBAction)btnBackTouched:(id)sender {
     
+    [self.navigationController popToRootViewControllerAnimated:YES];
 }
 
 - (void)didReceiveMemoryWarning {

+ 15 - 5
OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubWifiSearchSuccessViewController.m

@@ -76,7 +76,7 @@
     cell.lblHubName.text = model.ssid;
     cell.chkBtn.delegate = self;
     cell.chkBtn.value = model;
-    cell.chkBtn.checked = [cell.chkBtn getCheckStatusFromValue];
+    cell.chkBtn.checked = [selectedWLanModel isEqual:model];
     
     
     return cell;
@@ -94,13 +94,15 @@
     btn.selected = !btn.selected;
     
     selectedWLanModel = btn.value;
-    _btnNext.enabled = YES ;
+    _btnNext.enabled = YES;
+    
+    [_tableView reloadData];
     
 }
 
 
 #pragma mark - ble delegate
-- (void)BLEWiFiSSIDRead:(NSString*)ssid {
+- (void)BLEWiFiSSIDUpdate:(NSString*)ssid {
     
     NSLog(@"selectedWLanModel.ssid : %@", selectedWLanModel.ssid);
     NSLog(@"ssid : %@", ssid);
@@ -109,7 +111,15 @@
         
         HomeHubWifiPasswdInputViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"HomeHubWifiPasswdInputViewController" storyboardName:@"HomeHub"];
         vc.selectedWLanModel = selectedWLanModel;
-        [self presentViewController:vc animated:YES completion:nil];
+        
+        [self.navigationController pushViewController:vc animated:YES];
+    }
+    else {
+        
+        //실패처리
+        [[JDFacade facade] alertTitle:@"인터넷 연결 설정 실패"
+                              message:@"인터넷 연결 설정에 실패하였습니다."];
+        
     }
 }
 
@@ -128,6 +138,6 @@
 
 - (IBAction)btnCancelTouched:(id)sender {
     
-    [self dismissViewControllerAnimated:YES completion:nil];
+    [self.navigationController popToRootViewControllerAnimated:YES];
 }
 @end

+ 38 - 42
OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubWifiSearchViewController.m

@@ -27,7 +27,6 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
 
-    [self initUI];
     [self prepareViewDidLoad];
 }
 
@@ -40,6 +39,14 @@
     [super viewWillAppear:animated];
     
     
+    [self initUI];
+    
+    if (!bleService.isConnected) {
+        [bleService connect:bleService.conDevice];
+    }
+    else {
+        [self BLEConnected:nil];
+    }
 }
 
 
@@ -57,8 +64,7 @@
     bleService = [BLEServiceHandler sharedManager];
     bleService.delegate = self;
     startScan = NO;
-    
-    [bleService connect:bleService.conDevice];
+
     
 }
 
@@ -66,9 +72,10 @@
 
     _lblTimer.hidden = !isStart;
     _imgvLoading.hidden = !isStart;
+    
     if (isStart) {
+        
         _elapsedSeconds = kMaxTimeOut;
-        NSLog(@"ElapsedSecond : %zd", _elapsedSeconds);
         _lblTimer.text = [NSString stringWithFormat:@"%zd", _elapsedSeconds];
         if (!_timer) {
             _timer = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(updateInclusionStatus) userInfo:nil repeats:YES];
@@ -112,22 +119,7 @@
 
         if (startScan) {
             
-            NSString *result = [bleService getWLanList:_elapsedSeconds%3];
-       
-            if (!(EQUALS(result, @"") || EQUALS(result, @"-"))) {
-                
-                BLEWLanListModel *response = [[BLEWLanListModel alloc] initWithString:result error:nil];
-                
-                [wifiData setObject:response
-                             forKey:[NSString stringWithFormat:@"%ld", _elapsedSeconds%3]];
-                
-               
-                if (wifiData.allKeys.count == 3) {
-                    
-                    [self moveHomeHubWifiSearchSuccess];
-                }
-            }
-            
+            [bleService getWLanList:_elapsedSeconds%3];
         }
 
         
@@ -147,24 +139,10 @@
 }
 
 
-- (void)getJsonModel:(NSString*)string{
-    
-    NSError *jsonError;
-    NSData *objectData = [string dataUsingEncoding:NSUTF8StringEncoding];
-    NSDictionary *json = [NSJSONSerialization JSONObjectWithData:objectData
-                                                         options:NSJSONReadingMutableContainers
-                                                           error:&jsonError];
-    
-    NSLog(@"json : %@", json) ;
-    
-    NSArray *wlans = [json objectForKey:@"wlan"] ;
-    
-}
-
-
 #pragma mark - User Event
 - (IBAction)btnCloseTouched:(id)sender {
-    [self dismissViewControllerAnimated:YES completion:nil];
+    
+    [self.navigationController popViewControllerAnimated:YES];
 }
 
 
@@ -183,9 +161,29 @@
 }
 
 
-- (void)moveHomeHubWifiSearchSuccess {
+- (void)BLEWLanUpdateWithKey:(NSString *)kBLEChr result:(NSString *)result{
+
+    BLEWLanListModel *response = [[BLEWLanListModel alloc] initWithString:result error:nil];
+    
+    if (response == nil) {
+        
+        return;
+    }
+
+    [wifiData setObject:response
+                 forKey:kBLEChr];
     
     
+    if (wifiData.allKeys.count == 3) {
+        
+        [self moveHomeHubWifiSearchSuccess];
+    }
+    
+}
+
+
+- (void)moveHomeHubWifiSearchSuccess {
+ 
     [self startLoading:NO];
     
     NSArray *allKeys = wifiData.allKeys ;
@@ -200,22 +198,20 @@
             [wifiList addObject:model];
         }
     }
-    
 
     HomeHubWifiSearchSuccessViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"HomeHubWifiSearchSuccessViewController" storyboardName:@"HomeHub"];
     vc.wifiList = wifiList;
     
-    [self presentViewController:vc animated:YES completion:nil];
+    [self.navigationController pushViewController:vc animated:YES];
 }
 
 
 - (void)moveHomeHubWifiSearchFail {
-    
-    
+
     [self startLoading:NO];
     
     UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"HomeHubWifiSearchFailViewController" storyboardName:@"HomeHub"];
     
-    [self presentViewController:vc animated:YES completion:nil];
+    [self.navigationController pushViewController:vc animated:YES];
 }
 @end

+ 1 - 0
OneCable/Classes/ViewControllers/MainScreens/HomeModeMovementViewController.m

@@ -47,6 +47,7 @@
 }
 
 - (void) homeModeSet:(NSString *)modeCode{
+    
     HomeModeSettingsViewController *vc =[CommonUtil instantiateViewControllerWithIdentifier:@"HomeModeSettingsViewController" storyboardName:@"Main"];
     
     ModeModel *mode = [_modeArray objectKey:@"basicModeCode" eqaulToString:modeCode];

+ 1 - 1
OneCable/Classes/ViewControllers/MainScreens/LoginViewController.m

@@ -420,7 +420,7 @@ ID / PW Input Box Text Color
 
     UINavigationController *m_navi =[[UINavigationController alloc]initWithRootViewController:vc];
     
-[self presentViewController:m_navi animated:YES completion:nil];
+    [self presentViewController:m_navi animated:YES completion:nil];
     
 }
 

+ 3 - 1
OneCable/Classes/ViewControllers/MainScreens/ManagementViewController.m

@@ -99,7 +99,9 @@
         vc = [CommonUtil instantiateViewControllerWithIdentifier:@"MultiHomeHubViewController" storyboardName:@"Main"];
     }
     
-    [self presentViewController:vc animated:YES completion:nil];
+    UINavigationController *m_navi =[[UINavigationController alloc]initWithRootViewController:vc];
+    
+    [self presentViewController:m_navi animated:YES completion:nil];
 }
 
 // 설정 이동

+ 3 - 0
OneCable/Classes/ViewControllers/SignUpScreens/SignUpTypeSelectViewController.m

@@ -19,6 +19,7 @@
 @implementation SignUpTypeSelectViewController
 
 - (void)viewDidLoad {
+    
     [super viewDidLoad];
     
     [self initUI];
@@ -26,6 +27,7 @@
 
 // UI 설정
 - (void)initUI {
+    
     UIView *statusBar = [[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"] valueForKey:@"statusBar"];
     statusBar.backgroundColor = [UIColor whiteColor];
     
@@ -49,6 +51,7 @@
 
 // 약관 동의 메뉴로 이동
 - (void)moveAgreementViewController{
+    
     AgreementViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"AgreementViewController" storyboardName:@"SignUp"];
 
     [self.navigationController pushViewController:vc animated:YES];