提示和跳转;

This commit is contained in:
xuemh 2018-08-07 21:39:14 +08:00
parent 37b3ce32d5
commit 4a4194a6f4
5 changed files with 24 additions and 10 deletions

View File

@ -70,7 +70,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>493</string>
<string>494</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>

View File

@ -36,4 +36,8 @@
[self.view makeToast:@"设备即将重启"];
}
- (void)udpHelperMessage:(NSString *)msg {
[self.view makeToast:msg];
}
@end

View File

@ -37,4 +37,8 @@
[self.view makeToast:@"设备即将重置"];
}
- (void)udpHelperMessage:(NSString *)msg {
[self.view makeToast:msg];
}
@end

View File

@ -13,6 +13,7 @@
#import "IFishHotpotUDPHelper.h"
#import "ESPTouchResult.h"
#import "ESPTouchTask.h"
#import "IfishDataUnity.h"
@interface ConnectHotpotViewController ()<UITextFieldDelegate, IFishHotpotUDPHelperDelegate>
@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;
@ -244,6 +245,7 @@
-(void)bindDeviceWithSsid:(NSString*)bssid{
NSLog(@"设备bssid_%@",bssid);
NSString *userId = [dataContorl dataControlGetUserIdInfo];
[self.view makeToast:[NSString stringWithFormat:@"正在绑定设备,bssid:%@", bssid]];
[AFHttpTool bindDeviceWithUserId:userId macAddress:bssid success:^(id response) {
NSDictionary*resultDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
NSLog(@"data:%@",resultDic[@"data"]);
@ -270,6 +272,9 @@
[self showTitle:@"" messsage:@"设备不在服务器"];
}else{
[self.view makeToast:@"设备绑定成功"];
[[IfishDataUnity shareDataInstance] initAppCenterVcWith:devicemodel addWithdissMisVc:nil];
//
[[IfishUserObsever sharedInstance] xinZengJingYanZhi:IFISHADDEXP_BIDDEVICE addType:IFISHADDEXPTYPE1];
}
@ -287,6 +292,7 @@
}else if ([resultDic[@"result"] isEqualToString:@"302"]){
//
self.bakbutton.userInteractionEnabled=YES;
[self.view makeToast:@"绑定失败"];
}

View File

@ -13,6 +13,8 @@
#import "ResetDeviceModel.h"
#import "RestartDeviceModel.h"
#define K_ReSendTimeInterval 5
@interface IFishHotpotUDPHelper ()
{
NSString * _ssidName;
@ -37,11 +39,13 @@
- (void)broadCastHotspotConnectCommandWith:(NSString *)ssidName pwd:(NSString *)pwd {
_ssidName = ssidName;
_pwd = pwd;
self.loopTimer = [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(sendConnectHotspotSoketdata) userInfo:nil repeats:YES];
[self postmsg:@"命令已发出"];
self.loopTimer = [NSTimer scheduledTimerWithTimeInterval:K_ReSendTimeInterval target:self selector:@selector(sendConnectHotspotSoketdata) userInfo:nil repeats:YES];
}
- (void)broadCastRestCommand {
self.loopTimer = [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(sendRestSocketData) userInfo:nil repeats:YES];
[self postmsg:@"命令已发出"];
self.loopTimer = [NSTimer scheduledTimerWithTimeInterval:K_ReSendTimeInterval target:self selector:@selector(sendRestSocketData) userInfo:nil repeats:YES];
}
- (void)sendRestSocketData {
@ -70,7 +74,8 @@
}
- (void)broadCastRestartCommand {
self.loopTimer = [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(sendRestartSocketData) userInfo:nil repeats:YES];
[self postmsg:@"命令已发出"];
self.loopTimer = [NSTimer scheduledTimerWithTimeInterval:K_ReSendTimeInterval target:self selector:@selector(sendRestartSocketData) userInfo:nil repeats:YES];
}
@ -129,12 +134,7 @@
-(BOOL)onUdpSocket:(AsyncUdpSocket *)sock didReceiveData:(NSData *)data withTag:(long)tag fromHost:(NSString *)host port:(UInt16)port
{
NSString* result;
result = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
NSLog(@"didReceiveData%@",result);
NSLog(@"port%hu",port);
NSString* result = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
IFishUDPHelperBackMsgModel *model = [[IFishUDPHelperBackMsgModel alloc] initWithData:data];
if ([model.result isEqualToString:@"01"]) {
if ([self.delegate respondsToSelector:@selector(udpHelperCommandExecutedSuccess:)]) {