Esempio n. 1
0
int Config_GetPPP(HTTPCONNECTION hConnection, LIST *pParamList, int iAction, XML *pReturnXML)
{
	int i;
	
	switch (iAction)
	{
	case CA_AUTH:
		return AUTH_USER;
	case CA_CONFIG:
		tt_rmutex_lock(&g_rmutex);		
		AddHttpNum(pReturnXML, "Enable", g_ConfigParam.bPPPEnable);
		for (i = 0; i < sizeof(g_ConfigParam.aacPPPServer) / sizeof(g_ConfigParam.aacPPPServer[0]); ++i)
		{
			char acName[32];
			snprintf(acName, sizeof(acName), "Server%d", i);
			AddHttpValue(pReturnXML, acName, g_ConfigParam.aacPPPServer[i]);
		}
		for (i = 0; i < sizeof(g_ConfigParam.aiPPPPort) / sizeof(g_ConfigParam.aiPPPPort[0]); ++i)
		{
			char acName[32];
			snprintf(acName, sizeof(acName), "Port%d", i);
			AddHttpNum(pReturnXML, acName, g_ConfigParam.aiPPPPort[i]);
		}
		AddHttpValue(pReturnXML, "User", g_ConfigParam.acPPPUser);
		AddHttpValue(pReturnXML, "Pass", g_ConfigParam.acPPPPass);
		AddHttpValue(pReturnXML, "Status", (ppot_is_online() ? "online" : "offline"));
		tt_rmutex_unlock(&g_rmutex);
		return 0;
	}
	return -1;
}
Esempio n. 2
0
void thread_entry(void *arg)
{
	THREAD_ARG_T *the_arg = (THREAD_ARG_T *)arg;

	while(1)
	{
		int i;
		int value;

		/* Show LED so that users know that the thread is running. */
		int cur_ticks = tt_get_ticks ();
		if(cur_ticks % 64 < 32)
			DrvGPIO_SetBit(the_arg->gpio_group, the_arg->gpio_bit);	/* Turn off LED */
		else
			DrvGPIO_ClrBit(the_arg->gpio_group, the_arg->gpio_bit);	/* Turn on LED */


			
		/* Lock the mutex */
		tt_rmutex_lock(the_arg->mutex);

		/* Update value */
		for(i = 0; i < THREAD_NUM; ++i)
			++the_arg->value[i];
	
		/* (Recursive) Lock the mutex again */
		tt_rmutex_lock(the_arg->mutex);
		
		/* Check the lock operation by checking value */
		value = the_arg->value[0];
		for(i = 0; i < THREAD_NUM; ++i)
		{
			if(the_arg->value[i] != value)
			{
				/* To run to here indicates that the test for mutex lock has been failed. */
				tt_printf("Failed\n");
				while(1);
			}
		}
		
		/* (Recursive) Unlock the mutex */
		tt_rmutex_unlock(the_arg->mutex);
	
		/* Unlock the mutex */
		tt_rmutex_unlock(the_arg->mutex);
	}
}
Esempio n. 3
0
void vjpegUnlock (void)
{
	//g_vpJPEG.nRefCount = 0;
#ifndef ECOS
	tt_rmutex_unlock (&g_vpJPEG.mtLock);
#else
	cyg_mutex_unlock (&g_vpJPEG.mtLock);
#endif
}
Esempio n. 4
0
int Config_SetUPnP(HTTPCONNECTION hConnection, LIST *pParamList, int iAction, XML *pReturnXML)
{
	BOOL bEnableUPnP;
	unsigned short usUPnPPort;
	const char *acWatchdogIP;

	switch (iAction)
	{
	case CA_AUTH:
		return AUTH_ADMIN;
	case CA_CONFIG:
		if (httpIsExistParam(pParamList, "Enable"))
			bEnableUPnP = httpGetBool(pParamList, "Enable");
		else
			bEnableUPnP = g_ConfigParam.bEnableUPnP;

		if (httpIsExistParam(pParamList, "Port"))
			usUPnPPort = httpGetLong(pParamList, "Port");
		else
			usUPnPPort = g_ConfigParam.usUPnPPort;


		if (httpIsExistParam(pParamList, "WatchdogIP"))
			acWatchdogIP = httpGetString(pParamList, "WatchdogIP");
		if (bEnableUPnP != g_ConfigParam.bEnableUPnP
			|| usUPnPPort != g_ConfigParam.usUPnPPort
			|| strcmp(acWatchdogIP, g_ConfigParam.acWatchdogIP))
		{
			tt_rmutex_lock(&g_rmutex);
			g_ConfigParam.bEnableUPnP = bEnableUPnP;
			g_ConfigParam.usUPnPPort = usUPnPPort;
			httpMyStrncpy(g_ConfigParam.acWatchdogIP, acWatchdogIP, sizeof(g_ConfigParam.acWatchdogIP));
			tt_rmutex_unlock(&g_rmutex);
			
			WriteFlashMemory(&g_ConfigParam);
			RebootOnConnectionOver(hConnection);
		}

		return 0;
		break;
	}
	return -1;
}
Esempio n. 5
0
int Config_GetUPnP(HTTPCONNECTION hConnection, LIST *pParamList, int iAction, XML *pReturnXML)
{
	char acIP[32];
	unsigned short ausPort[5];
	int iSuccessNum;
	
	int i;
	switch (iAction)
	{
	case CA_AUTH:
		return AUTH_USER;
	case CA_CONFIG:
		iSuccessNum = upnp_get_port(0, ausPort);
		//AddHttpNum(pReturnXML, "Rt0", iSuccessNum);
		
		if (iSuccessNum < 0)
			iSuccessNum = 0;
		for (i = iSuccessNum; i < sizeof(ausPort) / sizeof(ausPort[0]); ++i)
			ausPort[i] = 0;
		
		if ((iSuccessNum = upnp_get_extip(0, acIP)) < 0)
			acIP[0] = 0;
		
		//AddHttpNum(pReturnXML, "Rt1", iSuccessNum);

		tt_rmutex_lock(&g_rmutex);		
		AddHttpNum(pReturnXML, "Enable", g_ConfigParam.bEnableUPnP);
		AddHttpNum(pReturnXML, "Port", (int) (g_ConfigParam.usUPnPPort == 0 ? DEFAULT_UPNP_FIRST_EXT_PORT : g_ConfigParam.usUPnPPort));
		AddHttpValue(pReturnXML, "WatchdogIP", g_ConfigParam.acWatchdogIP);
		tt_rmutex_unlock(&g_rmutex);
		
		AddHttpValue(pReturnXML, "IP", acIP);
		AddHttpNum(pReturnXML, "HTTP", (int)ausPort[0]);
		AddHttpNum(pReturnXML, "RTSP_TCP", (int)ausPort[1]);
		AddHttpNum(pReturnXML, "RTSP_UDP", (int)ausPort[2]);

		return 0;
	}
	return -1;
}
Esempio n. 6
0
int Config_GetWlan(HTTPCONNECTION hConnection, LIST *pParamList, int iAction, XML *pReturnXML)
{
	int iLen;
	char ac[128];
	int j;
	//prism_cnfDesireSSID_t *pESSIDList;
	//int iESSIDNum;

	switch (iAction)
	{
	case CA_AUTH:
		return AUTH_ADMIN;
	case CA_CONFIG:
		tt_rmutex_lock(&g_rmutex);

		AddHttpValue(pReturnXML, G_PC_ESSID, (char *)g_ConfigParam.acWlanESSID);
		AddHttpValue(pReturnXML, G_PC_MODE,
			g_apcWlanOperationMode[((int)g_ConfigParam.ucWlanOperationMode >= 0 && (int)g_ConfigParam.ucWlanOperationMode < sizeof(g_apcWlanOperationMode) / sizeof(const char *)) ? (int)g_ConfigParam.ucWlanOperationMode : 0]);
		AddHttpValue(pReturnXML, G_PC_KEY, 
			(strlen((char *)g_ConfigParam.acWlanKey) > 0 ? "*" : ""));

		AddHttpNum(pReturnXML, G_PC_CHANNEL, g_ConfigParam.ulWlanChannel);
		/* Useless items */
#if 0
		AddHttpValue(pReturnXML, G_PC_WEPSET, "Disable");
		AddHttpValue(pReturnXML, G_PC_WEPASC, "");
		AddHttpValue(pReturnXML, G_PC_WEPGROUP, "");

		//AddHttpValue(pReturnXML, G_PC_WEP64, ac);
		AddHttpValue(pReturnXML, G_PC_WEP64_TYPE, "Wep64ASC");
		
		//AddHttpValue(pReturnXML, G_PC_WEP128, ac);
		AddHttpValue(pReturnXML, G_PC_WEP128_TYPE, "Wep128ASC");
#else	
		AddHttpValue(pReturnXML, G_PC_WEPSET,
			(g_ConfigParam.ucWepSet == WEP_SET_K64 ?
				"K64" :	(g_ConfigParam.ucWepSet == WEP_SET_K128 ?
				"K128" : (g_ConfigParam.ucWepSet == WEP_SET_ASC ?
				"Asc": "Disable"))));
		AddHttpValue(pReturnXML, G_PC_WEPASC, (strlen((char*) g_ConfigParam.acWepAsc) > 0 ? "*" : ""));
		AddHttpNum(pReturnXML, G_PC_WEPGROUP, 0);
		
		if (g_ConfigParam.bWep64UseAsc)
		{
			memcpy(ac, g_ConfigParam.acWep64, 5);
			ac[5] = '\0';
		}
		else
		{
			for (iLen = 0, j = 0; j < 5; j++)
			{
				iLen += sprintf(ac + iLen, "%02x",
					(int)(unsigned char)g_ConfigParam.acWep64[j]);
			}
		}
		//AddHttpValue(pReturnXML, G_PC_WEP64, ac);
		AddHttpValue(pReturnXML, G_PC_WEP64_TYPE, (g_ConfigParam.bWep64UseAsc ? "Wep64ASC" : "Wep64HEX"));
		
		if (g_ConfigParam.bWep128UseAsc)
		{
			memcpy(ac, g_ConfigParam.acWep128, 13);
			ac[13] = '\0';
		}
		else
		{
			for (iLen = 0, j = 0; j < 13; j++)
			{
				iLen += sprintf(ac + iLen, "%02x",
					(int)(unsigned char)g_ConfigParam.acWep128[j]);
			}
		}
		//AddHttpValue(pReturnXML, G_PC_WEP128, ac);
		AddHttpValue(pReturnXML, G_PC_WEP128_TYPE, (g_ConfigParam.bWep128UseAsc ? "Wep128ASC" : "Wep128HEX"));
		
		{
			enum SET_WIFI_STATE_E wifiState;
			wsp_get_config_state(&wifiState, NULL);
			switch(wifiState)
			{
			case SET_WIFI__TRYING:
				AddHttpValue(pReturnXML, "CurrentWiFiState", "TRYING");
				break;
			case SET_WIFI__OK:
				AddHttpValue(pReturnXML, "CurrentWiFiState", "OK");
				break;
			default:
				AddHttpValue(pReturnXML, "CurrentWiFiState", "NO_INIT");		
			}
		}
		
#endif		
		tt_rmutex_unlock(&g_rmutex);
		return 0;
	}
	return -1;
}
Esempio n. 7
0
File: MCU.c Progetto: LucidOne/Rovio
void mcuUnlock()
{
	tt_rmutex_unlock(&g_rmutex_MCU);
}
Esempio n. 8
0
int Config_GetIP(HTTPCONNECTION hConnection, LIST *pParamList, int iAction, XML *pReturnXML)
{
	char ac[128];
	int i;
	const char *pcInterface;
	int iInterface;
	unsigned long ulClientIP;
	ulClientIP = httpGetClientAddr(hConnection).s_addr;

	switch (iAction)
	{
	case CA_AUTH:
		if (ulClientIP == 0x0100007f) return AUTH_ANY;
		else return AUTH_USER;
		break;
	case CA_CONFIG:
		tt_rmutex_lock(&g_rmutex);
		AddHttpValue(pReturnXML, G_PC_CAMERANAME, g_ConfigParam.acCameraName);
		for (i = 0; i < 3; i++)
		{
			char acName[8];
			sprintf(acName, G_PC_DNS_N, i); 
			httpIP2String(g_ConfigParam.aulAsDNS[i], ac);
			AddHttpValue(pReturnXML, acName, ac);
		}
#ifndef WLAN
		if (!httpIsExistParam(pParamList, G_PC_INTERFACE))
			pcInterface = g_apcNetworkInterface[0];
#else
		if (!httpIsExistParam(pParamList, G_PC_INTERFACE))
			pcInterface = g_apcNetworkInterface[1];
#endif
		else pcInterface = httpGetString(pParamList, G_PC_INTERFACE);
		for (iInterface = 0;
			iInterface < sizeof(g_apcNetworkInterface) / sizeof(const char *);
			iInterface++)
			if (strcasecmp(g_apcNetworkInterface[iInterface], pcInterface) == 0)
				break;

		if (iInterface < sizeof(g_apcNetworkInterface) / sizeof(const char *))
		{
			httpLong2String(g_ConfigParam.abAsNetEnable[iInterface], ac);
			AddHttpValue(pReturnXML, G_PC_ENABLE, ac);
			AddHttpValue(pReturnXML, G_PC_IPWAY,
					(g_ConfigParam.aucIPAssignedWay[iInterface] == IP_ASSIGNMENT_MANUALLY?"manually":"dhcp")
				);
			httpIP2String(g_ConfigParam.ulAsIPAddress[iInterface], ac);				
			AddHttpValue(pReturnXML, G_PC_IP, ac);
			httpIP2String(g_ConfigParam.ulAsNetmask[iInterface], ac);
			AddHttpValue(pReturnXML, G_PC_NETMASK, ac);
			httpIP2String(g_ConfigParam.ulAsGateway[iInterface], ac);
			AddHttpValue(pReturnXML, G_PC_GATEWAY, ac);
		}
		
		
		{
			unsigned long ulCurrentIP;
			unsigned long ulCurrentSubnetMask;
			unsigned long ulCurrentGateway;
			unsigned long ulCurrentDNSServer[3];
			enum SET_IP_STATE_E ipState;
			GetPubIPInfo(&ulCurrentIP, &ulCurrentSubnetMask, &ulCurrentGateway, ulCurrentDNSServer);
			httpIP2String(ulCurrentIP, ac);
			AddHttpValue(pReturnXML, "CurrentIP", ac);
			httpIP2String(ulCurrentSubnetMask, ac);
			AddHttpValue(pReturnXML, "CurrentNetmask", ac);
			httpIP2String(ulCurrentGateway, ac);
			AddHttpValue(pReturnXML, "CurrentGateway", ac);
			
			for (i = 0; i < 3; i++)
			{
				char acName[16];
				sprintf(acName, "CurrentDNS%d", i);
				httpIP2String(ulCurrentDNSServer[i], ac);
				AddHttpValue(pReturnXML, acName, ac);
			}
			
			
			wsp_get_config_state(NULL, &ipState);
			switch(ipState)
			{
			case SET_IP__DHCP_TRYING:
				AddHttpValue(pReturnXML, "CurrentIPState", "DHCP_TRYING");
				break;
			case SET_IP__DHCP_FAILED:
				AddHttpValue(pReturnXML, "CurrentIPState", "DHCP_FAILED");
				break;
			case SET_IP__DHCP_OK:
				AddHttpValue(pReturnXML, "CurrentIPState", "DHCP_OK");
				break;
			case SET_IP__STATIC_IP_TRYING:
				AddHttpValue(pReturnXML, "CurrentIPState", "STATIC_IP_TRYING");
				break;
			case SET_IP__STATIC_IP_FAILED:
				AddHttpValue(pReturnXML, "CurrentIPState", "STATIC_IP_FAILED");
				break;
			case SET_IP__STATIC_IP_OK:
				AddHttpValue(pReturnXML, "CurrentIPState", "STATIC_IP_OK");
				break;
			default:
				AddHttpValue(pReturnXML, "CurrentIPState", "NO_INIT");		
			}
		}
		tt_rmutex_unlock(&g_rmutex);
		return 0;
		break;
	}
	return -1;
}
Esempio n. 9
0
int Config_SetIP(HTTPCONNECTION hConnection, LIST *pParamList, int iAction, XML *pReturnXML)
{
	const char *pcIPAssignedWay;
	const char *pcInterface;
	int iInterface;
	unsigned char ucIPAssignedWay;
	int i;
	BOOL bIsChange = FALSE;

	unsigned long ulClientIP;
	ulClientIP = httpGetClientAddr(hConnection).s_addr;

	switch (iAction)
	{
	case CA_AUTH:
		//diag_printf("CA_AUTH Config_SetIP!\n");
		tt_rmutex_lock(&g_rmutex);
		if (ulClientIP == 0x0100007f) return AUTH_ANY;
		else return AUTH_ADMIN;
		break;
	case CA_CONFIG:
		diag_printf("CA_CONFIG Config_SetIP!\n");
		if (httpIsExistParam(pParamList, "CameraName"))
		{
			httpMyStrncpy(g_ConfigParam.acCameraName, httpGetString(pParamList, "CameraName"), sizeof(g_ConfigParam.acCameraName));
			bIsChange = TRUE;
		}
#ifndef WLAN
		if (!httpIsExistParam(pParamList, "Interface"))
			pcInterface = g_apcNetworkInterface[0];
#else
		if (!httpIsExistParam(pParamList, "Interface"))
			pcInterface = g_apcNetworkInterface[1];
#endif
		else pcInterface = httpGetString(pParamList, "Interface");
		for (iInterface = 0;
			iInterface < sizeof(g_apcNetworkInterface) / sizeof(const char *);
			iInterface++)
			if (strcasecmp(g_apcNetworkInterface[iInterface], pcInterface) == 0)
				break;
		if (iInterface < sizeof(g_apcNetworkInterface) / sizeof(const char *))
		{
			BOOL bAsNetEnable_Before = g_ConfigParam.abAsNetEnable[iInterface];
			g_ConfigParam.abAsNetEnable[iInterface] = httpGetBool(pParamList, "Enable");

			if (g_ConfigParam.abAsNetEnable[iInterface] != bAsNetEnable_Before)
				bIsChange = TRUE;

			pcIPAssignedWay = httpGetString(pParamList, "IPWay");
			if (strcasecmp(pcIPAssignedWay, "manually") == 0)
				ucIPAssignedWay = IP_ASSIGNMENT_MANUALLY;
			else if (strcasecmp(pcIPAssignedWay, "dhcp") == 0)
				ucIPAssignedWay = IP_ASSIGNMENT_DHCP;
			else ucIPAssignedWay = g_ConfigParam.aucIPAssignedWay[iInterface];
			if (ucIPAssignedWay != g_ConfigParam.aucIPAssignedWay[iInterface])
			{
				g_ConfigParam.aucIPAssignedWay[iInterface] = ucIPAssignedWay;
				bIsChange = TRUE;
			}
			if (httpIsExistParam(pParamList, "IP"))
			{
				g_ConfigParam.ulAsIPAddress[iInterface] = httpGetIP(pParamList, "IP");
				bIsChange = TRUE;
			}
			if (httpIsExistParam(pParamList, "Netmask"))
			{
				g_ConfigParam.ulAsNetmask[iInterface] = httpGetIP(pParamList, "Netmask");
				bIsChange = TRUE;
			}
			if (httpIsExistParam(pParamList, "Gateway"))
			{
				g_ConfigParam.ulAsGateway[iInterface] = httpGetIP(pParamList, "Gateway");
				bIsChange = TRUE;
			}
			//SIMON
			if (httpIsExistParam(pParamList, "WatchdogIP"))
			{
				g_ConfigParam.ulAsGateway[iInterface] = httpGetIP(pParamList, "Gateway");
				bIsChange = TRUE;
			}
		}

		for (i = 0; i < 3; i++)
		{
			char ac[16];
			sprintf(ac, "DNS%d", i);
			if (httpIsExistParam(pParamList, ac))
			{
				g_ConfigParam.aulAsDNS[i] = httpGetIP(pParamList, ac);
				bIsChange = TRUE;
			}
		}
	
		if (bIsChange == TRUE)
		{
			WebCameraLog(CL_PRIVILEGE_COMMON, CL_SET_IP, pcIPAssignedWay, hConnection);
			WriteFlashMemory(&g_ConfigParam);
		}
		tt_rmutex_unlock(&g_rmutex);
		/*Set new ip address*/
 		//SetIP();
 		wsp_set_network_ip();
 			
		diag_printf("CA_CONFIG Config_SetIP -- end!\n");
		return 0;
		break;
	}
	return -1;
}
Esempio n. 10
0
int Config_SetPPP(HTTPCONNECTION hConnection, LIST *pParamList, int iAction, XML *pReturnXML)
{
	BOOL bConfigChanged = FALSE;
	BOOL bPPPEnable;
	const char *apcPPPServer[ sizeof(g_ConfigParam.aacPPPServer) / sizeof(g_ConfigParam.aacPPPServer[0])];
	int aiPPPPort[ sizeof(g_ConfigParam.aiPPPPort) / sizeof(g_ConfigParam.aiPPPPort[0])];
	const char *pcPPPUser;
	const char *pcPPPPass;
	int i;

	switch (iAction)
	{
	case CA_AUTH:
		return AUTH_ADMIN;
	case CA_CONFIG:
		if (httpIsExistParam(pParamList, "Enable"))
			bPPPEnable = httpGetBool(pParamList, "Enable");
		else
			bPPPEnable = g_ConfigParam.bPPPEnable;
		
		if (bPPPEnable != g_ConfigParam.bPPPEnable)
			bConfigChanged = TRUE;



		for (i = 0; i < sizeof(g_ConfigParam.aacPPPServer) / sizeof(g_ConfigParam.aacPPPServer[0]); ++i)
		{
			char acName[32];
			snprintf(acName, sizeof(acName), "Server%d", i);
			
			apcPPPServer[i] = g_ConfigParam.aacPPPServer[i];
			if (httpIsExistParam(pParamList, acName))
			{
				apcPPPServer[i] = httpGetString(pParamList, acName);
				if (strcmp(apcPPPServer[i], g_ConfigParam.aacPPPServer[i]) != 0)
					bConfigChanged = TRUE;
			}
		}
		if (httpIsExistParam(pParamList, "Server"))
		{
			apcPPPServer[0] = httpGetString(pParamList, "Server");
			if (strcmp(apcPPPServer[0], g_ConfigParam.aacPPPServer[0]) != 0)
				bConfigChanged = TRUE;
		}
			

		for (i = 0; i < sizeof(g_ConfigParam.aiPPPPort) / sizeof(g_ConfigParam.aiPPPPort[0]); ++i)
		{
			char acName[32];
			snprintf(acName, sizeof(acName), "Port%d", i);
			aiPPPPort[i] = g_ConfigParam.aiPPPPort[i];
			if (httpIsExistParam(pParamList, acName))
			{
				aiPPPPort[i] = httpGetLong(pParamList, acName);
				if (aiPPPPort[i] != g_ConfigParam.aiPPPPort[i])
					bConfigChanged = TRUE;
			}
		}
		if (httpIsExistParam(pParamList, "Port"))
		{
			aiPPPPort[0] = httpGetLong(pParamList, "Port");
			if (aiPPPPort[0] != g_ConfigParam.aiPPPPort[0])
				bConfigChanged = TRUE;
		}
			

		if (httpIsExistParam(pParamList, "User"))
			pcPPPUser = httpGetString(pParamList, "User");
		else
			pcPPPUser = g_ConfigParam.acPPPUser;
		if (strcmp(pcPPPUser, g_ConfigParam.acPPPUser) != 0)
			bConfigChanged = TRUE;
		

		if (httpIsExistParam(pParamList, "Pass"))
			pcPPPPass = httpGetString(pParamList, "Pass");
		else
			pcPPPPass = g_ConfigParam.acPPPPass;
		if (strcmp(pcPPPPass, g_ConfigParam.acPPPPass) != 0)
			bConfigChanged = TRUE;

	
		if (bConfigChanged)
		{
			tt_rmutex_lock(&g_rmutex);
			g_ConfigParam.bPPPEnable = bPPPEnable;
			
			for (i = 0; i < sizeof(g_ConfigParam.aacPPPServer) / sizeof(g_ConfigParam.aacPPPServer[0]); ++i)
				httpMyStrncpy(g_ConfigParam.aacPPPServer[i], apcPPPServer[i], sizeof(g_ConfigParam.aacPPPServer[i]));
			for (i = 0; i < sizeof(g_ConfigParam.aiPPPPort) / sizeof(g_ConfigParam.aiPPPPort[0]); ++i)
				g_ConfigParam.aiPPPPort[i] = aiPPPPort[i];
			httpMyStrncpy(g_ConfigParam.acPPPUser, pcPPPUser, sizeof(g_ConfigParam.acPPPUser));
			httpMyStrncpy(g_ConfigParam.acPPPPass, pcPPPPass, sizeof(g_ConfigParam.acPPPPass));
			tt_rmutex_unlock(&g_rmutex);
			
			WriteFlashMemory(&g_ConfigParam);
		}
		
		if (!bPPPEnable)
		{
			/* Disconnect if possible */
			//if (ppot_is_connecting())
			ppot_disconnect();
		}
		
		if(bPPPEnable && bConfigChanged) //&& !ppot_is_connecting())
		{
			ppot_connect(apcPPPServer, aiPPPPort,
				sizeof(apcPPPServer) / sizeof(apcPPPServer[0]),
				pcPPPUser, pcPPPPass);
		}

		return 0;
		break;
	}
	return -1;
}