




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
PAGEPAGE1SDEASYCAM手机APP软件(1.0.8)#pragmamark-保存设置-(void)save:(id)sender{
NSIntegerstart,end;
start=sWeekIndex*49+sHourIndex*2+sMinuteIndex;
end=eWeekIndex*49+eHourIndex*2+eMinuteIndex;
if(end>start)
{
for(NSIntegeri=start;i<end;i++)
{
if(i==48||i==97||i==146||i==195||i==244||i==293||i==342){
continue;
}
planTime[i]='P';
}
doubledelayInSeconds=0.15;
dispatch_time_tpopTime=dispatch_time(DISPATCH_TIME_NOW,(int64_t)(delayInSeconds*NSEC_PER_SEC));
dispatch_after(popTime,dispatch_get_main_queue(),^(void){
SMsgAVIoctrlSetScheduleReq*s2=malloc(sizeof(SMsgAVIoctrlSetScheduleReq));
memset(s2,0,sizeof(SMsgAVIoctrlSetScheduleReq));
memcpy(s2->sDayData,planTime,sizeof(planTime));
s2->u32ScheduleType=AVIOTC_SCHEDULETYPE_ALARM;
[self.camerasendIOCtrlToChannel:0
Type:IOTYPE_USER_IPCAM_SET_SCHEDULE_REQ
Data:(char*)s2
DataSize:sizeof(SMsgAVIoctrlSetScheduleReq)];
free(s2);
});
}
elseif(sWeekIndex==6&&eWeekIndex==0&&eHourIndex==0&&eMinuteIndex==0)
{
end=342;
for(NSIntegeri=start;i<end;i++)
{
if(i==48||i==97||i==146||i==195||i==244||i==293||i==342){
continue;
}
planTime[i]='P';
}
doubledelayInSeconds=0.15;
dispatch_time_tpopTime=dispatch_time(DISPATCH_TIME_NOW,(int64_t)(delayInSeconds*NSEC_PER_SEC));
dispatch_after(popTime,dispatch_get_main_queue(),^(void){
SMsgAVIoctrlSetScheduleReq*s2=malloc(sizeof(SMsgAVIoctrlSetScheduleReq));
memset(s2,0,sizeof(SMsgAVIoctrlSetScheduleReq));
memcpy(s2->sDayData,planTime,sizeof(planTime));
s2->u32ScheduleType=AVIOTC_SCHEDULETYPE_ALARM;
[self.camerasendIOCtrlToChannel:0
Type:IOTYPE_USER_IPCAM_SET_SCHEDULE_REQ
Data:(char*)s2
DataSize:sizeof(SMsgAVIoctrlSetScheduleReq)];
free(s2);
});
}
elseif(sWeekIndex==0&&sHourIndex==0&&sMinuteIndex==0&&eWeekIndex==0&&eHourIndex==0&&eMinuteIndex==0)
{
}
else
{
[MBProgressHUDshowError:[NSStringstringWithFormat:NSLocalizedString(@"Error,Plstrysettingtimeagain!!",@"")]];
return;
}
//save
andloadup
//sendCMD
SMsgAVIoctrlSetGuardReqEn*s1=malloc(sizeof(SMsgAVIoctrlSetGuardReqEn));
memset(s1,0,sizeof(SMsgAVIoctrlSetGuardReqEn));
s1->channel=0;//
memcpy(s1->ftpServer,[sServerUTF8String],[sServerlength]);//
memcpy(s1->userName,[sAccountUTF8String],[sAccountlength]);//
memcpy(s1->password,[sPasswdUTF8String],[sPasswdlength]);//
s1->ftpPort=(int)nPort;
s1->alarm_motion_armed=self.isMotionSwitch;
s1->alarm_motion_sensitivity=self.motionDetection;
s1->alarm_preset=self.alarmPresetValue;
[self.camerasendIOCtrlToChannel:0
Type:IOTYPE_USER_IPCAM_SETGUARD_REQ
Data:(char*)s1
DataSize:sizeof(SMsgAVIoctrlSetGuardReqEn)];
free(s1);
//2savevideotoSDCard
SMsgAVIoctrlSetAlarmLinkageReq*s2=malloc(sizeof(SMsgAVIoctrlSetAlarmLinkageReq));
memset(s2,0,sizeof(SMsgAVIoctrlSetAlarmLinkageReq));
s2->channel=0;
s2->vidToSDCard=(int)self.isSaveVideoToSD;
[self.camerasendIOCtrlToChannel:0
Type:IOTYPE_USER_IPCAM_SET_ALARM_LINKAGE_REQ
Data:(char*)s2
DataSize:sizeof(SMsgAVIoctrlSetAlarmLinkageReq)];
free(s2);
//quit
[self.navigationControllerpopViewControllerAnimated:YES];}#pragmamark-sensi&presetDelegate
-(void)didSelectSensitivityValue:(NSInteger)value{
self.motionDetection=value;
[self.tableViewreloadData];}-(void)didSelectPresetValue:(NSInteger)value{
self.alarmPresetValue=value;
[self.tableViewreloadData];}#pragmamark-MyCameraDelegateMethods-(void)camera:(MyCamera*)camera__didReceiveIOCtrlWithType:(NSInteger)typeData:(constchar*)dataDataSize:(NSInteger)size{
if(camera_==self.camera&&type==IOTYPE_USER_IPCAM_GETGUARD_RESP){//1057
SMsgAVIoctrlGetGuardRespEn*s=(SMsgAVIoctrlGetGuardRespEn*)data;
self.isMotionSwitch=s->alarm_motion_armed;
self.motionDetection=s->alarm_motion_sensitivity;
NSLog(@"@@@@@@%ld@@@@@@@",(long)self.motionDetection);
self.alarmPresetValue=s->alarm_preset;
self.labelHint.hidden=YES;
[self.senderIndicatorstopAnimating];
self.navigationItem.rightBarButtonItem.enabled=!self.senderIndicator.isAnimating;
[self.tableViewreloadData];
}elseif(camera_==self.camera&&type==IOTYPE_USER_IPCAM_GETMOTIONDETECT_RESP)
{
SMsgAVIoctrlGetMotionDetectResp*s=(SMsgAVIoctrlGetMotionDetectResp*)data;
self.motionDetection=s->sensitivity;
[self.tableViewreloadData];
}elseif(camera_==self.camera&&type==IOTYPE_USER_IPCAM_SET_ALARM_LINKAGE_RESP){
SMsgAVIoctrlSetAlarmLinkageResp*s=(SMsgAVIoctrlSetAlarmLinkageResp*)data;
if(s->u32Result==0)
{
NSLog(@"设置pic&video保存到ftp成功!!");
}
[self.tableViewreloadData];
}elseif(camera_==self.camera&&type==IOTYPE_USER_IPCAM_GET_ALARM_LINKAGE_RESP){
//SMsgAVIoctrlGetAlarmLinkageResp
{//1057
SMsgAVIoctrlGetAlarmLinkageResp*s=(SMsgAVIoctrlGetAlarmLinkageResp*)data;
self.isSaveVideoToSD=s->vidToSDCard;
[self.tableViewreloadData];
}
}
}#pragmamark-UIPickerViewDataSoure-(NSInteger)numberOfComponentsInPickerView:(UIPickerView*)pickerView{
if(pickerType==WEEK_PICKER_VIEW)
{
return1;
}
elseif(pickerType==HM_PICKER_VIEW)
{
return2;
}
return1;}-(NSInteger)pickerView:(UIPickerView*)pickerViewnumberOfRowsInComponent:(NSInteger)component{
if(pickerType==WEEK_PICKER_VIEW)
{
returnweekArr.count;
}
elseif(pickerType==HM_PICKER_VIEW)
{
if(component==0){
returnhourArr.count;
}
else
{
returnminuteArr.count;
}
}
return0;}#pragmamark-UIPickerViewDelegate-(nullableNSString*)pickerView:(UIPickerView*)pickerViewtitleForRow:(NSInteger)rowforComponent:(NSInteger)component{
if(pickerType==WEEK_PICKER_VIEW)
{
return[weekArrobjectAtIndex:row];
}elseif(pickerType==HM_PICKER_VIEW)
{
if(component==0){
return
[hourArrobjectAtIndex:row];
}elseif(component==1)
{
return[minuteArrobjectAtIndex:row];
}
}
return@"test";}-(void)pickerView:(UIPickerView*)pickerViewdidSelectRow:(NSInteger)rowinComponent:(NSInteger)component{
if(pickerType==WEEK_PICKER_VIEW)
{
if(whitchBtn==100)
{
sWeekIndex=row;
}elseif(whitchBtn==101)
{
eWeekIndex=row;
}
}elseif(pickerType==HM_PICKER_VIEW)
{
if(component==0)
{
if(whitchBtn==200)
{
sHourIndex=row;
}elseif(whitchBtn==201)
{
eHourIndex=row;
}
}elseif(component==1)
{
if(whitchBtn==200)
{
sMinuteIndex=row;
}elseif(whitchBtn==201)
{
eMinuteIndex=row;
}
}
}
}#import<IOTCamera/AVIOCTRLDEFs.h>#import"AboutDeviceController.h"#import"MBProgressHUD.h"@implementationAboutDeviceController@synthesizecamera;@synthesizelabelItems;@synthesizemodel;@synthesizeversion;@synthesizevender;@synthesizetotalSize;@synthesizefreeSize;@synthesizemodelIndicator;@synthesizeversionIndicator;@synthesizevenderIndicator;@synthesizetotalIndicator;@synthesizefreeIndicator;-(IBAction)back:(id)sender{
[self.navigationControllerpopViewControllerAnimated:YES];}#pragmamark-Viewlifecycle-(void)viewDidLoad{
[superviewDidLoad];
labelItems=[[NSArrayalloc]initWithObjects:
NSLocalizedString(@"FreeSize",@""),
NSLocalizedString(@"TotalSize",@""),
NSLocalizedString(@"FormatSD",@""),nil];
UIButton*customButton=[UIButtonbuttonWithType:UIButtonTypeCustom];
customButton.frame=CGRectMake(0,0,44,44);
[customButtonsetBackgroundImage:[UIImageimageNamed:@"cam_back"]forState:UIControlStateNormal];
[customButtonsetBackgroundImage:[UIImageimageNamed:@"cam_back_clicked"]forState:UIControlStateHighlighted];
[customButtonaddTarget:selfaction:@selector(back:)forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem*backButton=[[UIBarButtonItemalloc]initWithCustomView:customButton];
UIBarButtonItem*negativeSpacer=[[UIBarButtonItemalloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
target:nilaction:nil];
negativeSpacer.width=-16;
self.navigationItem.leftBarButtonItems=[NSArrayarrayWithObjects:negativeSpacer,backButton,nil];
[backButtonrelease];
[negativeSpacerrelease];
self.navigationItem.title=NSLocalizedString(@"FormatSD",@"");
self.modelIndicator=[[[UIActivityIndicatorViewalloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]autorelease];
self.versionIndicator=[[[UIActivityIndicatorViewalloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]autorelease];
self.venderIndicator=[[[UIActivityIndicatorViewalloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]autorelease];
self.totalIndicator=[[[UIActivityIndicatorViewalloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]autorelease];
self.freeIndicator=[[[UIActivityIndicatorViewalloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]autorelease];}-(void)viewDidUnload{
self.modelIndicator=nil;
self.versionIndicator=nil;
self.venderIndicator=nil;
self.totalIndicator=nil;
self.freeIndicator=nil;
self.model=nil;
self.version=-1;
self.vender=nil;
self.totalSize=-1;
self.freeSize=-1;
self.labelItems=nil;
self.camera=nil;
[superviewDidUnload];}-(void)viewWillAppear:(BOOL)animated{
[superviewWillAppear:animated];
self.totalSize=-1;
self.freeSize=-1;
camera.delegate2=self;
SMsgAVIoctrlDeviceInfoReq*s=malloc(sizeof(SMsgAVIoctrlDeviceInfoReq));
memset(s,0,sizeof(SMsgAVIoctrlDeviceInfoReq));
[camerasendIOCtrlToChannel:0
Type:IOTYPE_USER_IPCAM_DEVINFO_REQ
Data:(char*)s
DataSize:sizeof(SMsgAVIoctrlDeviceInfoReq)];
free(s);
}-(void)viewWillDisappear:(BOOL)animated{
[superviewWillDisappear:animated];
camera.delegate2=nil;}-(void)dealloc{
[modelIndicatorrelease];
[versionIndicatorrelease];
[venderIndicatorrelease];
[totalIndicatorrelease];
[freeIndicatorrelease];
[modelrelease];
[venderrelease];
[labelItemsrelease];
[camerarelease];
[superdealloc];}#pragmamark-TableViewDataSourceMethods-(NSInteger)numberOfSectionsInTableView:(UITableView*)tableView{
return1;
}-(NSInteger)tableView:(UITableView*)tableViewnumberOfRowsInSection:(NSInteger)section{
returnlabelItems.count;}-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{
NSUIntegerrow=[indexPathrow];
staticNSString*AboutDeviceTableIdentifier=@"AboutDeviceTableIdentifier";
UITableViewCell*cell=[self.tableViewdequeueReusableCellWithIdentifier:AboutDeviceTableIdentifier];
if(cell==nil){
cell=[[[UITableViewCellalloc]
initWithStyle:UITableViewCellStyleValue1reuseIdentifier:AboutDeviceTableIdentifier]
autorelease];
}
NSIntegerindex=row;
cell.textLabel.text=[labelItemsobjectAtIndex:index];
cell.selectionStyle=UITableViewCellSelectionStyleNone;
if(row==0){
if(freeSize<0){
[celladdSubview:freeIndicator];
[freeIndicatorstartAnimating];
freeIndicator.center=CGPointMake(280,22);
}
else{
[freeIndicatorstopAnimating];
[freeIndicatorremoveFromSuperview];
}
cell.detailTextLabel.text=(freeSize>=0)?[NSStringstringWithFormat:@"%ldMB",(long)freeSize]:nil;
}
elseif(row==1){
if(totalSize<0){
[celladdSubview:totalIndicator];
[totalIndicatorstartAnimating];
totalIndicator.center=CGPointMake(280,22);
}
else{
[totalIndicatorstopAnimating];
[totalIndicatorremoveFromSuperview];
}
cell.detailTextLabel.text=(totalSize>=0)?[NSStringstringWithFormat:@"%ldMB",(long)totalSize]:nil;
}
returncell;}#pragmamark-Tableviewdelegate-(void)tableView:(UITableView*)tableViewdidSelectRowAtIndexPath:(NSIndexPath*)indexPath{
NSIntegerrow=[indexPathrow];
if(row==2)
{
UIAlertView*alert=[[UIAlertViewalloc]initWithTitle:NSLocalizedString(@"Warmtips",@"")message:NSLocalizedString(@"FormatcommandwillERASEalldataofyourSDCard",@"")delegate:selfcancelButtonTitle:NSLocalizedString(@"Cancel",@"")otherButtonTitles:NSLocalizedString(@"OK",@""),nil];
[alertshow];
}}#pragmamark-UIAlertViewDelegate-(void)alertView:(UIAlertView*)alertViewclickedButtonAtIndex:(NSInteger)buttonIndex{
if(buttonIndex==1)
{
if(camera!=nil)
{
SMsgAVIoctrlFormatExtStorageReq*s=malloc(sizeof(SMsgAVIoctrlFormatExtStorageReq));
memset(s,0,sizeof(SMsgAVIoctrlFormatExtStorageReq));
s->storage=0;
[camerasendIOCtrlToChannel:0
Type:IOTYPE_USER_IPCAM_FORMATEXTSTORAGE_REQ
Data:(char*)s
DataSize:sizeof(SMsgAVIoctrlFormatExtStorageReq)];
free(s);
}
}}#pragmamark-CameraDelegateMethods-(void)camera:(MyCamera*)camera__didReceiveIOCtrlWithType:(NSInteger)typeData:(constchar*)dataDataSize:(NSInteger)size{
if(camera_==camera&&type==IOTYPE_USER_IPCAM_DEVINFO_RESP){
SMsgAVIoctrlDeviceInfoResp*structDevInfo=(SMsgAVIoctrlDeviceInfoResp*)data;
self.totalSize=structDevInfo->total;
self.freeSize=structDevInfo->free;
[self.tableViewreloadData];
}
elseif(camera_==camera&&type==IOTYPE_USER_IPCAM_FORMATEXTSTORAGE_RESP){
SMsgAVIoctrlFormatExtStorageResp*s=(SMsgAVIoctrlFormatExtStorageResp*)data;
if(s->result==0)
{
MBProgressHUD*hud=[MBProgressHUDshowHUDAddedTo:self.viewanimated:YES];
hud.mode=MBProgressHUDModeText;
hud.labelText=NSLocalizedString(@"Formatcompleted.",@"");
hud.removeFromSuperViewOnHide=YES;
[hudhide:YESafterDelay:2];
}
else
{
MBProgressHUD*hud=[MBProgressHUDshowHUDAddedTo:self.viewanimated:YES];
hud.mode=MBProgressHUDModeText;
hud.labelText=NSLocalizedString(@"Formatfailed.",@"");
hud.removeFromSuperViewOnHide=YES;
[hudhide:YESafterDelay:2];
}
}}-(void)checkTimeout{
if(true==bDoWaiting){
UITableViewCell*cell=[self.tableViewcellForRowAtIndexPath:[NSIndexPathindexPathForRow:0inSection:0]]; UIActivityIndicatorView*waitView=(UIActivityIndicatorView*)[cellviewWithTag:77]; if(waitView){ [waitViewstopAnimating]; [waitViewremoveFromSuperview]; }
UIAlertView*alert=[[UIAlertViewalloc]initWithTitle:nilmessage:[NSStringstringWithFormat:NSLocalizedString(@"Incorrectpasswordfor%@",@""),ssid]
delegate:nilcancelButtonTitle:NSLocalizedString(@"Close",@"")otherButtonTitles:nil];
[alertshow];
[alertrelease];
}}-(IBAction)join:(id)sender{
NSString*password=nil; bDoWaiting=FALSE;
if(textFieldBeingEdited!=nil)
password=textFieldBeingEdited.text;
if(password!=nil&&[passwordlength]>0){ if([passwordlength]<=30){
SMsgAVIoctrlSetWifiReq*s=malloc(sizeof(SMsgAVIoctrlSetWifiReq)); memcpy(s->ssid,[ssidUTF8String],32); memcpy(s->password,[passwordUTF8String],32); s->enctype=enctype; s->mode=mode; [camerasendIOCtrlToChannel:0Type:IOTYPE_USER_IPCAM_SETWIFI_REQData:(char*)sDataSize:sizeof(SMsgAVIoctrlSetWifiReq)]; free(s); bDoWaiting=TRUE;
[selfperformSelector:@selector(checkTimeout)withObject:nilafterDelay:30]; } else{ UIAlertView*alert=[[UIAlertViewalloc]initWithTitle:nilmessage:NSLocalizedString(@"Thepasswordismorethan30characters",@"")delegate:nilcancelButtonTitle:NSLocalizedString(@"Close",@"")otherButtonTitles:nil]; [alertshow]; [alertrelease]; }
}
else{
UIAlertView*alert=[[UIAlertViewalloc]initWithTitle:nilmessage:[NSStringstringWithFormat:NSLocalizedString(@"Pleaseenterpassword",@"")]delegate:nilcancelButtonTitle:NSLocalizedString(@"Close",@"")otherButtonTitles:nil];
[alertshow];
[alertrelease];
} if(bDoWaiting){ UITableViewCell*cell=[self.tableViewcellForRowAtIndexPath:[NSIndexPathindexPathForRow:0inSection:0]]; UIActivityIndicatorView*indicator=[[UIActivityIndicatorViewalloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
//indicator.center=CGPointMake(self.textFieldBeingEdited.frame.origin.x-20,self.textFieldBeingEdited.frame.origin.y+(self.textFieldBeingEdited.frame.size.height/2));
indicator.center=CGPointMake(260,22);
indicator.tag=77; [celladdSubview:indicator]; [indicatorstartAnimating];
[indicatorrelease]; }}-(IBAction)cancel:(id)sender{
[self.navigationControllerpopViewControllerAnimated:YES];}-(id)initWithNibName:(NSString*)nibNameOrNilbundle:(NSBundle*)nibBundleOrNildelegate:(id<EditWiFiPasswordDelegate>)delegate_{
self=[superinitWithNibName:nibNameOrNilbundle:nibBundleOrNil];
if(self)
self.delegate=delegate_;
returnself;}#pragmamark-Viewlifecycle-(IBAction)back:(id)sender{
[self.navigationControllerpopViewControllerAnimated:YES];}-(void)viewDidLoad{
[superviewDidLoad];
self.navigationItem.title=NSLocalizedString(@"EnterPassword",@"");
UIBarButtonItem*cancelButton=[[UIBarButtonItemalloc]
initWithTitle:NSLocalizedString(@"Cancel",@"")
style:UIBarButtonItemStylePlain
target:self
action:@selector(cancel:)];
self.navigationItem.leftBarButtonItem=cancelButton;
[cancelButtonrelease];
UIBarButtonItem*joinButton=[[UIBarButtonItemalloc]
initWithTitle:NSLocalizedString(@"Join",@"")
style:UIBarButtonItemStyleDone
target:self
action:@selector(join:)];
self.navigationItem.rightBarButtonItem=joinButton;
[joinButtonrelease];
textFieldBeingEdited.frame=CGRectMake(115,9,180,25);
textFieldBeingEdited.clearsOnBeginEditing=NO;
textFieldBeingEdited.secureTextEntry=YES;
bDoWaiting=FALSE;
}-(id)initWithStyle:(UITableViewStyle)styledelegate:(id<WiFiNetworkDelegate>)delegate_{
self=[superinitWithStyle:style];
if(self)self.delegate=delegate_;
returnself;}#pragmamark-Viewlifecycle-(void)viewDidLoad{
[superviewDidLoad];
UIButton*customButton=[UIButtonbuttonWithType:UIButtonTypeCustom];
customButton.frame=CGRectMake(0,0,44,44);
[customButtonsetBackgroundImage:[UIImageimageNamed:@"cam_back"]forState:UIControlStateNormal];
[customButtonsetBackgroundImage:[UIImageimageNamed:@"cam_back_clicked"]forState:UIControlStateHighlighted];
[customButtonaddTarget:selfaction:@selector(back:)forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem*backButton=[[UIBarButtonItemalloc]initWithCustomView:customButton];
UIBarButtonItem*negativeSpacer=[[UIBarButtonItemalloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
target:nilaction:nil];
negativeSpacer.width=-16;
self.navigationItem.leftBarButtonItems=[NSArrayarrayWithObjects:negativeSpacer,backButton,nil];
[backButtonrelease];
[negativeSpacerrelease];
nLastSelIdx=-1;//
self.navigationItem.leftBarButtonItem=[[UIBarButtonItemalloc]//
style:UIBarButtonItemStylePlain//
target:self//
action:@selector(back:)];
self.navigationItem.title=NSLocalizedString(@"WiFiNetworks",@"");
[selfdoRefresh];
}-(void)viewDidUnload{
self.camera=nil;
self.delegate=nil;
[superviewDidUnload];}-(void)viewWillAppear:(BOOL)animated{
[superviewWillAppear:animated]; if(nLastSelIdx!=-1){// wifiSSIDListCount=-1;// [self.tableViewreloadData];// [selfdoRefresh]; }
self.camera.delegate2=self;}-(void)viewWillDisappear:(BOOL)animated{ [superviewWillDisappear:animated]; if(bTimerListWifiApResp){ [self.timerListWifiApRespinvalidate]; bTimerListWifiApResp=FALSE; }}-(void)dealloc{
if(bTimerListWifiApResp){ [self.timerListWifiApRespinvalidate]; bTimerListWifiApResp=FALSE; }
[camerarelease];
[superdealloc];}#pragmamark-TableViewDataSourceMethods-(NSInteger)numberOfSectionsInTableView:(UITableView*)tableView{
return1;}-(NSInteger)tableView:(UITableView*)tableViewnumberOfRowsInSection:(NSInteger)section{
returnwifiSSIDList!=NULL&&wifiSSIDListCount>=0?wifiSSIDListCount:0;}-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{
NSUIntegerrow=[indexPathrow];
staticNSString*WiFiNetworkCellIdentifier=@"WiFiNetworkCellIdentifier";
UITableViewCell*cell=[self.tableViewdequeueReusableCellWithIdentifier:WiFiNetworkCellIdentifier];
if(cell==nil){
cell=[[[UITableViewCellalloc]
initWithStyle:UITableViewCellStyleValue1reuseIdentifier:WiFiNetworkCellIdentifier]
autorelease];
}
SWifiApwifiAp=wifiSSIDList[row];
NSLog(@"wifiAP:%s\t%d",wifiAp.ssid,wifiAp.status);
NSString*ssid=[NSStringstringWithUTF8String:wifiAp.ssid];
if([ssidlength]>0)
cell.textLabel.text=ssid;
else
cell.textLabel.text=NSLocalizedString(@"Unknown",@"");
cell.accessoryType=UITableViewCellAccessoryNone;
if(([ssidlength]>0)&&
((self.wifiSSID!=nil&&[ssidlength]>0&&[ssidisEqualToString:self.wifiSSID])||
(wifiAp.status==1||wifiAp.status==3||wifiAp.status==4)))
cell.accessoryType=UITableViewCellAccessoryCheckmark;
returncell;}-(NSString*)tableView:(UITableView*)tableViewtitleForHeaderInSection:(NSInteger)section{
if(!bRemoteDevTimeout){ if(wifiSSIDListCount<0) returnNSLocalizedString(@"Scanning...",@""); elseif(wifiSSIDListCount==0) returnNSLocalizedString(@"NoWi-Finetworkfound",@""); else returnNSLocalizedString(@"ChooseaNetwork...",@""); } else{ returnNSLocalizedString(@"RemoteDeviceTimeout",@""); }}#pragmamark-TableViewDelegateMethods-(void)tableView:(UITableView*)tableViewdidSelectRowAtIndexPath:(NSIndexPath*)indexPath{
intidx=(int)[indexPathrow];
SWifiApwifiAp=wifiSSIDList[idx];
EditWiFiPasswordController*controller=[[EditWiFiPasswordControlleralloc]initWithNibName:@"WiFiPassword"bundle:nildelegate:self];
controller.camera=self.camera;
controller.ssid=[NSStringstringWithFormat:@"%s",wifiAp.ssid];
controller.ssid_length=32;
controller.mode=wifiAp.mode;
controller.enctype=wifiAp.enctype;
[self.navigationControllerpushViewController:controlleranimated:YES];
[controllerrelease]; nLastSelIdx=idx;}#pragmamark-MyCameraDelegateMethods-(void)camera:(MyCamera*)camera__didReceiveIOCtrlWithType:(NSInteger)typeData:(constchar*)dataDataSize:(NSInteger)size{
if(camera_==camera){
if(type==IOTYPE_USER_IPCAM_LISTWIFIAP_RESP){
if(bTimerListWifiApResp){ [self.timerListWifiApRespinvalidate]; bTimerListWifiApResp=FALSE; }
if(!isRecvWiFi){
memset(wifiSSIDList,0,sizeof(wifiSSIDList));
SMsgAVIoctrlListWifiApResp*p=(SMsgAVIoctrlListWifiApResp*)data;
wifiSSIDListCount=p->number;
memcpy(wifiSSIDList,p->stWifiAp,size-sizeof(p->number));
[self.tableViewreloadData];
isRecvWiFi=true;
}
}
}}#pragmamark-EditWiFiPasswordDelegateMethods-(void)didSetPasswordSuccess:(NSString*)ssid{
isChangeWiFi=true;
wifiSSID=[ssidcopy];
NSArray*visableCells=[self.tableViewvisibleCells];
inti;
for(i=0;i<[visableCellscount];i++){
UITableViewCell*currentCell=[visableCellsobjectAtIndex:i];
if([currentCell.textLabel.textisEqualToString:ssid]){
currentCell.accessoryType=UITableViewCellAccessoryCheckmark;
}
else{
currentCell.accessoryType=UITableViewCellAccessoryNone;
}
}}-(void)timeOutGetListWifiAPResp:(NSTimer*)timer{ bTimerListWifiApResp=FALSE; inttimeOut=[(NSNumber*)timer.userInfointValue]; nTotalWaitingTime+=timeOut; NSLog(@"!!!IOTYPE_USER_IPCAM_LISTWIFIAP_RESPTimeOut%dsec!!!",nTotalWaitingTime); if(nTotalWaitingTime<=30){ timeOut=20; } elseif(nTotalWaitingTime<=50){ timeOut=10; } els
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年度珠宝店员工劳动合同终止及后续服务合同
- 动产拍卖委托代理协议书(2025年度艺术品拍卖合作)
- 2025年福州货运丛业资格证考试题及答案
- 2025年四平道路运输从业人员从业资格考试
- 2024学生暑假工合同
- 2025年大理货运资格证培训考试题
- 区居住房屋租赁合同书
- 三农产品电商增强三农村地区可持续发展能力方案
- 自动生产线技术知到课后答案智慧树章节测试答案2025年春安徽机电职业技术学院
- 走进财务管理的世界知到课后答案智慧树章节测试答案2025年春青岛黄海学院
- 抢救车的管理
- GB/T 44927-2024知识管理体系要求
- GB/T 17350-2024专用汽车和专用挂车分类、名称及型号编制方法
- 2025山东青岛市属事业单位公开招聘笔试和高频重点提升(共500题)附带答案详解
- 2024年07月山东省泰山财产保险股份有限公司2024年夏季校园招考29名工作人员笔试历年参考题库附带答案详解
- 临床护理死亡病例讨论
- 2025年广东韶关城投集团招聘笔试参考题库含答案解析
- 医疗器械生产企业并购合同
- 2025版新能源汽车充电站建设合同含政府补贴及税收优惠条款
- 2025年北京国资公司招聘笔试参考题库含答案解析
- 建设工程总承包EPC建设工程项目管理方案1
评论
0/150
提交评论