printIp WICED Video 5-3 expanding on WPA2

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
alorc_1643676
Level 3
Level 3
10 replies posted 5 replies posted 5 questions asked

I copied the the code in the exercise 5-3 that expands 5-1 WPA2..

All works except printIP(ipAddress).

I commented        /*  printIp(ipAddress);  */         out to see if that is the only thing wrong. All looked good, even MAC address.

Question.

Did I copy the line correct or is there another way to get the addresses.

Thanks AAO

==============================================================

#include "wiced.h"

/* 115200 */

/* Joins a specified SSID and Password */

void application_start()

{

    wiced_result_t connectResult;

    wiced_bool_t led = WICED_FALSE;

    wiced_ip_address_t ipAddress;

    wiced_mac_t mac;

    wiced_init();

    connectResult = wiced_network_up(WICED_STA_INTERFACE, WICED_USE_EXTERNAL_DHCP_SERVER, NULL);

    if(connectResult == WICED_SUCCESS)

    {

        wiced_gpio_output_high(WICED_LED1);

        /* Print out network info */

                   WPRINT_APP_INFO(("NETWORK INFO\r\n"));

                   /* IP Info */

                   wiced_ip_get_ipv4_address(WICED_STA_INTERFACE, &ipAddress);

                   WPRINT_APP_INFO(("IP Addr  :\r\n"));

                 /*  printIp(ipAddress);  */

                   /* Netmask */

                               wiced_ip_get_netmask(WICED_STA_INTERFACE, &ipAddress);

                               WPRINT_APP_INFO(("Netmask  :  \r\n"));

                         /*    printIp(ipAddress); */

                  /* Gateway   */

                       wiced_ip_get_gateway_address(WICED_STA_INTERFACE, &ipAddress);

                       WPRINT_APP_INFO(("Gateway  :   \r\n"));

                       /* printIp(ipAddress); */

                       /* Cypress */

                       wiced_hostname_lookup("www.cypress.com", &ipAddress, WICED_NEVER_TIMEOUT, WICED_STA_INTERFACE);

                       WPRINT_APP_INFO(("Cypress   :  \r\n"));

                         /* printIp(ipAddress);  */

                    /* Device  */

                         wwd_wifi_get_mac_address(&mac  , WICED_STA_INTERFACE);

                         WPRINT_APP_INFO(("MAC Addtess:  "));

                         WPRINT_APP_INFO(("%X:%X:%X:%X:%X:%X\r\n",

                         mac.octet[0], mac.octet[1], mac.octet[2],

                         mac.octet[3],mac.octet[4],mac.octet[5]));

    }

while (1)

{

    if (connectResult != WICED_SUCCESS)

    {

        if (led == WICED_TRUE)

        {

            wiced_gpio_output_low(WICED_LED1);

            led = WICED_FALSE;

        }

        else

        {

            wiced_gpio_output_high(WICED_LED1);

                        led = WICED_TRUE;

        }

     }

    wiced_rtos_delay_milliseconds(250);

}

}

/* 115200 */

/* Joins a specified SSID and Password */

void application_start()

{

    wiced_result_t connectResult;

    wiced_bool_t led = WICED_FALSE;

    wiced_ip_address_t ipAddress;

    wiced_mac_t mac;

    wiced_init();

    connectResult = wiced_network_up(WICED_STA_INTERFACE, WICED_USE_EXTERNAL_DHCP_SERVER, NULL);

    if(connectResult == WICED_SUCCESS)

    {

        wiced_gpio_output_high(WICED_LED1);

        /* Print out network info */

                   WPRINT_APP_INFO(("NETWORK INFO\r\n"));

                   /* IP Info */

                   wiced_ip_get_ipv4_address(WICED_STA_INTERFACE, &ipAddress);

                   WPRINT_APP_INFO(("IP Addr  :\r\n"));

                 /*  printIp(ipAddress);  */

                   /* Netmask */

                               wiced_ip_get_netmask(WICED_STA_INTERFACE, &ipAddress);

                               WPRINT_APP_INFO(("Netmask  :  \r\n"));

                         /*    printIp(ipAddress); */

                  /* Gateway   */

                       wiced_ip_get_gateway_address(WICED_STA_INTERFACE, &ipAddress);

                       WPRINT_APP_INFO(("Gateway  :   \r\n"));

                       /* printIp(ipAddress); */

                       /* Cypress */

                       wiced_hostname_lookup("www.cypress.com", &ipAddress, WICED_NEVER_TIMEOUT, WICED_STA_INTERFACE);

                       WPRINT_APP_INFO(("Cypress   :  \r\n"));

                         /* printIp(ipAddress);  */

                    /* Device  */

                         wwd_wifi_get_mac_address(&mac  , WICED_STA_INTERFACE);

                         WPRINT_APP_INFO(("MAC Addtess:  "));

                         WPRINT_APP_INFO(("%X:%X:%X:%X:%X:%X\r\n",

                         mac.octet[0], mac.octet[1], mac.octet[2],

                         mac.octet[3],mac.octet[4],mac.octet[5]));

    }

while (1)

{

    if (connectResult != WICED_SUCCESS)

    {

        if (led == WICED_TRUE)

        {

            wiced_gpio_output_low(WICED_LED1);

            led = WICED_FALSE;

        }

        else

        {

            wiced_gpio_output_high(WICED_LED1);

                        led = WICED_TRUE;

        }

     }

    wiced_rtos_delay_milliseconds(250);

}

}

/* 115200 */

/* Joins a specified SSID and Password */

void application_start()

{

    wiced_result_t connectResult;

    wiced_bool_t led = WICED_FALSE;

    wiced_ip_address_t ipAddress;

    wiced_mac_t mac;

    wiced_init();

    connectResult = wiced_network_up(WICED_STA_INTERFACE, WICED_USE_EXTERNAL_DHCP_SERVER, NULL);

    if(connectResult == WICED_SUCCESS)

    {

        wiced_gpio_output_high(WICED_LED1);

        /* Print out network info */

                   WPRINT_APP_INFO(("NETWORK INFO\r\n"));

                   /* IP Info */

                   wiced_ip_get_ipv4_address(WICED_STA_INTERFACE, &ipAddress);

                   WPRINT_APP_INFO(("IP Addr  :\r\n"));

                 /*  printIp(ipAddress);  */

                   /* Netmask */

                               wiced_ip_get_netmask(WICED_STA_INTERFACE, &ipAddress);

                               WPRINT_APP_INFO(("Netmask  :  \r\n"));

                         /*    printIp(ipAddress); */

                  /* Gateway   */

                       wiced_ip_get_gateway_address(WICED_STA_INTERFACE, &ipAddress);

                       WPRINT_APP_INFO(("Gateway  :   \r\n"));

                       /* printIp(ipAddress); */

                       /* Cypress */

                       wiced_hostname_lookup("www.cypress.com", &ipAddress, WICED_NEVER_TIMEOUT, WICED_STA_INTERFACE);

                       WPRINT_APP_INFO(("Cypress   :  \r\n"));

                         /* printIp(ipAddress);  */

                    /* Device  */

                         wwd_wifi_get_mac_address(&mac  , WICED_STA_INTERFACE);

                         WPRINT_APP_INFO(("MAC Addtess:  "));

                         WPRINT_APP_INFO(("%X:%X:%X:%X:%X:%X\r\n",

                         mac.octet[0], mac.octet[1], mac.octet[2],

                         mac.octet[3],mac.octet[4],mac.octet[5]));

    }

while (1)

{

    if (connectResult != WICED_SUCCESS)

    {

        if (led == WICED_TRUE)

        {

            wiced_gpio_output_low(WICED_LED1);

            led = WICED_FALSE;

        }

        else

        {

            wiced_gpio_output_high(WICED_LED1);

                        led = WICED_TRUE;

        }

     }

    wiced_rtos_delay_milliseconds(250);

}

}

/* 115200 */

/* Joins a specified SSID and Password */

void application_start()

{

    wiced_result_t connectResult;

    wiced_bool_t led = WICED_FALSE;

    wiced_ip_address_t ipAddress;

    wiced_mac_t mac;

    wiced_init();

    connectResult = wiced_network_up(WICED_STA_INTERFACE, WICED_USE_EXTERNAL_DHCP_SERVER, NULL);

    if(connectResult == WICED_SUCCESS)

    {

        wiced_gpio_output_high(WICED_LED1);

        /* Print out network info */

                   WPRINT_APP_INFO(("NETWORK INFO\r\n"));

                   /* IP Info */

                   wiced_ip_get_ipv4_address(WICED_STA_INTERFACE, &ipAddress);

                   WPRINT_APP_INFO(("IP Addr  :\r\n"));

                 /*  printIp(ipAddress);  */

                   /* Netmask */

                               wiced_ip_get_netmask(WICED_STA_INTERFACE, &ipAddress);

                               WPRINT_APP_INFO(("Netmask  :  \r\n"));

                         /*    printIp(ipAddress); */

                  /* Gateway   */

                       wiced_ip_get_gateway_address(WICED_STA_INTERFACE, &ipAddress);

                       WPRINT_APP_INFO(("Gateway  :   \r\n"));

                       /* printIp(ipAddress); */

                       /* Cypress */

                       wiced_hostname_lookup("www.cypress.com", &ipAddress, WICED_NEVER_TIMEOUT, WICED_STA_INTERFACE);

                       WPRINT_APP_INFO(("Cypress   :  \r\n"));

                         /* printIp(ipAddress);  */

                    /* Device  */

                         wwd_wifi_get_mac_address(&mac  , WICED_STA_INTERFACE);

                         WPRINT_APP_INFO(("MAC Addtess:  "));

                         WPRINT_APP_INFO(("%X:%X:%X:%X:%X:%X\r\n",

                         mac.octet[0], mac.octet[1], mac.octet[2],

                         mac.octet[3],mac.octet[4],mac.octet[5]));

    }

while (1)

{

    if (connectResult != WICED_SUCCESS)

    {

        if (led == WICED_TRUE)

        {

            wiced_gpio_output_low(WICED_LED1);

            led = WICED_FALSE;

        }

        else

        {

            wiced_gpio_output_high(WICED_LED1);

                        led = WICED_TRUE;

        }

     }

    wiced_rtos_delay_milliseconds(250);

}

}

/* 115200 */

/* Joins a specified SSID and Password */

void application_start()

{

    wiced_result_t connectResult;

    wiced_bool_t led = WICED_FALSE;

    wiced_ip_address_t ipAddress;

    wiced_mac_t mac;

    wiced_init();

    connectResult = wiced_network_up(WICED_STA_INTERFACE, WICED_USE_EXTERNAL_DHCP_SERVER, NULL);

    if(connectResult == WICED_SUCCESS)

    {

        wiced_gpio_output_high(WICED_LED1);

        /* Print out network info */

                   WPRINT_APP_INFO(("NETWORK INFO\r\n"));

                   /* IP Info */

                   wiced_ip_get_ipv4_address(WICED_STA_INTERFACE, &ipAddress);

                   WPRINT_APP_INFO(("IP Addr  :\r\n"));

                 /*  printIp(ipAddress);  */

                   /* Netmask */

                               wiced_ip_get_netmask(WICED_STA_INTERFACE, &ipAddress);

                               WPRINT_APP_INFO(("Netmask  :  \r\n"));

                         /*    printIp(ipAddress); */

                  /* Gateway   */

                       wiced_ip_get_gateway_address(WICED_STA_INTERFACE, &ipAddress);

                       WPRINT_APP_INFO(("Gateway  :   \r\n"));

                       /* printIp(ipAddress); */

                       /* Cypress */

                       wiced_hostname_lookup("www.cypress.com", &ipAddress, WICED_NEVER_TIMEOUT, WICED_STA_INTERFACE);

                       WPRINT_APP_INFO(("Cypress   :  \r\n"));

                         /* printIp(ipAddress);  */

                    /* Device  */

                         wwd_wifi_get_mac_address(&mac  , WICED_STA_INTERFACE);

                         WPRINT_APP_INFO(("MAC Addtess:  "));

                         WPRINT_APP_INFO(("%X:%X:%X:%X:%X:%X\r\n",

                         mac.octet[0], mac.octet[1], mac.octet[2],

                         mac.octet[3],mac.octet[4],mac.octet[5]));

    }

while (1)

{

    if (connectResult != WICED_SUCCESS)

    {

        if (led == WICED_TRUE)

        {

            wiced_gpio_output_low(WICED_LED1);

            led = WICED_FALSE;

        }

        else

        {

            wiced_gpio_output_high(WICED_LED1);

                        led = WICED_TRUE;

        }

     }

    wiced_rtos_delay_milliseconds(250);

}

}

0 Likes
1 Solution
RaktimR_11
Moderator
Moderator
Moderator
500 replies posted 250 replies posted 100 replies posted

void printIp(wiced_ip_address_t ipV4address)

{

    WPRINT_APP_INFO(("%d.%d.%d.%d\r\n",

            (int)((ipV4address.ip.v4 >> 24) & 0xFF), (int)((ipV4address.ip.v4 >> 16) & 0xFF),

            (int)((ipV4address.ip.v4 >> 😎 & 0xFF),  (int)(ipV4address.ip.v4 & 0xFF)));

}

Do you have this before application_start() is called?

View solution in original post

0 Likes
1 Reply
RaktimR_11
Moderator
Moderator
Moderator
500 replies posted 250 replies posted 100 replies posted

void printIp(wiced_ip_address_t ipV4address)

{

    WPRINT_APP_INFO(("%d.%d.%d.%d\r\n",

            (int)((ipV4address.ip.v4 >> 24) & 0xFF), (int)((ipV4address.ip.v4 >> 16) & 0xFF),

            (int)((ipV4address.ip.v4 >> 😎 & 0xFF),  (int)(ipV4address.ip.v4 & 0xFF)));

}

Do you have this before application_start() is called?

0 Likes