修改设备绑定过程

This commit is contained in:
xuemh
2018-08-08 21:12:29 +08:00
parent f8009af9c0
commit 0a2f673918
2 changed files with 13 additions and 101 deletions
@@ -13,13 +13,16 @@
#import "ResetDeviceModel.h"
#import "RestartDeviceModel.h"
#define K_ReSendTimeInterval 5
#define K_ReSendTimeInterval 3
@interface IFishHotpotUDPHelper ()
{
NSString * _ssidName;
NSString *_pwd;
}
@property (nonatomic, assign) BOOL backMessageReceived;
@end
@@ -40,11 +43,13 @@
_ssidName = ssidName;
_pwd = pwd;
[self postmsg:@"命令已发出"];
self.backMessageReceived = NO;
self.loopTimer = [NSTimer scheduledTimerWithTimeInterval:K_ReSendTimeInterval target:self selector:@selector(sendConnectHotspotSoketdata) userInfo:nil repeats:YES];
}
- (void)broadCastRestCommand {
[self postmsg:@"命令已发出"];
self.backMessageReceived = NO;
self.loopTimer = [NSTimer scheduledTimerWithTimeInterval:K_ReSendTimeInterval target:self selector:@selector(sendRestSocketData) userInfo:nil repeats:YES];
}
@@ -75,6 +80,7 @@
- (void)broadCastRestartCommand {
[self postmsg:@"命令已发出"];
self.backMessageReceived = NO;
self.loopTimer = [NSTimer scheduledTimerWithTimeInterval:K_ReSendTimeInterval target:self selector:@selector(sendRestartSocketData) userInfo:nil repeats:YES];
}
@@ -134,6 +140,10 @@
-(BOOL)onUdpSocket:(AsyncUdpSocket *)sock didReceiveData:(NSData *)data withTag:(long)tag fromHost:(NSString *)host port:(UInt16)port
{
if (self.backMessageReceived) {
return YES;
}
self.backMessageReceived = YES;
NSString* result = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
IFishUDPHelperBackMsgModel *model = [[IFishUDPHelperBackMsgModel alloc] initWithData:data];
if ([model.result isEqualToString:@"01"]) {