1 Reply Latest reply on May 27, 2019 10:06 PM by RaktimR_11

    printIp WICED Video 5-3 expanding on WPA2

    alorc_1643676

      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);

      }

      }

        • 1. Re: printIp WICED Video 5-3 expanding on WPA2
          RaktimR_11
          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 >> 8) & 0xFF),  (int)(ipV4address.ip.v4 & 0xFF)));
          }
          

          Do you have this before application_start() is called?