}
}
public static ResponseSimulationValueCommandReader fromCommand(Command command) throws IOException, TraciException {
TraciInputStream payload = command.getPayload();
String objectId = new String(payload.readTraciString());
int count = payload.readUnsignedByte();
HashMap<Integer, Object> values = new HashMap<Integer, Object>();
for (int i = 0; i < count; i++) {
int id = payload.readUnsignedByte(); // value id
int status = payload.readUnsignedByte();
if (status == 0x00) {
// value could be retrieved without an error
int type = payload.readUnsignedByte();
if (type == TraciConstants.DATATYPE_INT)
values.put(id, payload.readInt());
else if (type == TraciConstants.DATATYPE_STRING_LIST) {
List<String> ids = new ArrayList<String>();
int length = payload.readInt();
for (int j = 0; j < length; j++) {
ids.add(new String(payload.readTraciString()));
}
values.put(id, ids);
}
} else if (status == 0xff){
payload.readUnsignedByte(); // type: String
String message = new String(payload.readTraciString());
throw new TraciException(message);
}
}