question regarding functional search

matchef
2012-09-15
2013-05-02
  • matchef
    matchef
    2012-09-15

    Hello,

    I have a question regarding the search for device.

    my code looks like this:

    import org.cybergarage.upnp.ControlPoint;
    import org.cybergarage.upnp.Device;
    import org.cybergarage.upnp.DeviceList;
    import org.cybergarage.upnp.UPnP;

    public class MainActivity  extends Activity {

    ControlPoint  ctrlPoint;
        int anzahl_device;     

    public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);

            Text_ausg_1 = (TextView)findViewById(R.id.Text1);
        }

        public void onClickButton1(final View sfNormal){
       
           
        ctrlPoint = new ControlPoint();
            ctrlPoint.start();
            Log.v("MainActivity", "Point started");
      ctrlPoint.search();
       }

       
    public void onClickButton2(final View sfNormal){
    DeviceList dl = ctrlPoint.getDeviceList();
             anzahl_device = dl.size();
    Text_ausg_1.setText(String.valueOf(String.valueOf(anzahl_device)));

    }

    }

    when I press the button1, nothing happens…then i waiting für 1 min. and i press button2, "anzahl_device" is allway "0",
    I've been using the "Device Sniffer" to checked if something happens on the network, but it seems as if the app does not send anything to the outside.

    i have Windows XP SP3 with Eclipse for Android
    I have integrated the clink210.jar in eclipse and I have no errors …

    Can someone give me a help what am I doing wrong?

    Thank you very much

    matchef

     
  • Satoshi Konno
    Satoshi Konno
    2012-09-21

    Hi,

    Do you run the sample on Android Emulator ? However, the emulator doesn't support
    the multicast protocol yet. Please check the following document.

      Using the Android Emulator
      http://developer.android.com/tools/devices/emulator.html

    Best Regards,

    Satoshi Konno

     
  • matchef
    matchef
    2012-09-21

    Hey,

    Yes that was a fault of different errors.
    I also had to make a "DeviceChangeListener" and run "Start" in a separate Thread.
    there is no chance to emulat this on a emulator?

    So now i can send and receive arguments from and to my UPnP Devices! :-)
    A big thanks for your great works and your UPnP-Library!

    Best Regards

    zulu23