Search in sources :

Example 1 with SSDPNotifySocket

use of org.cybergarage.upnp.ssdp.SSDPNotifySocket in project i2p.i2p by i2p.

the class Service method byebye.

public void byebye(String bindAddr) {
    // uuid:device-UUID::urn:schemas-upnp-org:service:serviceType:v
    String devNT = getNotifyServiceTypeNT();
    String devUSN = getNotifyServiceTypeUSN();
    SSDPNotifyRequest ssdpReq = new SSDPNotifyRequest();
    ssdpReq.setNTS(NTS.BYEBYE);
    ssdpReq.setNT(devNT);
    ssdpReq.setUSN(devUSN);
    SSDPNotifySocket ssdpSock = new SSDPNotifySocket(bindAddr);
    Device.notifyWait();
    ssdpSock.post(ssdpReq);
}
Also used : SSDPNotifyRequest(org.cybergarage.upnp.ssdp.SSDPNotifyRequest) SSDPNotifySocket(org.cybergarage.upnp.ssdp.SSDPNotifySocket)

Example 2 with SSDPNotifySocket

use of org.cybergarage.upnp.ssdp.SSDPNotifySocket in project i2p.i2p by i2p.

the class Service method announce.

public void announce(String bindAddr) {
    // uuid:device-UUID::urn:schemas-upnp-org:service:serviceType:v
    Device rootDev = getRootDevice();
    String devLocation = rootDev.getLocationURL(bindAddr);
    String serviceNT = getNotifyServiceTypeNT();
    String serviceUSN = getNotifyServiceTypeUSN();
    Device dev = getDevice();
    SSDPNotifyRequest ssdpReq = new SSDPNotifyRequest();
    ssdpReq.setServer(UPnP.getServerName());
    ssdpReq.setLeaseTime(dev.getLeaseTime());
    ssdpReq.setLocation(devLocation);
    ssdpReq.setNTS(NTS.ALIVE);
    ssdpReq.setNT(serviceNT);
    ssdpReq.setUSN(serviceUSN);
    SSDPNotifySocket ssdpSock = new SSDPNotifySocket(bindAddr);
    Device.notifyWait();
    ssdpSock.post(ssdpReq);
}
Also used : SSDPNotifyRequest(org.cybergarage.upnp.ssdp.SSDPNotifyRequest) SSDPNotifySocket(org.cybergarage.upnp.ssdp.SSDPNotifySocket)

Example 3 with SSDPNotifySocket

use of org.cybergarage.upnp.ssdp.SSDPNotifySocket in project i2p.i2p by i2p.

the class Device method byebye.

public void byebye(String bindAddr) {
    SSDPNotifySocket ssdpSock = new SSDPNotifySocket(bindAddr);
    SSDPNotifyRequest ssdpReq = new SSDPNotifyRequest();
    ssdpReq.setNTS(NTS.BYEBYE);
    // uuid:device-UUID(::upnp:rootdevice)*
    if (isRootDevice() == true) {
        String devNT = getNotifyDeviceNT();
        String devUSN = getNotifyDeviceUSN();
        ssdpReq.setNT(devNT);
        ssdpReq.setUSN(devUSN);
        ssdpSock.post(ssdpReq);
    }
    // uuid:device-UUID::urn:schemas-upnp-org:device:deviceType:v
    String devNT = getNotifyDeviceTypeNT();
    String devUSN = getNotifyDeviceTypeUSN();
    ssdpReq.setNT(devNT);
    ssdpReq.setUSN(devUSN);
    ssdpSock.post(ssdpReq);
    // Thanks for Mikael Hakman (04/25/05)
    ssdpSock.close();
    ServiceList serviceList = getServiceList();
    int serviceCnt = serviceList.size();
    for (int n = 0; n < serviceCnt; n++) {
        Service service = serviceList.getService(n);
        service.byebye(bindAddr);
    }
    DeviceList childDeviceList = getDeviceList();
    int childDeviceCnt = childDeviceList.size();
    for (int n = 0; n < childDeviceCnt; n++) {
        Device childDevice = childDeviceList.getDevice(n);
        childDevice.byebye(bindAddr);
    }
}
Also used : SSDPNotifyRequest(org.cybergarage.upnp.ssdp.SSDPNotifyRequest) SSDPNotifySocket(org.cybergarage.upnp.ssdp.SSDPNotifySocket)

Example 4 with SSDPNotifySocket

use of org.cybergarage.upnp.ssdp.SSDPNotifySocket in project i2p.i2p by i2p.

the class Device method announce.

public void announce(String bindAddr) {
    String devLocation = getLocationURL(bindAddr);
    SSDPNotifySocket ssdpSock = new SSDPNotifySocket(bindAddr);
    SSDPNotifyRequest ssdpReq = new SSDPNotifyRequest();
    ssdpReq.setServer(UPnP.getServerName());
    ssdpReq.setLeaseTime(getLeaseTime());
    ssdpReq.setLocation(devLocation);
    ssdpReq.setNTS(NTS.ALIVE);
    ssdpReq.setBootId(getBootId());
    // uuid:device-UUID(::upnp:rootdevice)*
    if (isRootDevice() == true) {
        String devNT = getNotifyDeviceNT();
        String devUSN = getNotifyDeviceUSN();
        ssdpReq.setNT(devNT);
        ssdpReq.setUSN(devUSN);
        ssdpSock.post(ssdpReq);
        String devUDN = getUDN();
        ssdpReq.setNT(devUDN);
        ssdpReq.setUSN(devUDN);
        ssdpSock.post(ssdpReq);
    }
    // uuid:device-UUID::urn:schemas-upnp-org:device:deviceType:v
    String devNT = getNotifyDeviceTypeNT();
    String devUSN = getNotifyDeviceTypeUSN();
    ssdpReq.setNT(devNT);
    ssdpReq.setUSN(devUSN);
    ssdpSock.post(ssdpReq);
    // Thanks for Mikael Hakman (04/25/05)
    ssdpSock.close();
    ServiceList serviceList = getServiceList();
    int serviceCnt = serviceList.size();
    for (int n = 0; n < serviceCnt; n++) {
        Service service = serviceList.getService(n);
        service.announce(bindAddr);
    }
    DeviceList childDeviceList = getDeviceList();
    int childDeviceCnt = childDeviceList.size();
    for (int n = 0; n < childDeviceCnt; n++) {
        Device childDevice = childDeviceList.getDevice(n);
        childDevice.announce(bindAddr);
    }
}
Also used : SSDPNotifyRequest(org.cybergarage.upnp.ssdp.SSDPNotifyRequest) SSDPNotifySocket(org.cybergarage.upnp.ssdp.SSDPNotifySocket)

Aggregations

SSDPNotifyRequest (org.cybergarage.upnp.ssdp.SSDPNotifyRequest)4 SSDPNotifySocket (org.cybergarage.upnp.ssdp.SSDPNotifySocket)4