瀏覽代碼

06.13 ble

eunmi.kim 8 年之前
父節點
當前提交
f80cd0a023

+ 10 - 2
OneCable/Base.lproj/HomeHub.storyboard

@@ -1553,6 +1553,8 @@
                                                                         <constraint firstAttribute="width" constant="30" id="k9W-ai-7Du"/>
                                                                         <constraint firstAttribute="height" constant="30" id="xNa-YW-u6t"/>
                                                                     </constraints>
+                                                                    <state key="normal" image="color_bg_02"/>
+                                                                    <state key="selected" image="common_list_checked"/>
                                                                 </button>
                                                                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bwQ-Rv-qR9">
                                                                     <rect key="frame" x="15" y="0.0" width="260" height="30"/>
@@ -2794,7 +2796,8 @@
                                                                         <constraint firstAttribute="height" constant="30" id="FSc-XV-yAh"/>
                                                                         <constraint firstAttribute="width" constant="30" id="aOk-sI-eNK"/>
                                                                     </constraints>
-                                                                    <state key="selected" backgroundImage="common_list_checked"/>
+                                                                    <state key="normal" image="color_bg_02"/>
+                                                                    <state key="selected" image="common_list_checked"/>
                                                                 </button>
                                                                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Xo9-0I-X8F">
                                                                     <rect key="frame" x="15" y="0.0" width="260" height="30"/>
@@ -2816,7 +2819,7 @@
                                                                     <nil key="textColor"/>
                                                                     <nil key="highlightedColor"/>
                                                                 </label>
-                                                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="img_list_network_wifi_unlock" translatesAutoresizingMaskIntoConstraints="NO" id="Rsr-6H-B07" customClass="CustomImageView">
+                                                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="img_list_network_wifi_unlock" highlightedImage="img_list_network_wifi_lock" translatesAutoresizingMaskIntoConstraints="NO" id="Rsr-6H-B07" customClass="CustomImageView">
                                                                     <rect key="frame" x="15" y="37" width="30" height="25"/>
                                                                     <constraints>
                                                                         <constraint firstAttribute="height" constant="25" id="G2v-2v-lLh"/>
@@ -3536,6 +3539,9 @@
                                                 <userDefinedRuntimeAttributes>
                                                     <userDefinedRuntimeAttribute type="boolean" keyPath="autoScrollUp" value="YES"/>
                                                 </userDefinedRuntimeAttributes>
+                                                <connections>
+                                                    <outlet property="delegate" destination="ZdB-ag-uXO" id="C7Y-5b-UB1"/>
+                                                </connections>
                                             </textField>
                                         </subviews>
                                         <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
@@ -4410,6 +4416,7 @@
         </scene>
     </scenes>
     <resources>
+        <image name="color_bg_02" width="2" height="2"/>
         <image name="common_bg_alpha_85" width="2" height="2"/>
         <image name="common_bg_line_01" width="1" height="1"/>
         <image name="common_bg_list_02" width="1" height="1"/>
@@ -4429,6 +4436,7 @@
         <image name="img_homehub_setting_step_4" width="157" height="17"/>
         <image name="img_homehub_setting_step_5" width="157" height="17"/>
         <image name="img_input_round_bg_default" width="50" height="35"/>
+        <image name="img_list_network_wifi_lock" width="30" height="25"/>
         <image name="img_list_network_wifi_unlock" width="30" height="25"/>
         <image name="loading_count" width="48" height="48"/>
         <image name="shadow_top" width="1" height="1"/>

+ 1 - 1
OneCable/Base.lproj/Main.storyboard

@@ -4751,7 +4751,7 @@
                                                     <outlet property="lblFirmCurrentVer" destination="yDZ-C8-9ch" id="BtN-jN-vFj"/>
                                                     <outlet property="lblFirmNewestVer" destination="tl6-F7-f93" id="47I-ey-ZuS"/>
                                                     <outlet property="lblSoftCurrentVer" destination="Ktd-pu-nG6" id="Zg5-zO-94f"/>
-                                                    <outlet property="lblSoftNewestVer" destination="tca-JO-pcb" id="yD0-9B-uG9"/>
+                                                    <outlet property="lblSoftNewestVer" destination="tca-JO-pcb" id="wkc-lJ-ORU"/>
                                                 </connections>
                                             </tableViewCell>
                                             <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="HubInfoCellIdentifier" rowHeight="164" id="bHe-zk-XaM" customClass="HomeHubInfoTableViewCell">

+ 3 - 1
OneCable/Classes/Handler/BLEServiceHandler.m

@@ -79,7 +79,9 @@
 
 - (BOOL) checkBLEStatus {
     
-    if (_manager.state == CBCentralManagerStatePoweredOff) {
+    if (_manager.state == CBManagerStatePoweredOff) {
+        
+        NSLog(@"_manager.state != CBCentralManagerStatePoweredOn") ;
         
         [[JDFacade facade] confirmTitle:@"Notice"
                                 message:@"블루투스가 비활성화 되어 있습니다. 활성화 해주세요."

+ 3 - 3
OneCable/Classes/Model/LoginModel.m

@@ -147,10 +147,11 @@
 }
 
 -(DeviceModel *)getHomeHub {
-    NSLog(@"%@", _deviceList);
+
     DeviceModel *result = nil;
     
     if (![self isMultiHomeHub]) {
+        
         if (_selectedHomeHubID == nil || [_selectedHomeHubID isEmptyString]) {
             for (DeviceModel *info in _deviceList) {
                 result = info;
@@ -165,8 +166,7 @@
             }
         }
     }
-    NSLog(@"%@", result);
-    
+
     return result;
 }
 

+ 15 - 0
OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubConnectWifiViewController.m

@@ -32,6 +32,21 @@
     
     _lbTitle.text = @"선택하신 홈허브에\n등록된 Wi-Fi정보가 없습니다.";
     _lblSSID.hidden = YES;
+    
+    DeviceModel *selectedDeviceModel = [[JDFacade facade].loginUser getHomeHub];
+    
+    NSLog(@"selectedHomeHubID : %@", [JDFacade facade].loginUser.selectedHomeHubID);
+    
+    NSLog(@"selectedDeviceModel : %@", selectedDeviceModel);
+    
+    if (selectedDeviceModel != nil) {
+
+//        _lbTitle.text = @"선택하신 홈허브에\n현재 연결된 Wi-Fi입니다.";
+//        _lblSSID.text = [NSString stringWithFormat:@"SSID : %@", selectedDeviceModel.];
+//        _lblSSID.hidden = NO;
+    }
+    
+    
 }
 
 - (void)prepareViewDidLoad {

+ 2 - 2
OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubSearchViewController.m

@@ -117,13 +117,13 @@
     [self startLoading:NO];
     
     
+    NSLog(@"");
+    
     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) {
         

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

@@ -54,8 +54,12 @@
     
     [self initUI];
     [self prepareViewDidLoad];
-    
+}
 
+- (void)viewWillAppear:(BOOL)animated {
+    [super viewWillAppear:animated];
+    
+    bleState = [[BLEServiceHandler sharedManager] checkBLEStatus];
 }
 
 
@@ -82,6 +86,9 @@
     } else {
         hubInfo = _selectHub;
     }
+
+    [[JDFacade facade].loginUser setHomeHubID:hubInfo.deviceId];
+
 }
 
 
@@ -155,6 +162,12 @@
         
 //        tcell.lblDate.text = [CommonUtil formattedDate3:[JDFacade facade].loginUser.homehubCreateDatetime];
         
+        tcell.lblFirmNewestVer.text = hubInfo.lastFirmwareVersion;
+        tcell.lblFirmCurrentVer.text = hubInfo.firmwareVersion;
+        tcell.lblSoftNewestVer.text = hubInfo.lastSoftwareVersion;
+        tcell.lblSoftCurrentVer.text = hubInfo.softwareVersion;
+        
+        
         [self masterBtn:tcell.btnFirmUpdate];
         [self masterBtn:tcell.btnSoftUpdate];
         
@@ -171,6 +184,8 @@
     } else if (indexPath.row == 2) {
         HomeHubInfoTableViewCell *tcell = (HomeHubInfoTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"HubInfoCellIdentifier"];
 
+        tcell.lblModelName.text = hubInfo.deviceModelId;
+        tcell.lblSerialNum.text = hubInfo.deviceSn;
         
         cell = tcell;
     }
@@ -196,14 +211,17 @@
 
 - (void)btnSetTouched:(id)sender {
     
+    NSLog(@"bleState : %d", bleState) ;
+    
     if (bleState) {
         
         UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"HomeHubSearchViewController" storyboardName:@"HomeHub"];
+        
          [self.navigationController pushViewController:vc animated:YES];
     }
     else {
         
-       [[BLEServiceHandler sharedManager] checkBLEStatus] ;
+       bleState = [[BLEServiceHandler sharedManager] checkBLEStatus] ;
     }
 }
 
@@ -221,7 +239,11 @@
 }
 
 - (void)btnCloseTouched:(id)sender {
-    [self dismissViewControllerAnimated:YES completion:nil];
+    
+    if ([[JDFacade facade].loginUser isMultiHomeHub])
+        [self.navigationController popViewControllerAnimated:YES];
+    else
+        [self dismissViewControllerAnimated:YES completion:nil];
 }
 
 

+ 14 - 1
OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubWifiPasswdInputViewController.m

@@ -9,7 +9,7 @@
 #import "HomeHubWifiPasswdInputViewController.h"
 #import "HomeHubConnectWifiViewController.h"
 
-@interface HomeHubWifiPasswdInputViewController () {
+@interface HomeHubWifiPasswdInputViewController ()<UITextFieldDelegate> {
     
     BLEServiceHandler *bleService;
 
@@ -100,6 +100,19 @@
 }
 
 
+- (BOOL)textFieldShouldReturn:(UITextField *)textField {
+    
+    NSLog(@"wifi pass textFieldShouldReturn");
+    
+    if (textField.text.length > 0) {
+        
+        [self btnConnectTouched:nil];
+    }
+    
+    return YES;
+}
+
+
 #pragma mark - ble delegate
 //enableDHCP
 - (void)BLEWiFiDHCPUpdate:(id)data {

+ 1 - 0
OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubWifiSearchSuccessViewController.m

@@ -77,6 +77,7 @@
     cell.chkBtn.delegate = self;
     cell.chkBtn.value = model;
     cell.chkBtn.checked = [selectedWLanModel isEqual:model];
+    cell.imgvWifi.highlighted = !EQUALS(model.security, @"none");
     
     
     return cell;

+ 9 - 6
OneCable/Classes/ViewControllers/HomeHubScreens/HomeHubWifiSearchViewController.m

@@ -40,13 +40,16 @@
     
     
     [self initUI];
+
+    [bleService connect:bleService.conDevice];
     
-    if (!bleService.isConnected) {
-        [bleService connect:bleService.conDevice];
-    }
-    else {
-        [self BLEConnected:nil];
-    }
+//    if (!bleService.isConnected) {
+//        
+//        
+//    }
+//    else {
+//        [self BLEConnected:nil];
+//    }
 }
 
 

+ 15 - 4
OneCable/Classes/ViewControllers/HomeHubScreens/MultiHomeHubViewController.m

@@ -50,6 +50,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];
 }
 
@@ -129,18 +135,23 @@
 -(void)showHomeHubDetail:(NSIndexPath *)indexPath
 {
     DeviceModel *info = [[JDFacade facade].loginUser.deviceList objectAtIndex:indexPath.row];
+    
     HomeHubViewController *vc = (HomeHubViewController *)[CommonUtil instantiateViewControllerWithIdentifier:@"HomeHubViewController" storyboardName:@"Main"];
     vc.selectHub = info;
+    
+    [self.navigationController pushViewController:vc animated:YES];
+    
 
 //    vc.providesPresentationContextTransitionStyle = YES;
 //    vc.definesPresentationContext = YES;
 //    
 //    [vc setModalPresentationStyle:UIModalPresentationOverCurrentContext];
 //    
-    UIViewController *pvc = self.presentingViewController;
-    [self dismissViewControllerAnimated:NO completion:^{//TODO : UI Confirm with Mr.Mo
-        [pvc presentViewController:vc animated:YES completion:nil];
-    }];
+
+    //    UIViewController *pvc = self.presentingViewController;
+//    [self dismissViewControllerAnimated:NO completion:^{//TODO : UI Confirm with Mr.Mo
+//        [pvc presentViewController:vc animated:YES completion:nil];
+//    }];
    
 //    UIViewController *pvc = self.presentingViewController;
 //    [self dismissViewControllerAnimated:NO completion:^{