diff --git a/Ifish.xcodeproj/project.pbxproj b/Ifish.xcodeproj/project.pbxproj index ba39fec..37fc2db 100644 --- a/Ifish.xcodeproj/project.pbxproj +++ b/Ifish.xcodeproj/project.pbxproj @@ -2471,6 +2471,7 @@ E54787102073192E0060C2C2 /* introlImage_iphonex_2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = E547870D2073192D0060C2C2 /* introlImage_iphonex_2.jpg */; }; E54787112073192E0060C2C2 /* introlImage_iphonex_3.jpg in Resources */ = {isa = PBXBuildFile; fileRef = E547870E2073192E0060C2C2 /* introlImage_iphonex_3.jpg */; }; E548F39720A557B7004CF1BC /* JiaReBang.png in Resources */ = {isa = PBXBuildFile; fileRef = E548F39620A557B5004CF1BC /* JiaReBang.png */; }; + E567026D21187E7C00E61993 /* ConnectHotspotModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E567026C21187E7C00E61993 /* ConnectHotspotModel.m */; }; E56A746220FCDBFC000129C9 /* ConnectHotpotViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E56A746020FCDBFC000129C9 /* ConnectHotpotViewController.m */; }; E56A746320FCDBFC000129C9 /* ConnectHotpotViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E56A746120FCDBFC000129C9 /* ConnectHotpotViewController.xib */; }; E58C9980208189780004C42B /* back_btn_1@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = E58C997F208189780004C42B /* back_btn_1@2x.png */; }; @@ -6269,6 +6270,8 @@ E547870D2073192D0060C2C2 /* introlImage_iphonex_2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = introlImage_iphonex_2.jpg; sourceTree = ""; }; E547870E2073192E0060C2C2 /* introlImage_iphonex_3.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = introlImage_iphonex_3.jpg; sourceTree = ""; }; E548F39620A557B5004CF1BC /* JiaReBang.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = JiaReBang.png; sourceTree = ""; }; + E567026B21187E7C00E61993 /* ConnectHotspotModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ConnectHotspotModel.h; sourceTree = ""; }; + E567026C21187E7C00E61993 /* ConnectHotspotModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ConnectHotspotModel.m; sourceTree = ""; }; E56A745F20FCDBFC000129C9 /* ConnectHotpotViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ConnectHotpotViewController.h; sourceTree = ""; }; E56A746020FCDBFC000129C9 /* ConnectHotpotViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ConnectHotpotViewController.m; sourceTree = ""; }; E56A746120FCDBFC000129C9 /* ConnectHotpotViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ConnectHotpotViewController.xib; sourceTree = ""; }; @@ -9641,6 +9644,8 @@ 883E781E1D48A5E50030E075 /* SelectDeviceViewController.m */, 883E781F1D48A5E50030E075 /* SetViewController.h */, 883E78201D48A5E50030E075 /* SetViewController.m */, + E567026B21187E7C00E61993 /* ConnectHotspotModel.h */, + E567026C21187E7C00E61993 /* ConnectHotspotModel.m */, E5F1B03E21184F9400A879A1 /* IFishHotpotUDPHelper.h */, E5F1B03D21184F9300A879A1 /* IFishHotpotUDPHelper.m */, E56A745F20FCDBFC000129C9 /* ConnectHotpotViewController.h */, @@ -16182,6 +16187,7 @@ 8875B4FB1EDFA406000FAE93 /* RunSun84Protocol.m in Sources */, E58C99872081A3BA0004C42B /* RuiMeiProtocolModel.m in Sources */, 881671C31EA5DE2B00BEBF23 /* UMComViewController.m in Sources */, + E567026D21187E7C00E61993 /* ConnectHotspotModel.m in Sources */, 883E785D1D48A5E50030E075 /* XuToWenDuPicview.m in Sources */, 880707F51DE302630076F65A /* LXActionView.m in Sources */, 88602A6C1E10BC3500F3DB5D /* NIMPinyinConverter.m in Sources */, diff --git a/Ifish/controllers/IfishTabControllers/我的/mineControllers/pushSetControllrs/IfishUDPBroadCastHelper.m b/Ifish/controllers/IfishTabControllers/我的/mineControllers/pushSetControllrs/IfishUDPBroadCastHelper.m index 4b38575..594f140 100644 --- a/Ifish/controllers/IfishTabControllers/我的/mineControllers/pushSetControllrs/IfishUDPBroadCastHelper.m +++ b/Ifish/controllers/IfishTabControllers/我的/mineControllers/pushSetControllrs/IfishUDPBroadCastHelper.m @@ -28,7 +28,7 @@ -(void)broadCaseUDP{ - 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]; } diff --git a/Ifish/controllers/leftcontrollers/ConnectHotpotViewController.m b/Ifish/controllers/leftcontrollers/ConnectHotpotViewController.m index 8109012..3a181ff 100644 --- a/Ifish/controllers/leftcontrollers/ConnectHotpotViewController.m +++ b/Ifish/controllers/leftcontrollers/ConnectHotpotViewController.m @@ -123,7 +123,7 @@ - (void)sendToDeviceWithSSIDName:(NSString *)name andSSIDPWD:(NSString *)pwd { [IFishHotpotUDPHelper sharedInstance].delegate = self; - [[IFishHotpotUDPHelper sharedInstance] broadCaseUDPWith:name pwd:pwd]; + [[IFishHotpotUDPHelper sharedInstance] broadCastHotspotConnectCommandWith:name pwd:pwd]; } #pragma mark - IFishHotpotUDPHelperDelegate diff --git a/Ifish/controllers/leftcontrollers/ConnectHotspotModel.h b/Ifish/controllers/leftcontrollers/ConnectHotspotModel.h new file mode 100644 index 0000000..9b914a7 --- /dev/null +++ b/Ifish/controllers/leftcontrollers/ConnectHotspotModel.h @@ -0,0 +1,16 @@ +// +// ConnectHotspotModel.h +// Ifish +// +// Created by Minghao Xue on 2018/8/6. +// Copyright © 2018年 lianlian. All rights reserved. +// + +#import "baseModel.h" + +@interface ConnectHotspotModel : baseModel + +@property (nonatomic, copy) NSString *ssidName; +@property (nonatomic, copy) NSString *pwd; + +@end diff --git a/Ifish/controllers/leftcontrollers/ConnectHotspotModel.m b/Ifish/controllers/leftcontrollers/ConnectHotspotModel.m new file mode 100644 index 0000000..881c17e --- /dev/null +++ b/Ifish/controllers/leftcontrollers/ConnectHotspotModel.m @@ -0,0 +1,28 @@ +// +// ConnectHotspotModel.m +// Ifish +// +// Created by Minghao Xue on 2018/8/6. +// Copyright © 2018年 lianlian. All rights reserved. +// + +#import "ConnectHotspotModel.h" + +@implementation ConnectHotspotModel + +- (NSString *)description{ + + self.messagetype=@"00"; + self.massagelegth=@"48"; + self.functionCode=@"12"; + self.sendmacId = @"000000000000"; + self.resavemacId = @"000000000000"; + + return [NSString stringWithFormat:@"%@%@%@%@%@%@%@%@", self.messagetype,self.functionCode,self.sendmacId,self.resavemacId,self.massagelegth,[dataContorl hexStringFromString:self.ssidName], [dataContorl hexStringFromString:self.pwd],[self crcCode]]; +} + +- (NSString *)crcCode { + return @"0000"; +} + +@end diff --git a/Ifish/controllers/leftcontrollers/IFishHotpotUDPHelper.h b/Ifish/controllers/leftcontrollers/IFishHotpotUDPHelper.h index f32a41d..cbf3a99 100644 --- a/Ifish/controllers/leftcontrollers/IFishHotpotUDPHelper.h +++ b/Ifish/controllers/leftcontrollers/IFishHotpotUDPHelper.h @@ -25,6 +25,6 @@ @property (nonatomic, weak) id delegate; --(void)broadCaseUDPWith:(NSString *)ssidName pwd:(NSString *)pwd; +-(void)broadCastHotspotConnectCommandWith:(NSString *)ssidName pwd:(NSString *)pwd; @end diff --git a/Ifish/controllers/leftcontrollers/IFishHotpotUDPHelper.m b/Ifish/controllers/leftcontrollers/IFishHotpotUDPHelper.m index 7154100..2dac777 100644 --- a/Ifish/controllers/leftcontrollers/IFishHotpotUDPHelper.m +++ b/Ifish/controllers/leftcontrollers/IFishHotpotUDPHelper.m @@ -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;