Merge remote-tracking branch 'origin/master'

This commit is contained in:
roy
2018-09-22 21:41:24 +08:00
113 changed files with 5077 additions and 240 deletions
+15 -4
View File
@@ -28,7 +28,18 @@ xcuserdata
*.hmap
*.ipa
作者:kuazi
链接:https://www.jianshu.com/p/82e1d05baf1c
來源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
.DS_Store
# fastlane specific
fastlane/report.xml
# deliver temporary files
fastlane/Preview.html
# snapshot generated screenshots
fastlane/screenshots
# scan temporary files
fastlane/test_output
Ifish.app.dSYM.zip
+3
View File
@@ -0,0 +1,3 @@
source "https://rubygems.org"
gem "fastlane"
+152
View File
@@ -0,0 +1,152 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.0)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
atomos (0.1.2)
babosa (1.0.2)
claide (1.0.2)
colored (1.2)
colored2 (3.1.2)
commander-fastlane (4.4.6)
highline (~> 1.7.2)
declarative (0.0.10)
declarative-option (0.1.0)
domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0)
dotenv (2.5.0)
emoji_regex (0.1.1)
excon (0.62.0)
faraday (0.15.2)
multipart-post (>= 1.2, < 3)
faraday-cookie_jar (0.0.6)
faraday (>= 0.7.4)
http-cookie (~> 1.0.0)
faraday_middleware (0.12.2)
faraday (>= 0.7.4, < 1.0)
fastimage (2.1.3)
fastlane (2.99.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.3, < 3.0.0)
babosa (>= 1.0.2, < 2.0.0)
bundler (>= 1.12.0, < 2.0.0)
colored
commander-fastlane (>= 4.4.6, < 5.0.0)
dotenv (>= 2.1.1, < 3.0.0)
emoji_regex (~> 0.1)
excon (>= 0.45.0, < 1.0.0)
faraday (~> 0.9)
faraday-cookie_jar (~> 0.0.6)
faraday_middleware (~> 0.9)
fastimage (>= 2.1.0, < 3.0.0)
gh_inspector (>= 1.1.2, < 2.0.0)
google-api-client (>= 0.21.2, < 0.22.0)
highline (>= 1.7.2, < 2.0.0)
json (< 3.0.0)
mini_magick (~> 4.5.1)
multi_json
multi_xml (~> 0.5)
multipart-post (~> 2.0.0)
plist (>= 3.1.0, < 4.0.0)
public_suffix (~> 2.0.0)
rubyzip (>= 1.2.1, < 2.0.0)
security (= 0.1.3)
simctl (~> 1.6.3)
slack-notifier (>= 2.0.0, < 3.0.0)
terminal-notifier (>= 1.6.2, < 2.0.0)
terminal-table (>= 1.4.5, < 2.0.0)
tty-screen (>= 0.6.3, < 1.0.0)
tty-spinner (>= 0.8.0, < 1.0.0)
word_wrap (~> 1.0.0)
xcodeproj (>= 1.5.7, < 2.0.0)
xcpretty (~> 0.2.8)
xcpretty-travis-formatter (>= 0.0.3)
gh_inspector (1.1.3)
google-api-client (0.21.2)
addressable (~> 2.5, >= 2.5.1)
googleauth (>= 0.5, < 0.7.0)
httpclient (>= 2.8.1, < 3.0)
mime-types (~> 3.0)
representable (~> 3.0)
retriable (>= 2.0, < 4.0)
googleauth (0.6.2)
faraday (~> 0.12)
jwt (>= 1.4, < 3.0)
logging (~> 2.0)
memoist (~> 0.12)
multi_json (~> 1.11)
os (~> 0.9)
signet (~> 0.7)
highline (1.7.10)
http-cookie (1.0.3)
domain_name (~> 0.5)
httpclient (2.8.3)
json (2.1.0)
jwt (2.1.0)
little-plugger (1.1.4)
logging (2.2.2)
little-plugger (~> 1.1)
multi_json (~> 1.10)
memoist (0.16.0)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_magick (4.5.1)
multi_json (1.13.1)
multi_xml (0.6.0)
multipart-post (2.0.0)
nanaimo (0.2.6)
naturally (2.2.0)
os (0.9.6)
plist (3.4.0)
public_suffix (2.0.5)
representable (3.0.4)
declarative (< 0.1.0)
declarative-option (< 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rouge (2.0.7)
rubyzip (1.2.1)
security (0.1.3)
signet (0.8.1)
addressable (~> 2.3)
faraday (~> 0.9)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
simctl (1.6.5)
CFPropertyList
naturally
slack-notifier (2.3.2)
terminal-notifier (1.8.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
tty-cursor (0.5.0)
tty-screen (0.6.4)
tty-spinner (0.8.0)
tty-cursor (>= 0.5.0)
uber (0.1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
unicode-display_width (1.4.0)
word_wrap (1.0.0)
xcodeproj (1.5.9)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.2)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.2.5)
xcpretty (0.2.8)
rouge (~> 2.0.7)
xcpretty-travis-formatter (1.0.0)
xcpretty (~> 0.2, >= 0.0.7)
PLATFORMS
ruby
DEPENDENCIES
fastlane
BUNDLED WITH
1.14.6
File diff suppressed because one or more lines are too long
+12 -13
View File
@@ -37,7 +37,7 @@
: NO)
#import <Bugly/Bugly.h>
#define BUGLY_APPID @"900013241"
#define BUGLY_APPID @"16d2b238e3"
#import "TalkingData.h"
#define TalkingDataAPPID @"351E6F7956CEF7FB6AABAEB64EF9BF18"
#define BMKMAP_APPKEY @"wYcF3YXqeepKfzruExLPn0eS"
@@ -166,7 +166,6 @@ NSString *NTESNotificationLogout = @"NTESNotificationLogout";
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window.backgroundColor=[UIColor whiteColor];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO];
//崩溃日志
@@ -231,17 +230,6 @@ NSString *NTESNotificationLogout = @"NTESNotificationLogout";
launchedByNotification = NO;
}
/**
* 初始化Bugly
*/
BuglyConfig *config = [[BuglyConfig alloc] init];
config.unexpectedTerminatingDetectionEnable = YES;
config.blockMonitorEnable = YES;
config.reportLogLevel = BuglyLogLevelWarn;
[Bugly startWithAppId:BUGLY_APPID config:config];
//[Bugly startWithAppId:BUGLY_APPID];
/**
* TalkingData 统计工具
*/
@@ -400,6 +388,17 @@ if (kScreenSize.height>480) {
[[AlibcTradeSDK sharedInstance] setIsForceH5:NO];
[self.window makeKeyAndVisible];
/**
* 初始化Bugly
*/
BuglyConfig *config = [[BuglyConfig alloc] init];
config.unexpectedTerminatingDetectionEnable = YES;
config.blockMonitorEnable = YES;
config.debugMode = YES;
config.reportLogLevel = BuglyLogLevelWarn;
[Bugly startWithAppId:BUGLY_APPID config:config];
return YES;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "4251531889028_.pic.jpg",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
+24 -6
View File
@@ -1,7 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
@@ -13,10 +18,20 @@
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="LaunchImage-1" translatesAutoresizingMaskIntoConstraints="NO" id="xcR-bi-fW8">
<rect key="frame" x="0.0" y="20" width="375" height="647"/>
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="xcR-bi-fW8" firstAttribute="top" secondItem="Llm-lL-Icb" secondAttribute="bottom" id="7p1-Za-ueq"/>
<constraint firstAttribute="trailing" secondItem="xcR-bi-fW8" secondAttribute="trailing" id="icG-Xh-wXa"/>
<constraint firstItem="xcR-bi-fW8" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="jge-en-hhV"/>
<constraint firstItem="xb3-aO-Qok" firstAttribute="top" secondItem="xcR-bi-fW8" secondAttribute="bottom" id="vSF-RG-pK4"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -24,4 +39,7 @@
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
<resources>
<image name="LaunchImage-1" width="16" height="16"/>
</resources>
</document>
+14
View File
@@ -0,0 +1,14 @@
//
// CommonMacros.h
// Ifish
//
// Created by Minghao Xue on 2018/3/28.
// Copyright © 2018年 lianlian. All rights reserved.
//
#ifndef CommonMacros_h
#define CommonMacros_h
#define is_iPhone_X ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
#endif /* CommonMacros_h */
+2
View File
@@ -29,6 +29,8 @@
#import "NIMKit.h"
#import <Bugly/BuglyLog.h>
#import "CommonMacros.h"
#define NTES_USE_CLEAR_BAR - (BOOL)useClearBar{return YES;}
#define NTES_FORBID_INTERACTIVE_POP - (BOOL)forbidInteractivePop{return YES;}
+8 -6
View File
@@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>4.6.3</string>
<string>4.6.7</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
@@ -70,7 +70,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>4.6.3</string>
<string>511</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>
@@ -375,19 +375,21 @@
<key>NSCameraUsageDescription</key>
<string>使用相机</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>使用位置服务</string>
<string>为获取爱鱼奇智能硬件产品及用户的地址区域分布,以提供更好的特色服务,爱鱼奇将获取您的地址</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>使用位置服务</string>
<string>为获取爱鱼奇智能硬件产品及用户的地址区域分布,以提供更好的特色服务,爱鱼奇将获取您的地址</string>
<key>NSMicrophoneUsageDescription</key>
<string>使用麦克风</string>
<string>爱鱼奇需要您的同意,才能访问麦克风</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>使用相册</string>
<string>爱鱼奇需要您的同意,才能访问相册</string>
<key>UIApplicationExitsOnSuspend</key>
<false/>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
@@ -15,7 +15,13 @@
#import "ThreeControlName.h"
#import "FourControlName.h"
#import "XuToControlName.h"
#import "RuiMeiCHControl.h"
@interface UserExtendataArchaver : NSObject
//自定义水族箱名字数据
+(void)archiverRuiMeiDeviceCHInfo:(RuiMeiCHControl*)ch;
+(RuiMeiCHControl*)unArchiverRuiMeiDeviceCHInfo:(NSString *)mac;
//自定义水族箱名字数据
+(void)archiverDeviceCHInfo:(RunSunCHControl*)ch;
+(RunSunCHControl*)unArchiverDeviceCHInfo:(NSString *)mac;
@@ -9,6 +9,20 @@
#import "UserExtendataArchaver.h"
@implementation UserExtendataArchaver
+(void)archiverRuiMeiDeviceCHInfo:(RuiMeiCHControl*)ch {
NSString *key = [NSString stringWithFormat:@"Ruimei%@",ch.macAd];
NSString *file = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject stringByAppendingPathComponent:key];
[NSKeyedArchiver archiveRootObject:ch toFile:file];
}
+(RuiMeiCHControl*)unArchiverRuiMeiDeviceCHInfo:(NSString *)mac {
NSString *key = [NSString stringWithFormat:@"Ruimei%@",mac];
NSString *file = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject stringByAppendingPathComponent:key];
RuiMeiCHControl *ch = [NSKeyedUnarchiver unarchiveObjectWithFile:file];
return ch;
}
+(void)archiverDeviceCHInfo:(RunSunCHControl*)ch
{
NSString *key = [NSString stringWithFormat:@"Rusun%@",ch.macAd];
@@ -90,6 +90,17 @@ typedef void(^kanHuShangJia)(CertificationShopModel*kanHuShangJia);
-(void)getverifyWithTimerButton:(UIButton*)timeBtn addphoneNumber:(NSString*)phoneNumber zone:
(NSString*)areaCode result:(void (^)(NSError *err))result;
/**
* 获取验证码 SMS
*
* @param timeBtn 验证码按钮
* @param zone 区域号,不要加"+"号(Area code)
* @param isTextCode 是否为短信验证码
*/
-(void)getverifyWithTimerButton:(UIButton*)timeBtn addphoneNumber:(NSString*)phoneNumber zone:
(NSString*)areaCode isTextCode:(BOOL)isTextCode result:(void (^)(NSError *err))result;
/**
* 注册
@@ -177,12 +177,12 @@
addPhoneNumber:(NSString*)phoneNumber
addSendType:(NSString*)sendType
backData:(backVerifyCode)backVerifyCodeblock{
[self timerFireWithTimerButton:timeBtn addPhoneNumber:phoneNumber];
[self timerFireWithTimerButton:timeBtn addPhoneNumber:phoneNumber timeBtnFinalTitle:@"语音验证码"];
[self getverifyWithTimerButton:timeBtn addphoneNumber:phoneNumber AddSendType:sendType backData:backVerifyCodeblock];
}
#pragma mark 倒计时
-(void)timerFireWithTimerButton:(UIButton*)timeBtn addPhoneNumber:(NSString*)phoneNumber{
-(void)timerFireWithTimerButton:(UIButton*)timeBtn addPhoneNumber:(NSString*)phoneNumber timeBtnFinalTitle:(NSString *)title{
__block int timeout=60; //倒计时时间
@@ -195,7 +195,7 @@
dispatch_async(dispatch_get_main_queue(), ^{
//设置界面的按钮显示 根据自己需求设置
[timeBtn setTitle:@"语音验证码" forState:UIControlStateNormal];
[timeBtn setTitle:title forState:UIControlStateNormal];
timeBtn.userInteractionEnabled = YES;
//timeBtn.backgroundColor=COLOR_LABEL_TITLE;
[timeBtn setBackgroundImage:[UIImage imageNamed:@"registered_icon_validation"] forState:UIControlStateNormal];
@@ -232,7 +232,7 @@
dispatch_source_cancel(_timer1);
dispatch_async(dispatch_get_main_queue(), ^{
//设置界面的按钮显示 根据自己需求设置
[timeBtn setTitle:@"语音验证码" forState:UIControlStateNormal];
[timeBtn setTitle:title forState:UIControlStateNormal];
timeBtn.userInteractionEnabled = YES;
//timeBtn.backgroundColor=COLOR_LABEL_TITLE;
[timeBtn setBackgroundImage:[UIImage imageNamed:@"registered_icon_validation"] forState:UIControlStateNormal];
@@ -311,11 +311,42 @@
#pragma mark - SMS 新
-(void)getverifyWithTimerButton:(UIButton*)timeBtn addphoneNumber:(NSString*)phoneNumber zone:
(NSString*)areaCode result:(void (^)(NSError *err))result
(NSString*)areaCode isTextCode:(BOOL)isTextCode result:(void (^)(NSError *))result
{
NSString *title = isTextCode ? @"短信验证码" : @"语音验证码";
[self timerFireWithTimerButton:timeBtn addPhoneNumber:phoneNumber timeBtnFinalTitle:title];
[SMSSDK getVerificationCodeByMethod:isTextCode ? SMSGetCodeMethodSMS : SMSGetCodeMethodVoice phoneNumber:phoneNumber zone:areaCode customIdentifier:nil result:^(NSError *error) {
if (!error) {
NSLog(@"获取验证码成功");
} else {
NSLog(@"错误信息:%@",error);
dispatch_source_cancel(_timer1);
dispatch_async(dispatch_get_main_queue(), ^{
//设置界面的按钮显示 根据自己需求设置
[timeBtn setTitle:title forState:UIControlStateNormal];
timeBtn.userInteractionEnabled = YES;
//timeBtn.backgroundColor=COLOR_LABEL_TITLE;
[timeBtn setBackgroundImage:[UIImage imageNamed:@"registered_icon_validation"] forState:UIControlStateNormal];
});
[self showTitle:@"" messsage:@"获取验证失败"];
}
}];
}
-(void)getverifyWithTimerButton:(UIButton*)timeBtn addphoneNumber:(NSString*)phoneNumber zone:
(NSString*)areaCode result:(void (^)(NSError *))result
{
[self timerFireWithTimerButton:timeBtn addPhoneNumber:phoneNumber];
[self timerFireWithTimerButton:timeBtn addPhoneNumber:phoneNumber timeBtnFinalTitle:@"语音验证码"];
[SMSSDK getVerificationCodeByMethod:SMSGetCodeMethodVoice phoneNumber:phoneNumber zone:areaCode customIdentifier:nil result:^(NSError *error) {
@@ -19,6 +19,8 @@
#import "RuSunHaveHeateViewController.h"
#import "SongNuoDBCenterViewController.h"
#import "RunSun84biteCenterViewController.h"
#import "RuiMeiViewController.h"
//默认选中 下表类型
//typedef NS_ENUM (NSInteger,saveIndexType){
//
@@ -140,6 +140,15 @@
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
app1.window.rootViewController=nav;
} else if ([devicemodel.type isEqualToString:DECICE_TYPE_RUIMEI]) {
RuiMeiViewController *ruimeiCenter=[[RuiMeiViewController alloc] init];
ruimeiCenter.currentDevice = devicemodel;
UIApplication*app=[UIApplication sharedApplication];
AppDelegate*app1=(AppDelegate*)app.delegate;
UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:ruimeiCenter];
[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
app1.window.rootViewController=nav;
}else{
int controlAmount=[devicemodel.controlAmount intValue];
@@ -46,5 +46,7 @@
//睿芯 独立 84 字节
#define DECICE_TYPE_RUSUN2A @"2a" //0x2a
//瑞美4控
#define DECICE_TYPE_RUIMEI @"2b"
#endif /* IfishDeviceInfo_h */
@@ -26,6 +26,11 @@ static char overlayKey;
if (!self.overlay) {
[self setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
self.overlay = [[UIView alloc] initWithFrame:CGRectMake(0, -20, [UIScreen mainScreen].bounds.size.width, CGRectGetHeight(self.bounds) + 20)];
if (@available(iOS 11.0, *)) {
self.overlay = [[UIView alloc] initWithFrame:CGRectMake(0, -44, [UIScreen mainScreen].bounds.size.width, CGRectGetHeight(self.bounds) + 44)];
} else {
self.overlay = [[UIView alloc] initWithFrame:CGRectMake(0, -20, [UIScreen mainScreen].bounds.size.width, CGRectGetHeight(self.bounds) + 20)];
}
self.overlay.userInteractionEnabled = NO;
self.overlay.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
[self insertSubview:self.overlay atIndex:0];
@@ -29,6 +29,8 @@
UITableViewCell *cell = nil;
id model = [[self.interactor items] objectAtIndex:indexPath.row];
if ([model isKindOfClass:[NIMMessageModel class]]) {
[model calculateContent:tableView.bounds.size.width force:NO];
cell = [NIMMessageCellFactory cellInTable:tableView
forMessageMode:model];
[(NIMMessageCell *)cell setDelegate:self.delegate];
@@ -56,7 +56,7 @@
// self.navigationItem.backBarButtonItem=backItem;
_bakbutton = [UIButton buttonWithType:UIButtonTypeCustom];
_bakbutton.frame = CGRectMake(0,0,48,44);
[_bakbutton setImage:[UIImage imageNamed:@"arrow_l"] forState:UIControlStateNormal];
[_bakbutton setImage:[UIImage imageNamed:@"back_btn"] forState:UIControlStateNormal];
[_bakbutton addTarget: self action: @selector(goBackAction) forControlEvents: UIControlEventTouchUpInside];
@@ -47,7 +47,7 @@
_bakbutton = [UIButton buttonWithType:UIButtonTypeCustom];
_bakbutton.frame = CGRectMake(0,0,48,44);
[_bakbutton setImage:[UIImage imageNamed:@"arrow_l"] forState:UIControlStateNormal];
[_bakbutton setImage:[UIImage imageNamed:@"back_btn"] forState:UIControlStateNormal];
[_bakbutton addTarget: self action: @selector(goBackAction) forControlEvents: UIControlEventTouchUpInside];
@@ -21,12 +21,7 @@
}
-(void)setNav{
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
btn.frame = CGRectMake(2, 5,47, 44);
[btn setBackgroundImage:[UIImage imageNamed:@"arrow_l"] forState:UIControlStateNormal];
[btn addTarget: self action: @selector(goBackAction) forControlEvents: UIControlEventTouchUpInside];
UIBarButtonItem*back=[[UIBarButtonItem alloc]initWithCustomView:btn];
UIBarButtonItem*back=[[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"back_btn"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStyleDone target:self action:@selector(goBackAction)];
self.navigationItem.leftBarButtonItem=back;
}
- (void)addTitleViewWithTitle:(NSString *)title{
@@ -43,18 +43,8 @@
}
-(void)initNav{
// 1. 可以改变全栈back按钮 图片 60*60 @2x像素
_bakbutton = [UIButton buttonWithType:UIButtonTypeCustom];
_bakbutton.frame = CGRectMake(0,0,48,44);
[_bakbutton setImage:[UIImage imageNamed:@"arrow_b"] forState:UIControlStateNormal];
[_bakbutton addTarget: self action: @selector(goBackAction) forControlEvents: UIControlEventTouchUpInside];
_back=[[UIBarButtonItem alloc] initWithCustomView:_bakbutton];
_back =[[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"back_btn_1"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStyleDone target:self action:@selector(goBackAction)];
self.navigationItem.leftBarButtonItem=_back;
}
-(void)goBackAction{
@@ -127,7 +127,7 @@
// 左侧按钮背景
UIImage *hamburger = [UIImage imageNamed:@"arrow_l"];
UIImage *hamburger = [[UIImage imageNamed:@"back_btn"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
self.openDrawerButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.openDrawerButton.frame = CGRectMake(0, 0, 47,44);
[self.openDrawerButton setImage:hamburger forState:UIControlStateNormal];
@@ -135,8 +135,6 @@
[self.openDrawerButton addTarget:self action:@selector(leftBtnGoBackAction) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *leftItem=[[UIBarButtonItem alloc] initWithImage:hamburger style:UIBarButtonItemStylePlain target:self action:@selector(leftBtnGoBackAction)];
leftItem.customView = self.openDrawerButton;
self.navigationItem.leftBarButtonItem = leftItem;
@@ -14,7 +14,7 @@
[aCoder encodeObject:_light1 forKey:@"light1"];
[aCoder encodeObject:_light2 forKey:@"light2"];
[aCoder encodeObject:_uvName forKey:@"uvName"];
[aCoder encodeObject:_pumpName forKey:@"pumpName"];
[aCoder encodeObject:_macAddress forKey:@"macAddress"];
}
@@ -24,6 +24,7 @@
self.light1=[aDecoder decodeObjectForKey:@"light1"];
self.light2=[aDecoder decodeObjectForKey:@"light2"];
self.uvName = [aDecoder decodeObjectForKey:@"uvName"];
self.pumpName=[aDecoder decodeObjectForKey:@"pumpName"];
self.macAddress = [aDecoder decodeObjectForKey:@"macAddress"];
@@ -123,7 +123,7 @@
[self.view makeToast:@"UV不能为空"];
return;
}
name.uvName = cell2.chName.text;
name.uvName = cell3.chName.text;
RuSunChangeNameTextViewCell*cell4 = [self.view viewWithTag:FOURCHCELL_PUMP];
if (cell4.chName.text.length>3) {
@@ -90,9 +90,14 @@
self.button.tag=231+i;
CGFloat y = 0;
if (is_iPhone_X) {
y = kScreenSize.height -180 - 34 + 10;
} else {
y = kScreenSize.height -180 + 10;
}
self.button.frame=CGRectMake((wspace+i * (btnwidth+wspace)), (kScreenSize.height -180 + 10),btnwidth, btnwidth * 243/210);
self.button.frame=CGRectMake((wspace+i * (btnwidth+wspace)), y,btnwidth, btnwidth * 243/210);
[self.button setImage:[UIImage imageNamed:nomalarr[i]] forState:UIControlStateNormal];
[self.button addTarget:self action:@selector(fourControlBtnCilck:) forControlEvents:UIControlEventTouchUpInside];
@@ -118,8 +123,13 @@
NSArray*arry=@[@"灯1",@"灯2",@"UV杀菌",@"冲浪/氧泵"];
for (int j=0; j<nomalarr.count; j++){
UILabel *buttonNameLabel=[[UILabel alloc]initWithFrame:CGRectMake((wspace+j * (btnwidth+wspace)) - 5,(kScreenSize.height-180+btnwidth+20),btnwidth +10, 20)];
CGFloat y = 0;
if (is_iPhone_X) {
y = kScreenSize.height-180+btnwidth+20 - 34;
} else {
y = kScreenSize.height-180+btnwidth+20;
}
UILabel *buttonNameLabel=[[UILabel alloc]initWithFrame:CGRectMake((wspace+j * (btnwidth+wspace)) - 5,y,btnwidth +10, 20)];
@@ -0,0 +1,45 @@
//
// RuiMeiBackMsgUtils.h
// Ifish
//
// Created by Minghao Xue on 2018/4/14.
// Copyright © 2018年 lianlian. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "RuiMeiProtocolModel.h"
#define DataCenterRuiMeiModelKey @"DataCenterRuiMeiModelKey"
@interface RuiMeiBackMsgUtils : NSObject
/**
* save soket massage control
*/
+(void)readSoketDataWithBaackMassgModel:(RuiMeiProtocolModel*)ruSunModel
addWithBackData:(NSData*)data;
/**
* setTemperaturelabel
*/
+(void)setTemperaturelabel:(UILabel*)temperaturelabel
addbubleImge:(UIImageView*)bubleImg
WithBackData:(NSData*)data
addWithBackMassageModel:(RuiMeiProtocolModel*)backModel
addWithTableview:(UITableView*)tableview;
/**
* light state
*/
+(void)resetRuSunCHState:(UIButton*)ch1
ch2:(UIButton*)ch2
ch3:(UIButton*)ch3
ch4:(UIButton*)ch4
andJiaRe:(UIButton*)jiaReBang
withBackModel:(RuiMeiProtocolModel*)backModel;
/**
* refresh setViewData
*/
+(NSArray*)refreshRuSunTimerAddTemperatureWithBackMassageModel:(RuiMeiProtocolModel*)backModel;
@end
@@ -0,0 +1,231 @@
//
// RuiMeiBackMsgUtils.m
// Ifish
//
// Created by Minghao Xue on 2018/4/14.
// Copyright © 2018年 lianlian. All rights reserved.
//
#import "RuiMeiBackMsgUtils.h"
@implementation RuiMeiBackMsgUtils
+(void)readSoketDataWithBaackMassgModel:(RuiMeiProtocolModel*)ruSunModel
addWithBackData:(NSData*)data
{
NSString*totalString=[dataContorl dataToHexString:data];
//无运行模式
ruSunModel.ch1=[totalString substringWithRange:NSMakeRange(30, 4)];
ruSunModel.ch2=[totalString substringWithRange:NSMakeRange(34, 4)];
ruSunModel.ch3 = [totalString substringWithRange:NSMakeRange(38, 4)];
ruSunModel.ch4 = [totalString substringWithRange:NSMakeRange(42, 4)];
ruSunModel.customModel = [totalString substringWithRange:NSMakeRange(46, 4)];
ruSunModel.timer1=[totalString substringWithRange:NSMakeRange(50,12)];
ruSunModel.timer2=[totalString substringWithRange:NSMakeRange(62, 12)];
ruSunModel.timer3=[totalString substringWithRange:NSMakeRange(74, 12)];
ruSunModel.timer4=[totalString substringWithRange:NSMakeRange(86, 12)];
ruSunModel.timer5=[totalString substringWithRange:NSMakeRange(98, 12)];
ruSunModel.timer6=[totalString substringWithRange:NSMakeRange(110, 12)];
ruSunModel.timer7=[totalString substringWithRange:NSMakeRange(122, 12)];
ruSunModel.timer8=[totalString substringWithRange:NSMakeRange(134, 12)];
ruSunModel.heatStickState=[totalString substringWithRange:NSMakeRange(146, 2)];//16进制型
ruSunModel.wendu=[totalString substringWithRange:NSMakeRange(148, 4)];
ruSunModel.heatTemperature=[totalString substringWithRange:NSMakeRange(152, 4)];
ruSunModel.shiwen = [totalString substringWithRange:NSMakeRange(156, 4)];
ruSunModel.baojingSwitch=[totalString substringWithRange:NSMakeRange(160, 2)];
ruSunModel.miniTp=[totalString substringWithRange:NSMakeRange(162, 4)];
ruSunModel.maxTp=[totalString substringWithRange:NSMakeRange(166, 4)];
ruSunModel.funcCode= [totalString substringWithRange:NSMakeRange(170, 4)];
[[DataCenter defaultDtacenter] setValue:ruSunModel forKey:DataCenterRuiMeiModelKey];
}
+(void)setTemperaturelabel:(UILabel*)temperaturelabel
addbubleImge:(UIImageView*)bubleImg
WithBackData:(NSData*)data
addWithBackMassageModel:(RuiMeiProtocolModel*)backModel
addWithTableview:(UITableView*)tableview
{
NSString*str=[dataContorl dataToHexString:data];
str=[str substringWithRange:NSMakeRange(148,4)];
UInt64 mac=[dataContorl hexToTen:str];
float TPlabel=mac/10+(mac%10)*0.1;
NSString *stringFloat = [NSString stringWithFormat:@"%.1f",TPlabel];
NSLog(@"%@",stringFloat);
dispatch_async(dispatch_get_main_queue(), ^{
if (mac==0) {
temperaturelabel.text=@"00.0";
}else{
temperaturelabel.text=stringFloat;
}
});
}
+(void)resetRuSunCHState:(UIButton*)ch1
ch2:(UIButton*)ch2
ch3:(UIButton*)ch3
ch4:(UIButton*)ch4
andJiaRe:(UIButton*)jiaReBang
withBackModel:(RuiMeiProtocolModel*)backModel
{
// ch1
NSString*stateString1=[backModel.ch1 substringWithRange:NSMakeRange(2, 2)];
if ([stateString1 isEqualToString:@"01"]) {
[ch1 setImage:[UIImage imageNamed:@"PFLight1_on"] forState:UIControlStateNormal];
ch1.selected=YES;
}else{
[ch1 setImage:[UIImage imageNamed:@"PFLight1_off"] forState:UIControlStateNormal];
ch1.selected=NO;
}
// ch2
NSString*stateString2=[backModel.ch2 substringWithRange:NSMakeRange(2, 2)];
if ([stateString2 isEqualToString:@"01"]) {
[ch2 setImage:[UIImage imageNamed:@"PFLight1_on"] forState:UIControlStateNormal];
ch2.selected=YES;
}else{
[ch2 setImage:[UIImage imageNamed:@"PFLight1_off"] forState:UIControlStateNormal];
ch2.selected=NO;
}
// ch3
NSString*stateString3=[backModel.ch3 substringWithRange:NSMakeRange(2, 2)];
if ([stateString3 isEqualToString:@"01"]){
[ch3 setImage:[UIImage imageNamed:@"PFkilLlight_on"] forState:UIControlStateNormal];
ch3.selected=YES;
}else{
[ch3 setImage:[UIImage imageNamed:@"PFkilLlight_off"] forState:UIControlStateNormal];
ch3.selected=NO;
}
// ch4
NSString*stateString4=[backModel.ch4 substringWithRange:NSMakeRange(2, 2)];
if ([stateString4 isEqualToString:@"01"]){
[ch4 setImage:[UIImage imageNamed:@"O2_on"] forState:UIControlStateNormal];
ch4.selected=YES;
}else{
[ch4 setImage:[UIImage imageNamed:@"O2_off"] forState:UIControlStateNormal];
ch4.selected=NO;
}
// 加热制冷 状态 1字节
NSString*stateString6=[backModel.heatStickState substringWithRange:NSMakeRange(0, 2)];
UInt64 mac=[dataContorl hexToTen:backModel.heatTemperature];
float TPlabel=mac/10;
int temp= (int)(TPlabel+0.5);
NSString *stringFloat = [NSString stringWithFormat:@"%d",temp];
UILabel *lbl = [jiaReBang viewWithTag:1];
if ([stateString6 isEqualToString:@"01"]){
//加热
lbl.textColor = JWUIColorFromRGB(0x38b9fc);
}else{
lbl.textColor = [UIColor lightGrayColor];
}
lbl.text = [NSString stringWithFormat:@"%@°C", stringFloat];
}
+(NSArray*)refreshRuSunTimerAddTemperatureWithBackMassageModel:(RuiMeiProtocolModel*)backModel
{
NSArray*timerArr=[[NSArray alloc]init];
NSString*low=backModel.miniTp;
NSString*heigh=backModel.maxTp;
UInt64 lowten=[dataContorl hexToTen:low];
UInt64 heighten=[dataContorl hexToTen:heigh];
float formatlow=lowten/10;
float formatheigh=heighten/10;
NSString*wenduString=[NSString stringWithFormat:@"%.0f~%.0f°C",formatlow,formatheigh];
// 十六进制
NSString*startTimeHex1=[backModel.timer1 substringWithRange:NSMakeRange(4, 4)];
NSString*endTimeHex1=[backModel.timer1 substringWithRange:NSMakeRange(8, 4)];
// 十进制
NSString*startTimeTen1=[dataContorl hexStringToDateString:startTimeHex1];
NSString*endTimeTen1=[dataContorl hexStringToDateString:endTimeHex1];
NSString*setTim1=[NSString stringWithFormat:@"%@~%@",startTimeTen1,endTimeTen1];
// 十六进制
NSString*startTimeHex2=[backModel.timer2 substringWithRange:NSMakeRange(4, 4)];
NSString*endTimeHex2=[backModel.timer2 substringWithRange:NSMakeRange(8, 4)];
// 十进制
NSString*startTimeTen2=[dataContorl hexStringToDateString:startTimeHex2];
NSString*endTimeTen2=[dataContorl hexStringToDateString:endTimeHex2];
NSString*setTim2=[NSString stringWithFormat:@"%@~%@",startTimeTen2,endTimeTen2];
// 十六进制
NSString*startTimeHex3=[backModel.timer3 substringWithRange:NSMakeRange(4, 4)];
NSString*endTimeHex3=[backModel.timer3 substringWithRange:NSMakeRange(8, 4)];
// 十进制
NSString*startTimeTen3=[dataContorl hexStringToDateString:startTimeHex3];
NSString*endTimeTen3=[dataContorl hexStringToDateString:endTimeHex3];
NSString*setTim3=[NSString stringWithFormat:@"%@~%@",startTimeTen3,endTimeTen3];
// 十六进制
NSString*startTimeHex4=[backModel.timer4 substringWithRange:NSMakeRange(4, 4)];
NSString*endTimeHex4=[backModel.timer4 substringWithRange:NSMakeRange(8, 4)];
// 十进制
NSString*startTimeTen4=[dataContorl hexStringToDateString:startTimeHex4];
NSString*endTimeTen4=[dataContorl hexStringToDateString:endTimeHex4];
NSString*setTim4=[NSString stringWithFormat:@"%@~%@",startTimeTen4,endTimeTen4];
// 十六进制
NSString*startTimeHex5=[backModel.timer5 substringWithRange:NSMakeRange(4, 4)];
NSString*endTimeHex5=[backModel.timer5 substringWithRange:NSMakeRange(8, 4)];
// 十进制
NSString*startTimeTen5=[dataContorl hexStringToDateString:startTimeHex5];
NSString*endTimeTen5=[dataContorl hexStringToDateString:endTimeHex5];
NSString*setTim5=[NSString stringWithFormat:@"%@~%@",startTimeTen5,endTimeTen5];
// 十六进制
NSString*startTimeHex6=[backModel.timer6 substringWithRange:NSMakeRange(4, 4)];
NSString*endTimeHex6=[backModel.timer6 substringWithRange:NSMakeRange(8, 4)];
// 十进制
NSString*startTimeTen6=[dataContorl hexStringToDateString:startTimeHex6];
NSString*endTimeTen6=[dataContorl hexStringToDateString:endTimeHex6];
NSString*setTim6=[NSString stringWithFormat:@"%@~%@",startTimeTen6,endTimeTen6];
// 十六进制
NSString*startTimeHex7=[backModel.timer7 substringWithRange:NSMakeRange(4, 4)];
NSString*endTimeHex7=[backModel.timer7 substringWithRange:NSMakeRange(8, 4)];
// 十进制
NSString*startTimeTen7=[dataContorl hexStringToDateString:startTimeHex7];
NSString*endTimeTen7=[dataContorl hexStringToDateString:endTimeHex7];
NSString*setTim7=[NSString stringWithFormat:@"%@~%@",startTimeTen7,endTimeTen7];
// 十六进制
NSString*startTimeHex8=[backModel.timer8 substringWithRange:NSMakeRange(4, 4)];
NSString*endTimeHex8=[backModel.timer8 substringWithRange:NSMakeRange(8, 4)];
// 十进制
NSString*startTimeTen8=[dataContorl hexStringToDateString:startTimeHex8];
NSString*endTimeTen8=[dataContorl hexStringToDateString:endTimeHex8];
NSString*setTim8=[NSString stringWithFormat:@"%@~%@",startTimeTen8,endTimeTen8];
timerArr=@[@[wenduString,@"设置时段"],@[setTim1,setTim2],@[setTim3,setTim4],@[setTim5,setTim6],@[setTim7,setTim8,@""]];
return timerArr;
}
@end
@@ -0,0 +1,18 @@
//
// RuiMeiCHControl.h
// Ifish
//
// Created by Minghao Xue on 2018/4/22.
// Copyright © 2018年 lianlian. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface RuiMeiCHControl : NSObject
@property (nonatomic,copy) NSString *ch1name;
@property (nonatomic,copy) NSString *ch2name;
@property (nonatomic,copy) NSString *ch3name;
@property (nonatomic,copy) NSString *ch4name;
@property (nonatomic,copy) NSString *jiaRe;
@property (nonatomic,copy) NSString *macAd;
@end
@@ -0,0 +1,36 @@
//
// RuiMeiCHControl.m
// Ifish
//
// Created by Minghao Xue on 2018/4/22.
// Copyright © 2018 lianlian. All rights reserved.
//
#import "RuiMeiCHControl.h"
@implementation RuiMeiCHControl
-(void)encodeWithCoder:(NSCoder*)aCoder{
[aCoder encodeObject:_ch1name forKey:@"ch1name"];
[aCoder encodeObject:_ch2name forKey:@"ch2name"];
[aCoder encodeObject:_ch3name forKey:@"ch3name"];
[aCoder encodeObject:_ch4name forKey:@"ch4name"];
[aCoder encodeObject:_macAd forKey:@"macaddress"];
[aCoder encodeObject:_jiaRe forKey:@"jiaRe"];
}
-(id)initWithCoder:(NSCoder*)aDecoder{
if (self=[super init]) {
self.ch1name=[aDecoder decodeObjectForKey:@"ch1name"];
self.ch2name=[aDecoder decodeObjectForKey:@"ch2name"];
self.ch3name=[aDecoder decodeObjectForKey:@"ch3name"];
self.ch4name=[aDecoder decodeObjectForKey:@"ch4name"];
self.macAd = [aDecoder decodeObjectForKey:@"macaddress"];
self.jiaRe = [aDecoder decodeObjectForKey:@"jiaRe"];
}
return self;
}
@end
@@ -0,0 +1,17 @@
//
// RuiMeiCHNameCustom.h
// Ifish
//
// Created by Minghao Xue on 2018/4/22.
// Copyright © 2018年 lianlian. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "RuiMeiCHControl.h"
@interface RuiMeiCHNameCustom : NSObject
+(void)saveCHname:(RuiMeiCHControl*)chModel;
+(RuiMeiCHControl *)currentdevice:(NSString *)macaddress;
@end
@@ -0,0 +1,36 @@
//
// RuiMeiCHNameCustom.m
// Ifish
//
// Created by Minghao Xue on 2018/4/22.
// Copyright © 2018 lianlian. All rights reserved.
//
#import "RuiMeiCHNameCustom.h"
#import "UserExtendataArchaver.h"
@implementation RuiMeiCHNameCustom
+(void)saveCHname:(RuiMeiCHControl*)chModel
{
[UserExtendataArchaver archiverRuiMeiDeviceCHInfo:chModel];
}
+(RuiMeiCHControl *)currentdevice:(NSString *)macaddress
{
RuiMeiCHControl *runsunCH = [UserExtendataArchaver unArchiverRuiMeiDeviceCHInfo:macaddress];
if (!runsunCH||[runsunCH isKindOfClass:[NSNull class]]) {
runsunCH = [[RuiMeiCHControl alloc] init];
runsunCH.ch1name = @"灯1";
runsunCH.ch2name = @"灯2";
runsunCH.ch3name = @"UV/杀菌";
runsunCH.ch4name = @"冲浪/氧泵";
runsunCH.jiaRe = @"加热棒";
runsunCH.macAd = macaddress;
}
return runsunCH;
}
@end
@@ -0,0 +1,13 @@
//
// RuiMeiInputViewController.h
// Ifish
//
// Created by Minghao Xue on 2018/4/23.
// Copyright © 2018年 lianlian. All rights reserved.
//
#import "IfishDeviceControlNameBaseController.h"
@interface RuiMeiInputViewController : IfishDeviceControlNameBaseController
@end
@@ -0,0 +1,157 @@
//
// RuiMeiInputViewController.m
// Ifish
//
// Created by Minghao Xue on 2018/4/23.
// Copyright © 2018 lianlian. All rights reserved.
//
#import "RuiMeiInputViewController.h"
#import "RuSunChangeNameTextViewCell.h"
#define RUSUNCHCELL_CH1 20000
#define RUSUNCHCELL_CH2 20001
#define RUSUNCHCELL_CH3 20002
#define RUSUNCHCELL_CH4 20003
#define RUSUNCHCELL_JIARE 20004
#import "RuiMeiCHNameCustom.h"
#import "RuiMeiCHControl.h"
#import "UserExtendataArchaver.h"
@interface RuiMeiInputViewController ()
@end
@implementation RuiMeiInputViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.tableView.dataSource =self;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (section==0) {
return 1;
}else{
return 5;
}
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 2;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section==0) {
return [super baseViewLoadDeviceNameCell:indexPath intable:tableView];
}
RuSunChangeNameTextViewCell*cell=[tableView dequeueReusableCellWithIdentifier:@"RuSunChangeNameTextViewCell"];
if (cell==nil) {
cell= [[[NSBundle mainBundle]loadNibNamed:@"RuSunChangeNameTextViewCell" owner:self options:nil]lastObject];
}
//
if (indexPath.row==4&&indexPath.section==1) {
cell.lineImgView.image = [UIImage imageNamed:@"redact_line_last"];
}
NSArray *titles= @[@"灯1",@"灯2",@"UV/杀菌",@"冲浪/氧泵",@"加热棒"];
if (indexPath.section==1) {
cell.chTitle.text = titles[indexPath.row];
}
//
RuiMeiCHControl * ruSunch = [RuiMeiCHNameCustom currentdevice:self.device.macAddress];
if (indexPath.section==1&&indexPath.row==0) {
cell.chName.text = ruSunch.ch1name;
}else if (indexPath.section==1&&indexPath.row==1){
cell.chName.text = ruSunch.ch2name;
}else if (indexPath.section==1&&indexPath.row==2){
cell.chName.text = ruSunch.ch3name;
}else if (indexPath.section==1&&indexPath.row==3){
cell.chName.text = ruSunch.ch4name;
}else if (indexPath.section==1&&indexPath.row==4){
cell.chName.text = ruSunch.jiaRe;
}
cell.chName.delegate = self;
cell.tag = 20000 + indexPath.row;
return cell;
}
-(void)sureAction
{
//RuiMeiCHNameCustom
RuiMeiCHControl *ruSunch = [[RuiMeiCHControl alloc] init];
RuSunChangeNameTextViewCell*cell1 = [self.view viewWithTag:RUSUNCHCELL_CH1];
if (cell1.chName.text.length>3) {
[self.view makeToast:@"灯1不能超过3个字"];
return;
}
if (cell1.chName.text.length==0) {
[self.view makeToast:@"灯1不能为空"];
return;
}
ruSunch.ch1name = cell1.chName.text;
RuSunChangeNameTextViewCell*cell2 = [self.view viewWithTag:RUSUNCHCELL_CH2];
if (cell2.chName.text.length>3) {
[self.view makeToast:@"S2不能超过3个字"];
return;
}
if (cell2.chName.text.length==0) {
[self.view makeToast:@"S2不能为空"];
return;
}
ruSunch.ch2name = cell2.chName.text;
RuSunChangeNameTextViewCell*cell3 = [self.view viewWithTag:RUSUNCHCELL_CH3];
if (cell3.chName.text.length>3) {
[self.view makeToast:@"UV/杀菌不能超过3个字"];
return;
}
if (cell3.chName.text.length==0) {
[self.view makeToast:@"UV/杀菌不能为空"];
return;
}
ruSunch.ch3name = cell3.chName.text;
RuSunChangeNameTextViewCell*cell4 = [self.view viewWithTag:RUSUNCHCELL_CH4];
if (cell4.chName.text.length>3) {
[self.view makeToast:@"冲浪/氧泵不能超过3个字"];
return;
}
if (cell4.chName.text.length==0) {
[self.view makeToast:@"冲浪/氧泵不能为空"];
return;
}
ruSunch.ch4name = cell4.chName.text;
RuSunChangeNameTextViewCell*cell5 = [self.view viewWithTag:RUSUNCHCELL_JIARE];
if (cell5.chName.text.length>3) {
[self.view makeToast:@"加热棒名不能超过3个字"];
return;
}
if (cell5.chName.text.length==0) {
[self.view makeToast:@"加热棒名不能为空"];
return;
}
ruSunch.jiaRe = cell5.chName.text;
ruSunch.macAd = self.device.macAddress;
[RuiMeiCHNameCustom saveCHname:ruSunch];
[self upLoadDeviceName];
}
@end
@@ -0,0 +1,37 @@
//
// RuiMeiProtocolModel.h
// Ifish
//
// Created by Minghao Xue on 2018/4/14.
// Copyright © 2018年 lianlian. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface RuiMeiProtocolModel : NSObject <NSCoding>
@property (nonatomic,copy) NSString *ch1;
@property (nonatomic,copy) NSString *ch2;
@property (nonatomic,copy) NSString *ch3;
@property (nonatomic,copy) NSString *ch4;
@property (nonatomic,copy) NSString *customModel;
@property(nonatomic,copy) NSString *timer1;
@property(nonatomic,copy) NSString *timer2;
@property(nonatomic,copy) NSString *timer3;
@property(nonatomic,copy) NSString *timer4;
@property(nonatomic,copy) NSString *timer5;
@property(nonatomic,copy) NSString *timer6;
@property(nonatomic,copy) NSString *timer7;
@property(nonatomic,copy) NSString *timer8;
@property(nonatomic,copy) NSString *heatStickState;
@property(nonatomic,copy) NSString *wendu;
// 加热温度
@property(nonatomic,copy) NSString *heatTemperature;
//室温
@property(nonatomic,copy) NSString *shiwen;
@property(nonatomic,copy) NSString *baojingSwitch;
@property(nonatomic,copy) NSString *miniTp;
@property(nonatomic,copy) NSString *maxTp;
@property(nonatomic,copy) NSString *funcCode;
@end
@@ -0,0 +1,70 @@
//
// RuiMeiProtocolModel.m
// Ifish
//
// Created by Minghao Xue on 2018/4/14.
// Copyright © 2018 lianlian. All rights reserved.
//
#import "RuiMeiProtocolModel.h"
@implementation RuiMeiProtocolModel
- (void)encodeWithCoder:(NSCoder *)aCoder {
[aCoder encodeObject:self.ch1 forKey:@"ch1"];
[aCoder encodeObject:self.ch2 forKey:@"ch2"];
[aCoder encodeObject:self.ch3 forKey:@"ch3"];
[aCoder encodeObject:self.ch4 forKey:@"ch4"];
[aCoder encodeObject:self.customModel forKey:@"customModel"];
[aCoder encodeObject:self.timer1 forKey:@"timer1"];
[aCoder encodeObject:self.timer2 forKey:@"timer2"];
[aCoder encodeObject:self.timer3 forKey:@"timer3"];
[aCoder encodeObject:self.timer4 forKey:@"timer4"];
[aCoder encodeObject:self.timer5 forKey:@"timer5"];
[aCoder encodeObject:self.timer6 forKey:@"timer6"];
[aCoder encodeObject:self.timer7 forKey:@"timer7"];
[aCoder encodeObject:self.timer8 forKey:@"timer8"];
[aCoder encodeObject:self.heatStickState forKey:@"heatStickState"];
[aCoder encodeObject:self.wendu forKey:@"wendu"];
[aCoder encodeObject:self.heatTemperature forKey:@"heatTemperature"];
[aCoder encodeObject:self.shiwen forKey:@"shiwen"];
[aCoder encodeObject:self.baojingSwitch forKey:@"baojingSwitch"];
[aCoder encodeObject:self.miniTp forKey:@"miniTp"];
[aCoder encodeObject:self.maxTp forKey:@"maxTp"];
[aCoder encodeObject:self.funcCode forKey:@"funcCode"];
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
if (self = [super init]) {
self.ch1 = [aDecoder decodeObjectForKey:@"ch1"];
self.ch2 = [aDecoder decodeObjectForKey:@"ch2"];
self.ch3 = [aDecoder decodeObjectForKey:@"ch3"];
self.ch4 = [aDecoder decodeObjectForKey:@"ch4"];
self.customModel = [aDecoder decodeObjectForKey:@"customModel"];
self.timer1 = [aDecoder decodeObjectForKey:@"timer1"];
self.timer2 = [aDecoder decodeObjectForKey:@"timer2"];
self.timer3 = [aDecoder decodeObjectForKey:@"timer3"];
self.timer4 = [aDecoder decodeObjectForKey:@"timer4"];
self.timer5 = [aDecoder decodeObjectForKey:@"timer5"];
self.timer6 = [aDecoder decodeObjectForKey:@"timer6"];
self.timer7 = [aDecoder decodeObjectForKey:@"timer7"];
self.timer8 = [aDecoder decodeObjectForKey:@"timer8"];
self.heatStickState = [aDecoder decodeObjectForKey:@"heatStickState"];
self.wendu = [aDecoder decodeObjectForKey:@"wendu"];
self.heatTemperature = [aDecoder decodeObjectForKey:@"heatTemperature"];
self.shiwen = [aDecoder decodeObjectForKey:@"shiwen"];
self.baojingSwitch = [aDecoder decodeObjectForKey:@"baojingSwitch"];
self.miniTp = [aDecoder decodeObjectForKey:@"miniTp"];
self.maxTp = [aDecoder decodeObjectForKey:@"maxTp"];
self.funcCode = [aDecoder decodeObjectForKey:@"funcCode"];
}
return self;
}
@end
@@ -0,0 +1,28 @@
//
// RuiMeiSetViewController.h
// Ifish
//
// Created by Minghao Xue on 2018/4/22.
// Copyright © 2018年 lianlian. All rights reserved.
//
#import "FatherController.h"
@interface RuiMeiSetViewController : FatherController
{
BOOL _isHidden;
BOOL mySwitchIsOn;
}
@property(nonatomic,strong)NSArray*timeArr;
@property(nonatomic,strong)NSArray*titleArr;
@property(nonatomic)BOOL isAuto;// 自动模式
@property(nonatomic)UIActivityIndicatorView*indicatorView;
@property(nonatomic)int percent;
@property(nonatomic,strong) DeviceModel* currentdevice;
@property (nonatomic, assign) BOOL customModeOn;
@end
@@ -0,0 +1,32 @@
//
// RuiMeiViewController.h
// Ifish
//
// Created by Minghao Xue on 2018/4/14.
// Copyright © 2018年 lianlian. All rights reserved.
//
#import "CenterViewController.h"
//瑞美四控
@interface RuiMeiViewController : CenterViewController
@property(nonatomic,strong)UIButton*button;
@property(nonatomic,strong)UIButton *ch1Button;
@property(nonatomic,strong)UIButton *ch2Button;
@property(nonatomic,strong)UIButton *ch3Button;
@property(nonatomic,strong)UIButton *ch4Button;
@property(nonatomic,strong) UILabel *chName;
@property(nonatomic,strong) UILabel *ch1Name;
@property(nonatomic,strong) UILabel *ch2Name;
@property(nonatomic,strong) UILabel *ch3Name;
@property(nonatomic,strong) UILabel *ch4Name;
//S5 只控制温度
@property(nonatomic,strong) UILabel *jiaReName;
@property(nonatomic,strong)UIButton*heatBtn;
@property(nonatomic,strong) UILabel *hotcolLabe;
@property(nonatomic,strong) UILabel *hotcolTempLabe;
@end
@@ -0,0 +1,608 @@
//
// RuiMeiViewController.m
// Ifish
//
// Created by Minghao Xue on 2018/4/14.
// Copyright © 2018 lianlian. All rights reserved.
//
#define kPlace ([UIScreen mainScreen].bounds.size.width - btnWid*2) /4
#define RUNSUN_CH1 6000
#define RUNSUN_CH2 6001
#define RUNSUN_CH3 6002
#define RUNSUN_CH4 6003
#define RUNSUN_JARE 6004
#define btnWid 100
#import "RuiMeiViewController.h"
#import "RuiMeiProtocolModel.h"
#import "RuiMeiBackMsgUtils.h"
#import "XuToWenDuPicview.h"
#import "RuSunLightOrder.h"
#import "RuSunGuiDeng.h"
#import "RuiMeiSetViewController.h"
#import "RuiMeiCHControl.h"
#import "RuiMeiCHNameCustom.h"
#import "RuiMeiInputViewController.h"
#import "HaveHotCoolWenDuPicview.h"
@interface RuiMeiViewController ()<IfishCommuniteDelegate>
{
dispatch_queue_t _ruSunMainQueue;
}
@property(nonatomic,strong) RuiMeiProtocolModel *backmodel;
@property(nonatomic,strong) HaveHotCoolWenDuPicview *wenduPicview;
@property(nonatomic,strong) RuiMeiSetViewController *setVC;
//@property(nonatomic,strong) RunSunChangeNameViewController *changenameVC;
@property(nonatomic,strong) RuiMeiInputViewController *changenameVC;
@end
@implementation RuiMeiViewController
- (void)viewDidLoad {
[super viewDidLoad];
_backmodel=[[RuiMeiProtocolModel alloc] init];
[Socketsingleton sharedInstance].communiteDelegate=self;
_ruSunMainQueue = dispatch_get_main_queue();
// Do any additional setup after loading the view.
UITapGestureRecognizer*tapgestureRecognizer=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(RuSunCenterViewSetTap)];
[self.setImag addGestureRecognizer:tapgestureRecognizer];
[self.setbackBtn addTarget:self action:@selector(RuSunCenterViewSetAction:) forControlEvents:UIControlEventTouchUpInside];
[self.SetTimeButton addTarget:self action:@selector(RuSunCenterViewSetAction:) forControlEvents:UIControlEventTouchUpInside];
[self initControlNormalBtn];
}
-(void)RuSunCenterViewSetTap
{
RuiMeiProtocolModel*backmodel=[[DataCenter defaultDtacenter]valueForKey:DataCenterRuiMeiModelKey];
if (backmodel) {
[self pushSetTimeVC];
}else{
[self deviceNotOnlineState];
[self showLableAction:@"设备已离线"];
[self.indicatorView stopAnimating];
}
}
#pragma mark -转跳设置界面
-(void)RuSunCenterViewSetAction:(UIButton*)btn
{
RuiMeiProtocolModel*backmodel=[[DataCenter defaultDtacenter]valueForKey:DataCenterRuiMeiModelKey];
if (backmodel) {
[self pushSetTimeVC];
}else{
[self deviceNotOnlineState];
[self showLableAction:@"设备已离线"];
[self.indicatorView stopAnimating];
}
}
-(void)pushSetTimeVC{
self.setVC=[[RuiMeiSetViewController alloc]init];
self.setVC.currentdevice=self.currentDevice;
NSString*stateString=[self.backmodel.customModel substringWithRange:NSMakeRange(2, 2)];
if ([stateString isEqualToString:@"01"]) {
self.setVC.customModeOn=YES;
}else{
self.setVC.customModeOn=NO;
}
[self.navigationController pushViewController:self.setVC animated:YES];
}
-(void)initControlNormalBtn
{
NSArray*nameArr=@[@"PFLight1_off.png",@"PFLight1_off.png",@"PFkilLlight_off.png",@"O2_off.png",@"JiaReBang"];
CGFloat btnControlWith = 70;
CGFloat btnControlPlace = (kScreenSize.width - 3*btnControlWith )/4;
for (int i = 0; i < 3; i ++) {
self.button = [[UIButton alloc] init] ;
self.button.frame = CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith),kScreenSize.height - 3*btnControlPlace - 2 *btnControlWith -10 - 10 , btnControlWith, btnControlWith +11);
[self.button setImage:[UIImage imageNamed:nameArr[i]] forState:UIControlStateNormal];
//self.button.backgroundColor = [UIColor redColor];
self.button.tag=6000+i;
[self.button addTarget:self action:@selector(controlBtnCilck:) forControlEvents:UIControlEventTouchUpInside];
self.chName = [[UILabel alloc] initWithFrame:CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith),kScreenSize.height - 3*btnControlPlace - 2 *btnControlWith -20 + btnControlWith -5 , btnControlWith, btnControlPlace - 5)];
//textLbl.backgroundColor = [UIColor blackColor];
self.chName.textColor = [UIColor colorWithRed:250/255.0f green:255/255.0f blue:255/254.0f alpha:1];
self.chName.textAlignment = NSTextAlignmentCenter;
NSArray *arr = @[@"灯1",@"灯2",@"UV/杀菌"];
self.chName.text = arr[i];
self.chName.font = [UIFont boldSystemFontOfSize:14];
[self.tableView addSubview:self.chName];
[self.tableView addSubview:self.button];
if (i==0) {
self.ch1Button = self.button;
self.ch1Name = self.chName;
}else if (i==1){
self.ch2Button = self.button;
self.ch2Name = self.chName;
}else if (i==2){
self.ch3Name = self.chName;
self.ch3Button = self.button;
}
}
//CGFloat btnControlPlace1 = (kScreenSize.width - 2*btnControlWith )/3;
for (int i = 0; i < 2; i ++) {
self.button = [[UIButton alloc] init] ;
self.button.frame = CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith), kScreenSize.height - 2*btnControlPlace - btnControlWith -25 -5 , btnControlWith, btnControlWith + 11);
[self.button setImage:[UIImage imageNamed:nameArr[i+3]]forState:UIControlStateNormal];
self.button.tag= 6003+i;
[self.button addTarget:self action:@selector(controlBtnCilck:) forControlEvents:UIControlEventTouchUpInside];
if (i == 1) {
UILabel *tempLbl = [UILabel new];
[self.button addSubview:tempLbl];
tempLbl.tag = 1;
tempLbl.font = [UIFont boldSystemFontOfSize:16];
tempLbl.textColor = [UIColor lightGrayColor];
tempLbl.textAlignment = NSTextAlignmentCenter;
tempLbl.translatesAutoresizingMaskIntoConstraints = NO;
[NSLayoutConstraint constraintWithItem:tempLbl attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.button attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0.0].active = YES;
[NSLayoutConstraint constraintWithItem:tempLbl attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.button attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:-4.0].active = YES;
}
UILabel* textLbl = [[UILabel alloc] initWithFrame:CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith), kScreenSize.height - 2*btnControlPlace - btnControlWith -35 + btnControlWith, btnControlWith, btnControlPlace - 5)];
//textLbl.backgroundColor = [UIColor blackColor];
textLbl.textAlignment = NSTextAlignmentCenter;
textLbl.textColor = [UIColor colorWithRed:250/255.0f green:255/255.0f blue:255/254.0f alpha:1];
NSArray *arr = @[@"冲浪/氧泵",@"加热棒"];
textLbl.font = [UIFont boldSystemFontOfSize:14];
textLbl.text = arr[i];
self.chName = textLbl;
[self.tableView addSubview:textLbl];
[self.tableView addSubview:self.button];
if (i==0) {
self.ch4Button = self.button;
self.ch4Name = self.chName;
} else if (i==1){
self.heatBtn = self.button;
self.jiaReName = self.chName;
}
}
// self.bubble frame
CGFloat animViewHeight= kScreenSize.width/4;
if (kScreenSize.height==480) {
self.bubble.frame = CGRectMake((kScreenSize.width -(kScreenSize.width - 2 * kPlace)*2/3)/2, kPlace + 60 , (kScreenSize.width - 2 * kPlace)*2/3, (kScreenSize.width - 2 * kPlace)*2/3);
//(kScreenSize.width - 2 * kPlace - 200)*2/3
self.temperature.frame = CGRectMake(30, 70, (kScreenSize.width - 2 * kPlace - 100)*2/3, 50);
self.temperature.font = [UIFont fontWithName:@"Avenir Next Condensed" size:46];
self.dulabel.frame = CGRectMake( (kScreenSize.width - 2 * kPlace - 100)*2/3,74,50, kScreenSize.width - 2 * kPlace - 210);
self.dulabel.font = [UIFont fontWithName:@"Avenir Next Condensed" size:20];
self.animView.frame= CGRectMake(0, kPlace + 80 + (kScreenSize.width - 2 * kPlace) -animViewHeight/2 - 15-80, kScreenSize.width, animViewHeight);
self.notOnLineLabel.frame = CGRectMake(40, 60, kScreenSize.width - 2 * kPlace - 100, kScreenSize.width - 2 * kPlace - 200);
self.notOnLineLabel .font = [UIFont fontWithName:@"Avenir Next Condensed" size:15];
self.hotcolLabe = [[UILabel alloc] init];
self.hotcolLabe.frame = CGRectMake(0, CGRectGetMaxY(self.temperature.frame) + 10, self.bubble.frame.size.width, 15);
//self.hotcolLabe.textColor = JWUIColorFromRGB(fc6638);
self.hotcolLabe.textAlignment = NSTextAlignmentCenter;
self.hotcolLabe.font =[UIFont systemFontOfSize:13];
self.hotcolLabe.text = @"制冷加热";
[self.bubble addSubview:self.hotcolLabe];
self.hotcolTempLabe = [[UILabel alloc] init];
self.hotcolTempLabe.frame = CGRectMake(0, CGRectGetMaxY(self.hotcolLabe.frame) + 5, self.bubble.frame.size.width, 15);
self.hotcolTempLabe.font =[UIFont systemFontOfSize:14];
self.hotcolTempLabe.textAlignment = NSTextAlignmentCenter;
self.hotcolTempLabe.textColor = JWUIColorFromRGB(0x666666);
self.hotcolTempLabe.text = @"温度";
[self.bubble addSubview:self.hotcolTempLabe];
}else{
//kScreenSize.width - 2 * kPlace - 200
self.temperature.frame = CGRectMake(10, 80, kScreenSize.width - 2 * kPlace - 100,70);
self.temperature.font = [UIFont fontWithName:@"Avenir Next Condensed" size:60];
self.bubble.frame = CGRectMake((kScreenSize.width -(kScreenSize.width - 3 * kPlace ))/2, kPlace + 80 , kScreenSize.width - 3 * kPlace, kScreenSize.width - 3 * kPlace);
self.dulabel.frame = CGRectMake((kScreenSize.width - 2 * kPlace)/3*2 -30 , 90 ,50, 60);
self.dulabel.font = [UIFont fontWithName:@"Avenir Next Condensed" size:40];
self.animView.frame= CGRectMake(0, kPlace + 40 + (kScreenSize.width - 2 * kPlace) -animViewHeight/2 - 15, kScreenSize.width, animViewHeight);
CGFloat bubH=kScreenSize.width - 3 * kPlace;
self.notOnLineLabel.frame = CGRectMake(0,bubH/2-15, bubH, 30);
self.notOnLineLabel .font = [UIFont fontWithName:@"Avenir Next Condensed" size:20];
self.hotcolLabe = [[UILabel alloc] init];
self.hotcolLabe.frame = CGRectMake(0, CGRectGetMaxY(self.temperature.frame) + 10, self.bubble.frame.size.width, 15);
//self.hotcolLabe.textColor = JWUIColorFromRGB(fc6638);
self.hotcolLabe.textAlignment = NSTextAlignmentCenter;
self.hotcolLabe.font =[UIFont systemFontOfSize:13];
[self.bubble addSubview:self.hotcolLabe];
self.hotcolTempLabe = [[UILabel alloc] init];
self.hotcolTempLabe.frame = CGRectMake(0, CGRectGetMaxY(self.hotcolLabe.frame) + 5, self.bubble.frame.size.width, 15);
self.hotcolTempLabe.font =[UIFont systemFontOfSize:14];
self.hotcolTempLabe.textAlignment = NSTextAlignmentCenter;
self.hotcolTempLabe.textColor = JWUIColorFromRGB(0x666666);
self.hotcolTempLabe.text = @"温度";
[self.bubble addSubview:self.hotcolTempLabe];
}
[self initCHNames];
}
#pragma mark - 控制按钮事件
-(void)controlBtnCilck:(UIButton *)btn{
RuiMeiProtocolModel*backmodel=[[DataCenter defaultDtacenter]valueForKey:DataCenterRuiMeiModelKey];
if (backmodel) {
}else{
[self.indicatorView stopAnimating];
[self deviceNotOnlineState];
[self showLableAction:@"设备已离线"];
return;
}
NSString *lightSate;
if (btn.selected) {
lightSate=@"00";
btn.selected=NO;
}else {
lightSate=@"01";
btn.selected=YES;
}
switch (btn.tag) {
case RUNSUN_CH1:
{
btn.userInteractionEnabled=YES;
[btn setImage:[UIImage imageNamed:@"PFLight1_on.png"] forState:UIControlStateSelected];
[self sendOffOnLinghtCommend:@"01" liaghtState:lightSate];
}
break;
case RUNSUN_CH2:
{
btn.userInteractionEnabled=YES;
[btn setImage:[UIImage imageNamed:@"PFLight1_on.png"] forState:UIControlStateSelected];
[self sendOffOnLinghtCommend:@"02" liaghtState:lightSate];
}
break;
case RUNSUN_CH3:
{
btn.userInteractionEnabled=YES;
[btn setImage:[UIImage imageNamed:@"PFkilLlight_on.png"] forState:UIControlStateSelected];
[self sendOffOnLinghtCommend:@"03" liaghtState:lightSate];
}
break;
case RUNSUN_CH4:
{
btn.userInteractionEnabled=YES;
[btn setImage:[UIImage imageNamed:@"O2_on.png"] forState:UIControlStateSelected];
[self sendOffOnLinghtCommend:@"04" liaghtState:lightSate];
}
break;
case RUNSUN_JARE:
{
if (backmodel) {
_wenduPicview=[[HaveHotCoolWenDuPicview alloc] init];
_wenduPicview.cateSwich.hidden = YES;
_wenduPicview.frame=CGRectMake(0, 0, kScreenSize.width, kScreenSize.height);
[_wenduPicview.sureBtn addTarget:self action:@selector(sureBtnClick:) forControlEvents:UIControlEventTouchUpInside];
[self.view.window addSubview:_wenduPicview];
_wenduPicview.wenDuPicviewDelegate = self;
NSString *stateStr =nil;
if ([backmodel.heatStickState isKindOfClass:[NSNull class]]||!backmodel.heatStickState) {
backmodel.heatStickState = @"00";
}
stateStr = [backmodel.heatStickState substringWithRange:NSMakeRange(0, 2)];
[_wenduPicview initCateBtnSate:stateStr];
[self ruSunJiaReMianQue];
}else{
[self showLableAction:@"设备已离线"];
}
}
break;
default:
break;
}
}
#pragma mark - 发送开关灯指令
-(void)sendOffOnLinghtCommend:(NSString *)linghtNumber liaghtState:(NSString *)state
{
//
RuSunLightOrder*lightOrder=[[RuSunLightOrder alloc]init];
lightOrder.sendmacId = self.currentDevice.macAddress;
lightOrder.resavemacId = self.currentDevice.macAddress;
NSString*switchString1=lightOrder.description;
lightOrder.switchBtn = state;
lightOrder.crc16Str=@"0000";
lightOrder.lightNumber=linghtNumber;
NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString1,lightOrder.lightNumber,lightOrder.switchBtn,lightOrder.crc16Str];
NSData*manulData=[dataContorl stringToHexData:switchString2];
[ [Socketsingleton sharedInstance] soketWriteData:manulData];
if ([Socketsingleton sharedInstance].clientSocket.isConnected) {
//soket
[self initHUD];
[self.myhud myhudstart];
}
}
#pragma mark -发送柜灯指令
-(void)sendGuiDengCommend:(NSString *)lightSate
{
RuSunGuiDeng*guidengModel=[[RuSunGuiDeng alloc]init];
guidengModel.resavemacId = self.currentDevice.macAddress;
guidengModel.sendmacId = self.currentDevice.macAddress;
guidengModel.crc16Str=@"0000";
guidengModel.onOff=lightSate;
NSString* guidengOrder=[NSString stringWithFormat:@"%@%@%@",guidengModel.description,guidengModel.onOff,guidengModel.crc16Str];
NSData*guidengData=[dataContorl stringToHexData:guidengOrder];
[[Socketsingleton sharedInstance] soketWriteData:guidengData];
if ([Socketsingleton sharedInstance].clientSocket.isConnected) {
//soket
[self initHUD];
[self.myhud myhudstart];
}
}
#pragma mark -加热制冷温度选择
-(void)sureBtnClick:(UIButton *)btn{
NSLog(@"%@******** _wenduPicview.picViewResultString",_wenduPicview.picViewResultString);
if (_wenduPicview.picViewResultString ==nil) {
[_wenduPicview removeFromSuperview];
}else{
JiaReWenDuModel *model=[[JiaReWenDuModel alloc] init];
model.resavemacId = self.currentDevice.macAddress;
model.sendmacId = self.currentDevice.macAddress;
int intlowString = [_wenduPicview.picViewResultString intValue];
int newIntlowString=intlowString*10;
NSLog(@"%d******** newIntlowString",newIntlowString);
// 16
model.JiaReWenDu=[dataContorl tpIntStringToFourHex:newIntlowString];
model.crc16Code =@"0000";
NSString * hexstring=[NSString stringWithFormat:@"%@%@%@",model.description,model.JiaReWenDu,model.crc16Code];
NSData*data=[dataContorl stringToHexData:hexstring];
[ [Socketsingleton sharedInstance] soketWriteData:data];
}
[_wenduPicview removeFromSuperview];
}
-(void)ruSunJiaReMianQue
{
RuiMeiProtocolModel*backmodel=[[DataCenter defaultDtacenter]valueForKey:DataCenterRuiMeiModelKey];
UInt64 mac=[dataContorl hexToTen:backmodel.heatTemperature];
NSLog(@"%llu",mac);
float TPlabel=mac/10;
int temp= (int)(TPlabel+0.5);
NSString *stringFloat = [NSString stringWithFormat:@"%d",temp];
NSLog(@"%@",stringFloat);
NSArray*wenDuArr=[_wenduPicview.picArr objectAtIndex:0];
dispatch_async(_ruSunMainQueue, ^{
for (NSInteger i=0; i<wenDuArr.count; i++) {
NSString*picString=wenDuArr[i];
if ([picString isEqualToString:stringFloat ] ) {
[_wenduPicview.pic selectRow:i inComponent:0 animated:NO];
}
}
});
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - 登陆成功后收到服务端的回执之后,调用的代理方法
-(void)socketDidGetBackmsgData:(NSData *)data onsoket:(AsyncSocket *)sock{
[self.indicatorView stopAnimating];
self.temperature.hidden=NO;
//线线
self.dulabel.hidden=NO;
//线线
self.notOnLineLabel.hidden = YES;
self.temperaturebackImg.hidden=NO;
self.hotcolTempLabe.hidden = NO;
self.hotcolLabe.hidden = NO;
[self.myhud hidmyHud];
if (self.setVC.indicatorView) {
[self.setVC.indicatorView stopAnimating];
}
//
[RuiMeiBackMsgUtils readSoketDataWithBaackMassgModel:_backmodel addWithBackData:data];
//
dispatch_async(dispatch_get_main_queue(), ^{
if (self.setVC) {
NSString*stateString=[self.backmodel.customModel substringWithRange:NSMakeRange(2, 2)];
if ([stateString isEqualToString:@"01"]) {
self.setVC.customModeOn=YES;
}else{
self.setVC.customModeOn=NO;
}
}
[RuiMeiBackMsgUtils setTemperaturelabel:self.temperature addbubleImge:self.bubble WithBackData:data addWithBackMassageModel:_backmodel addWithTableview:self.tableView];
[RuiMeiBackMsgUtils resetRuSunCHState:_ch1Button ch2:_ch2Button ch3:_ch3Button ch4:_ch4Button andJiaRe:_heatBtn withBackModel:_backmodel ];
if (!_backmodel.heatStickState) {
_backmodel.heatStickState = @"00";
}
NSString*stateString=[_backmodel.heatStickState substringWithRange:NSMakeRange(0, IFISH_LIGHTBTN_BYTE)];
self.hotcolLabe.text = [NSString stringWithFormat:@"-室内温度-"];
self.hotcolLabe.textColor = JWUIColorFromRGB(0x38b9fc);
if (!_backmodel.heatStickState) {
_backmodel.heatStickState = @"00";
}
UInt64 mac=[dataContorl hexToTen:_backmodel.shiwen];
float TPlabel=mac/10;
int temp= (int)(TPlabel+0.5);
NSString *stringFloat = [NSString stringWithFormat:@"%d°C",temp];
NSLog(@"制冷加热温度%@",stringFloat);
self.hotcolTempLabe.text = stringFloat;
});
//
dispatch_async(dispatch_get_main_queue(), ^{
if (self.setVC) {
self.setVC.timeArr= [RuiMeiBackMsgUtils refreshRuSunTimerAddTemperatureWithBackMassageModel:_backmodel];
[self.setVC.tableView reloadData];
}
});
}
-(void)ifishDeviceLogInSuccees{
self.isconnect=YES;
NSLog(@"设备登录成功");
}
-(void)ifishDeviceLogInFail{
[self endRefreshing];
[self.indicatorView stopAnimating];
dispatch_async(dispatch_get_main_queue(), ^{
[self deviceNotOnlineState];//线
self.hotcolTempLabe.hidden = YES;
self.hotcolLabe.hidden = YES;
});
}
#pragma mark -父类方法
-(void)shezhiMingCheng
{
_changenameVC = [[RuiMeiInputViewController alloc] init];
_changenameVC.name = self.name.text;
_changenameVC.device = self.currentDevice;
__weak typeof (self)wself = self;
_changenameVC.NameWithBlock = ^(NSString *nameStr){
wself.name.text = nameStr;
[wself initCHNames];
};
[ wself.navigationController pushViewController: _changenameVC animated:YES];
}
-(void)initCHNames{
RuiMeiCHControl * ruSunCH = [RuiMeiCHNameCustom currentdevice:self.currentDevice.macAddress];
self.ch1Name.text = ruSunCH.ch1name;
self.ch2Name.text = ruSunCH.ch2name;
self.ch3Name.text = ruSunCH.ch3name;
self.ch4Name.text = ruSunCH.ch4name;
self.jiaReName.text = ruSunCH.jiaRe;
}
#pragma mark - 制冷制热指令
-(void)didSelectCoolOrHeat:(NSString *)hotCool{
// //s5
// RuSunLightOrder*lightOrder=[[RuSunLightOrder alloc]init];
// lightOrder.sendmacId = self.currentDevice.macAddress;
// lightOrder.resavemacId = self.currentDevice.macAddress;
// NSString*switchString1=lightOrder.description;
// lightOrder.switchBtn = hotCool;
// lightOrder.crc16Str=@"0000";
// lightOrder.lightNumber=@"05";
//
// NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString1,lightOrder.lightNumber,lightOrder.switchBtn,lightOrder.crc16Str];
// NSData*manulData=[dataContorl stringToHexData:switchString2];
// [ [Socketsingleton sharedInstance] soketWriteData:manulData];
// if ([Socketsingleton sharedInstance].clientSocket.isConnected) {
// //soket
// [self initHUD];
// [self.myhud myhudstart];
// }
}
@end
@@ -26,9 +26,10 @@
#import "SongNuo86Name.h"
#import "UserExtendataArchaver.h"
@interface SongNuoDBCenterViewController ()
@interface SongNuoDBCenterViewController ()<UITableViewDelegate>
{
dispatch_queue_t _songNuoMainQueue;
CGFloat _tableviewSizeHeight;
}
@property(nonatomic,strong) SongNuoDBSetViewController *songNuoSetVC;
@@ -59,6 +60,24 @@
UITapGestureRecognizer*tapgestureRecognizer=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(songNuoBDSetBtnAction:)];
[self.setImag addGestureRecognizer:tapgestureRecognizer];
[self.tableView addObserver:self forKeyPath:@"contentSize" options:NSKeyValueObservingOptionNew context:nil];
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {
if ([keyPath isEqualToString:@"contentSize"]) {
NSValue *new = [change valueForKey:NSKeyValueChangeNewKey];
CGSize size = [new CGSizeValue];
if (size.height == 0) {
self.tableView.contentSize = CGSizeMake(size.width, _tableviewSizeHeight);
}
} else {
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
}
- (void)dealloc {
[self.tableView removeObserver:self forKeyPath:@"contentSize"];
}
#pragma mark- 设置
@@ -125,87 +144,6 @@
-(void)initSongNuoBDUI
{
NSArray *nameArr=@[@"PFLight1_off",@"PFLight1_off",@"ChongLang_off",@"O2_off",@"",@"PFkilLlight_off",@"JiaReBang_off"];
CGFloat btnControlWith = 70;
CGFloat btnControlPlace = (kScreenSize.width - 3*btnControlWith )/4;
for (int i = 0; i < 3; i ++) {
self.button = [[UIButton alloc] init] ;
self.button.frame = CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith),kScreenSize.height - 3*btnControlPlace - 2 *btnControlWith -10 , btnControlWith, btnControlWith +11);
[self.button setImage:[UIImage imageNamed:nameArr[i]] forState:UIControlStateNormal];
//self.button.backgroundColor = [UIColor redColor];
self.button.tag=600000+i;
[self.button addTarget:self action:@selector(songNuoBDBtnClick:) forControlEvents:UIControlEventTouchUpInside];
UILabel* textLbl = [[UILabel alloc] initWithFrame:CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith),kScreenSize.height - 3*btnControlPlace - 2 *btnControlWith -20 + btnControlWith , btnControlWith, btnControlPlace - 5)];
//textLbl.backgroundColor = [UIColor blackColor];
textLbl.textColor = [UIColor colorWithRed:250/255.0f green:255/255.0f blue:255/254.0f alpha:1];
textLbl.textAlignment = NSTextAlignmentCenter;
NSArray *arr = @[@"灯1",@"灯2",@"水泵"];
textLbl.text = arr[i];
textLbl.font = [UIFont boldSystemFontOfSize:14];
[self.tableView addSubview:textLbl];
[self.tableView addSubview:self.button];
if (i==0) {
self.nuoLight1Btn = self.button;
self.light1Name = textLbl;
}else if (i==1){
self.nuoLight2Btn = self.button;
self.light2Name = textLbl;
}else if (i==2){
self.nuoWaterPumpBtn = self.button;
self.waterPumpName = textLbl;
}
}
CGFloat btnControlPlace1 = (kScreenSize.width - 2*btnControlWith )/3;
for (int i = 0; i < 3; i ++) {
self.button = [[UIButton alloc] init] ;
self.button.frame =CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith),kScreenSize.height - 2*btnControlPlace - btnControlWith -25, btnControlWith, btnControlWith +11);
[self.button setImage:[UIImage imageNamed:nameArr[i+3]]forState:UIControlStateNormal];
self.button.tag= 600003+i;
[self.button addTarget:self action:@selector(songNuoBDBtnClick:) forControlEvents:UIControlEventTouchUpInside];
UILabel* textLbl = [[UILabel alloc] initWithFrame:CGRectMake(btnControlPlace1 +i*(btnControlPlace1 + btnControlWith), kScreenSize.height - 2*btnControlPlace - btnControlWith -35 + btnControlWith, btnControlWith, btnControlPlace - 5)];
//textLbl.backgroundColor = [UIColor blackColor];
textLbl.textAlignment = NSTextAlignmentCenter;
textLbl.textColor = [UIColor colorWithRed:250/255.0f green:255/255.0f blue:255/254.0f alpha:1];
NSArray *arr = @[@"氧泵",@"柜灯",@"加热棒"];
textLbl.font = [UIFont boldSystemFontOfSize:14];
textLbl.text = arr[i];
[self.tableView addSubview:textLbl];
[self.tableView addSubview:self.button];
if (i==0) {
self.nuoAirPumpBtn = self.button;
self.airPumpName = textLbl;
}else if (i==1){
self.nuoGuiDengBtn = self.button;
self.guiDengName = textLbl;
}else if (i==1){
self.nuoJiaReBtn = self.button;
self.jiaReName = textLbl;
}
}
// self.bubble frame
CGFloat animViewHeight= kScreenSize.width/4;
if (kScreenSize.height==480) {
@@ -247,8 +185,103 @@
}
[self initCHNames];
NSArray *nameArr=@[@"PFLight1_off",@"PFLight1_off",@"ChongLang_off",@"O2_off",@"PFkilLlight_off",@"JiaReBang"];
CGFloat btnControlWith = 70;
CGFloat btnControlPlace = (kScreenSize.width - 3*btnControlWith )/4;
CGFloat currentY = CGRectGetMaxY(self.bubble.frame);
for (int i = 0; i < 3; i ++) {
self.button = [[UIButton alloc] init] ;
self.button.frame = CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith),currentY , btnControlWith, btnControlWith +11);
[self.button setImage:[UIImage imageNamed:nameArr[i]] forState:UIControlStateNormal];
//self.button.backgroundColor = [UIColor redColor];
self.button.tag=600000+i;
[self.button addTarget:self action:@selector(songNuoBDBtnClick:) forControlEvents:UIControlEventTouchUpInside];
UILabel* textLbl = [[UILabel alloc] initWithFrame:CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith),currentY + btnControlWith +11 - 6, btnControlWith, 14)];
//textLbl.backgroundColor = [UIColor blackColor];
textLbl.textColor = [UIColor colorWithRed:250/255.0f green:255/255.0f blue:255/254.0f alpha:1];
textLbl.textAlignment = NSTextAlignmentCenter;
NSArray *arr = @[@"灯1",@"灯2",@"水泵"];
textLbl.text = arr[i];
textLbl.font = [UIFont boldSystemFontOfSize:14];
[self.tableView addSubview:textLbl];
[self.tableView addSubview:self.button];
if (i==0) {
self.nuoLight1Btn = self.button;
self.light1Name = textLbl;
}else if (i==1){
self.nuoLight2Btn = self.button;
self.light2Name = textLbl;
}else if (i==2){
self.nuoWaterPumpBtn = self.button;
self.waterPumpName = textLbl;
}
if (i == 2) {
currentY = CGRectGetMaxY(textLbl.frame);
}
}
for (int i = 0; i < 3; i ++) {
self.button = [[UIButton alloc] init] ;
self.button.frame =CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith),currentY + 6, btnControlWith, btnControlWith +11);
[self.button setImage:[UIImage imageNamed:nameArr[i+3]]forState:UIControlStateNormal];
self.button.tag= 600003+i;
[self.button addTarget:self action:@selector(songNuoBDBtnClick:) forControlEvents:UIControlEventTouchUpInside];
if (i == 2) {
UILabel *tempLbl = [UILabel new];
[self.button addSubview:tempLbl];
tempLbl.tag = 1;
tempLbl.font = [UIFont boldSystemFontOfSize:16];
tempLbl.textColor = [UIColor lightGrayColor];
tempLbl.textAlignment = NSTextAlignmentCenter;
tempLbl.translatesAutoresizingMaskIntoConstraints = NO;
[NSLayoutConstraint constraintWithItem:tempLbl attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.button attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0.0].active = YES;
[NSLayoutConstraint constraintWithItem:tempLbl attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.button attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:-4.0].active = YES;
}
UILabel* textLbl = [[UILabel alloc] initWithFrame:CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith),currentY + btnControlWith +11, btnControlWith, 14)];
//textLbl.backgroundColor = [UIColor blackColor];
textLbl.textAlignment = NSTextAlignmentCenter;
textLbl.textColor = [UIColor colorWithRed:250/255.0f green:255/255.0f blue:255/254.0f alpha:1];
NSArray *arr = @[@"氧泵",@"柜灯",@"加热棒"];
textLbl.font = [UIFont boldSystemFontOfSize:14];
textLbl.text = arr[i];
[self.tableView addSubview:textLbl];
[self.tableView addSubview:self.button];
if (i==0) {
self.nuoAirPumpBtn = self.button;
self.airPumpName = textLbl;
}else if (i==1){
self.nuoGuiDengBtn = self.button;
self.guiDengName = textLbl;
}else if (i==2){
self.nuoJiaReBtn = self.button;
self.jiaReName = textLbl;
}
_tableviewSizeHeight = 64 + CGRectGetMaxY(textLbl.frame);
}
[self initCHNames];
}
-(void)songNuoBDBtnClick:(UIButton*)btn{
@@ -390,7 +423,7 @@
{
btn.userInteractionEnabled=YES;
[btn setImage:[UIImage imageNamed:@"PFkilLlight_on.png"] forState:UIControlStateSelected];
[btn setImage:[UIImage imageNamed:@"PFkilLlight_on.png"] forState:UIControlStateNormal];
lightModel.lightNumber=@"05";//
NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString1,lightModel.lightNumber,lightModel.switchBtn,lightModel.crc16Str];
@@ -825,7 +825,7 @@
-(void)songNuoremindCyclePicDone{
if (_indexpath.section==0&&_indexpath.row==3) {
// if (_indexpath.section==0&&_indexpath.row==3) {
ChangeWaterCell*cell=[self.tableView cellForRowAtIndexPath:_indexpath];
@@ -867,7 +867,7 @@
[_remindPic removeFromSuperview];
}
// }
}
#pragma mark 默认换水时间
@@ -471,15 +471,18 @@
//
NSString*stateString6=[backModel.heatStickState substringWithRange:NSMakeRange(0, 2)];
if ([stateString6 isEqualToString:@"01"]) {
[JiaReBtn setImage:[UIImage imageNamed:@"JiaReBang_on.png"] forState:UIControlStateNormal];
JiaReBtn.selected=YES;
UInt64 mac=[dataContorl hexToTen:backModel.heatTemperature];
float TPlabel=mac/10;
int temp= (int)(TPlabel+0.5);
NSString *stringFloat = [NSString stringWithFormat:@"%d",temp];
UILabel *lbl = [JiaReBtn viewWithTag:1];
if ([stateString6 isEqualToString:@"01"]){
//
lbl.textColor = JWUIColorFromRGB(0x38b9fc);
}else{
JiaReBtn.selected=NO;
[JiaReBtn setImage:[UIImage imageNamed:@"JiaReBang_off.png"] forState:UIControlStateNormal];
lbl.textColor = [UIColor lightGrayColor];
}
lbl.text = [NSString stringWithFormat:@"%@°C", stringFloat];
}
+(NSArray*)refreshSongNuoBD86TimerAddTempWithBackMassageModel:(SongNuoBDProtocol*)backModel
@@ -94,9 +94,14 @@ typedef NS_ENUM(NSInteger,ThreeControBackMsgTape){
self.button.tag=201+i;
CGFloat y = 0;
if (is_iPhone_X) {
y = kScreenSize.height - (btnControlPlace - 10) - btnControlWith -10 -64 - 34;
} else {
y = kScreenSize.height - (btnControlPlace - 10) - btnControlWith -10 -64;
}
self.button.frame=CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith * 105 / 122), kScreenSize.height - (btnControlPlace - 10) - btnControlWith -10 -64 , btnControlWith * 105 / 122, btnControlWith );
self.button.frame=CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith * 105 / 122), y, btnControlWith * 105 / 122, btnControlWith );
//self.button.frame=CGRectMake1(wSpace1+(i%3)*(60+wSpace1), kScreenSize.height-80-64,60, 60);
@@ -121,8 +126,13 @@ typedef NS_ENUM(NSInteger,ThreeControBackMsgTape){
NSArray*arry=@[@"灯1",@"灯2",@"UV/冲浪"];
for (int j=0; j<nomalarr.count; j++){
self.buttonNameLabel=[[UILabel alloc]initWithFrame:CGRectMake(btnControlPlace +j*(btnControlPlace + btnControlWith * 105 / 122), kScreenSize.height - (btnControlPlace - 10) - 20 -64, btnControlWith * 7 / 8, btnControlPlace -10)];
CGFloat y = 0;
if (is_iPhone_X) {
y = kScreenSize.height - (btnControlPlace - 10) - 20 -64 - 34;
} else {
y = kScreenSize.height - (btnControlPlace - 10) - 20 -64;
}
self.buttonNameLabel=[[UILabel alloc]initWithFrame:CGRectMake(btnControlPlace +j*(btnControlPlace + btnControlWith * 105 / 122), y, btnControlWith * 7 / 8, btnControlPlace -10)];
// self.timeLabel=[[UILabel alloc]initWithFrame:CGRectMake1(wSpace+(i%3)*(60+wSpace), kScreenSize.height-30-64,60, 20)];
@@ -232,8 +232,13 @@ typedef NS_ENUM(NSInteger,TwoControBackMsgTape){
for (int i=0; i<twoControlNormalImgArr.count; i++) {
self.button=[UIButton buttonWithType:UIButtonTypeCustom];
self.button.frame = CGRectMake(space+i*(buttonSize+space) + 10 ,kScreenSize.height - buttonSize - 20 - 64 - 20 , buttonSize * 105 / 122 , buttonSize );
CGFloat y;
if (is_iPhone_X) {
y = kScreenSize.height - buttonSize - 20 - 64 - 20 - 34;
} else {
y = kScreenSize.height - buttonSize - 20 - 64 - 20;
}
self.button.frame = CGRectMake(space+i*(buttonSize+space) + 10 ,y , buttonSize * 105 / 122 , buttonSize );
[self.button setImage:[UIImage imageNamed:twoControlNormalImgArr[i]] forState:UIControlStateNormal];
@@ -257,8 +262,13 @@ typedef NS_ENUM(NSInteger,TwoControBackMsgTape){
NSArray*arry=@[@"",@"水泵"];
for (int j=0; j<arry.count; j++){
self.buttonNameLabel=[[UILabel alloc]initWithFrame:CGRectMake(space+j*(buttonSize+space) + 10, kScreenSize.height - 20 - 64 - 30 , buttonSize * 105 / 122, 20)];
CGFloat y = 0;
if (is_iPhone_X) {
y = kScreenSize.height - 20 - 64 - 30 - 34;
} else {
y = kScreenSize.height - 20 - 64 - 30;
}
self.buttonNameLabel=[[UILabel alloc]initWithFrame:CGRectMake(space+j*(buttonSize+space) + 10, y, buttonSize * 105 / 122, 20)];
@@ -218,7 +218,7 @@ NS_ENUM(NSInteger,deviceType){
-(void)setNav{
UIButton *bakbutton = [UIButton buttonWithType:UIButtonTypeCustom];
bakbutton.frame = CGRectMake(0,0,48,44);
[bakbutton setImage:[UIImage imageNamed:@"arrow_l"] forState:UIControlStateNormal];
[bakbutton setImage:[UIImage imageNamed:@"back_btn"] forState:UIControlStateNormal];
[bakbutton addTarget: self action: @selector(goBackAction) forControlEvents: UIControlEventTouchUpInside];
@@ -60,11 +60,8 @@ extern BOOL launchedByNotification;
// Do any additional setup after loading the view.
//[self creatViewControllers];
//[self setUpSubNav];
UIView *backView = [[UIView alloc] initWithFrame:CGRectMake(0, 0,self.view.frame.size.width, self.tabBar.frame.size.height)];
// backView.backgroundColor = TABLE_BAR_COLOR;
backView.backgroundColor = [UIColor whiteColor];
[self.tabBar insertSubview:backView atIndex:0];
self.tabBar.opaque = YES;
self.tabBar.translucent = NO;
[[NIMSDK sharedSDK].systemNotificationManager addDelegate:self];
[[NIMSDK sharedSDK].conversationManager addDelegate:self];
@@ -13,6 +13,8 @@
#import "ChangeSecretCodeController.h"
#define TUICHUAlertTAg 4100
#import "IfishUserDefaultHelper.h"
#import "SettingResetViewController.h"
@interface IfishSetViewController ()<UITableViewDelegate,UITableViewDataSource,UIAlertViewDelegate>
@property(nonatomic,strong)UITableView *tableView;
@@ -32,8 +34,8 @@ extern BOOL firstLogIn;
}
-(void)loadData{
self.titles=@[@[@"更换手机",@"修改密码"],@[@"切换账号"]];
self.imgs = @[@[@"personal_iocn_replace",@"replace_iocn_code"],@[@"personal_iocn_switch"]];
self.titles=@[@[@"更换手机",@"修改密码",@"恢复出厂模式"],@[@"切换账号"]];
self.imgs = @[@[@"personal_iocn_replace",@"replace_iocn_code",@"setting-reset"],@[@"personal_iocn_switch"]];
}
-(void)creatTab{
@@ -61,16 +63,12 @@ extern BOOL firstLogIn;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (section==1) {
return 1;
}
return 2;
return [self.titles[section] count];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 2;
return self.titles.count;
}
@@ -120,7 +118,12 @@ extern BOOL firstLogIn;
ChangeSecretCodeController *secretVC=[[ChangeSecretCodeController alloc]init];
[self.navigationController pushViewController:secretVC animated:YES];
}else if (indexPath.section==1&&indexPath.row==0){
} else if (indexPath.section == 0 && indexPath.row == 2) {
self.hidesBottomBarWhenPushed = YES;
SettingResetViewController *vc = [[SettingResetViewController alloc] initWithNibName:@"SettingResetViewController" bundle:nil];
vc.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:vc animated:YES];
} else if (indexPath.section==1&&indexPath.row==0){
UIAlertView*alert=[[UIAlertView alloc]initWithTitle:@"提醒" message:@"确认切换账号并重新登录?" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
alert.tag=TUICHUAlertTAg;
@@ -0,0 +1,13 @@
//
// SettingResetViewController.h
// Ifish
//
// Created by Minghao Xue on 2018/7/24.
// Copyright © 2018年 lianlian. All rights reserved.
//
#import "BaseVIewContorller.h"
@interface SettingResetViewController : BaseVIewContorller
@end
@@ -0,0 +1,78 @@
//
// SettingResetViewController.m
// Ifish
//
// Created by Minghao Xue on 2018/7/24.
// Copyright © 2018 lianlian. All rights reserved.
//
#import "SettingResetViewController.h"
#import "IFishHotpotUDPHelper.h"
#import "ConnectHotspotTipViewController.h"
#import "DeviceCameraModel.h"
#import "DeviceModel.h"
#import "MBProgressHUD.h"
#import<SystemConfiguration/CaptiveNetwork.h>
@interface SettingResetViewController ()<IFishHotpotUDPHelperDelegate>
@property (nonatomic, strong) DeviceModel *currentDevice;
@property (nonatomic, strong) MBProgressHUD *HUD;
@end
@implementation SettingResetViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"恢复出厂设置";
}
- (IBAction)reset:(id)sender {
if (![[self currentWifiSSID].lowercaseString hasPrefix:@"ifish"]) {
[self.view makeToast:@"请先将手机连接到wifi:ifish-xxxx"];
return;
}
self.HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
self.HUD.mode = MBProgressHUDModeIndeterminate;
self.HUD.labelText = @"重置指令已发出";
[IFishHotpotUDPHelper sharedInstance].delegate = self;
[[IFishHotpotUDPHelper sharedInstance] broadCastRestCommand];
}
- (IBAction)tipBtnClicked:(id)sender {
ConnectHotspotTipViewController *vc = [[ConnectHotspotTipViewController alloc] initWithNibName:nil bundle:nil];
[self.navigationController pushViewController:vc animated:YES];
}
#pragma mark - IFishHotpotUDPHelperDelegate
- (void)udpHelperCommandExecutedSuccess:(IFishUDPHelperBackMsgModel *)backModel {
self.HUD.mode = MBProgressHUDModeText;
self.HUD.labelText = @"设备已重置";
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[MBProgressHUD hideHUDForView:self.view animated:YES];
});
}
- (void)udpHelperMessage:(NSString *)msg {
// [self.view makeToast:msg];
}
#pragma mark - 删除设备
- (NSString *)currentWifiSSID {
NSString *ssid = @"Not Found";
CFArrayRef myArray = CNCopySupportedInterfaces();
if (myArray != nil) {
CFDictionaryRef myDict = CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0));
if (myDict != nil) {
NSDictionary *dict = (NSDictionary *)CFBridgingRelease(myDict);
ssid = [dict valueForKey:@"SSID"];
}
}
return ssid;
}
@end
@@ -0,0 +1,151 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="SettingResetViewController">
<connections>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Nsq-Ll-ePn">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Hmh-Qz-g3c">
<rect key="frame" x="0.0" y="35" width="375" height="183"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" image="hotspotconnect" translatesAutoresizingMaskIntoConstraints="NO" id="Y4O-50-CzP">
<rect key="frame" x="21" y="20" width="16" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="5pg-9H-7gX"/>
<constraint firstAttribute="width" constant="16" id="PqR-kc-gxk"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="特别提醒" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iJA-np-ESy">
<rect key="frame" x="50" y="18.5" width="69.5" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="DBF-b1-8Di" customClass="UIImageView">
<rect key="frame" x="38" y="61" width="299" height="1"/>
<color key="backgroundColor" red="0.77127617390000003" green="0.77127617390000003" blue="0.77127617390000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="scZ-MA-HWy"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="1.请将手机连接至wifi:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="q2B-K0-R3L">
<rect key="frame" x="50" y="78" width="145.5" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ifish-xxxx" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GJv-hc-FLm">
<rect key="frame" x="203" y="78" width="62" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2.恢复出厂参数指令将清除内部保存参数,设备信息、路由器信息、服务器地址、故障记录信息全部被默认设置。" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PwC-sM-vwr">
<rect key="frame" x="50" y="109" width="273" height="54"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hmW-nS-fZt">
<rect key="frame" x="269" y="71.5" width="62" height="30"/>
<color key="backgroundColor" red="0.08235294118" green="0.66274509800000003" blue="0.92156862750000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<state key="normal" title="点击连接">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="8"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="tipBtnClicked:" destination="-1" eventType="touchUpInside" id="hFS-cK-6dp"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="Y4O-50-CzP" firstAttribute="top" secondItem="Hmh-Qz-g3c" secondAttribute="top" constant="20" id="3w0-TD-w7v"/>
<constraint firstItem="GJv-hc-FLm" firstAttribute="centerY" secondItem="q2B-K0-R3L" secondAttribute="centerY" id="6vx-5G-UE1"/>
<constraint firstAttribute="trailing" secondItem="PwC-sM-vwr" secondAttribute="trailing" constant="52" id="AwE-CM-ElH"/>
<constraint firstItem="Y4O-50-CzP" firstAttribute="leading" secondItem="Hmh-Qz-g3c" secondAttribute="leading" constant="21" id="EBe-Ri-fen"/>
<constraint firstItem="hmW-nS-fZt" firstAttribute="leading" secondItem="GJv-hc-FLm" secondAttribute="trailing" constant="4" id="GaC-aT-yv6"/>
<constraint firstItem="GJv-hc-FLm" firstAttribute="leading" secondItem="q2B-K0-R3L" secondAttribute="trailing" constant="8" id="IlM-PV-lN7"/>
<constraint firstItem="DBF-b1-8Di" firstAttribute="leading" secondItem="Hmh-Qz-g3c" secondAttribute="leading" constant="38" id="Jdz-qN-yCS"/>
<constraint firstItem="hmW-nS-fZt" firstAttribute="centerY" secondItem="GJv-hc-FLm" secondAttribute="centerY" id="Lf6-yl-bSc"/>
<constraint firstItem="iJA-np-ESy" firstAttribute="leading" secondItem="Y4O-50-CzP" secondAttribute="trailing" constant="13" id="TeA-Cm-Ly5"/>
<constraint firstItem="q2B-K0-R3L" firstAttribute="top" secondItem="DBF-b1-8Di" secondAttribute="bottom" constant="16" id="XPK-MM-gih"/>
<constraint firstItem="DBF-b1-8Di" firstAttribute="top" secondItem="iJA-np-ESy" secondAttribute="bottom" constant="22" id="YQf-rv-UDW"/>
<constraint firstItem="PwC-sM-vwr" firstAttribute="top" secondItem="q2B-K0-R3L" secondAttribute="bottom" constant="13" id="cRa-RL-IR2"/>
<constraint firstItem="iJA-np-ESy" firstAttribute="centerY" secondItem="Y4O-50-CzP" secondAttribute="centerY" id="dPW-tR-lj7"/>
<constraint firstAttribute="trailing" secondItem="DBF-b1-8Di" secondAttribute="trailing" constant="38" id="dfB-or-nzx"/>
<constraint firstItem="PwC-sM-vwr" firstAttribute="leading" secondItem="q2B-K0-R3L" secondAttribute="leading" id="hhd-Bh-bNq"/>
<constraint firstItem="q2B-K0-R3L" firstAttribute="leading" secondItem="iJA-np-ESy" secondAttribute="leading" id="mqw-CL-bpe"/>
<constraint firstAttribute="bottom" secondItem="PwC-sM-vwr" secondAttribute="bottom" constant="20" id="rOm-yC-cCx"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="aPp-g0-kA2">
<rect key="frame" x="36" y="236" width="303" height="30"/>
<color key="backgroundColor" red="0.08235294118" green="0.66274509800000003" blue="0.92156862750000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="0Fg-MZ-PZd"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="确定恢复出厂值"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="4"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="reset:" destination="-1" eventType="touchUpInside" id="XwX-J9-wjl"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="aPp-g0-kA2" secondAttribute="bottom" constant="20" id="8jk-Mm-8jR"/>
<constraint firstItem="aPp-g0-kA2" firstAttribute="leading" secondItem="Nsq-Ll-ePn" secondAttribute="leading" constant="36" id="8mq-HT-uEu"/>
<constraint firstItem="aPp-g0-kA2" firstAttribute="centerX" secondItem="Nsq-Ll-ePn" secondAttribute="centerX" id="CDl-Ks-DXe"/>
<constraint firstItem="aPp-g0-kA2" firstAttribute="top" secondItem="Hmh-Qz-g3c" secondAttribute="bottom" constant="18" id="O21-ss-uRr"/>
<constraint firstItem="aPp-g0-kA2" firstAttribute="leading" secondItem="Nsq-Ll-ePn" secondAttribute="leading" constant="36" id="Qti-A3-6Ze"/>
<constraint firstItem="aPp-g0-kA2" firstAttribute="top" secondItem="Hmh-Qz-g3c" secondAttribute="bottom" constant="18" id="agu-8W-TSh"/>
<constraint firstAttribute="trailing" secondItem="aPp-g0-kA2" secondAttribute="trailing" constant="36" id="cU3-0e-6Zt"/>
<constraint firstAttribute="bottom" secondItem="aPp-g0-kA2" secondAttribute="bottom" constant="20" id="ezh-1n-e2s"/>
<constraint firstAttribute="trailing" secondItem="Hmh-Qz-g3c" secondAttribute="trailing" id="oTL-7I-zey"/>
<constraint firstAttribute="trailing" secondItem="aPp-g0-kA2" secondAttribute="trailing" constant="36" id="s0h-5I-UEp"/>
<constraint firstItem="Hmh-Qz-g3c" firstAttribute="top" secondItem="Nsq-Ll-ePn" secondAttribute="top" constant="35" id="svA-gP-NZU"/>
<constraint firstItem="Hmh-Qz-g3c" firstAttribute="leading" secondItem="Nsq-Ll-ePn" secondAttribute="leading" id="utL-HY-TdK"/>
</constraints>
</scrollView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="Nsq-Ll-ePn" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="IVk-jR-n3v"/>
<constraint firstAttribute="bottom" secondItem="Nsq-Ll-ePn" secondAttribute="bottom" id="JCo-ME-iHx"/>
<constraint firstItem="Nsq-Ll-ePn" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="eqr-XM-Yop"/>
<constraint firstAttribute="trailing" secondItem="Nsq-Ll-ePn" secondAttribute="trailing" id="sea-0V-d5J"/>
</constraints>
</view>
</objects>
<resources>
<image name="hotspotconnect" width="19" height="17"/>
</resources>
</document>
@@ -25,7 +25,12 @@
// CFShow((__bridge CFTypeRef)(infoDic));
NSString *app_Version=[infoDic objectForKey:@"CFBundleShortVersionString"];
NSLog(@"app_Version%@",app_Version);
self.versionLabel.text=[NSString stringWithFormat:@"v%@",app_Version];
NSString *versionStr = [NSString stringWithFormat:@"v%@",app_Version];
NSString *buildVersion = [infoDic objectForKey:@"CFBundleVersion"];
if (buildVersion.length > 0) {
versionStr = [versionStr stringByAppendingString:[NSString stringWithFormat:@"(%@)", buildVersion]];
}
self.versionLabel.text=versionStr;
//build
// NSString *app_build=[infoDic objectForKey:@"CFBundleVersion"];
@@ -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];
}
@@ -80,8 +80,9 @@
pageController.selectIndex = 0;
//pageController.menuViewBottomSpace = 10;
[self addChildViewController: pageController];
CGFloat height = [UIApplication sharedApplication].statusBarFrame.size.height + 44;
//tab中时
pageController.viewFrame = CGRectMake(0,64,self.view.frame.size.width, self.view.frame.size.height - 64) ;
pageController.viewFrame = CGRectMake(0,height,self.view.frame.size.width, self.view.frame.size.height - height) ;
self.pageController = pageController;
[self.view addSubview: pageController.view];
@@ -143,7 +143,7 @@ NIMContactSelectDelegate
//
UIButton *bakbutton = [UIButton buttonWithType:UIButtonTypeCustom];
bakbutton.frame = CGRectMake(0,0,48,44);
[bakbutton setImage:[UIImage imageNamed:@"arrow_l"] forState:UIControlStateNormal];
[bakbutton setImage:[UIImage imageNamed:@"back_btn"] forState:UIControlStateNormal];
[bakbutton addTarget: self action: @selector(goBackAction) forControlEvents: UIControlEventTouchUpInside];
@@ -91,7 +91,7 @@
//tab栏中时设置返回按钮
UIButton *bakbutton = [UIButton buttonWithType:UIButtonTypeCustom];
bakbutton.frame = CGRectMake(0,0,48,44);
[bakbutton setImage:[UIImage imageNamed:@"arrow_l"] forState:UIControlStateNormal];
[bakbutton setImage:[UIImage imageNamed:@"back_btn"] forState:UIControlStateNormal];
[bakbutton addTarget: self action: @selector(backAction) forControlEvents: UIControlEventTouchUpInside];
@@ -688,6 +688,9 @@
[self.tableView addGestureRecognizer:longpress];
_scrollHeight = 64;
if (@available(iOS 11.0, *)) {
self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
}
-(void)addLongPressGesture:(UILongPressGestureRecognizer *)guesture
@@ -66,6 +66,8 @@
#import "RunSun84CHSetViewController.h"
#import "HaveHotCoolWenDuPicview.h"
#import "RuSunLightOrder.h"
#import "RuiMeiSetViewController.h"
//
@interface IfishP2PMonitorController ()<HaveHotCoolWenDuPicviewDelegate>
{
@@ -103,6 +105,7 @@
@property(nonatomic,strong) KeLiAiSetViewController *keLiAiSetVc;
@property(nonatomic,strong) RusunHaveHeateSetViewController *rusunSet;
@property(nonatomic,strong) RunSun84CHSetViewController *rusun84Set;
@property (nonatomic, strong) RuiMeiSetViewController *ruimeiSet;
@property(nonatomic,strong) DXPopover *popover;
@property(nonatomic,strong) UIButton *rightPopButton;
@property (nonatomic,strong) SetNameTextViewController *setNameVC;
@@ -468,7 +471,7 @@
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
UIButton*leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
leftBtn.frame = CGRectMake(0, 0, 47,44);
[leftBtn setBackgroundImage:[UIImage imageNamed:@"arrow_l"] forState:UIControlStateNormal];
[leftBtn setImage:[UIImage imageNamed:@"back_btn"] forState:UIControlStateNormal];
[leftBtn addTarget: self action: @selector(btnClickToBack:) forControlEvents: UIControlEventTouchUpInside];
UIBarButtonItem * lbbItem=[[UIBarButtonItem alloc]initWithCustomView:leftBtn];
self.navigationItem.leftBarButtonItem=lbbItem;
@@ -4002,6 +4005,19 @@
[self.navigationController pushViewController:_rusun84Set animated:YES];
}else if ([dmodel.type isEqualToString:DECICE_TYPE_RUIMEI]){
_ruimeiSet = [[RuiMeiSetViewController alloc] init];
_ruimeiSet.currentdevice = dmodel;
NSString*stateString=[self.fishControlView.ruiMeiBack.customModel substringWithRange:NSMakeRange(2, 2)];
if ([stateString isEqualToString:@"01"]) {
_ruimeiSet.customModeOn=YES;
}else{
_ruimeiSet.customModeOn=NO;
}
usleep(50*1000);
[self.navigationController pushViewController:_ruimeiSet animated:YES];
}else if ([dmodel.type isEqualToString:DECICE_TYPE_JUNENGCC]){
@@ -4149,6 +4165,19 @@
[_rusun84Set.tableView reloadData];
}else if ([dmodel.type isEqualToString:DECICE_TYPE_RUIMEI]){
_ruimeiSet.timeArr = timerArr;
[_ruimeiSet.indicatorView stopAnimating];
NSString*stateString=[self.fishControlView.ruiMeiBack.customModel substringWithRange:NSMakeRange(2, 2)];
if ([stateString isEqualToString:@"01"]) {
_ruimeiSet.customModeOn=YES;
}else{
_ruimeiSet.customModeOn=NO;
}
[_ruimeiSet.tableView reloadData];
}else if ([dmodel.type isEqualToString:DECICE_TYPE_JUNENGCC]){
@@ -4571,7 +4600,19 @@
[self setHotCoolMianQueueWithUint64:mac];
}
#pragma mark - 瑞美
-(void)selectRuiMeiIndex:(NSIndexPath *)index withbackModle:(RuiMeiProtocolModel *)backModel {
[self showWenDuPic];
[self setMeiMianQueue];
}
-(void)setMeiMianQueue
{
RuiMeiProtocolModel*backmodel=[[DataCenter defaultDtacenter]valueForKey:DataCenterRuiMeiModelKey];
UInt64 mac=[dataContorl hexToTen:backmodel.heatTemperature];
[self setMianQueueWithUint64:mac];
}
#pragma mark - 松诺BD 加热棒
-(void)selectSongNuoBDIndex:(NSIndexPath *)index withBackModel:(SongNuoBDProtocol *)backModel{
@@ -38,8 +38,8 @@
UIButton *back = [UIButton buttonWithType:UIButtonTypeCustom];
back.frame = CGRectMake(0,0,48,44);
[back setImage:[UIImage imageNamed:@"arrow_l"] forState:UIControlStateNormal];
// [_bakbutton setBackgroundImage:[UIImage imageNamed:@"arrow_l"] forState:UIControlStateNormal];
[back setImage:[UIImage imageNamed:@"back_btn"] forState:UIControlStateNormal];
// [_bakbutton setBackgroundImage:[UIImage imageNamed:@"back_btn"] forState:UIControlStateNormal];
[back addTarget: self action: @selector(goBackAction) forControlEvents: UIControlEventTouchUpInside];
@@ -562,8 +562,13 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
//967/1018/ 0.95
CGFloat percentHbiW = 0.117 ;//5s 35/300
self.nodImg= [[UIImageView alloc] initWithFrame:CGRectMake(5, 20 + 64,12, 12)];
CGFloat y;
if (is_iPhone_X) {
y = 20 + 88;
} else {
y = 20 + 64;
}
self.nodImg= [[UIImageView alloc] initWithFrame:CGRectMake(5, y,12, 12)];
self.nodImg.image = [UIImage imageNamed:@"linkingdevice_point"];
[self.view addSubview:self.nodImg];
@@ -587,7 +592,7 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
CGFloat labelSizeW = [self widthForString:self.wifilabel.text fontSize:18 andHeight:10];
CGFloat labelH= [self heightForString:self.wifilabel.text fontSize:18 andWidth:labelSizeW];
self.wifilabel.frame = CGRectMake(CGRectGetMaxX(self.nodImg.frame), 20 + 64, labelSizeW, labelH);
self.wifilabel.frame = CGRectMake(CGRectGetMaxX(self.nodImg.frame), y, labelSizeW, labelH);
[self.view addSubview:self.wifilabel];
//wifi 输入框
@@ -973,8 +978,14 @@ withFilterContext:(id)filterContext
{
if (!self.connectingView) {
CGFloat yOffset = 0;
if (is_iPhone_X) {
yOffset = 88;
} else {
yOffset = 64;
}
IfishConnectingView *connectingView=[[IfishConnectingView alloc] initWithFrame:CGRectMake(0,64, kScreenSize.width, CGRectGetMaxY(self.wifiSecFiled.frame))];
IfishConnectingView *connectingView=[[IfishConnectingView alloc] initWithFrame:CGRectMake(0,yOffset, kScreenSize.width, CGRectGetMaxY(self.wifiSecFiled.frame))];
self.connectingView =connectingView;
[self.connectingView.textChangeView animationWithTexts:[NSArray arrayWithObjects:@"正在拼命连接中...",@"请将摄像头放在wifi信号良好的位置",@"连接时,请开大手机音量",@"连接过程会持续40s左右,请耐心等待",@"连接不上,请点击下方说明书",nil]];
@@ -18,6 +18,8 @@
#import "RuSunProtocol.h"
#import "SongNuoBDProtocol.h"
#import "RunSun84Protocol.h"
#import "RuiMeiProtocolModel.h"
@interface BootomViewSoketBackMasgConreol : NSObject
//获取温度
+(NSString*)getTempWithSoketData:(NSData *)data;
@@ -59,5 +61,7 @@ indexPath;
+(void)SongnuoBDCommandSelectorWithBackMode86:(SongNuoBDProtocol *)model atindexPath:(NSIndexPath *)indexPath;
//瑞美
+(void)RuiMeiCommandSelectorWithBackMode168:(RuiMeiProtocolModel *)model atindexPath:(NSIndexPath *)indexPath;
@end
@@ -84,6 +84,10 @@
// 86
str=[str substringWithRange:NSMakeRange(148,IFISH_TEMPERATURE_BYTE2)];
}else if ([type isEqualToString:DECICE_TYPE_RUIMEI]){
//
str=[str substringWithRange:NSMakeRange(148,IFISH_TEMPERATURE_BYTE2)];
}
UInt64 mac=[dataContorl hexToTen:str];
@@ -762,6 +766,81 @@ indexPath{
}
+(void)RuiMeiCommandSelectorWithBackMode168:(RuiMeiProtocolModel *)model atindexPath:(NSIndexPath *)indexPath
{
NSInteger index= indexPath.row - 3;
manulswitchMSModel*manulModel=[[manulswitchMSModel alloc]init];
[[Socketsingleton sharedInstance] setSoketLightDataWith:manulModel];
NSString*switchString=manulModel.description;
if (index == 0) {
manulModel.lightNumber = @"01";
if([[model.ch1 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
{
manulModel.switchBtn = @"01";
}else{
manulModel.switchBtn = @"00";
}
}else if (index == 1){
manulModel.lightNumber = @"02";
if([[model.ch2 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
{
manulModel.switchBtn = @"01";
}else{
manulModel.switchBtn = @"00";
}
}else if (index == 2){
manulModel.lightNumber = @"03";
if([[model.ch3 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
{
manulModel.switchBtn = @"01";
}else{
manulModel.switchBtn = @"00";
}
}else if (index == 3){
manulModel.lightNumber = @"04";
if([[model.ch4 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
{
manulModel.switchBtn = @"01";
}else{
manulModel.switchBtn = @"00";
}
}else if (index == 4){
//
return;
}
manulModel.crc16Str = @"0000";
NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str];
NSData*manulData=[dataContorl stringToHexData:switchString2];
[[Socketsingleton sharedInstance] soketWriteData:manulData];
}
+(void)SongnuoBDCommandSelectorWithBackMode86:(SongNuoBDProtocol *)model atindexPath:(NSIndexPath *)indexPath
{
NSInteger index= indexPath.row - 3;
@@ -30,6 +30,9 @@
#import "SongNuoBDProtocol.h"
#import "RunSun84Protocol.h"
#import "RuSun84BackMsgUtils.h"
#import "RuiMeiProtocolModel.h"
#import "RuiMeiBackMsgUtils.h"
@protocol MonitorBottomCollcetionSelectDelegate <NSObject>
@optional
@@ -67,6 +70,8 @@
-(void)selectRuSunIndex:(NSIndexPath*)index withbackModle:(RuSunProtocol *)backModel;
-(void)selectRuSun84Index:(NSIndexPath*)index withbackModle:(RunSun84Protocol *)backModel;
//瑞美
-(void)selectRuiMeiIndex:(NSIndexPath*)index withbackModle:(RunSun84Protocol *)backModel;
//松诺 BD
@@ -141,6 +146,7 @@
@property(nonatomic,strong) RuSunProtocol *ruSunBack;
@property(nonatomic,strong) RunSun84Protocol *ruSun84Back;
@property (nonatomic, strong) RuiMeiProtocolModel *ruiMeiBack;
@property(nonatomic,strong) SongNuoBDProtocol *songNuoBDBack;
-(void)setTabViewWithFrame:(CGRect)frame;
@@ -27,6 +27,9 @@
#import "ThreeControlName.h"
#import "FourControlName.h"
#import "XuToControlName.h"
#import "RuiMeiCHNameCustom.h"
#import "RuiMeiCHControl.h"
@implementation MonitorBootmView
-(id)initWithFrame:(CGRect)frame
@@ -605,7 +608,9 @@
return 3 + self.device.controlAmount.integerValue +1;
}else{
} else if ([self.device.type isEqualToString:DECICE_TYPE_RUIMEI]) {
return 3 + 5;
} else {
if (self.device.controlAmount.integerValue ==5) {
@@ -659,6 +664,17 @@
withData:self.device
addMassglength:self.dataLength];
}else if ([self.device.type isEqualToString:DECICE_TYPE_RUIMEI]){
if (!_ruiMeiBack) {
[self makeToast:@"暂未连接"];
return;
}
[self.MonitorBottomDelegate didselectCollectionIex:indexPath
withData:self.device
addMassglength:self.dataLength];
}else if ([self.device.type isEqualToString:DECICE_TYPE_JUNENGCC]){
@@ -843,6 +859,23 @@
}
}else if ([self.device.type isEqualToString:DECICE_TYPE_RUIMEI]){
if (!_ruiMeiBack) {
[self makeToast:@"暂未连接"];
return;
}
if (indexPath.row == 7) {
//
[self.MonitorBottomDelegate selectRuiMeiIndex:indexPath withbackModle:_ruiMeiBack];
}else{
[BootomViewSoketBackMasgConreol RuiMeiCommandSelectorWithBackMode168:_ruiMeiBack atindexPath:indexPath];
[self makeToastActivity];
}
}else if ([self.device.type isEqualToString:DECICE_TYPE_JUNENGCC]){
@@ -1124,6 +1157,14 @@
[cell setRusuan84ControlBtnImg:self.btnImgArr addArr:self.btnOnImgArr atIndex:indexPath addBackModel:_ruSun84Back];
}else if ([self.device.type isEqualToString:DECICE_TYPE_RUIMEI]){
if (!_ruiMeiBack) {
cell.controBtnImg.image = self.btnImgArr[indexPath.row - 3];
[self makeToast:@"连接设备中..."];
}
[cell setRuiMeiControlBtnImg:self.btnImgArr addArr:self.btnOnImgArr atIndex:indexPath addBackModel:_ruiMeiBack];
}else if ([self.device.type isEqualToString:DECICE_TYPE_JUNENGCC]){
@@ -1337,7 +1378,24 @@
LXImageWithImageName(@"bootview_022_on"),
LXImageWithImageName(@"bootview_heat_on")];
}else{
} else if ([self.device.type isEqualToString:DECICE_TYPE_RUIMEI]){
//self.btnNameArr = @[@"灯1",@"灯2",@"水泵",@"氧泵",@"加热棒"];
RuiMeiCHControl* ruimei = [RuiMeiCHNameCustom currentdevice:self.device.macAddress];
self.btnNameArr = @[ruimei.ch1name,ruimei.ch2name,ruimei.ch3name,ruimei.ch4name,ruimei.jiaRe];
self.btnImgArr = @[LXImageWithImageName(@"bootview_light_off"),
LXImageWithImageName(@"bootview_light_off"),
LXImageWithImageName(@"bootview_shajun_off"),
LXImageWithImageName(@"bootview_co2_off"),
LXImageWithImageName(@"bootview_heat_off")];
self.btnOnImgArr = @[LXImageWithImageName(@"bootview_light_on"),
LXImageWithImageName(@"bootview_light_on"),
LXImageWithImageName(@"bootview_shajun_on"),
LXImageWithImageName(@"bootview_co2_on"),
LXImageWithImageName(@"bootview_heat_on")];
} else{
int controlAmount=[self.device.controlAmount intValue];
@@ -1608,6 +1666,26 @@
addMassglength:string1.length];
}else if ([self.device.type isEqualToString:DECICE_TYPE_RUIMEI]){
//
if (!_ruiMeiBack) {
_ruiMeiBack = [[RuiMeiProtocolModel alloc] init];
}
[RuiMeiBackMsgUtils readSoketDataWithBaackMassgModel:_ruiMeiBack addWithBackData:data];
self.temperature = [BootomViewSoketBackMasgConreol getTempNewWayWithSoketData:data adddeviceType:DECICE_TYPE_RUIMEI];
[self.collectionView reloadData];
NSArray *timerArr=[RuiMeiBackMsgUtils refreshRuSunTimerAddTemperatureWithBackMassageModel:_ruiMeiBack];
[self.MonitorBottomDelegate setTimeVCReloadDatawithTimerArr:timerArr
withData:self.device
addMassglength:string1.length];
}else if ([self.device.type isEqualToString:DECICE_TYPE_JUNENGCC]){
//
@@ -16,6 +16,8 @@
#import "RuSunProtocol.h"
#import "SongNuoBDProtocol.h"
#import "RunSun84Protocol.h"
#import "RuiMeiProtocolModel.h"
@interface FishControlFourthCell : UICollectionViewCell
@property(nonatomic,strong) UIImageView *controBtnImg;
@@ -80,4 +82,10 @@
atIndex:(NSIndexPath *)indexPath
addBackModel:(SongNuoBDProtocol*)model;
// 瑞美
-(void)setRuiMeiControlBtnImg:(NSArray *)imgOffArr
addArr:(NSArray *)imgOnArr
atIndex:(NSIndexPath *)indexPath
addBackModel:(RuiMeiProtocolModel*)model;
@end
@@ -397,6 +397,50 @@
}
}
-(void)setRuiMeiControlBtnImg:(NSArray *)imgOffArr
addArr:(NSArray *)imgOnArr
atIndex:(NSIndexPath *)indexPath
addBackModel:(RuiMeiProtocolModel*)model
{
NSInteger index = indexPath.row - 3;
if (index == 0) {
NSString*stateString=[model.ch1 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)];
[self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr
addOffArr:imgOffArr];
}else if (index == 1){
NSString*stateString=[model.ch2 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)];
[self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr
addOffArr:imgOffArr];
}else if (index == 2){
NSString*stateString=[model.ch3 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)];
[self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr
addOffArr:imgOffArr];
}else if (index == 3){
NSString*stateString=[model.ch4 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)];
[self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr
addOffArr:imgOffArr];
}else if (index == 4){
//
//
//00 01
//model.heatStickState
NSString*stateString=[model.heatStickState substringWithRange:NSMakeRange(0, IFISH_LIGHTBTN_BYTE)];
[self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr
addOffArr:imgOffArr];
}
}
-(void)setSongNuoBDControBtnImg:(NSArray *)imgOffArr
@@ -510,8 +510,8 @@ const CGFloat ktkDefaultToolbarHeight = 49;
UIButton *back = [UIButton buttonWithType:UIButtonTypeCustom];
back.frame = CGRectMake(0,0,48,44);
[back setImage:[UIImage imageNamed:@"arrow_l"] forState:UIControlStateNormal];
// [_bakbutton setBackgroundImage:[UIImage imageNamed:@"arrow_l"] forState:UIControlStateNormal];
[back setImage:[UIImage imageNamed:@"back_btn"] forState:UIControlStateNormal];
// [_bakbutton setBackgroundImage:[UIImage imageNamed:@"back_btn"] forState:UIControlStateNormal];
[back addTarget: self action: @selector(goBackAction) forControlEvents: UIControlEventTouchUpInside];
@@ -58,7 +58,7 @@
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
_bakbutton = [UIButton buttonWithType:UIButtonTypeCustom];
_bakbutton.frame = CGRectMake(0, 0, 47,44);
[_bakbutton setBackgroundImage:[UIImage imageNamed:@"arrow_l"] forState:UIControlStateNormal];
[_bakbutton setImage:[UIImage imageNamed:@"back_btn"] forState:UIControlStateNormal];
[_bakbutton addTarget: self action: @selector(backButtonEvent) forControlEvents: UIControlEventTouchUpInside];
@@ -0,0 +1,16 @@
//
// ConnectHotpotViewController.h
// Ifish
//
// Created by Minghao Xue on 2018/7/16.
// Copyright © 2018年 lianlian. All rights reserved.
//
#import "BaseVIewContorller.h"
@interface ConnectHotpotViewController : BaseVIewContorller
@property (nonatomic, copy) NSString *ssid;
@property (nonatomic, copy) NSString *bssid;
@end
@@ -0,0 +1,299 @@
//
// ConnectHotpotViewController.m
// Ifish
//
// Created by Minghao Xue on 2018/7/16.
// Copyright © 2018 lianlian. All rights reserved.
//
#import "ConnectHotpotViewController.h"
#import "ConnectHotspotTipViewController.h"
#import "dataContorl.h"
#import<SystemConfiguration/CaptiveNetwork.h>
#import "IFishHotpotUDPHelper.h"
#import "ESPTouchResult.h"
#import "ESPTouchTask.h"
#import "IfishDataUnity.h"
#import "MBProgressHUD.h"
@interface ConnectHotpotViewController ()<UITextFieldDelegate, IFishHotpotUDPHelperDelegate>
@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;
@property (weak, nonatomic) IBOutlet UITextField *nameLbl;
@property (strong, nonatomic) IBOutletCollection(UIImageView) NSArray *dashView;
@property (weak, nonatomic) IBOutlet UITextField *pwdTf;
@property (weak, nonatomic) IBOutlet UIView *containerView;
@property (nonatomic, strong) ESPTouchTask* epTask;
@property (nonatomic, strong) NSMutableString *trackString;
@property (nonatomic, strong) MBProgressHUD *HUD;
/**
mac地址
*/
@property (nonatomic, copy) NSString *macAddress;
/**
*/
@property (nonatomic, assign) BOOL isBindingDevice;
@property (nonatomic, strong) NSTimer *bindTimer;
@property (nonatomic, assign) NSInteger retryTimes;
@end
@implementation ConnectHotpotViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"热点连接";
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keybordframeChanged:) name:UIKeyboardDidChangeFrameNotification object:nil];
for (UIImageView *view in self.dashView) {
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];
}
- (void)test {
[UIPasteboard generalPasteboard].string = [self.trackString copy];
}
- (UIImage *)imageWithLineWithSize:(CGSize)size{
CGFloat width = size.width;
UIGraphicsBeginImageContext(size);
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGFloat lengths[] = {2,2};
CGContextRef line = UIGraphicsGetCurrentContext();
CGContextSetStrokeColorWithColor(line, [UIColor colorWithRed:133/255.0 green:133/255.0 blue:133/255.0 alpha:1.0].CGColor);
CGContextSetLineDash(line, 0, lengths, 1);
CGContextMoveToPoint(line, 0, 1);
CGContextAddLineToPoint(line, width-10, 1);
CGContextStrokePath(line);
return UIGraphicsGetImageFromCurrentImageContext();
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)keybordframeChanged:(NSNotification *)no {
NSDictionary *userInfo = no.userInfo;
//
double duration = [userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue];
// frame
CGRect keyboardF = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
keyboardF = [self.view convertRect:keyboardF fromView:[UIApplication sharedApplication].keyWindow];
CGRect containerViewF = [self.view convertRect:self.containerView.frame fromView:self.scrollView];
CGFloat miniSpacing = 4;
CGFloat offset = CGRectGetMaxY(containerViewF) + miniSpacing - CGRectGetMinY(keyboardF);
if (offset <= 0) {
offset = 0;
}
[UIView animateWithDuration:duration animations:^{
self.scrollView.contentInset = UIEdgeInsetsMake(-offset, 0, 0, 0);
}];
}
- (IBAction)clickHereBtnClicked:(id)sender {
ConnectHotspotTipViewController *vc = [[ConnectHotspotTipViewController alloc] initWithNibName:@"ConnectHotspotTipViewController" bundle:nil];
[self.navigationController pushViewController:vc animated:YES];
}
#pragma mark - UITextFieldDelegate
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
[textField resignFirstResponder];
return YES;
}
- (IBAction)setLinkBtnClicked:(id)sender {
if (self.nameLbl.text.length == 0) {
[self.view makeToast:@"请输入正确的路由器名称"];
return;
}
BOOL isRight =[dataContorl isIncludeSpecialCharact:self.pwdTf.text];
if (!isRight) {
[self.view makeToast:@"路由器密码不能包含特殊字符,只能为数字字母下划线"];
return;
}
if (![[self currentWifiSSID].lowercaseString hasPrefix:@"ifish"]) {
[self.view makeToast:@"请先将手机连接到wifi:ifish-xxxx"];
return;
}
NSString *ssidName = self.nameLbl.text;
NSString *ssidPwd = self.pwdTf.text;
[self sendToDeviceWithSSIDName:ssidName andSSIDPWD:ssidPwd];
}
- (NSString *)currentWifiSSID {
NSString *ssid = @"Not Found";
CFArrayRef myArray = CNCopySupportedInterfaces();
if (myArray != nil) {
CFDictionaryRef myDict = CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0));
if (myDict != nil) {
NSDictionary *dict = (NSDictionary *)CFBridgingRelease(myDict);
ssid = [dict valueForKey:@"SSID"];
}
}
return ssid;
}
#pragma mark - UDP related
- (void)sendToDeviceWithSSIDName:(NSString *)name andSSIDPWD:(NSString *)pwd {
[IFishHotpotUDPHelper sharedInstance].delegate = self;
[[IFishHotpotUDPHelper sharedInstance] broadCastHotspotConnectCommandWith:name pwd:pwd];
}
#pragma mark - IFishHotpotUDPHelperDelegate
- (void)udpHelperCommandExecutedSuccess:(IFishUDPHelperBackMsgModel *)backModel {
self.ssid = backModel.senderMacAddress;
[self.view resignFirstResponder];
self.HUD.labelText = @"请稍后";
self.trackString = [NSMutableString string];
[self appendTrakContent:@"=================收到设备答复==================="];
[self appendTrakContent:[NSString stringWithFormat:@"答复状态码:%@", backModel.result]];
[self appendTrakContent:[NSString stringWithFormat:@"答复Mac地址:%@", backModel.senderMacAddress]];
self.macAddress = backModel.senderMacAddress;
[IFishHotpotUDPHelper sharedInstance].delegate = nil;
[[IFishHotpotUDPHelper sharedInstance] broadCastRestartCommand];
self.bindTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(startBinding) userInfo:nil repeats:YES];
}
- (void)startBinding {
BOOL networkOk = NO;
AFNetworkReachabilityStatus status = [AFNetworkReachabilityManager sharedManager].networkReachabilityStatus;
if (status == AFNetworkReachabilityStatusReachableViaWiFi) {
if (![[self currentWifiSSID].lowercaseString hasPrefix:@"ifish"]) {
networkOk = YES;
}
} else if (status == AFNetworkReachabilityStatusReachableViaWWAN) {
networkOk = YES;
}
if (!networkOk) {
return;
}
if (self.isBindingDevice) {
return;
}
if (self.macAddress.length == 0) {
return;
}
self.isBindingDevice = YES;
if (self.bindTimer) {
[self.bindTimer invalidate];
self.bindTimer = nil;
}
self.retryTimes = 0;
[self bindDeviceWithSsid:self.macAddress];
}
- (void)udpHelperMessage:(NSString *)msg {
self.HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
self.HUD.mode = MBProgressHUDModeIndeterminate;
self.HUD.labelText = msg;
}
#pragma mark - bind
-(void)bindDeviceWithSsid:(NSString*)bssid{
NSLog(@"设备bssid_%@",bssid);
[self appendTrakContent:@"=================进入绑定函数================="];
NSString *userId = [dataContorl dataControlGetUserIdInfo];
self.HUD.labelText = @"正在绑定设备";
[self appendTrakContent:[NSString stringWithFormat:@"绑定参数 userID:%@", userId]];
[self appendTrakContent:[NSString stringWithFormat:@"绑定参数 macaddress:%@", bssid]];
[AFHttpTool bindDeviceWithUserId:userId macAddress:bssid success:^(id response) {
self.isBindingDevice = NO;
self.macAddress = nil;
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.HUD.labelText = @"用户绑定设备成功,但设备初次入网失败请重新登陆";
}else{
NSMutableArray * _deviceArry=[[DataCenter defaultDtacenter]valueForKey:@"deviceInfo"];
[_deviceArry insertObject:devicemodel atIndex:0];
[[DataCenter defaultDtacenter]setValue:_deviceArry forKey:@"deviceInfo"];
if ([devicemodel.type isEqual:[NSNull null]]){
//
self.HUD.labelText = @"设备不在服务器";
}else{
self.HUD.labelText = @"设备绑定成功";
[[IfishDataUnity shareDataInstance] initAppCenterVcWith:devicemodel addWithdissMisVc:nil];
//
[[IfishUserObsever sharedInstance] xinZengJingYanZhi:IFISHADDEXP_BIDDEVICE addType:IFISHADDEXPTYPE1];
}
}
}else if ([resultDic[@"result"] isEqualToString:@"101"]){
[self appendTrakContent:@"绑定返回状态码错误。设备信息为:%@"];
self.HUD.labelText = @"绑定失败";
self.bakbutton.userInteractionEnabled=YES;
}else if ([resultDic[@"result"] isEqualToString:@"301"]){
[self appendTrakContent:@"绑定返回状态码错误。设备信息为:%@"];
self.HUD.labelText = @"请求验证失败,请重新登录";
self.bakbutton.userInteractionEnabled=YES;
}else if ([resultDic[@"result"] isEqualToString:@"302"]){
//
[self appendTrakContent:@"绑定返回状态码错误。设备信息为:%@"];
self.bakbutton.userInteractionEnabled=YES;
self.HUD.labelText = @"绑定失败";
[self.HUD hide:YES afterDelay:2];
}
} failure:^(NSError *err) {
if (self.retryTimes < 3) {
[self bindDeviceWithSsid:self.macAddress];
self.retryTimes += 1;
} else {
self.isBindingDevice = NO;
self.HUD.labelText = @"请求异常";
[self.HUD hide:YES afterDelay:2];
[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
@@ -0,0 +1,207 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ConnectHotpotViewController">
<connections>
<outlet property="containerView" destination="1Km-pH-09L" id="XAO-g5-CDw"/>
<outlet property="nameLbl" destination="APB-5y-OkX" id="mJ6-4x-fap"/>
<outlet property="pwdTf" destination="kiH-bp-24Q" id="PIU-eW-NJW"/>
<outlet property="scrollView" destination="rVr-h5-uWd" id="xVI-ZH-ZBs"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
<outletCollection property="dashView" destination="g0t-sG-8Wn" id="LZL-DB-Zre"/>
<outletCollection property="dashView" destination="qEQ-pQ-mfJ" id="oNj-aK-CHc"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rVr-h5-uWd">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1Km-pH-09L">
<rect key="frame" x="0.0" y="35" width="375" height="251.5"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" image="hotspotconnect" translatesAutoresizingMaskIntoConstraints="NO" id="YQa-dk-iMD">
<rect key="frame" x="21" y="20" width="16" height="16"/>
<constraints>
<constraint firstAttribute="width" constant="16" id="CtN-fF-qWh"/>
<constraint firstAttribute="height" constant="16" id="Jp8-hy-x86"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="热点连接" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QfU-Iw-5Wj">
<rect key="frame" x="50" y="18.5" width="69.5" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="g0t-sG-8Wn" customClass="UIImageView">
<rect key="frame" x="38" y="61" width="299" height="1"/>
<color key="backgroundColor" red="0.77127617390000003" green="0.77127617390000003" blue="0.77127617390000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="Gkj-Pr-nXo"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="请将手机连接至wifi:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kGw-DQ-YIO">
<rect key="frame" x="50" y="78" width="135" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="连接说明书,请" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dSQ-fr-q0c">
<rect key="frame" x="50" y="109" width="107.5" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ifish-xxxx" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dDg-6q-BXw">
<rect key="frame" x="193" y="78.5" width="62" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WQq-Kn-abo">
<rect key="frame" x="157.5" y="103.5" width="72" height="29"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<state key="normal" title="点击此处。"/>
<connections>
<action selector="clickHereBtnClicked:" destination="-1" eventType="touchUpInside" id="fua-j5-2TE"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qEQ-pQ-mfJ" customClass="UIImageView">
<rect key="frame" x="38" y="148.5" width="299" height="1"/>
<color key="backgroundColor" red="0.77127617390000003" green="0.77127617390000003" blue="0.77127617390000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="hPn-jR-jsT"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="路由器名称" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="63z-z9-F6B">
<rect key="frame" x="50" y="179.5" width="76.5" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="路由器密码" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="svD-TG-gy8">
<rect key="frame" x="50" y="213.5" width="76.5" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="APB-5y-OkX">
<rect key="frame" x="134.5" y="175" width="188.5" height="28"/>
<color key="backgroundColor" red="0.77127617390000003" green="0.77127617390000003" blue="0.77127617390000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="28" id="reY-Lx-dbw"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" returnKeyType="done"/>
<connections>
<outlet property="delegate" destination="-1" id="egJ-r2-yXE"/>
</connections>
</textField>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="kiH-bp-24Q">
<rect key="frame" x="134.5" y="209" width="188.5" height="28"/>
<color key="backgroundColor" red="0.77127617390000003" green="0.77127617390000003" blue="0.77127617390000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" returnKeyType="done" secureTextEntry="YES"/>
<connections>
<outlet property="delegate" destination="-1" id="yMf-oO-0nW"/>
</connections>
</textField>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="g0t-sG-8Wn" firstAttribute="leading" secondItem="1Km-pH-09L" secondAttribute="leading" constant="38" id="38U-Zi-JdF"/>
<constraint firstItem="qEQ-pQ-mfJ" firstAttribute="top" secondItem="WQq-Kn-abo" secondAttribute="bottom" constant="16" id="4fb-6z-WQe"/>
<constraint firstItem="63z-z9-F6B" firstAttribute="top" secondItem="qEQ-pQ-mfJ" secondAttribute="bottom" constant="30" id="57S-tP-Zhv"/>
<constraint firstItem="dSQ-fr-q0c" firstAttribute="leading" secondItem="kGw-DQ-YIO" secondAttribute="leading" id="5D4-Vk-MRL"/>
<constraint firstItem="APB-5y-OkX" firstAttribute="centerY" secondItem="63z-z9-F6B" secondAttribute="centerY" id="5o9-8z-dnD"/>
<constraint firstItem="kGw-DQ-YIO" firstAttribute="leading" secondItem="QfU-Iw-5Wj" secondAttribute="leading" id="8Ym-vo-U81"/>
<constraint firstItem="kGw-DQ-YIO" firstAttribute="top" secondItem="g0t-sG-8Wn" secondAttribute="bottom" constant="16" id="A5z-xO-ypQ"/>
<constraint firstItem="63z-z9-F6B" firstAttribute="leading" secondItem="dSQ-fr-q0c" secondAttribute="leading" id="Be1-2g-ZMp"/>
<constraint firstAttribute="trailing" secondItem="APB-5y-OkX" secondAttribute="trailing" constant="52" id="Cjf-I3-eC7"/>
<constraint firstItem="kiH-bp-24Q" firstAttribute="trailing" secondItem="APB-5y-OkX" secondAttribute="trailing" id="IHa-Bu-Zj5"/>
<constraint firstItem="WQq-Kn-abo" firstAttribute="centerY" secondItem="dSQ-fr-q0c" secondAttribute="centerY" id="IoQ-o3-ziI"/>
<constraint firstAttribute="trailing" secondItem="g0t-sG-8Wn" secondAttribute="trailing" constant="38" id="IxD-TL-yIw"/>
<constraint firstItem="qEQ-pQ-mfJ" firstAttribute="leading" secondItem="g0t-sG-8Wn" secondAttribute="leading" id="OMa-YR-Rsd"/>
<constraint firstItem="kiH-bp-24Q" firstAttribute="centerY" secondItem="svD-TG-gy8" secondAttribute="centerY" id="P4M-Td-w33"/>
<constraint firstItem="APB-5y-OkX" firstAttribute="leading" secondItem="63z-z9-F6B" secondAttribute="trailing" constant="8" id="T0L-Th-1SB"/>
<constraint firstItem="QfU-Iw-5Wj" firstAttribute="leading" secondItem="YQa-dk-iMD" secondAttribute="trailing" constant="13" id="VIx-06-fdp"/>
<constraint firstAttribute="bottom" secondItem="svD-TG-gy8" secondAttribute="bottom" constant="20" id="Vkp-LA-7KX"/>
<constraint firstItem="qEQ-pQ-mfJ" firstAttribute="trailing" secondItem="g0t-sG-8Wn" secondAttribute="trailing" id="ZDY-Ve-WaS"/>
<constraint firstItem="dDg-6q-BXw" firstAttribute="centerY" secondItem="kGw-DQ-YIO" secondAttribute="centerY" id="aSx-Fd-kY4"/>
<constraint firstItem="WQq-Kn-abo" firstAttribute="leading" secondItem="dSQ-fr-q0c" secondAttribute="trailing" id="e1a-7p-7R1"/>
<constraint firstItem="dDg-6q-BXw" firstAttribute="leading" secondItem="kGw-DQ-YIO" secondAttribute="trailing" constant="8" id="jfy-Gz-dbp"/>
<constraint firstItem="kiH-bp-24Q" firstAttribute="height" secondItem="APB-5y-OkX" secondAttribute="height" id="kTi-2v-plW"/>
<constraint firstItem="dSQ-fr-q0c" firstAttribute="top" secondItem="kGw-DQ-YIO" secondAttribute="bottom" constant="13" id="kWG-mx-Kkc"/>
<constraint firstItem="QfU-Iw-5Wj" firstAttribute="centerY" secondItem="YQa-dk-iMD" secondAttribute="centerY" id="ntz-Bt-5xY"/>
<constraint firstItem="g0t-sG-8Wn" firstAttribute="top" secondItem="QfU-Iw-5Wj" secondAttribute="bottom" constant="22" id="oou-Dr-PLm"/>
<constraint firstItem="svD-TG-gy8" firstAttribute="top" secondItem="63z-z9-F6B" secondAttribute="bottom" constant="16" id="qCO-SU-xw9"/>
<constraint firstItem="svD-TG-gy8" firstAttribute="leading" secondItem="63z-z9-F6B" secondAttribute="leading" id="rPY-Qz-GOx"/>
<constraint firstItem="YQa-dk-iMD" firstAttribute="top" secondItem="1Km-pH-09L" secondAttribute="top" constant="20" id="ttq-AW-hSb"/>
<constraint firstItem="YQa-dk-iMD" firstAttribute="leading" secondItem="1Km-pH-09L" secondAttribute="leading" constant="21" id="xms-lO-w5o"/>
<constraint firstItem="kiH-bp-24Q" firstAttribute="leading" secondItem="svD-TG-gy8" secondAttribute="trailing" constant="8" id="yW3-mV-4KC"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="mTK-j3-V77">
<rect key="frame" x="36" y="304.5" width="303" height="30"/>
<color key="backgroundColor" red="0.082352941176470587" green="0.66274509803921566" blue="0.92156862745098034" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="8Ra-AW-7XB"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="设置连接"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="4"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="setLinkBtnClicked:" destination="-1" eventType="touchUpInside" id="cOx-dO-PUg"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="1Km-pH-09L" firstAttribute="top" secondItem="rVr-h5-uWd" secondAttribute="top" constant="35" id="3jw-tR-fsS"/>
<constraint firstItem="mTK-j3-V77" firstAttribute="centerX" secondItem="rVr-h5-uWd" secondAttribute="centerX" id="5wV-9b-X56"/>
<constraint firstAttribute="trailing" secondItem="mTK-j3-V77" secondAttribute="trailing" constant="36" id="H8Z-fV-gfn"/>
<constraint firstAttribute="trailing" secondItem="1Km-pH-09L" secondAttribute="trailing" id="O9f-Uo-1eB"/>
<constraint firstItem="mTK-j3-V77" firstAttribute="top" secondItem="1Km-pH-09L" secondAttribute="bottom" constant="18" id="V4L-Go-5vf"/>
<constraint firstItem="1Km-pH-09L" firstAttribute="leading" secondItem="rVr-h5-uWd" secondAttribute="leading" id="VEA-kw-md9"/>
<constraint firstItem="mTK-j3-V77" firstAttribute="leading" secondItem="rVr-h5-uWd" secondAttribute="leading" constant="36" id="XFL-cL-tgQ"/>
<constraint firstAttribute="bottom" secondItem="mTK-j3-V77" secondAttribute="bottom" constant="20" id="l5P-j3-zHM"/>
</constraints>
</scrollView>
</subviews>
<color key="backgroundColor" red="0.77127617390000003" green="0.77127617390000003" blue="0.77127617390000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="rVr-h5-uWd" secondAttribute="trailing" id="6YL-lw-Bp2"/>
<constraint firstItem="1Km-pH-09L" firstAttribute="width" secondItem="i5M-Pr-FkT" secondAttribute="width" id="7gz-wd-ya3"/>
<constraint firstAttribute="bottom" secondItem="rVr-h5-uWd" secondAttribute="bottom" id="UrT-BG-inV"/>
<constraint firstItem="rVr-h5-uWd" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="fKh-SC-M4t"/>
<constraint firstItem="rVr-h5-uWd" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="k3H-Mh-Bln"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="borderColor">
<color key="value" red="0.77127617385786795" green="0.77127617385786795" blue="0.77127617385786795" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<point key="canvasLocation" x="46.5" y="98.5"/>
</view>
</objects>
<resources>
<image name="hotspotconnect" width="19" height="17"/>
</resources>
</document>
@@ -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
@@ -0,0 +1,50 @@
//
// 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=@"39";
self.functionCode=@"12";
self.sendmacId = @"000000000000";
self.resavemacId = @"000000000000";
return [NSString stringWithFormat:@"%@%@%@%@%@%@%@%@", self.messagetype,self.functionCode,self.sendmacId,self.resavemacId,self.massagelegth,[self zeroLeftPadding:[dataContorl hexStringFromString:self.ssidName]], [self zeroLeftPadding:[dataContorl hexStringFromString:self.pwd]],[self crcCode]];
}
- (NSString *)ssidName {
return [NSString stringWithFormat:@"%@\0", _ssidName];
}
- (NSString *)pwd {
return [NSString stringWithFormat:@"%@\0", _pwd];
}
- (NSString *)zeroLeftPadding:(NSString *)origin {
if (origin.length >= 40) {
return [origin substringToIndex:40];
} else {
NSInteger left = 40 - origin.length;
NSMutableString *str = [NSMutableString string];
[str appendString:origin];
for (NSInteger index = 0; index < left; index++) {
[str appendString:@"0"];
}
return [str copy];
}
}
- (NSString *)crcCode {
return @"0000";
}
@end
@@ -0,0 +1,13 @@
//
// ConnectHotspotTipViewController.h
// Ifish
//
// Created by Minghao Xue on 2018/7/22.
// Copyright © 2018年 lianlian. All rights reserved.
//
#import "BaseVIewContorller.h"
@interface ConnectHotspotTipViewController : BaseVIewContorller
@end
@@ -0,0 +1,23 @@
//
// ConnectHotspotTipViewController.m
// Ifish
//
// Created by Minghao Xue on 2018/7/22.
// Copyright © 2018 lianlian. All rights reserved.
//
#import "ConnectHotspotTipViewController.h"
@interface ConnectHotspotTipViewController ()
@end
@implementation ConnectHotspotTipViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"ifish7热点连接";
}
@end
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ConnectHotspotTipViewController">
<connections>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="375" height="3174"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsVerticalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ga8-zb-3S0">
<rect key="frame" x="0.0" y="0.0" width="375" height="3174"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="tip.png" translatesAutoresizingMaskIntoConstraints="NO" id="SwS-gb-wDb">
<rect key="frame" x="0.0" y="0.0" width="375" height="1724.5"/>
<constraints>
<constraint firstAttribute="width" secondItem="SwS-gb-wDb" secondAttribute="height" multiplier="750:3449" id="Tdv-hp-gEO"/>
<constraint firstAttribute="height" constant="1724.5" id="TfU-XG-Yp1"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
<real key="value" value="0.0"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
</subviews>
<constraints>
<constraint firstItem="SwS-gb-wDb" firstAttribute="leading" secondItem="ga8-zb-3S0" secondAttribute="leading" id="VnB-ze-GKK"/>
<constraint firstItem="SwS-gb-wDb" firstAttribute="top" secondItem="ga8-zb-3S0" secondAttribute="top" id="iB9-V6-KAV"/>
<constraint firstAttribute="bottom" secondItem="SwS-gb-wDb" secondAttribute="bottom" id="rZM-Vw-go1"/>
<constraint firstAttribute="trailing" secondItem="SwS-gb-wDb" secondAttribute="trailing" id="s8q-gp-UwF"/>
</constraints>
</scrollView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="ga8-zb-3S0" secondAttribute="bottom" id="9vT-F2-9an"/>
<constraint firstAttribute="trailing" secondItem="ga8-zb-3S0" secondAttribute="trailing" id="CTc-eO-o8t"/>
<constraint firstItem="ga8-zb-3S0" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="KYp-hh-hve"/>
<constraint firstItem="SwS-gb-wDb" firstAttribute="width" secondItem="i5M-Pr-FkT" secondAttribute="width" id="OnW-ou-Y9w"/>
<constraint firstItem="ga8-zb-3S0" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="ey7-pu-en9"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="32.5" y="1330"/>
</view>
</objects>
<resources>
<image name="tip.png" width="750" height="3449"/>
</resources>
</document>
@@ -0,0 +1,33 @@
//
// IfishUDPBroadCastHelper.h
// Ifish
//
// Created by imac on 16/9/12.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AsyncUdpSocket.h"
#import "IFishUDPHelperBackMsgModel.h"
@protocol IFishHotpotUDPHelperDelegate<NSObject>
@optional
- (void)udpHelperMessage:(NSString *)msg;
- (void)udpHelperCommandExecutedSuccess:(IFishUDPHelperBackMsgModel *)backModel;
@end
@interface IFishHotpotUDPHelper : NSObject <AsyncUdpSocketDelegate>
@property (nonatomic, strong) AsyncUdpSocket *clientSocket;
+ (IFishHotpotUDPHelper *)sharedInstance;
@property (nonatomic, weak) id<IFishHotpotUDPHelperDelegate> delegate;
- (void)broadCastHotspotConnectCommandWith:(NSString *)ssidName pwd:(NSString *)pwd;
- (void)broadCastRestartCommand;
- (void)broadCastRestCommand;
@end
@@ -0,0 +1,185 @@
//
// IfishUDPBroadCastHelper.m
// Ifish
//
// Created by imac on 16/9/12.
// Copyright © 2016 lianxiang. All rights reserved.
//
#import "IFishHotpotUDPHelper.h"
#import "LxGetCurrentIp.h"
#import "AppDelegate.h"
#import "ConnectHotspotModel.h"
#import "ResetDeviceModel.h"
#import "RestartDeviceModel.h"
#define K_ReSendTimeInterval 3
@interface IFishHotpotUDPHelper ()
{
NSString * _ssidName;
NSString *_pwd;
}
@property (nonatomic, strong) NSTimer *loopTimer;
@property (nonatomic, assign) int tag;
@end
@implementation IFishHotpotUDPHelper
+ (IFishHotpotUDPHelper *)sharedInstance{
static IFishHotpotUDPHelper *sharedInstace = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstace = [[self alloc] init];
});
return sharedInstace;
}
- (instancetype)init {
if (self = [super init]) {
self.clientSocket = [[AsyncUdpSocket alloc] initWithDelegate:self];
UInt16 bindPort = 9954;
NSError *error;
//
[self.clientSocket bindToPort:bindPort error:&error];
}
return self;
}
- (void)loopTimerTick {
if (self.tag == 0) {
[self sendConnectHotspotSoketdata];
} else if (self.tag == 1) {
[self sendRestartSocketData];
} else if (self.tag == 2) {
[self sendResetSocketData];
}
}
- (void)startLoopTimer {
self.loopTimer = [NSTimer scheduledTimerWithTimeInterval:K_ReSendTimeInterval target:self selector:@selector(loopTimerTick) userInfo:nil repeats:YES];
}
- (void)broadCastHotspotConnectCommandWith:(NSString *)ssidName pwd:(NSString *)pwd {
_ssidName = ssidName;
_pwd = pwd;
[self postmsg:@"命令已发出"];
[self sendConnectHotspotSoketdata];
[self startLoopTimer];
}
- (void)broadCastRestCommand {
[self postmsg:@"命令已发出"];
[self sendResetSocketData];
[self startLoopTimer];
}
- (void)sendResetSocketData {
NSString* hostS = @"192.168.4.1";
ResetDeviceModel *model = [ResetDeviceModel new];
NSString *request=[NSString stringWithFormat:@"%@", model.description];
NSData *data=[dataContorl stringToHexData:request];
UInt16 port = 333;
self.tag = 2;
[self.clientSocket receiveWithTimeout:-1 tag:self.tag];
[self.clientSocket sendData:data toHost:hostS port:port withTimeout:-1 tag:self.tag];
}
- (void)broadCastRestartCommand {
[self postmsg:@"命令已发出"];
[self sendRestartSocketData];
[self startLoopTimer];
}
- (void)sendRestartSocketData {
NSString* hostS = @"192.168.4.1";
//120.55.190.56 IP
RestartDeviceModel *model = [RestartDeviceModel new];
NSString *request=[NSString stringWithFormat:@"%@", model.description];
NSData *data=[dataContorl stringToHexData:request];
UInt16 port = 333;
self.tag = 1;
[self.clientSocket receiveWithTimeout:-1 tag:self.tag];
[self.clientSocket sendData:data toHost:hostS port:port withTimeout:-1 tag:self.tag];
}
-(void)sendConnectHotspotSoketdata{
NSString* hostS = @"192.168.4.1";
//120.55.190.56 IP
ConnectHotspotModel *model = [ConnectHotspotModel new];
model.ssidName = _ssidName;
model.pwd = _pwd;
NSString *request=[NSString stringWithFormat:@"%@", model.description];
NSData *data=[dataContorl stringToHexData:request];
UInt16 port = 333;
self.tag = 0;
[self.clientSocket receiveWithTimeout:-1 tag:self.tag];
[self.clientSocket sendData:data toHost:hostS port:port withTimeout:-1 tag:self.tag];
}
-(BOOL)onUdpSocket:(AsyncUdpSocket *)sock didReceiveData:(NSData *)data withTag:(long)tag fromHost:(NSString *)host port:(UInt16)port
{
[self.loopTimer invalidate];
self.loopTimer = nil;
NSString* result = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
IFishUDPHelperBackMsgModel *model = [[IFishUDPHelperBackMsgModel alloc] initWithData:data];
if ([model.result isEqualToString:@"01"]) {
if ([self.delegate respondsToSelector:@selector(udpHelperCommandExecutedSuccess:)]) {
[self.delegate udpHelperCommandExecutedSuccess:model];
}
} else {
AppDelegate *app =(AppDelegate*)[UIApplication sharedApplication].delegate;
[app.window makeToast:[NSString stringWithFormat:@"收到答复:%@", result]];
}
return YES;
}
-(void)onUdpSocketDidClose:(AsyncUdpSocket *)sock{
NSLog(@"关闭");
}
-(void)onUdpSocket:(AsyncUdpSocket *)sock didSendDataWithTag:(long)tag{
NSLog(@"didSendData");
}
-(void)onUdpSocket:(AsyncUdpSocket *)sock didNotReceiveDataWithTag:(long)tag dueToError:(NSError *)error{
NSLog(@"dueToError%@",error);
[self postmsg:error.localizedDescription];
}
-(void)dealloc{
[self.clientSocket close];
}
- (void)postmsg:(NSString *)msg {
if ([self.delegate respondsToSelector:@selector(udpHelperMessage:)]) {
[self.delegate udpHelperMessage:msg];
}
}
@end
@@ -0,0 +1,20 @@
//
// 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 *senderMacAddress;
@property (nonatomic, copy) NSString *result;
@property (nonatomic, copy) NSString *changshang;
@property (nonatomic, copy) NSString *device;
- (instancetype)initWithData:(NSData *)data;
@end
@@ -0,0 +1,24 @@
//
// 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.senderMacAddress = [totalString substringWithRange:NSMakeRange(4, 12)];
self.result = [totalString substringWithRange:NSMakeRange(30, 2)];
self.changshang = [totalString substringWithRange:NSMakeRange(32, 2)];
self.device = [totalString substringWithRange:NSMakeRange(34, 2)];
}
return self;
}
@end
@@ -0,0 +1,13 @@
//
// ResetDeviceModel.h
// Ifish
//
// Created by Minghao Xue on 2018/8/6.
// Copyright © 2018年 lianlian. All rights reserved.
//
#import "baseModel.h"
@interface ResetDeviceModel : baseModel
@end
@@ -0,0 +1,28 @@
//
// ResetDeviceModel.m
// Ifish
//
// Created by Minghao Xue on 2018/8/6.
// Copyright © 2018 lianlian. All rights reserved.
//
#import "ResetDeviceModel.h"
@implementation ResetDeviceModel
- (NSString *)description{
self.messagetype=@"00";
self.massagelegth=@"00";
self.functionCode=@"13";
self.sendmacId = @"000000000000";
self.resavemacId = @"000000000000";
return [NSString stringWithFormat:@"%@%@%@%@%@%@", self.messagetype,self.functionCode,self.sendmacId,self.resavemacId,self.massagelegth,[self crcCode]];
}
- (NSString *)crcCode {
return @"0000";
}
@end
@@ -0,0 +1,13 @@
//
// RestartDeviceModel.h
// Ifish
//
// Created by Minghao Xue on 2018/8/6.
// Copyright © 2018年 lianlian. All rights reserved.
//
#import "baseModel.h"
@interface RestartDeviceModel : baseModel
@end
@@ -0,0 +1,28 @@
//
// RestartDeviceModel.m
// Ifish
//
// Created by Minghao Xue on 2018/8/6.
// Copyright © 2018 lianlian. All rights reserved.
//
#import "RestartDeviceModel.h"
@implementation RestartDeviceModel
- (NSString *)description{
self.messagetype=@"00";
self.massagelegth=@"11";
self.functionCode=@"14";
self.sendmacId = @"000000000000";
self.resavemacId = @"000000000000";
return [NSString stringWithFormat:@"%@%@%@%@%@%@", self.messagetype,self.functionCode,self.sendmacId,self.resavemacId,self.massagelegth,[self crcCode]];
}
- (NSString *)crcCode {
return @"0000";
}
@end
@@ -16,6 +16,7 @@
- (IBAction)makeSureButton:(id)sender;
- (IBAction)lickHereBtnClicked:(id)sender;
@property(nonatomic,strong)NSString*ssid;
@property(nonatomic,strong)NSString*bssid;
@@ -25,6 +26,8 @@
@property (weak, nonatomic) IBOutlet UIButton *shuoMingShuBtn;
@property (weak, nonatomic) IBOutlet UIImageView *nodImg;
@property (weak, nonatomic) IBOutlet UILabel *connectTipLbl;
@property (weak, nonatomic) IBOutlet UIButton *connectBtn;
@end
@@ -27,6 +27,9 @@
#import "IfishConnectingView.h"
#import "PushMasssageWebViewController.h"
#import "IfishUserObsever.h"
#import "ConnectHotpotViewController.h"
@interface EspTouchDelegateImpl : NSObject<ESPTouchDelegate>
@end
@@ -96,6 +99,7 @@ extern BOOL isfromCameraView;
self.view.backgroundColor=[UIColor whiteColor];
_deviceArry =[[NSMutableArray alloc]init];
[self updateUI];
[self getSSid];
//UI
@@ -136,6 +140,19 @@ extern BOOL isfromCameraView;
[self creatConnectStateUI];
}
- (void)updateUI {
CGFloat yOffset = 0;
if (is_iPhone_X) {
yOffset = 20 + 88;
} else {
yOffset = 20 + 64;
}
self.nodImg.frame = CGRectMake(12, yOffset, 10, 10);
self.wifiNamelabel.frame = CGRectMake(23, yOffset - 18 + 5, 336, 36);
[self.view bringSubviewToFront:self.connectTipLbl];
[self.view bringSubviewToFront:self.connectBtn];
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
@@ -169,8 +186,14 @@ extern BOOL isfromCameraView;
{
if (!self.connectingView) {
CGFloat yOffset = 0;
if (is_iPhone_X) {
yOffset = 88;
} else {
yOffset = 64;
}
IfishConnectingView *connectingView=[[IfishConnectingView alloc] initWithFrame:CGRectMake(0,64, kScreenSize.width, CGRectGetMaxY(self.wifiTextFiled.frame))];
IfishConnectingView *connectingView=[[IfishConnectingView alloc] initWithFrame:CGRectMake(0,yOffset, kScreenSize.width, CGRectGetMaxY(self.wifiTextFiled.frame))];
self.connectingView =connectingView;
@@ -180,6 +203,8 @@ extern BOOL isfromCameraView;
[self.view addSubview:connectingView];
self.wifiNamelabel.hidden = NO;
self.wifiTextFiled.hidden = NO;
self.connectTipLbl.hidden = NO;
self.connectBtn.hidden = NO;
self.shareButton.hidden = NO;
self.nodImg.hidden = NO;
@@ -195,6 +220,8 @@ extern BOOL isfromCameraView;
[self.connectingView.textChangeView stopAnimation];
self.wifiNamelabel.hidden = NO;
self.wifiTextFiled.hidden = NO;
self.connectTipLbl.hidden = NO;
self.connectBtn.hidden = NO;
self.shareButton.hidden = NO;
self.nodImg.hidden = NO;
@@ -220,6 +247,8 @@ extern BOOL isfromCameraView;
self.wifiNamelabel.hidden = YES;
self.wifiTextFiled.hidden = YES;
self.connectTipLbl.hidden = YES;
self.connectBtn.hidden = YES;
self.shareButton.hidden = YES;
self.nodImg.hidden = YES;
@@ -388,6 +417,13 @@ extern BOOL isfromCameraView;
}
- (IBAction)lickHereBtnClicked:(id)sender {
ConnectHotpotViewController *vc = [[ConnectHotpotViewController alloc] initWithNibName:@"ConnectHotpotViewController" bundle:nil];
vc.ssid = self.ssid;
vc.bssid = self.bssid;
[self.navigationController pushViewController:vc animated:YES];
}
- (IBAction)commandbackBtn:(id)sender {
SaySomethingViewController*say=[[SaySomethingViewController alloc]init];
[self.navigationController pushViewController:say animated:YES];
@@ -1,16 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11542" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" colorMatched="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="SecondConnectWifiController">
<connections>
<outlet property="connectBtn" destination="eDA-Ia-DAy" id="twz-Z9-3oO"/>
<outlet property="connectTipLbl" destination="dwN-It-iak" id="hMH-hE-W8C"/>
<outlet property="nodImg" destination="ZVX-4y-CYu" id="XQa-yT-9oP"/>
<outlet property="shareButton" destination="pAw-UG-caT" id="1p5-yY-6Wq"/>
<outlet property="shuoMingShuBtn" destination="38a-MZ-Nbp" id="g7n-n1-KcQ"/>
@@ -33,6 +35,22 @@
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<textInputTraits key="textInputTraits"/>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="如果连接有问题,请尝试热点连接模式" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="dwN-It-iak">
<rect key="frame" x="16" y="182" width="217" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="eDA-Ia-DAy">
<rect key="frame" x="225" y="182" width="63" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<state key="normal" title="点击这里"/>
<connections>
<action selector="lickHereBtnClicked:" destination="-1" eventType="touchUpInside" id="YeL-tw-ThH"/>
</connections>
</button>
<view contentMode="scaleToFill" misplaced="YES" id="rxi-ML-YUX" customClass="LXWaveProgressView">
<rect key="frame" x="0.0" y="184" width="375" height="61"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
@@ -79,9 +97,4 @@
<image name="linkingdevice_point.png" width="9" height="9"/>
<image name="linkingdevice_setting.png" width="360" height="404"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4_7.fullscreen"/>
</simulatedMetricsContainer>
</document>
Binary file not shown.

After

Width:  |  Height:  |  Size: 689 KiB

@@ -60,6 +60,8 @@
@property(nonatomic) double latitude;
@property(nonatomic,copy) NSString *adderss;
@property (weak, nonatomic) IBOutlet UILabel *qrcodeSwitchLbl;
@end
extern BOOL formLogIn;
@@ -133,12 +135,21 @@ extern BOOL formLogIn;
//NSString *zone = [dataContorl areaCode:self.phoneNumberTextField.text];
//self.areaCode = zone;
[IFISHHTTPTOOL getverifyWithTimerButton:_timeBtn addphoneNumber:self.phoneNumberTextField.text zone:self.areaCode result:^(NSError *err) {
BOOL isTextCode = [[self.timeBtn titleForState:UIControlStateNormal] isEqualToString:@"短信验证码"];
[IFISHHTTPTOOL getverifyWithTimerButton:_timeBtn addphoneNumber:self.phoneNumberTextField.text zone:self.areaCode isTextCode:isTextCode result:^(NSError *err) {
}];
}
- (IBAction)qrcodeSwithBtnClicked:(UIButton *)sender {
if ([[self.timeBtn titleForState:UIControlStateNormal] isEqualToString:@"语音验证码"]) {
[self.timeBtn setTitle:@"短信验证码" forState:UIControlStateNormal];
self.qrcodeSwitchLbl.text = @"语音验证码";
} else if ([[self.timeBtn titleForState:UIControlStateNormal] isEqualToString:@"短信验证码"]) {
[self.timeBtn setTitle:@"语音验证码" forState:UIControlStateNormal];
self.qrcodeSwitchLbl.text = @"短信验证码";
}
}
#pragma mark-设置键盘样式
-(void)setTextkeyboadType{
@@ -559,11 +570,14 @@ extern BOOL formLogIn;
NSMutableArray * imageNames = [NSMutableArray array];
for (int i=1; i<=3; i++) {
[imageNames addObject:[NSString stringWithFormat:@"introlImage_%d",i]];
if (is_iPhone_X) {
[imageNames addObject:[NSString stringWithFormat:@"introlImage_iphonex_%d.jpg",i]];
} else {
[imageNames addObject:[NSString stringWithFormat:@"introlImage_%d.png",i]];
}
}
introductionVC.imageNames=imageNames;
introductionVC.imageNames=imageNames;
introductionVC.hiddenPageControl=NO;
introductionVC.introductionStyle=LXIntroductionStyleFullScreenGoButton;
introductionVC.goActionCallBack=^(MyIntroductionViewController* intrVC){
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
@@ -16,6 +16,7 @@
<outlet property="countryView" destination="42g-iR-QpF" id="SVZ-QG-x9J"/>
<outlet property="passwordTextField" destination="7xd-HS-1kK" id="tmw-kh-qyQ"/>
<outlet property="phoneNumberTextField" destination="iE3-ny-LX2" id="kOJ-c7-cq8"/>
<outlet property="qrcodeSwitchLbl" destination="hT6-V3-AAb" id="np4-Ek-9LA"/>
<outlet property="registBtn" destination="I52-cD-mf7" id="Kam-09-yMp"/>
<outlet property="timeBtn" destination="JFw-B7-IwK" id="6a6-Xs-pmB"/>
<outlet property="verifyTextField" destination="nOn-jr-IQE" id="ijZ-Xl-BiV"/>
@@ -118,7 +119,7 @@
<action selector="chooseBtn:" destination="-1" eventType="touchUpInside" id="fNS-Yb-Dfi"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Pnt-Um-Tap">
<button opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Pnt-Um-Tap">
<rect key="frame" x="49" y="287" width="146" height="28"/>
<constraints>
<constraint firstAttribute="height" constant="28" id="6Sw-Nc-gLW"/>
@@ -164,6 +165,19 @@
<constraint firstAttribute="width" secondItem="42g-iR-QpF" secondAttribute="height" multiplier="283:42" id="rdP-1c-cDT"/>
</constraints>
</view>
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="短信验证码" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hT6-V3-AAb">
<rect key="frame" x="246.5" y="294" width="61.5" height="14.5"/>
<gestureRecognizers/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="JIR-jc-I5O" userLabel="QRSwitchBtn">
<rect key="frame" x="195" y="284" width="113" height="56.5"/>
<connections>
<action selector="qrcodeSwithBtnClicked:" destination="-1" eventType="touchUpInside" id="pyz-qc-Ryt"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
@@ -173,20 +187,25 @@
<constraint firstItem="nOn-jr-IQE" firstAttribute="leading" secondItem="SR2-Pu-ao5" secondAttribute="leading" constant="25" id="6VE-4O-kdQ"/>
<constraint firstAttribute="trailing" secondItem="I52-cD-mf7" secondAttribute="trailing" constant="25" id="6Vl-Cm-hqd"/>
<constraint firstItem="I52-cD-mf7" firstAttribute="leading" secondItem="SR2-Pu-ao5" secondAttribute="leading" constant="25" id="7WF-hP-l9D"/>
<constraint firstItem="JIR-jc-I5O" firstAttribute="top" secondItem="I52-cD-mf7" secondAttribute="bottom" id="9nr-cZ-GZo"/>
<constraint firstAttribute="trailing" secondItem="42g-iR-QpF" secondAttribute="trailing" constant="25" id="Arw-Vj-JaJ"/>
<constraint firstItem="JFw-B7-IwK" firstAttribute="top" secondItem="nOn-jr-IQE" secondAttribute="top" id="B6q-9T-0nQ"/>
<constraint firstAttribute="trailing" secondItem="nOn-jr-IQE" secondAttribute="trailing" constant="25" id="BqD-SS-c5h"/>
<constraint firstItem="Pnt-Um-Tap" firstAttribute="centerY" secondItem="LoQ-C1-iph" secondAttribute="centerY" id="D7n-jE-lyh"/>
<constraint firstItem="JIR-jc-I5O" firstAttribute="leading" secondItem="Pnt-Um-Tap" secondAttribute="trailing" id="DP9-DB-YgZ"/>
<constraint firstItem="7xd-HS-1kK" firstAttribute="leading" secondItem="SR2-Pu-ao5" secondAttribute="leading" constant="25" id="Ghr-d7-hbN"/>
<constraint firstItem="Pnt-Um-Tap" firstAttribute="leading" secondItem="LoQ-C1-iph" secondAttribute="trailing" constant="8" id="H8i-4E-QXN"/>
<constraint firstItem="iE3-ny-LX2" firstAttribute="leading" secondItem="SR2-Pu-ao5" secondAttribute="leading" constant="25" id="Mwx-3S-JUa"/>
<constraint firstItem="hT6-V3-AAb" firstAttribute="centerY" secondItem="Pnt-Um-Tap" secondAttribute="centerY" id="OBF-Gu-1CW"/>
<constraint firstItem="JFw-B7-IwK" firstAttribute="leading" secondItem="nOn-jr-IQE" secondAttribute="trailing" constant="-80" id="QRt-rk-8zr"/>
<constraint firstItem="I52-cD-mf7" firstAttribute="top" secondItem="7xd-HS-1kK" secondAttribute="bottom" constant="28" id="TLH-RA-nOC"/>
<constraint firstItem="JFw-B7-IwK" firstAttribute="height" secondItem="nOn-jr-IQE" secondAttribute="height" id="TWk-fJ-dMA"/>
<constraint firstItem="nOn-jr-IQE" firstAttribute="top" secondItem="iE3-ny-LX2" secondAttribute="bottom" constant="8" symbolic="YES" id="XyG-Qo-cPp"/>
<constraint firstItem="hT6-V3-AAb" firstAttribute="trailing" secondItem="I52-cD-mf7" secondAttribute="trailing" id="YIn-l6-t7M"/>
<constraint firstItem="iE3-ny-LX2" firstAttribute="centerX" secondItem="SR2-Pu-ao5" secondAttribute="centerX" id="Zaa-h7-urA"/>
<constraint firstAttribute="trailing" secondItem="iE3-ny-LX2" secondAttribute="trailing" constant="25" id="aOl-em-1x8"/>
<constraint firstItem="7xd-HS-1kK" firstAttribute="top" secondItem="nOn-jr-IQE" secondAttribute="bottom" constant="8" id="biI-hb-OQE"/>
<constraint firstItem="JIR-jc-I5O" firstAttribute="trailing" secondItem="I52-cD-mf7" secondAttribute="trailing" id="cit-38-gNN"/>
<constraint firstItem="I52-cD-mf7" firstAttribute="centerX" secondItem="SR2-Pu-ao5" secondAttribute="centerX" id="e0y-xf-AYF"/>
<constraint firstItem="nOn-jr-IQE" firstAttribute="centerX" secondItem="SR2-Pu-ao5" secondAttribute="centerX" id="eMW-44-dZ3"/>
<constraint firstAttribute="width" secondItem="SR2-Pu-ao5" secondAttribute="height" multiplier="333:290" constant="-57.413793103448256" id="hxK-ez-n9r"/>
@@ -195,6 +214,7 @@
<constraint firstItem="LoQ-C1-iph" firstAttribute="top" secondItem="I52-cD-mf7" secondAttribute="bottom" constant="9" id="loD-LC-V1s"/>
<constraint firstItem="42g-iR-QpF" firstAttribute="top" secondItem="SR2-Pu-ao5" secondAttribute="top" constant="21" id="sVJ-BR-cLd"/>
<constraint firstItem="JFw-B7-IwK" firstAttribute="bottom" secondItem="nOn-jr-IQE" secondAttribute="bottom" id="wAg-Wh-1lt"/>
<constraint firstAttribute="bottom" secondItem="JIR-jc-I5O" secondAttribute="bottom" id="xku-8I-uiZ"/>
</constraints>
</view>
</subviews>
Binary file not shown.

After

Width:  |  Height:  |  Size: 467 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Some files were not shown because too many files have changed in this diff Show More