5 Replies Latest reply on Sep 24, 2019 9:35 AM by MaVa_3369831

    Gedday not working - post a functioning example...?

    MaVa_3369831

      I am using the gedday or mDNS interface - at least attempting to.  I have used the examples that I can find in Wiced 6.1 and also tried it in 6.4.  Since there is no source code and only examples that are in different places and not tied together in a meaningful way I am stuck.

       

      I have included snips for both discovery and service add (each run on separate Cypress HW) below.  These take place after the apps are up and running - wiced_init and network stack are fully functional, each has obtained a DHCP lease, etc.

       

      I see traffic in wireshark as well as a program called zeroconfServiceBrowser (most of the time it is...touchy - at best).  I can also see the traffic from my MacAir every time.

      But "Discovery" always returns...

       

      ---  mDNS  -- Discover try [172] -- result == 4

      [ERROR] -- mDNS -- Service Discovery Failed with Error [4]

       

      Any suggestions?

       

      [note to Cypress] having code supported only by a library (no source code) - it is non optimal to return "error" only with no other explanations.

       

      Discovery --

      static char hostName[64] = {"G0017\0"};

      static wiced_bool_t exitMDNS= WICED_TRUE;

      static char serviceN[] = {"_http._tcp.local"};

       

      void service_Discovery( void )

      {

          wiced_result_t  res = 0;

          gedday_service_t service_result;

          int i = 0;

          exitMDNS = WICED_TRUE;

          WPRINT_APP_INFO(("---  mDNS  -- Init Service Discover -- %s --\n", serviceN));

          res = gedday_init(WICED_STA_INTERFACE, hostName);

       

          while ( exitMDNS )

          {

              WPRINT_APP_INFO(("---  mDNS  -- Discover try [%03d] -- result == %d \n", i++, res));

              memset(&service_result, 0x0, sizeof(service_result));

              res = gedday_discover_service(serviceN, &service_result);

              if (res != WICED_SUCCESS)

              {

                  WPRINT_APP_INFO(("[ERROR] -- mDNS -- Service Discovery Failed with Error [%d]\n", res));

              }

              else

              {

                  WPRINT_APP_INFO(("\nService Discovery Result:\n"));

                  WPRINT_APP_INFO(("  Service Name  = [%s]\n", service_result.service_name));

                  WPRINT_APP_INFO(("  Instance Name = [%s]\n", service_result.instance_name));

                  WPRINT_APP_INFO(("  Host Name     = [%s]\n", service_result.hostname));

                  WPRINT_APP_INFO(("  TXT Record    = [%s]\n", service_result.txt));

                  WPRINT_APP_INFO(("  Port          = [%d]\n", service_result.port));

                  /* Free the records */

                  if (service_result.instance_name != NULL)

                  {

                      free(service_result.instance_name);

                  }

                  if (service_result.hostname != NULL)

                  {

                      free(service_result.hostname);

                  }

                  if (service_result.txt != NULL)

                  {

                      free(service_result.txt);

                  }

              }

              wiced_rtos_delay_milliseconds( 500 );

          }  //end WHILE

      }

       

      ServiceAdd

      void service_start_Add( void )

      {

          wiced_result_t  res;

          WPRINT_APP_INFO(("---  mDNS  -- serviceN -- %s --\n", serviceN));

       

          res = gedday_init(WICED_STA_INTERFACE, hostName);

          if (res != WICED_SUCCESS)

          {

              WPRINT_APP_INFO(("Failed to init Geddy. Error [%d]\n", res));

              return;

          }

          service_Add(hostName);

      }

       

      void service_Add( char* svc )

      {

          wiced_result_t  res;

          res = gedday_add_service(svc, serviceN, 80, 300, NULL );

          if (res != WICED_SUCCESS)

          {

              WPRINT_APP_INFO(("Service Add Failed with Error [%d]\n", res));

          }

      }