diff --git a/Ifish/controllers/leftcontrollers/ConnectHotpotViewController.m b/Ifish/controllers/leftcontrollers/ConnectHotpotViewController.m index 3406874..7b37132 100644 --- a/Ifish/controllers/leftcontrollers/ConnectHotpotViewController.m +++ b/Ifish/controllers/leftcontrollers/ConnectHotpotViewController.m @@ -24,6 +24,8 @@ @property (nonatomic, strong) ESPTouchTask* epTask; +@property (nonatomic, strong) NSMutableString *trackString; + @end @implementation ConnectHotpotViewController @@ -37,6 +39,19 @@ view.backgroundColor = [UIColor clearColor]; view.image = [self imageWithLineWithSize:view.frame.size]; } + + UITapGestureRecognizer *fiveTapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(test)]; + fiveTapGesture.numberOfTapsRequired = 5; + [self.containerView addGestureRecognizer:fiveTapGesture]; + + IFishUDPHelperBackMsgModel *model = [IFishUDPHelperBackMsgModel new]; + model.result = @"01"; + model.senderMacAddress = @"123456778"; + [self udpHelperCommandExecutedSuccess:model]; +} + +- (void)test { + [UIPasteboard generalPasteboard].string = [self.trackString copy]; } - (UIImage *)imageWithLineWithSize:(CGSize)size{ @@ -136,6 +151,10 @@ - (void)udpHelperCommandExecutedSuccess:(IFishUDPHelperBackMsgModel *)backModel { self.ssid = backModel.senderMacAddress; [self.view makeToast:[NSString stringWithFormat:@"连接设置成功,mac 地址:%@",backModel.senderMacAddress]]; + self.trackString = [NSMutableString string]; + [self appendTrakContent:@"=================收到设备答复==================="]; + [self appendTrakContent:[NSString stringWithFormat:@"答复状态码:%@", backModel.result]]; + [self appendTrakContent:[NSString stringWithFormat:@"答复Mac地址:%@", backModel.senderMacAddress]]; [self bindDeviceWithSsid:backModel.senderMacAddress]; } @@ -146,17 +165,22 @@ #pragma mark - bind -(void)bindDeviceWithSsid:(NSString*)bssid{ NSLog(@"设备bssid_%@",bssid); + [self appendTrakContent:@"=================进入绑定函数================="]; NSString *userId = [dataContorl dataControlGetUserIdInfo]; [self.view makeToast:[NSString stringWithFormat:@"正在绑定设备,bssid:%@", bssid]]; + [self appendTrakContent:[NSString stringWithFormat:@"绑定参数 userID:%@", userId]]; + [self appendTrakContent:[NSString stringWithFormat:@"绑定参数 macaddress:%@", bssid]]; [AFHttpTool bindDeviceWithUserId:userId macAddress:bssid success:^(id response) { NSDictionary*resultDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil]; NSLog(@"data:%@",resultDic[@"data"]); + [self appendTrakContent:[NSString stringWithFormat:@"绑定请求成功。返回数据为:%@", resultDic]]; if ([resultDic[@"result"] isEqualToString:@"100"]) { // 保存设备信息 NSDictionary*dataDic=resultDic[@"data"]; DeviceModel*devicemodel=[[DeviceModel alloc] initWithDict:dataDic]; - + [self appendTrakContent:[NSString stringWithFormat:@"绑定返回状态码正确。设备信息为:%@", dataDic]]; + if (!devicemodel.type){ [self.view makeToast:@"用户绑定设备成功,但设备初次入网失败请重新登陆"]; @@ -183,16 +207,20 @@ } }else if ([resultDic[@"result"] isEqualToString:@"101"]){ - + [self appendTrakContent:@"绑定返回状态码错误。设备信息为:%@"]; + [self.view makeToast:@"绑定失败"]; self.bakbutton.userInteractionEnabled=YES; }else if ([resultDic[@"result"] isEqualToString:@"301"]){ - + [self appendTrakContent:@"绑定返回状态码错误。设备信息为:%@"]; + [self.view makeToast:@"请求验证失败,请重新登录"]; self.bakbutton.userInteractionEnabled=YES; }else if ([resultDic[@"result"] isEqualToString:@"302"]){ // 请求被舍弃未执行 + [self appendTrakContent:@"绑定返回状态码错误。设备信息为:%@"]; + self.bakbutton.userInteractionEnabled=YES; [self.view makeToast:@"绑定失败"]; } @@ -200,10 +228,18 @@ } failure:^(NSError *err) { [self.view makeToast:@"网络异常"]; + [self appendTrakContent:[NSString stringWithFormat:@"绑定网络请求错误:%@", err.localizedDescription]]; self.bakbutton.userInteractionEnabled=YES; }]; } +#pragma mark - Private + +- (void)appendTrakContent:(NSString *)msg { + [self.trackString appendString:msg]; + [self.trackString appendString:@"\n"]; +} + @end diff --git a/Ifish/controllers/leftcontrollers/ResetDeviceModel.m b/Ifish/controllers/leftcontrollers/ResetDeviceModel.m index e64d52d..194a252 100644 --- a/Ifish/controllers/leftcontrollers/ResetDeviceModel.m +++ b/Ifish/controllers/leftcontrollers/ResetDeviceModel.m @@ -13,7 +13,7 @@ - (NSString *)description{ self.messagetype=@"00"; - self.massagelegth=@"11"; + self.massagelegth=@"00"; self.functionCode=@"13"; self.sendmacId = @"000000000000"; self.resavemacId = @"000000000000";