SDEASYCAM 手机APP软件代码_第1页
SDEASYCAM 手机APP软件代码_第2页
SDEASYCAM 手机APP软件代码_第3页
SDEASYCAM 手机APP软件代码_第4页
SDEASYCAM 手机APP软件代码_第5页
已阅读5页,还剩26页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论