[tr064] fix incorrectly reported decibel values for DSL Noise Margin and Attenuation (#11337)
* [tr064] fix incorrectly reported decibel values for DSL Noise Margin and Attenuation Signed-off-by: Stefan Giehl <stefangiehl@gmail.com> * apply review feedback Signed-off-by: Stefan Giehl <stefangiehl@gmail.com>
This commit is contained in:
parent
18d26aa821
commit
19cd505b0c
|
@ -38,6 +38,7 @@ import org.openhab.core.library.types.DecimalType;
|
|||
import org.openhab.core.library.types.OnOffType;
|
||||
import org.openhab.core.library.types.QuantityType;
|
||||
import org.openhab.core.library.types.StringType;
|
||||
import org.openhab.core.library.unit.Units;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.State;
|
||||
import org.openhab.core.types.UnDefType;
|
||||
|
@ -200,6 +201,20 @@ public class SOAPValueConverter {
|
|||
return mappedSignalStrength;
|
||||
}
|
||||
|
||||
/**
|
||||
* post processor for decibel values (which are served as deca decibel)
|
||||
*
|
||||
* @param state the channel value in deca decibel
|
||||
* @param channelConfig channel config of the channel
|
||||
* @return the state converted to decibel
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private State processDecaDecibel(State state, Tr064ChannelConfig channelConfig) {
|
||||
Float value = state.as(DecimalType.class).floatValue() / 10;
|
||||
|
||||
return new QuantityType(value, Units.DECIBEL);
|
||||
}
|
||||
|
||||
/**
|
||||
* post processor for answering machine new messages channel
|
||||
*
|
||||
|
|
|
@ -284,25 +284,25 @@
|
|||
<item type="Number:Dimensionless" unit="dB" statePattern="%.1f dB"/>
|
||||
<service deviceType="urn:dslforum-org:device:WANDevice:1"
|
||||
serviceId="urn:WANDSLIfConfig-com:serviceId:WANDSLInterfaceConfig1"/>
|
||||
<getAction name="GetInfo" argument="NewDownstreamNoiseMargin"/>
|
||||
<getAction name="GetInfo" argument="NewDownstreamNoiseMargin" postProcessor="processDecaDecibel"/>
|
||||
</channel>
|
||||
<channel name="dslUpstreamNoiseMargin" label="DSL Upstream Noise Margin">
|
||||
<item type="Number:Dimensionless" unit="dB" statePattern="%.1f dB"/>
|
||||
<service deviceType="urn:dslforum-org:device:WANDevice:1"
|
||||
serviceId="urn:WANDSLIfConfig-com:serviceId:WANDSLInterfaceConfig1"/>
|
||||
<getAction name="GetInfo" argument="NewUpstreamNoiseMargin"/>
|
||||
<getAction name="GetInfo" argument="NewUpstreamNoiseMargin" postProcessor="processDecaDecibel"/>
|
||||
</channel>
|
||||
<channel name="dslDownstreamAttenuation" label="DSL Downstream Attenuation">
|
||||
<item type="Number:Dimensionless" unit="dB" statePattern="%.1f dB"/>
|
||||
<service deviceType="urn:dslforum-org:device:WANDevice:1"
|
||||
serviceId="urn:WANDSLIfConfig-com:serviceId:WANDSLInterfaceConfig1"/>
|
||||
<getAction name="GetInfo" argument="NewDownstreamAttenuation"/>
|
||||
<getAction name="GetInfo" argument="NewDownstreamAttenuation" postProcessor="processDecaDecibel"/>
|
||||
</channel>
|
||||
<channel name="dslUpstreamAttenuation" label="DSL Upstream Attenuation">
|
||||
<item type="Number:Dimensionless" unit="dB" statePattern="%.1f dB"/>
|
||||
<service deviceType="urn:dslforum-org:device:WANDevice:1"
|
||||
serviceId="urn:WANDSLIfConfig-com:serviceId:WANDSLInterfaceConfig1"/>
|
||||
<getAction name="GetInfo" argument="NewUpstreamAttenuation"/>
|
||||
<getAction name="GetInfo" argument="NewUpstreamAttenuation" postProcessor="processDecaDecibel"/>
|
||||
</channel>
|
||||
<channel name="dslFECErrors" label="DSL FEC Errors">
|
||||
<item type="Number:Dimensionless"/>
|
||||
|
|
Loading…
Reference in New Issue