device discovery  function definition