org.fourthline.cling.protocol.async
Class ReceivingSearch
java.lang.Object
org.fourthline.cling.protocol.ReceivingAsync<IncomingSearchRequest>
org.fourthline.cling.protocol.async.ReceivingSearch
- All Implemented Interfaces:
- Runnable
public class ReceivingSearch
- extends ReceivingAsync<IncomingSearchRequest>
Handles reception of search requests, responds for local registered devices.
Waits a random time between 0 and the requested MX (maximum 120 seconds)
before executing. Only waits if there are actually any registered local devices.
Extracts the search target, builds and sends the dozens of messages
required by the UPnP specification, depending on the search target and what
local devices and services are found in the Registry
.
- Author:
- Christian Bauer
randomGenerator
protected final Random randomGenerator
ReceivingSearch
public ReceivingSearch(UpnpService upnpService,
IncomingDatagramMessage<UpnpRequest> inputMessage)
execute
protected void execute()
throws RouterException
- Specified by:
execute
in class ReceivingAsync<IncomingSearchRequest>
- Throws:
RouterException
waitBeforeExecution
protected boolean waitBeforeExecution()
throws InterruptedException
- Description copied from class:
ReceivingAsync
- Provides an opportunity to pause before executing the protocol.
- Overrides:
waitBeforeExecution
in class ReceivingAsync<IncomingSearchRequest>
- Returns:
true
(default) if execution should continue after waiting.
- Throws:
InterruptedException
- If waiting has been interrupted, which also stops execution.
sendResponses
protected void sendResponses(UpnpHeader searchTarget,
NetworkAddress activeStreamServer)
throws RouterException
- Throws:
RouterException
sendSearchResponseAll
protected void sendSearchResponseAll(NetworkAddress activeStreamServer)
throws RouterException
- Throws:
RouterException
createDeviceMessages
protected List<OutgoingSearchResponse> createDeviceMessages(LocalDevice device,
NetworkAddress activeStreamServer)
createServiceTypeMessages
protected List<OutgoingSearchResponse> createServiceTypeMessages(LocalDevice device,
NetworkAddress activeStreamServer)
sendSearchResponseRootDevices
protected void sendSearchResponseRootDevices(NetworkAddress activeStreamServer)
throws RouterException
- Throws:
RouterException
sendSearchResponseUDN
protected void sendSearchResponseUDN(UDN udn,
NetworkAddress activeStreamServer)
throws RouterException
- Throws:
RouterException
sendSearchResponseDeviceType
protected void sendSearchResponseDeviceType(DeviceType deviceType,
NetworkAddress activeStreamServer)
throws RouterException
- Throws:
RouterException
sendSearchResponseServiceType
protected void sendSearchResponseServiceType(ServiceType serviceType,
NetworkAddress activeStreamServer)
throws RouterException
- Throws:
RouterException
getDescriptorLocation
protected Location getDescriptorLocation(NetworkAddress activeStreamServer,
LocalDevice device)
isAdvertisementDisabled
protected boolean isAdvertisementDisabled(LocalDevice device)
prepareOutgoingSearchResponse
protected void prepareOutgoingSearchResponse(OutgoingSearchResponse message)
- Override this to edit the outgoing message, e.g. by adding headers.
Copyright © 2013 4th Line GmbH, Switzerland. All Rights Reserved.