| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- //
- // 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
|