// // HomeHubWifiPasswdInputViewController.m // OneCable // // Created by nComz on 2017. 5. 11.. // Copyright © 2017년 ntels. All rights reserved. // #import "HomeHubWifiPasswdInputViewController.h" @interface HomeHubWifiPasswdInputViewController () { BLEServiceHandler *bleService; } @end @implementation HomeHubWifiPasswdInputViewController - (void)viewDidLoad { [super viewDidLoad]; [self initUI]; [self prepareViewDidLoad]; } - (void)initUI { _lblSSID.text = [NSString stringWithFormat:@"SSID : %@", _selectedWLanModel.ssid]; } - (void)prepareViewDidLoad { //ble bleService = [BLEServiceHandler sharedManager]; bleService.delegate = self; } - (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]; } - (IBAction)btnConnectTouched:(id)sender { NSString *pass = _txtInputPasswd.text.trim; if (pass.length == 0) { return; } NSLog(@"pass : %@", pass); [bleService setWiFiPwd:pass]; [bleService enableDHCP]; [bleService readAndNotifyCharacteristicUUID:kBLEChrStDHCPArg isNotify:NO]; } - (IBAction)btnCancelTouched:(id)sender { [self dismissViewControllerAnimated:YES completion:nil]; } #pragma mark - ble delegate - (void)BLEWiFiDHCPRead:(id)data { NSLog(@"BLEWiFiDHCPRead") ; [bleService applyWiFiSettingInfo]; [bleService readAndNotifyCharacteristicUUID:kBLEChrRdConInfo isNotify:YES]; } @end