Ejemplo n.º 1
0
void Menu::Information()
{
    u8 macaddr[6];
    Wifi_GetData(WIFIGETDATA_MACADDRESS, 6, macaddr);
    consoleClear();
    printf("\n INFORMATION\n ___________\n\n"
           " MAC ADDRESS\n"
           "   %02x:%02x:%02x:%02x:%02x:%02x\n\n"
           " NETXMMS-NDS VERSION %d.%d.%d\n\n"
           " http://digital-haze.net/\n"
           " ___________\n\n", macaddr[0], macaddr[1], macaddr[2], macaddr[3],
           macaddr[4], macaddr[5], VERSION_MAJOR, VERSION_MINOR,
           VERSION_REVISION);

    Menu::Continue();
}
Ejemplo n.º 2
0
Archivo: wifi.c Proyecto: elzk/nds-ide
int
wifi_init(void)
{
    struct links *channel = CHANNELS + CHANNEL_WIFI;
#ifdef _WIN32
    WSADATA wsaData;

    if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) {
        confirm_error("WIFI: Error at WSAStartup()\n", 0);
        return DSH_CONNECTION_FAILED;
    }
#else
    char readtext[33];
    char iptext[33]; // ip address ONLY
    int ret, i, j, oldstatus;

    FILE *fp;

    unsigned char BUF[6];

    iprintf("WIFI: Finding AP...\n");

    fp = fopen("DallShell_Conf.txt","rb");

    if(fp == NULL)
    {
    	ret = Wifi_InitDefault(WFC_CONNECT);
    }
    else
    {
    	Wifi_InitDefault(INIT_ONLY);

    	Wifi_EnableWifi();

    	for(i=0;i<8;i++)
    	{
    		// DallShell Conf ���α׷����� txt���� ���,
    		// �ԷµǴ� ���ڿ� �迭�� ũ�⸦ �÷��� (11.08.29)
    		fgets(readtext,33,fp);
    		memset(iptext,0,33); // iptext�� memory�ʱ�ȭ (11.08.29)
    		switch(i){
    		case 0 : strcpy(ap.ssid,readtext); break;
    		case 1 : ap.ssid_len = atoi(readtext); break;
    		case 2 : ap.channel = atoi(readtext); break;
    		case 3 : memcpy(iptext, readtext, strlen(readtext)-1);
    		MyIP.s_addr = inet_addr(iptext);
    		break;
    		case 4 : memcpy(iptext, readtext, strlen(readtext)-1);
    		gateway.s_addr = inet_addr(iptext);
    		break;
    		case 5 : memcpy(iptext, readtext, strlen(readtext)-1);
    		mask.s_addr = inet_addr(iptext);
    		break;
    		case 6 : memcpy(iptext, readtext, strlen(readtext)-1);
    		dns1.s_addr = inet_addr(iptext);
    		break;
    		case 7 : memcpy(iptext, readtext, strlen(readtext)-1);
    		dns2.s_addr = inet_addr(iptext);
    		break;
    		}
    	}
    	ret = Wifi_ConnectAP(&ap,WEPMODE_NONE,0,0);
    }

    iprintf("MAC : ");
    Wifi_GetData(WIFIGETDATA_MACADDRESS, 6, BUF);
    for (i = 0; i < 6; i++) {
        iprintf("%02X", BUF[i]);
        if (i < 5)
            iprintf(":");
    }
    iprintf("\n\n");

    if(fp == NULL)
    {
    	if(ret == 0)
    	{
    		confirm_error("WIFI:Failed to connect AP!\n", 0);
    		return DSH_CONNECTION_FAILED;
    	}
    	iprintf("NULL");
    	MyIP = Wifi_GetIPInfo(&gateway, &mask, &dns1, &dns2);
    }
    else
    {
    	if(ret != -1)
    	{
    		iprintf("AP Connecting...\n");
    		while(j != ASSOCSTATUS_ASSOCIATED && j!= ASSOCSTATUS_CANNOTCONNECT)
    		{
    			oldstatus = j;
    			j = Wifi_AssocStatus();
    			if(oldstatus != j) {
    				iprintf("%s\n",ASSOCSTATUS_STRINGS[j]);
    				if(j == ASSOCSTATUS_ASSOCIATED )
    				{
    					Wifi_SetIP(MyIP.s_addr,gateway.s_addr,mask.s_addr,dns1.s_addr,dns2.s_addr);
    				}
    			}
    		}
    	}
    }

    iprintf("WIFI: Connected to AP\n"); // Mark that WIFI is available
    iprintf("IP  : %s\n", inet_ntoa(MyIP));
    iprintf("SVIP: %s\n", DOWNLOAD_IP);
#endif

    channel->name = channel_name(CHANNEL_WIFI);
    channel->number =number_connect; // number connect
    channel->connect = wifi_connect;
    channel->read = wifi_read;
    channel->write = wifi_write;
    channel->disconnect = wifi_disconnect;
    channel->cleanup = wifi_cleanup;
    return 0;
}