Changeset 30532 in osm for applications/editors/josm/plugins/globalsat/src/org/kaintoch
- Timestamp:
- 2014-07-14T04:18:06+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/globalsat/src/org/kaintoch/gps/globalsat/dg100/Response.java
r29854 r30532 12 12 * 13 13 */ 14 public class Response 14 public class Response<E> 15 15 { 16 16 final static public byte typeFileInfo = (byte)0xBB; … … 23 23 private int nextIdx = 0; 24 24 private Dg100Config config = null; 25 private List data = new ArrayList(100); 25 private List<E> data = new ArrayList<>(100); 26 26 private long id = 0; 27 27 … … 35 35 * @param resp 36 36 */ 37 static public Response parseResponse(byte resp[], int len) 37 static public Response<?> parseResponse(byte resp[], int len) 38 38 { 39 39 ByteBuffer buf = ByteBuffer.wrap(resp); 40 40 byte respType = buf.get(4); 41 Response response = new Response(respType);42 41 buf.position(5); 43 42 if (respType == typeFileInfo) // file info 44 43 { 44 Response<FileInfoRec> response = new Response<>(respType); 45 45 int cntInfoCur = buf.getShort(); 46 46 int nextIdx = buf.getShort(); … … 52 52 response.addRec(fileInfoRec); 53 53 } 54 return response; 54 55 } 55 56 else if (respType == typeGpsRec) // gps recs 56 57 { 58 Response<GpsRec> response = new Response<>(respType); 57 59 int recType = 2; 58 60 // read part 1 … … 85 87 recType = gpsRec.getDg100TypeOfNextRec(); 86 88 } 89 return response; 87 90 } 88 91 else if (respType == typeConfig) // config 89 92 { 93 Response<?> response = new Response<>(respType); 90 94 Dg100Config config = new Dg100Config(buf); 91 95 response.config = config; 96 return response; 92 97 } 93 98 else if (respType == typeId) // id 94 99 { 100 Response<?> response = new Response<>(respType); 95 101 response.id = 0; 96 102 for (int ii = 0 ; ii < 8 ; ++ii) … … 99 105 response.id = response.id * 10 + digit; 100 106 } 107 return response; 101 108 } 102 109 else 103 110 { 111 return new Response<>(respType); 104 112 } 105 return response;106 113 } 107 114 108 private void addRec( Objectobj)115 private void addRec(E obj) 109 116 { 110 117 data.add(obj); 111 118 } 112 119 113 public List getRecs() 120 public List<E> getRecs() 114 121 { 115 122 return data;
Note:
See TracChangeset
for help on using the changeset viewer.
