添加回调数据的解析过程

This commit is contained in:
xuemh 2018-08-06 22:51:30 +08:00
parent 1028ffa9ac
commit 5614a0a931
5 changed files with 61 additions and 4 deletions

View File

@ -2468,6 +2468,7 @@
E52B400621042ED2003BBA3E /* ConnectHotspotTipViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E52B400421042ED2003BBA3E /* ConnectHotspotTipViewController.xib */; };
E5317A1321188F170014AFDD /* ResetDeviceModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E5317A1221188F170014AFDD /* ResetDeviceModel.m */; };
E5317A1621188F8A0014AFDD /* RestartDeviceModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E5317A1521188F8A0014AFDD /* RestartDeviceModel.m */; };
E5317A19211896080014AFDD /* IFishUDPHelperBackMsgModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E5317A18211896080014AFDD /* IFishUDPHelperBackMsgModel.m */; };
E547870B20728F390060C2C2 /* back_btn@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = E547870A20728F380060C2C2 /* back_btn@2x.png */; };
E547870F2073192E0060C2C2 /* introlImage_iphonex_1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = E547870C2073192D0060C2C2 /* introlImage_iphonex_1.jpg */; };
E54787102073192E0060C2C2 /* introlImage_iphonex_2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = E547870D2073192D0060C2C2 /* introlImage_iphonex_2.jpg */; };
@ -6271,6 +6272,8 @@
E5317A1221188F170014AFDD /* ResetDeviceModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ResetDeviceModel.m; sourceTree = "<group>"; };
E5317A1421188F8A0014AFDD /* RestartDeviceModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RestartDeviceModel.h; sourceTree = "<group>"; };
E5317A1521188F8A0014AFDD /* RestartDeviceModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RestartDeviceModel.m; sourceTree = "<group>"; };
E5317A17211896080014AFDD /* IFishUDPHelperBackMsgModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IFishUDPHelperBackMsgModel.h; sourceTree = "<group>"; };
E5317A18211896080014AFDD /* IFishUDPHelperBackMsgModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IFishUDPHelperBackMsgModel.m; sourceTree = "<group>"; };
E547870A20728F380060C2C2 /* back_btn@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "back_btn@2x.png"; sourceTree = "<group>"; };
E547870C2073192D0060C2C2 /* introlImage_iphonex_1.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = introlImage_iphonex_1.jpg; sourceTree = "<group>"; };
E547870D2073192D0060C2C2 /* introlImage_iphonex_2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = introlImage_iphonex_2.jpg; sourceTree = "<group>"; };
@ -9656,6 +9659,8 @@
883E78201D48A5E50030E075 /* SetViewController.m */,
E567026B21187E7C00E61993 /* ConnectHotspotModel.h */,
E567026C21187E7C00E61993 /* ConnectHotspotModel.m */,
E5317A17211896080014AFDD /* IFishUDPHelperBackMsgModel.h */,
E5317A18211896080014AFDD /* IFishUDPHelperBackMsgModel.m */,
E5F1B03E21184F9400A879A1 /* IFishHotpotUDPHelper.h */,
E5F1B03D21184F9300A879A1 /* IFishHotpotUDPHelper.m */,
E56A745F20FCDBFC000129C9 /* ConnectHotpotViewController.h */,
@ -15659,6 +15664,7 @@
885928CA1E67EC0400E0011E /* JingYanValuelist.m in Sources */,
886F4E041D76CCDC001EDA34 /* PingfenModel.m in Sources */,
8815D2051E037AFD00BEA2DA /* P2PPlayingbackVC.m in Sources */,
E5317A19211896080014AFDD /* IFishUDPHelperBackMsgModel.m in Sources */,
8815D1241DFA8A6500BEA2DA /* CameraRecordViewController.m in Sources */,
883E78D21D48A5E50030E075 /* NetManager.m in Sources */,
881672231EA5DE2B00BEBF23 /* UMComChangeBorderBtn.m in Sources */,

View File

@ -128,6 +128,10 @@
#pragma mark - IFishHotpotUDPHelperDelegate
- (void)udpHelperCommandExecutedSuccess {
[self.view makeToast:@"连接设置成功"];
}
- (void)udpHelperMessage:(NSString *)msg {
[self.view makeToast:msg];
}

View File

@ -12,6 +12,7 @@
#import "ConnectHotspotModel.h"
#import "ResetDeviceModel.h"
#import "RestartDeviceModel.h"
#import "IFishUDPHelperBackMsgModel.h"
@interface IFishHotpotUDPHelper ()
{
@ -135,10 +136,14 @@
NSLog(@"didReceiveData%@",result);
NSLog(@"port%hu",port);
AppDelegate *app =(AppDelegate*)[UIApplication sharedApplication].delegate;
[app.window makeToast:[NSString stringWithFormat:@"收到答复:%@", result]];
if ([self.delegate respondsToSelector:@selector(udpHelperCommandExecutedSuccess)]) {
[self.delegate udpHelperCommandExecutedSuccess];
IFishUDPHelperBackMsgModel *model = [[IFishUDPHelperBackMsgModel alloc] initWithData:data];
if ([model.result isEqualToString:@"01"]) {
if ([self.delegate respondsToSelector:@selector(udpHelperCommandExecutedSuccess)]) {
[self.delegate udpHelperCommandExecutedSuccess];
}
} else {
AppDelegate *app =(AppDelegate*)[UIApplication sharedApplication].delegate;
[app.window makeToast:[NSString stringWithFormat:@"收到答复:%@", result]];
}
[self.loopTimer invalidate];
return YES;

View File

@ -0,0 +1,19 @@
//
// IFishUDPHelperBackMsgModel.h
// Ifish
//
// Created by Minghao Xue on 2018/8/6.
// Copyright © 2018年 lianlian. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface IFishUDPHelperBackMsgModel : NSObject
@property (nonatomic, copy) NSString *result;
@property (nonatomic, copy) NSString *changshang;
@property (nonatomic, copy) NSString *device;
- (instancetype)initWithData:(NSData *)data;
@end

View File

@ -0,0 +1,23 @@
//
// IFishUDPHelperBackMsgModel.m
// Ifish
//
// Created by Minghao Xue on 2018/8/6.
// Copyright © 2018 lianlian. All rights reserved.
//
#import "IFishUDPHelperBackMsgModel.h"
@implementation IFishUDPHelperBackMsgModel
- (instancetype)initWithData:(NSData *)data {
if (self = [super init]) {
NSString*totalString=[dataContorl dataToHexString:data];
self.result = [totalString substringWithRange:NSMakeRange(30, 2)];
self.changshang = [totalString substringWithRange:NSMakeRange(32, 2)];
self.device = [totalString substringWithRange:NSMakeRange(34, 2)];
}
return self;
}
@end