完善连接热点udp指令

This commit is contained in:
xuemh
2018-08-06 21:37:34 +08:00
parent cdd634df71
commit 4546e0b981
7 changed files with 62 additions and 8 deletions
@@ -9,6 +9,7 @@
#import "IFishHotpotUDPHelper.h"
#import "LxGetCurrentIp.h"
#import "AppDelegate.h"
#import "ConnectHotspotModel.h"
@interface IFishHotpotUDPHelper ()
{
@@ -31,18 +32,21 @@
return sharedInstace;
}
- (void)broadCaseUDPWith:(NSString *)ssidName pwd:(NSString *)pwd {
- (void)broadCastHotspotConnectCommandWith:(NSString *)ssidName pwd:(NSString *)pwd {
_ssidName = ssidName;
_pwd = pwd;
self.loopTimer = [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(sendLoopSoketdata) userInfo:nil repeats:YES];
self.loopTimer = [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(sendConnectHotspotSoketdata) userInfo:nil repeats:YES];
}
-(void)sendLoopSoketdata{
-(void)sendConnectHotspotSoketdata{
NSString* hostS = @"192.168.4.1";
self.clientSocket = [[AsyncUdpSocket alloc] initWithDelegate:self];
//120.55.190.56 服务器IP 指令中用
NSString *request=@"0007000000000000000000000000273132302e35352e3139302e353600000000000000bbbb0000";
ConnectHotspotModel *model = [ConnectHotspotModel new];
model.ssidName = _ssidName;
model.pwd = _pwd;
NSString *request=[NSString stringWithFormat:@"%@", model.description];
NSData *data=[dataContorl stringToHexData:request];
@@ -71,7 +75,7 @@
NSLog(@"didReceiveData%@",result);
NSLog(@"port%hu",port);
AppDelegate *app =(AppDelegate*)[UIApplication sharedApplication].delegate;
[app.window makeToast:@"切换成功"];
[app.window makeToast:[NSString stringWithFormat:@"收到答复:%@", result]];
[self.loopTimer invalidate];
return YES;