-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResult.java
More file actions
32 lines (29 loc) · 1.19 KB
/
Result.java
File metadata and controls
32 lines (29 loc) · 1.19 KB
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
32
// Class for creating rsults objects
public class Result
{
public enum ResultCode { SrvSucessful, // Service completed - no errors
SrvNotAllowed, // Service not allowed for context
ReachedLimit, // For primary - cannot support additional secondary stations
UnexpectedFrameReceived, // Unexpected Frame Type (I, S, U) received
UnexpectedUFrameReceived, // Unexpected U-Frame (SNRM, UA, DISC) received
InvalidAddress // For primary - address of frame invalid (no connection exists)
};
private ResultCode result;
private int address;
private String sdu; // Service data unit
// Constructor - sets all values of the results
public Result(ResultCode res, int adr, String sdu)
{
result = res;
address = adr;
this.sdu = sdu;
}
// Getters to get results
public ResultCode getResult() { return result; }
public int getAddress() { return address; }
public String getSdu() { return sdu; }
public String toString()
{
return("Result: code is "+result+", address is "+address+", data is "+sdu);
}
}