-
Notifications
You must be signed in to change notification settings - Fork 2
/
MessageResolver.java
31 lines (28 loc) · 1.21 KB
/
MessageResolver.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.taptrack.tcmptappy2;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
/**
* MessageResolver take in TCMPMessages that may or may not already be resolved to a
* concrete command attempts to resolve it.
*/
public interface MessageResolver {
/**
* Resolves a TCMP message into the explicit message that it represents. Generally used for
* decoding sent TCMP messages
* @param message message to decode, must not be null
* @return TCMPMessage of explicit type or null if the message cannot be matched to a concrete
* message type
* @throws MalformedPayloadException Command code valid, but payload is malformed
*/
@Nullable
TCMPMessage resolveCommand(@NonNull TCMPMessage message) throws MalformedPayloadException;
/**
* Resolves a TCMP message into the explicit message that it represents. Generally used for
* decoding received TCMP messages
* @param message message to decode, must not be null
* @return TCMPMessage of explicit type or null if the message cannot be matched to a concrete
* message type
*/
@Nullable
TCMPMessage resolveResponse(@NonNull TCMPMessage message) throws MalformedPayloadException;
}