Java Code Examples for javax.jmdns.ServiceInfo#getType()

The following examples show how to use javax.jmdns.ServiceInfo#getType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DNSRecord.java    From DeviceConnect-Android with MIT License 6 votes vote down vote up
@Override
public ServiceEvent getServiceEvent(JmDNSImpl dns) {
    ServiceInfo info = this.getServiceInfo(false);
    ((ServiceInfoImpl) info).setDns(dns);
    // String domainName = "";
    // String serviceName = this.getServer();
    // int index = serviceName.indexOf('.');
    // if (index > 0)
    // {
    // serviceName = this.getServer().substring(0, index);
    // if (index + 1 < this.getServer().length())
    // domainName = this.getServer().substring(index + 1);
    // }
    // return new ServiceEventImpl(dns, domainName, serviceName, info);
    return new ServiceEventImpl(dns, info.getType(), info.getName(), info);

}
 
Example 2
Source File: SoundTouchDiscoveryParticipant.java    From smarthome with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public ThingUID getThingUID(ServiceInfo info) {
    logger.trace("ServiceInfo: {}", info);
    ThingTypeUID typeUID = getThingTypeUID(info);
    if (typeUID != null) {
        if (info.getType() != null) {
            if (info.getType().equals(getServiceType())) {
                logger.trace("Discovered a Bose SoundTouch thing with name '{}'", info.getName());
                byte[] mac = getMacAddress(info);
                if (mac != null) {
                    return new ThingUID(typeUID, new String(mac, StandardCharsets.UTF_8));
                } else {
                    return null;
                }
            }
        }
    }
    return null;
}
 
Example 3
Source File: DNSRecord.java    From DeviceConnect-Android with MIT License 5 votes vote down vote up
@Override
public ServiceEvent getServiceEvent(JmDNSImpl dns) {
    ServiceInfo info = this.getServiceInfo(false);
    ((ServiceInfoImpl) info).setDns(dns);
    String domainName = info.getType();
    String serviceName = JmDNSImpl.toUnqualifiedName(domainName, this.getAlias());
    return new ServiceEventImpl(dns, domainName, serviceName, info);
}
 
Example 4
Source File: DNSRecord.java    From DeviceConnect-Android with MIT License 4 votes vote down vote up
@Override
public ServiceEvent getServiceEvent(JmDNSImpl dns) {
    ServiceInfo info = this.getServiceInfo(false);
    ((ServiceInfoImpl) info).setDns(dns);
    return new ServiceEventImpl(dns, info.getType(), info.getName(), info);
}
 
Example 5
Source File: DNSRecord.java    From DeviceConnect-Android with MIT License 4 votes vote down vote up
@Override
public ServiceEvent getServiceEvent(JmDNSImpl dns) {
    ServiceInfo info = this.getServiceInfo(false);
    ((ServiceInfoImpl) info).setDns(dns);
    return new ServiceEventImpl(dns, info.getType(), info.getName(), info);
}
 
Example 6
Source File: DNSRecord.java    From DeviceConnect-Android with MIT License 4 votes vote down vote up
@Override
public ServiceEvent getServiceEvent(JmDNSImpl dns) {
    ServiceInfo info = this.getServiceInfo(false);
    ((ServiceInfoImpl) info).setDns(dns);
    return new ServiceEventImpl(dns, info.getType(), info.getName(), info);
}