using GLib;
using GUPnP;
public class Browser: ControlPoint {
public MainLoop main_loop { get; private set; }
private void on_device_proxy_available(ControlPoint cp,
DeviceProxy proxy) {
stdout.printf("device %s found\n", proxy.get_friendly_name());
}
private bool on_timeout () {
this.main_loop.quit();
return false;
}
public Browser() {
this.client = new Context(null, null, 0);
this.target = "ssdp:all";
this.resource_factory = ResourceFactory.get_default();
this.main_loop = new MainLoop(null, false);
}
static int main(string[] args) {
Browser browser;
Thread.init();
browser = new Browser();
browser.device_proxy_available += browser.on_device_proxy_available;
browser.set_active(true);
var time = new GLib.TimeoutSource(5000);
time.set_callback(browser.on_timeout, null);
time.attach(browser.main_loop.get_context());
browser.main_loop.run();
return 0;
}
}
If you are really anxious to try it out, you can get it here but please keep in mind that it needs a bit (at least) of polishing/love before it could be taken seriously.
No comments:
Post a Comment