摄像头智能配网强化修改

This commit is contained in:
kai60 2020-05-06 11:50:47 +08:00
parent b15f10afe2
commit b11f6aaced
2 changed files with 15 additions and 6 deletions

View File

@ -70,7 +70,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<string>4</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>

View File

@ -43,6 +43,7 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
}
@property (strong,nonatomic) NSMutableDictionary *addresses;
@property (strong,nonatomic) NSMutableDictionary *linkDict;
@property (nonatomic,strong) UIButton *sBtn;
@property(nonatomic)BOOL autodismiss;
@property(nonatomic,assign)lodingViewdissMissStyle lodviewMissStyle;
@ -66,8 +67,10 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
//智能联机
self.isDeviceLinkIn = NO;
[GWP2PDeviceLinker shareInstance].delegate=self;
self.deviceID=nil;
//[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(viewWillEnterForeground:) name:Noti_WillEnterForeground object:nil];
self.addresses = [[NSMutableDictionary alloc] initWithCapacity:1];
self.linkDict = [[NSMutableDictionary alloc] initWithCapacity:1];
self.view.backgroundColor = [UIColor whiteColor];
[self addTitleViewWithTitle:@"连接摄像头"];
[self initComponent];
@ -456,15 +459,16 @@ self.attentionLabel.text=@"1、请长按摄像头背后复位孔复位摄像
-(void)deviceLinkin:(NSDictionary*)deviceDict linkType:(NSInteger)type
{
NSLog(@"声波配网成功,返回数据:%@",deviceDict);
if (self.isDeviceLinkIn) {
return;
}
NSString *deviceID = [deviceDict[@"deviceID"] stringValue];
NSString *deviceIP = deviceDict[@"deviceIP"];
if ([self.linkDict[deviceID] boolValue]) {
return;
}
//AP配网时有值 smart没有值
if ([self.deviceID isEqualToString:deviceID]||self.deviceID==nil)
{
self.isDeviceLinkIn = YES;
if (type==conectType_Intelligent)
{
[self.view makeToast:@"声波配网成功"];
@ -480,6 +484,7 @@ self.attentionLabel.text=@"1、请长按摄像头背后复位孔复位摄像
// NSString *devicePassword = deviceDict[@"devicePassword"];
self.deviceID = deviceID;
self.linkDict[deviceID]=@(YES);
[self resetPassWord];//初始化密码
if (![deviceDict[@"isInitPassword"] boolValue]){ //设备没有初始化密码,设置密码
[[GWP2PClient sharedClient] setDeviceInitialPassword:self.lastSetPassword withDeviceID:deviceIP completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
@ -504,7 +509,7 @@ self.attentionLabel.text=@"1、请长按摄像头背后复位孔复位摄像
-(void)deviceLinkinTimeout:(NSInteger)type
{
//
if (!self.isDeviceLinkIn) {//90秒之后还未连接上连接超时
if (self.deviceID.length&&![self.linkDict[self.deviceID] boolValue]) {//90秒之后还未连接上连接超时
[[GWP2PDeviceLinker shareInstance] p2pStopAPLink];
[self connectNormalView];
@ -518,6 +523,10 @@ self.attentionLabel.text=@"1、请长按摄像头背后复位孔复位摄像
}
}
else if(!self.deviceID.length)
{
[self.view makeToast:@"获取设备ID失败"];
}
}
-(void)apLinkConnect
{