• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package autotest.moblab.rpc;
2 
3 import com.google.gwt.json.client.JSONObject;
4 import com.google.gwt.json.client.JSONString;
5 
6 /**
7  * Connected board and model information
8  */
9 public class ConnectedBoard extends JsonRpcEntity {
10   public static final String JSON_FIELD_MODEL = "model";
11   public static final String JSON_FIELD_BOARD = "board";
12 
13   private static final String NO_MODEL_FOUND = "NO_MODEL_FOUND";
14   private static final String NO_BOARD_FOUND = "NO_BOARD_FOUND";
15 
16   private String model;
17   private String board;
18 
ConnectedBoard()19   public ConnectedBoard() {
20 
21   }
22 
getModel()23   public String getModel() {
24     return model;
25   }
26 
getBoard()27   public String getBoard() {
28     return board;
29   }
30 
31   @Override
fromJson(JSONObject object)32   public void fromJson(JSONObject object) {
33     this.model = getStringFieldOrDefault(object, JSON_FIELD_MODEL, "");
34     this.board = getStringFieldOrDefault(object, JSON_FIELD_BOARD, "");
35   }
36 
37   @Override
toJson()38   public JSONObject toJson() {
39     JSONObject object = new JSONObject();
40     object.put(JSON_FIELD_BOARD, new JSONString(board));
41     object.put(JSON_FIELD_MODEL, new JSONString(model));
42     return object;
43   }
44 }
45