Package org.osgi.service.zigbee
Interface ZCLCommandResponseStream
-
public interface ZCLCommandResponseStream
This type represents a stream of responses to a broadcast operation. It can be closed by the client using theclose()
method is called. TheZCLCommandResponseStream
is used to process a stream of responses from a ZigBee network. Responses are consumed by registering a handler withforEach(Predicate)
. Responses received before a handler is registered are buffered until a handler is registered, or until the close method is called. A handler consumes events returningtrue
to continue delivery. At some point the ZigBee service invocation will terminate event delivery by sending a close event (aZCLCommandResponse
which returnstrue
fromZCLCommandResponse.isEnd()
. After a close event the handler function will be dereferenced.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Closes this response, indicating that no further responses are needed.void
forEach(Predicate<? super ZCLCommandResponse> handler)
Registers a handler that will be called for each of the received responses.
-
-
-
Method Detail
-
close
void close()
Closes this response, indicating that no further responses are needed. Any buffered responses will be discarded, and a close event will be sent to a handler if it is registered.
-
forEach
void forEach(Predicate<? super ZCLCommandResponse> handler)
Registers a handler that will be called for each of the received responses. Only one handler may be registered. Any responses that arrive before a handler is registered will be buffered and pushed into the handler when it is registered. If the handler returnsfalse
from its accept method then the handler will be released and no further events will be delivered. Any remaining buffered events will be discarded, and this object marked as closed. If the handler does not close the stream early then the ZigBee service implementation will eventually send a close event.- Parameters:
handler
- A handler to process ZCLCommandResponse objects- Throws:
java.lang.IllegalStateException
- if a handler has already been registered, or if this object has been closed (aZCLCommandResponse
which returnstrue
fromZCLCommandResponse.isEnd()
. After a close event the handler function will be dereferenced.
-
-