Methods Summary |
---|
public void | cacheMessage(HdmiCecMessage message)Cache incoming {@link HdmiCecMessage}. If opcode of message is not listed on
cacheable opcodes list, just ignore it.
int opcode = message.getOpcode();
if (!isCacheable(opcode)) {
return;
}
int source = message.getSource();
SparseArray<HdmiCecMessage> messages = mCache.get(source);
if (messages == null) {
messages = new SparseArray<>();
mCache.put(source, messages);
}
messages.put(opcode, message);
|
public void | flushAll()Flush all cached {@link HdmiCecMessage}s.
mCache.clear();
|
public void | flushMessagesFrom(int address)Flush all {@link HdmiCecMessage}s sent from the given {@code address}.
mCache.remove(address);
|
public HdmiCecMessage | getMessage(int address, int opcode)Return a {@link HdmiCecMessage} corresponding to the given {@code address} and
{@code opcode}.
SparseArray<HdmiCecMessage> messages = mCache.get(address);
if (messages == null) {
return null;
}
return messages.get(opcode);
|
private boolean | isCacheable(int opcode)
return CACHEABLE_OPCODES.contains(opcode);
|