Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,15 @@ public void handleOpenElement(final @Nullable String elementName, final @Nullabl
} else if ("durchsichtig".equals(classFlag)) { // link
this.fieldType = FieldType.IGNORE;
} else if ("bord".equals(classFlag)) { // special button style - not of our interest...
continue;
} else {
logger.debug("Unhanndled class in {}:{}:{}: '{}' ", id, line, col, classFlag);
}
}
}
} else if (this.parserState == ParserState.DATA_ENTRY && this.fieldType == FieldType.BUTTON
&& "span".equals(elementName)) {
// ignored...
return; // ignored...
} else {
logger.debug("Unexpected OpenElement in {}:{}: {} [{}]", line, col, elementName, attributes);
}
Expand Down Expand Up @@ -245,14 +246,14 @@ public void handleCloseElement(final @Nullable String elementName, final int lin
getApiPageEntry(id, line, col, shortName, description, this.buttonValue);
}
} else if (this.fieldType == FieldType.IGNORE) {
// ignore
return; // ignore
} else {
logger.debug("Unhandled setting {}:{}:{} [{}] : {}", id, line, col, this.fieldType, sb);
}
}
} else if (this.parserState == ParserState.DATA_ENTRY && this.fieldType == FieldType.BUTTON
&& "span".equals(elementName)) {
// ignored...
return;// ignored...
} else {
logger.debug("Unexpected CloseElement in {}:{}: {}", line, col, elementName);
}
Expand Down Expand Up @@ -307,7 +308,7 @@ public void handleText(final char @Nullable [] buffer, final int offset, final i
}
} else if (this.parserState == ParserState.INIT && ((len == 1 && buffer[offset] == '\n')
|| (len == 2 && buffer[offset] == '\r' && buffer[offset + 1] == '\n'))) {
// single newline - ignore/drop it...
return; // single newline - ignore/drop it...
} else {
String msg = new String(buffer, offset, len).replace("\n", "\\n").replace("\r", "\\r");
logger.debug("Unexpected Text {}:{}: ParserState: {} ({}) `{}`", line, col, parserState, len, msg);
Expand Down Expand Up @@ -400,22 +401,22 @@ private void getApiPageEntry(@Nullable String id2, int line, int col, String sho
// failed to get unit...
if ("Imp".equals(unitStr) || "€$".contains(unitStr)) {
// special case
unitData = taCmiSchemaHandler.SPECIAL_MARKER;
unitData = TACmiSchemaHandler.SPECIAL_MARKER;
} else {
unitData = taCmiSchemaHandler.NULL_MARKER;
unitData = TACmiSchemaHandler.NULL_MARKER;
logger.warn(
"Unhandled UoM '{}' - seen on channel {} '{}'; Message from QuantityType: {}",
valParts[1], shortName, description, iae.getMessage());
}
}
taCmiSchemaHandler.unitsCache.put(unitStr, unitData);
}
if (unitData == taCmiSchemaHandler.NULL_MARKER) {
if (unitData == TACmiSchemaHandler.NULL_MARKER) {
// no UoM mappable - just send value
channelType = "Number";
unit = null;
state = new DecimalType(bd);
} else if (unitData == taCmiSchemaHandler.SPECIAL_MARKER) {
} else if (unitData == TACmiSchemaHandler.SPECIAL_MARKER) {
// special handling for unknown UoM
if ("Imp".equals(unitStr)) { // Number of Pulses
// impulses - no idea how to map this to something useful here?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void handleOpenElement(final String elementName, final Map<String, String
this.optionFieldName = attributes == null ? null : attributes.get("name");
} else if ((this.parserState == ParserState.INIT || this.parserState == ParserState.INPUT)
&& "br".equals(elementName)) {
// ignored
return; // ignored
} else if ((this.parserState == ParserState.INIT || this.parserState == ParserState.INPUT)
&& "input".equals(elementName) && "changeto".equals(id)) {
this.parserState = ParserState.INPUT_DATA;
Expand Down Expand Up @@ -171,7 +171,6 @@ public void handleOpenElement(final String elementName, final Map<String, String
}
this.options.put(ChangerX2Entry.TIME_PERIOD_PARTS, timeParts);
} else {

logger.warn("Error parsing options for {}: Unhandled input field in {}:{}: {}", channelName, line,
col, attributes);
}
Expand Down Expand Up @@ -218,7 +217,7 @@ public void handleCloseElement(final @Nullable String elementName, final int lin
}
}
} else if (this.parserState == ParserState.INPUT && "span".equals(elementName)) {
// span's are ignored...
return; // span's are ignored...
} else {
logger.debug("Error parsing options for {}: Unexpected CloseElement in {}:{}: {}", channelName, line, col,
elementName);
Expand Down Expand Up @@ -275,10 +274,11 @@ public void handleText(final char @Nullable [] buffer, final int offset, final i
sb.append(buffer, offset, len);
}
} else if (this.parserState == ParserState.INIT && len == 1 && buffer[offset] == '\n') {
// single newline - ignore/drop it...
return; // single newline - ignore/drop it...
} else if (this.parserState == ParserState.INPUT) {
// this is a label next to the value input field - we currently have no use for it so
// it's dropped...
return;
} else {
logger.debug("Error parsing options for {}: Unexpected Text {}:{}: (ctx: {} len: {}) '{}' ",
this.channelName, line, col, this.parserState, len, new String(buffer, offset, len));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ record UnitAndType(Unit<?> unit, String channelType) {
// this is the units lookup cache.
protected final Map<String, UnitAndType> unitsCache = new ConcurrentHashMap<>();
// marks an entry with known un-resolveable unit
protected final UnitAndType NULL_MARKER = new UnitAndType(Units.ONE, "");
protected static final UnitAndType NULL_MARKER = new UnitAndType(Units.ONE, "");
// marks an entry with special handling - i.e. 'Imp'
protected final UnitAndType SPECIAL_MARKER = new UnitAndType(Units.ONE, "s");
protected static final UnitAndType SPECIAL_MARKER = new UnitAndType(Units.ONE, "s");

public TACmiSchemaHandler(final Thing thing, final HttpClient httpClient,
final TACmiChannelTypeProvider channelTypeProvider) {
Expand Down