Beispiel #1
0
void getdef_env(int argc, char **argv)
{
	printf(" Set Default Environtment \r\n");
	garis_bawah();	
	set_default_ip();
	printf(" OK\n");
}
/*************************************************
Function:			OnNetDoorDeal
Description: 		处理网络门前机
Input:
1.win:   		当前处理的窗口
2.wParam:
Output:
Return:
Others:
*************************************************/
static void OnNetDoorDealNetParam(uint32 wParam)
{
	uint32 ret = 0;

	PNET_PARAM pnet_param = storage_get_netparam();
	switch (wParam)
	{
	case CMD_GATEWAY_GET_NET_PARAM:
		MsgWaitHitLayerOnShow("SetNetDoorNetParamLayer", SID_Inter_Search, SID_Msg_Connect_Outtime);
		ret = logic_get_netdevice_netparam();
		if (NETDOOR_ECHO_SUCESS != ret)
		{
			memset(&g_ndparam, 0, sizeof(g_ndparam));
			memset(&g_old_ndparam, 0, sizeof(NET_PARAM));

			MsgWaitHitLayerOnHide();
			MsgLinkOutTimeOnShow(SID_Msg_Connect_Outtime);			//显示连接超时 
		}
		break;

	case CMD_GATEWAY_SET_NET_PARAM:
		MsgWaitHitLayerOnShow("SetNetDoorNetParamLayer", SID_Inter_Search, 0);
		set_default_ip();
		//设置网络门前机设备编号以及规则
		ret = logic_set_netdoor_devnoinfo(&g_netdoorno, NULL);
		// 将中心机等参数从本机中取重新设置门前机
		memcpy((char*)&g_ndparam + 12, (char*)pnet_param + 12, sizeof(NET_PARAM)-12);
		if (ENGLISH == storage_get_language())
		{
			g_ndparam.DNS1 = 0xEE;				// 语言,英语
		}
		g_ndparam.DNS2 = 0xCF;					// 视频格式,CIF格式

		//设置网络门前机网络参数
		ret |= logic_set_netdoor_netparam(&g_ndparam);
		if (NETDOOR_ECHO_SUCESS != ret)
		{
			MsgWaitHitLayerOnHide();
			ShowMsgFailHintSuccessLayer(HIT_SPRITE_TO_ERROR, SID_Msg_Save_Err, "SetNetDoorNetParamLayer");

			if (readmacflag)
			{
				net_set_local_param();
				readmacflag = FALSE;
			}
		}
		break;

	case CMD_GATEWAY_GET_MAC:
		MsgWaitHitLayerOnShow("SetNetDoorNetParamLayer", SID_Inter_Search, SID_Msg_Connect_Outtime);
		set_default_ip();
		ret = logic_get_netdoor_mac(g_devIndex, HWaddr);
		if (NETDOOR_ECHO_SUCESS != ret)
		{
			MsgWaitHitLayerOnHide();
			MsgLinkOutTimeOnShow(SID_Msg_Connect_Outtime);

			if (readmacflag)
			{
				net_set_local_param();
				readmacflag = FALSE;
			}
		}
		
		break;
	}
}
Beispiel #3
0
int baca_env(char tampil)
{
	struct t_env *ev;
	int i;
	char teku[128];
	
	if (tampil == 1)
	{
		printf(" Data Environtment \r\n");
		garis_bawah();
	}
	else
	{
		/* pada saat awal start, pasti akses ini dulu */
		ev = (struct t_env *) 0x7A000;
		memcpy((char *)&env2, (char *) 0x7A000, sizeof (env2));	
	}
	
	if (ev->magic1 == 0xAA)
	{
		if (ev->magic2 == 0x77)
		{			
			printf(" Nama board = ");
			printf(env2.nama_board);
			printf("\r\n IP Address = ");
			printf("%d.%d.%d.%d\r\n", env2.IP0, env2.IP1, env2.IP2, env2.IP3);
			
			// tampilkan GW address, pakai env2 sekalian buat ngetes
			printf(" Gateway IP = ");
			printf("%d.%d.%d.%d\r\n", env2.GW0, env2.GW1, env2.GW2, env2.GW3); 
			
			if (tampil == 1)
			{
				printf(" Faktor kalibrasi (y = mx + C) :\r\n");
				
				extern char tek;
				
				double ff = 0.123;
				int t;
				
				/*
				portENTER_CRITICAL();
				//snprintf(teku, 64, " float %f", ff);
				//teku = (char *) fcvt(ff, 6, i, t);
				printf("%f", ff);
				
				portEXIT_CRITICAL();
				*/
				
				for (i=0; i<20; i++)
				{
					printf("  (%2d) m = %3.3f, C = %3.3f", i+1, env2.kalib[i].m, env2.kalib[i].C);
					i++;
					printf("  (%2d) m = %3.3f, C = %3.3f\r\n", i+1, env2.kalib[i].m, env2.kalib[i].C);
				}
				
				printf(" Keterangan kanal :\r\n");
				for (i=0; i<20; i++)
				{
					printf("  (%2d) %s\r\n", i+1, env2.kalib[i].ket);
				}
				printf("\n");
			}			
			return 0;
		}
		else
		{
			printf(" Magic number2 salah !\r\n");
			set_default_ip();
			
			return -1;
		}
	}
	else
	{
		printf(" Magic number1 salah !\r\n");		
		set_default_ip();
		
		return -1;
	}
}