摄像头增加AP配网模式,bug修改,bugly id修改

摄像头增加AP配网模式,bug修改,bugly id修改
其他页面修改,细节处理
This commit is contained in:
kai 2019-11-07 22:29:04 +08:00
parent 9c0d42d796
commit 3da5a875ec
13 changed files with 225 additions and 111 deletions

View File

@ -15424,7 +15424,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 10.1.8;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = WFX8GD5HFX;
ENABLE_BITCODE = NO;
ENABLE_TESTABILITY = YES;
@ -15498,7 +15498,7 @@
"$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrlIOS/libAVCtrl",
"$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrl",
);
MARKETING_VERSION = 5.0.1;
MARKETING_VERSION = 4.7.4;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"-ObjC",
@ -15541,7 +15541,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 10.1.8;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = WFX8GD5HFX;
ENABLE_BITCODE = NO;
ENABLE_TESTABILITY = YES;
@ -15615,7 +15615,7 @@
"$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrlIOS/libAVCtrl",
"$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrl",
);
MARKETING_VERSION = 5.0.1;
MARKETING_VERSION = 4.7.4;
ONLY_ACTIVE_ARCH = NO;
OTHER_LDFLAGS = (
"-ObjC",

View File

@ -38,7 +38,7 @@
: NO)
#import <Bugly/Bugly.h>
#define BUGLY_APPID @"16d2b238e3"
#define BUGLY_APPID @"c958830c57"//16d2b238e3
#import "TalkingData.h"
#define TalkingDataAPPID @"351E6F7956CEF7FB6AABAEB64EF9BF18"
#define BMKMAP_APPKEY @"wYcF3YXqeepKfzruExLPn0eS"

View File

@ -8,6 +8,7 @@
#import <Foundation/Foundation.h>
#import "UIColor+HexString.h"
#import <SystemConfiguration/CaptiveNetwork.h>
@interface CommonUtils : NSObject
typedef enum{
@ -20,6 +21,9 @@ typedef enum{
#define separaterColor HEXCOLOR(@"#e5e5e5")
//系统默认整体页面背景色
#define COLOR_Background HEXCOLOR(@"#f6f6f6")
/// 获取WiFi信息
+ (NSDictionary *)getSSIDInfo;
/**
*/

View File

@ -287,6 +287,20 @@
return timeString;
}
+ (NSDictionary *)getSSIDInfo
{
NSArray *interfaceNames = CFBridgingRelease(CNCopySupportedInterfaces());
NSDictionary *SSIDInfo;
for (NSString *interfaceName in interfaceNames) {
SSIDInfo = CFBridgingRelease(
CNCopyCurrentNetworkInfo((__bridge CFStringRef)interfaceName));
BOOL isNotEmpty = (SSIDInfo.count > 0);
if (isNotEmpty) {
break;
}
}
return SSIDInfo;
}
//view
CGAffineTransform GetCGAffineTransformRotateAroundPoint(float centerX, float centerY ,float x ,float y ,float angle)
{

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>5.1.2</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>

View File

@ -7,6 +7,7 @@
//
#import "BaseViewController.h"
#import "YooseeNextConnectViewController.h"
NS_ASSUME_NONNULL_BEGIN

View File

@ -68,7 +68,15 @@ Assign BOOL isGoChangeWiFi;//更换为设备的WiFi
}
-(void)addContentLabel{
UILabel *preLabel;
NSArray *textArr = @[@"1.请将产品15秒内断电通电3次进入热点模式",@"2.点击去设置:设置-WiFi-选择ifish-xxx的网络输入密码12345678连接好后返回爱奇鱼app。"];
NSString*tip1=@"1.请将产品重置后15秒内断电通电3次进入热点模式";
NSString*tip2=@"2.点击去设置:设置-WiFi-选择ifish-xxx的网络输入密码12345678连接好后返回爱奇鱼app。";
if (self.deviceType==DEVICECAMERA)
{
tip2=@"2.点击去设置:设置-WiFi-选择GW-AP-xxx的网络一般无密码或12345678或查看说明书连接好后返回爱奇鱼app。";
}
NSArray*textArr=@[tip1,tip2];
for (int i=0; i<2; i++) {
UILabel *label = InitObject(UILabel);
label.text = textArr[i];
@ -113,12 +121,24 @@ Assign BOOL isGoChangeWiFi;//更换为设备的WiFi
}
if ([wifiName rangeOfString:@"ifish"].location!=NSNotFound||[wifiName rangeOfString:@"GW"].location!=NSNotFound) {
//wifi
ConnectingAquarVC *connecting = InitObject(ConnectingAquarVC);
connecting.ssid = self.ssid;
connecting.bssid = self.bssid;
connecting.wifiName = self.wifiName;
connecting.wifiPassword = self.wifiPwd;
[self.navigationController pushViewController:connecting animated:YES];
if(self.deviceType==DEVICECAMERA)
{
YooseeNextConnectViewController *nextvc=[[YooseeNextConnectViewController alloc] init];
nextvc.wifiName=self.wifiName;
nextvc.wifiPwd=self.wifiPwd;
nextvc.conectType =conectType_ap;
[self.navigationController pushViewController:nextvc animated:YES];
}
else
{
ConnectingAquarVC *connecting = InitObject(ConnectingAquarVC);
connecting.ssid = self.ssid;
connecting.bssid = self.bssid;
connecting.wifiName = self.wifiName;
connecting.wifiPassword = self.wifiPwd;
[self.navigationController pushViewController:connecting animated:YES];
}
}else{
[self.view makeToast:@"WiFi名称不匹配请重试"];
}

View File

@ -83,7 +83,7 @@ Strong UILabel *subTitleLabel;
if (self.deviceType==DEVICECAMERA)
{
YooseeNextConnectViewController *nextvc=[[YooseeNextConnectViewController alloc] init];
nextvc.conectType = 0;
nextvc.conectType = conectType_Intelligent;
[self.navigationController pushViewController:nextvc animated:YES];
}
@ -91,7 +91,7 @@ Strong UILabel *subTitleLabel;
{
SecondConnectWifiController *wifivc=[[SecondConnectWifiController alloc]init];
wifivc.deviceType=self.deviceType;
wifivc.vcTitle=@"连接水族箱";
wifivc.vcTitle=self.titleString;
[self.navigationController pushViewController:wifivc animated:YES];
}
@ -99,6 +99,10 @@ Strong UILabel *subTitleLabel;
}else{
ConAquarNowWiFiPwdVC *vc = InitObject(ConAquarNowWiFiPwdVC);
vc.deviceType=self.deviceType;
NSDictionary *netInfo = [CommonUtils getSSIDInfo];
vc.ssid = [netInfo objectForKey:@"SSID"];
vc.bssid = [netInfo objectForKey:@"BSSID"];
vc.deviceType=self.deviceType;
[self.navigationController pushViewController:vc animated:YES];
}

View File

@ -121,7 +121,7 @@ Strong UIButton *nextBtn;
[leftView addSubview:leftImage];
[leftImage setImage:IMAGEBYENAME(@"icons_con_lock")];
_wifiPwdTextField.leftView = leftView;
_wifiPwdTextField.text=@"1314ever";
}
return _wifiPwdTextField;
}

View File

@ -177,16 +177,16 @@ extern BOOL isfromCameraView;
{
self.hidesBottomBarWhenPushed = YES;
// ConAquarMethodVC *methodVC = InitObject(ConAquarMethodVC);
// methodVC.deviceType=DEVICEHEATING;
// methodVC.titleString=@"连接加热器";
//
// [self.navigationController pushViewController:methodVC animated:YES];
SecondConnectWifiController *wifivc=[[SecondConnectWifiController alloc]init];
wifivc.vcTitle=@"连接加热器";
[self.navigationController pushViewController:wifivc animated:YES];
[wifivc addTitleViewWithTitle:@"连接加热器"];
ConAquarMethodVC *methodVC = InitObject(ConAquarMethodVC);
methodVC.deviceType=DEVICEHEATING;
methodVC.titleString=@"连接加热器";
[self.navigationController pushViewController:methodVC animated:YES];
// SecondConnectWifiController *wifivc=[[SecondConnectWifiController alloc]init];
// wifivc.vcTitle=@"连接加热器";
// [self.navigationController pushViewController:wifivc animated:YES];
// [wifivc addTitleViewWithTitle:@"连接加热器"];
//[self.view makeToast:@"敬请期待"];

View File

@ -753,18 +753,7 @@ Assign BOOL isPush;
[self getMessageCount];
//
if (_isPush) {
NSIndexPath *indexPath =[NSIndexPath indexPathForRow:0 inSection:0];
NSArray *arr =nil;
if (_didSelectIndexPath) {
arr =@[indexPath,_didSelectIndexPath];
}else{
arr =@[indexPath];
}
[self.tableView reloadRowsAtIndexPaths:arr withRowAnimation:UITableViewRowAnimationNone];
}
}
-(void)refreshUI{

View File

@ -17,7 +17,9 @@
enum
{
conectType_Intelligent,
conectType_qrcode
conectType_qrcode,
conectType_ap
};
/**
@ -26,6 +28,7 @@ enum
@interface YooseeNextConnectViewController : BaseViewController
@property (nonatomic,strong) NSString *uuidString;
@property (nonatomic,strong) NSString *wifiPwd;
@property (nonatomic,strong) NSString *wifiName;
@property (strong, nonatomic) GCDAsyncUdpSocket *socket;
@property (nonatomic) BOOL isWaiting;//YES表示发包设置wifi后在等待局域网添加设备
@property (nonatomic) BOOL isFinish;
@ -37,7 +40,7 @@ enum
@property(nonatomic,strong) UITextField *wifiSecFiled;
@property(nonatomic,strong) UILabel *redTipLable;
@property (nonatomic) int conectType; //1-二维码扫描 0-智能联机
@property (nonatomic) int conectType; //2AP 1-二维码扫描 0-智能联机
@property (strong, nonatomic) NSString *lastSetPassword;
//点击确定绑定后 不让操作返回 和查看说明

View File

@ -37,13 +37,12 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
lodingViewdissMissAlreadyBinded
};
@interface YooseeNextConnectViewController ()<UITextFieldDelegate,UIAlertViewDelegate>
@interface YooseeNextConnectViewController ()<UITextFieldDelegate,UIAlertViewDelegate,GWPP2PDeviceLinkerProtocol>
{
void *_context;
}
@property (strong,nonatomic) NSMutableDictionary *addresses;
@property (nonatomic,copy) NSString *wifiName;
@property (nonatomic,strong) UIButton *sBtn;
@property(nonatomic)BOOL autodismiss;
@property(nonatomic,assign)lodingViewdissMissStyle lodviewMissStyle;
@ -66,7 +65,8 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
[super viewDidLoad];
//智能联机
self.isDeviceLinkIn = NO;
self.conectType = conectType_Intelligent;
[GWP2PDeviceLinker shareInstance].delegate=self;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(viewWillEnterForeground:) name:Noti_WillEnterForeground object:nil];
self.addresses = [[NSMutableDictionary alloc] initWithCapacity:1];
self.view.backgroundColor = [UIColor whiteColor];
[self addTitleViewWithTitle:@"连接摄像头"];
@ -76,6 +76,13 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
_canDissMissController = YES;
//添加警告内容
[self redTipLable];
if (self.conectType==conectType_ap&&self.wifiPwd.length&&self.wifiPwd.length)
{
[self connectNotNormalView];
_canDissMissController = NO;
[self apLinkConnect];
}
}
-(UILabel *)redTipLable{
@ -141,7 +148,11 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
self.wifilabel=[[UILabel alloc] init];
NSDictionary *ifs = [self fetchSSIDInfo];
self.wifiName = [ifs objectForKey:@"SSID"];
if (!self.wifiName.length)
{
self.wifiName = [ifs objectForKey:@"SSID"];
}
self.wifilabel.text = [NSString stringWithFormat:@"请输入当前WiFi:%@密码",self.wifiName];
self.wifilabel.textAlignment = NSTextAlignmentLeft;
@ -269,7 +280,7 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
[alert show];
return;
}
UIAlertView *alert= [[UIAlertView alloc] initWithTitle:@"提示" message:@"即将使用声波连接,请调大手机音量,并靠近设备,在听到“等待连接“后再点击确认" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
UIAlertView *alert= [[UIAlertView alloc] initWithTitle:@"提示" message:@"即将使用声波连接,请调大手机音量,并靠近设备,确认设备已经重置(按复位小孔,听到“等待连接“或者“滴”)后再点击确认" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
alert.tag = ALERT_TAG_B_SURE;
[alert show];
@ -318,9 +329,27 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
NSString *newPassword = GIWEI_INITPASS;
self.lastSetPassword = [Utils GetTreatedPassword:newPassword];
}
#pragma mark---到前台,搜索设备
-(void)viewWillEnterForeground:(NSNotification *)noti{
if (self.deviceID.length&&!self.isDeviceLinkIn)
{
[GWP2PDeviceLinker shareInstance].delegate=self;
[[GWP2PDeviceLinker shareInstance] forceScanLanDevices];
}
}
#pragma mark - 搜索到设备,弹出添加设备提示 暂不用
/**
局域网里面有设备联网成功后都会回调此方法。UDP使用
@param deviceDict 设备信息
*/
- (void)p2pDeviceLinker:(GWP2PDeviceLinker *)linker deviceLinkSuccess:(NSDictionary *)deviceDict
{
NSLog(@"扫描到设备");
[self deviceLinkin:deviceDict linkType:self.conectType];
}
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
@ -352,82 +381,131 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
_canDissMissController = NO;
[self savePassw];
//声波智能联机
[self smartLinkConnect];
if (self.conectType==conectType_Intelligent)
{
[self smartLinkConnect];
}
else
{
[self apLinkConnect];
}
}
}
}
-(void)deviceLinkin:(NSDictionary*)deviceDict linkType:(NSInteger)type
{
NSLog(@"声波配网成功,返回数据:%@",deviceDict);
if (self.isDeviceLinkIn) {
return;
}
NSString *deviceID = [deviceDict[@"deviceID"] stringValue];
NSString *deviceIP = deviceDict[@"deviceIP"];
//AP配网时有值 smart没有值
if ([self.deviceID isEqualToString:deviceID]||self.deviceID==nil)
{
self.isDeviceLinkIn = YES;
if (type==conectType_Intelligent)
{
[self.view makeToast:@"声波配网成功"];
[[GWP2PDeviceLinker shareInstance] p2pStopSmartLink];
}
else
{
[self.view makeToast:@"AP配网成功"];
[[GWP2PDeviceLinker shareInstance] p2pStopAPLink]; }
// NSString *devicePassword = deviceDict[@"devicePassword"];
self.deviceID = deviceID;
[self resetPassWord];//初始化密码
if (![deviceDict[@"isInitPassword"] boolValue]){ //设备没有初始化密码,设置密码
[[GWP2PClient sharedClient] setDeviceInitialPassword:self.lastSetPassword withDeviceID:deviceIP completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
NSLog(@"success:%i %@",success,dataDictionary);
[self resetPassWord];//初始化密码
[self bindCameraDevice];
}];
}else{//如果已经设置过初始密码,则直接使用
[self bindCameraDevice];
}
}
}
-(void)deviceLinkinTimeout:(NSInteger)type
{
//
if (!self.isDeviceLinkIn) {//90秒之后还未连接上连接超时
[[GWP2PDeviceLinker shareInstance] p2pStopAPLink];
[self connectNormalView];
if ([[[CommonUtils getSSIDInfo] objectForKey:@"SSID"] isEqualToString:self.wifiName])
{
[self.view makeToast:[NSString stringWithFormat:@"请确认手机已经连接到%@",self.wifiName]];
}
else
{
[self.view makeToast:@"WiFi连接失败"];
}
}
}
-(void)apLinkConnect
{
WEAK_SELF;
[[GWP2PDeviceLinker shareInstance] p2pStopAPLink];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(90 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self deviceLinkinTimeout:self.conectType];
});
[self resetPassWord];//初始化密码
[[GWP2PDeviceLinker shareInstance] p2pAPLinkDeviceWithWiFiSSID:weakSelf.wifiName wifiPassword:weakSelf.wifiPwd devicePassword:weakSelf.lastSetPassword deviceReceive:^(NSString *deviceId, BOOL isSupport) {
if (isSupport)
{
weakSelf.deviceID=deviceId;
[weakSelf.view makeToast:[NSString stringWithFormat:@"设备即将连接网络,请将手机重新连接到%@",weakSelf.wifiName]];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NSURL * url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
if([[UIApplication sharedApplication] canOpenURL:url]) {
if (@available(iOS 10.0, *)) {
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
}else {
[[UIApplication sharedApplication] openURL:url];
}
}
});
}
else
{
[weakSelf.view makeToast:@"该设备不支持AP配网"];
}
} deviceLinkIn:^(NSDictionary *deviceDict) {
[weakSelf deviceLinkin:deviceDict linkType:weakSelf.conectType];
}];
}
//智能联机
-(void)smartLinkConnect{
WEAK_SELF;
[[GWP2PDeviceLinker shareInstance] p2pStopSmartLink];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(90 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//
if (!self.isDeviceLinkIn) {//90秒之后还未连接上连接超时
[[GWP2PDeviceLinker shareInstance] p2pStopSmartLink];
[self connectNormalView];
[self.view makeToast:@"WiFi连接失败"];
}
[self deviceLinkinTimeout:self.conectType];
});
[[GWP2PDeviceLinker shareInstance] p2pSmartLinkDeviceWithWiFiSSID:weakSelf.wifiName password:weakSelf.wifiPwd useSimpleConfig:YES deviceLinkIn:^(NSDictionary *deviceDict) {
NSLog(@"声波配网成功,返回数据:%@",deviceDict);
if (weakSelf.isDeviceLinkIn) {
return;
}
weakSelf.isDeviceLinkIn = YES;
[self.view makeToast:@"声波配网成功"];
//如果智能联机,设备配网成功,就断开发送智能联机
[[GWP2PDeviceLinker shareInstance] p2pStopSmartLink];
NSString *deviceID = [deviceDict[@"deviceID"] stringValue];
NSString *deviceIP = deviceDict[@"deviceIP"];
// NSString *devicePassword = deviceDict[@"devicePassword"];
weakSelf.deviceID = deviceID;
[self resetPassWord];//初始化密码
if (![deviceDict[@"isInitPassword"] boolValue]){ //设备没有初始化密码,设置密码
[[GWP2PClient sharedClient] setDeviceInitialPassword:self.lastSetPassword withDeviceID:deviceIP completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
NSLog(@"success:%i %@",success,dataDictionary);
[weakSelf resetPassWord];//初始化密码
[weakSelf bindCameraDevice];
}];
}else{//如果已经设置过初始密码,则直接使用
[weakSelf bindCameraDevice];
}
// else{
// [[GWP2PClient sharedClient] getMultipleDeviceStatusWithDeviceID:deviceIP password:@"123" completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
// NSLog(@"success:%i %@",success,dataDictionary);
// [weakSelf resetPassWord];//更新密码
// [weakSelf bindCameraDevice];
//
// }];
// }
// else {
// //设备已经初始化过密码,则直接获取设备信息
// [[GWP2PClient sharedClient] getMultipleDeviceStatusWithDeviceID:deviceIP password:devicePassword completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
// NSLog(@"success:%i %@",success,dataDictionary);
// [weakSelf resetPassWord];//更新密码
// if (success) {
// dispatch_async(dispatch_get_main_queue(), ^{
// //[self.view makeToast:NSLocalizedString(@"operator_success", nil)];
// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// usleep(800000);
// dispatch_async(dispatch_get_main_queue(), ^{
//
// [weakSelf ifishUserBindcameraIdBy:self.contactID];
//
// });
// });
// });
// }else{
// dispatch_async(dispatch_get_main_queue(), ^{
//
// self.lodviewMissStyle =lodingViewdissMissSuccsess;
// [self connectNormalView];
// _canDissMissController = YES;
// [self.view makeToast:NSLocalizedString(@"operator_failure", nil)];
//
// });
// }
// }];
// }
[weakSelf deviceLinkin:deviceDict linkType:weakSelf.conectType];
}];
}
//初始化设备密码回调
@ -465,6 +543,7 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
-(void)dealloc{
[[GWP2PDeviceLinker shareInstance] p2pStopSmartLink];
[[GWP2PDeviceLinker shareInstance] p2pStopAPLink];
}
#pragma mark - UI正常状态