engine/psp/netcomm.c
/* Select && Connect to an Access Point */
Select && Connect to an Access Point
Select && Connect to an Access Point
int selectAccessPoint(int selected)
{
	int err;
	int stateLast = -1;
	int state;
	err = sceNetApctlConnect(selected);
	if (err != 0)
	{
		writeToLogFile("Error, sceNetApctlConnect returns %08X\n", err);
		wifiError = 1;
		return -1;
	}
	while(1)
	{
		err = sceNetApctlGetState(&state);
		if(err != 0)
		{
			writeToLogFile("sceNetApctlGetState returns $%x\n", err);
			wifiError = 1;
			break;
		}
		if(state > stateLast)
		{
			stateLast = state;
		}
		if(state == 4) break;
		sceKernelDelayThread(50*1000);
	}
	while(1)
	{
		if(sceNetApctlGetInfo(8, AccessPoints[selected-1].pInfo) == 0)
		{
			AccessPoints[selected-1].color = DARK_GREEN;
			addPSP("SamuraiX", "11:11:11:11", "22:22:22:22", AccessPoints[selected-1].pInfo->ip, 5060, "88:88:88:88", "99:99:99:99", AccessPoints[selected-1].pInfo->ip, 5060, 0);
			break;
		}
		sceKernelDelayThread(1000 * 1000);
	}
	if(err != 0)
	{
		wifiError = 1;
		return -1;
	}
	return 1;
}
int selectAccessPoint ( int selected ) { int err ; int stateLast = -1 ; int state ; err = sceNetApctlConnect ( selected ) ; if ( err != 0 ) { writeToLogFile ( " \n " , err ) ; wifiError = 1 ; return -1 ; } while ( 1 ) { err = sceNetApctlGetState ( & state ) ; if ( err != 0 ) { writeToLogFile ( " \n " , err ) ; wifiError = 1 ; break ; } if ( state > stateLast ) { stateLast = state ; } if ( state == 4 ) break ; sceKernelDelayThread ( 50 * 1000 ) ; } while ( 1 ) { if ( sceNetApctlGetInfo ( 8 , AccessPoints [ selected - 1 ] . pInfo ) == 0 ) { AccessPoints [ selected - 1 ] . color = DARK_GREEN ; addPSP ( " " , " " , " " , AccessPoints [ selected - 1 ] . pInfo -> ip , 5060 , " " , " " , AccessPoints [ selected - 1 ] . pInfo -> ip , 5060 , 0 ) ; break ; } sceKernelDelayThread ( 1000 * 1000 ) ; } if ( err != 0 ) { wifiError = 1 ; return -1 ; } return 1 ; }
Select && Connect to an Access Point
Select && Connect to an Access Point
/* Connect using the first profile */ //printf("Connecting...\n"); //printf("Connection state %d of 4\n", state); /* Connected with IP Address*/ /* Wait 50 ms before polling again */ /* Now obtain IP Address */