use of org.openmuc.framework.config.ChannelScanInfo in project OpenMUC by isc-konstanz.
the class FromJson method getChannelScanInfoList.
public List<ChannelScanInfo> getChannelScanInfoList() {
List<ChannelScanInfo> returnValue = new ArrayList<>();
// TODO: another name?
JsonElement jse = jsonObject.get(Const.CHANNELS);
JsonArray jsa;
if (jse.isJsonArray()) {
jsa = jse.getAsJsonArray();
Iterator<JsonElement> jseIterator = jsa.iterator();
while (jseIterator.hasNext()) {
JsonObject jso = jseIterator.next().getAsJsonObject();
String channelAddress = getString(jso.get(Const.ADDRESS));
String channelSettings = getString(jso.get(Const.SETTINGS));
ValueType valueType = ValueType.valueOf(getString(jso.get(Const.VALUE_TYPE)));
int valueTypeLength = getInt(jso.get(Const.VALUE_TYPE_LENGTH));
String description = getString(jso.get(Const.DESCRIPTION));
boolean readable = getBoolean(jso.get(Const.READABLE));
boolean writeable = getBoolean(jso.get(Const.WRITEABLE));
String metadata = getString(jso.get(Const.METADATA));
returnValue.add(new ChannelScanInfo(channelAddress, channelSettings, description, valueType, valueTypeLength, readable, writeable, metadata));
}
} else {
returnValue = null;
}
return returnValue;
}
Aggregations