## Supported Things
Two Bridge things are supported:
+
- `generic`: the internet gateway device itself (generic device)
- `fritzbox`: similar to `generic` with extensions for AVM FritzBox devices.
Two kind of Things are supported:
+
- `subDevice`: a sub-device of the Bridge thing (e.g. a WAN interface)
- `subDeviceLan`: a special type of sub-device that supports MAC-detection
val tr064Actions = getActions("tr064","tr064:fritzbox:2a28aee1ee")
val result = tr064Actions.phonebookLookup("49157712341234", 5)
```
+
## A note on textual configuration
Textual configuration through a `.things` file is possible but, at present, strongly discouraged because it is significantly more error-prone
needed subdevices).
The definition of the bridge and of the subdevices things is the following
+
```
Bridge tr064:fritzbox:rootuid "Root label" @ "location" [ host="192.168.1.1", user="user", password="passwd",
phonebookInterval="0"]{
// in case there are multiple phone entries with same number -> name mapping, i.e. in phonebooks exported from
// mobiles containing multiple accounts like: local, cloudprovider1, messenger1, messenger2,...
private String mergeSameContactNames(String nameA, String nameB) {
- if (nameA != null && nameA.equals(nameB)) {
+ if (nameA.equals(nameB)) {
return nameA;
}
throw new IllegalStateException(
*/
package org.openhab.binding.tr064.internal.soap;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
/**
* The {@link CallListType} is used for post processing the retrieved call list
*
* @author Jan N. Klug - Initial contribution
*/
+
+@NonNullByDefault
public enum CallListType {
MISSED_COUNT("2"),
INBOUND_COUNT("1"),
default:
}
} else if (command instanceof StringType) {
- if (dataType.equals("string")) {
+ if ("string".equals(dataType)) {
return Optional.of(command.toString());
}
} else if (command instanceof OnOffType) {
- if (dataType.equals("boolean")) {
+ if ("boolean".equals(dataType)) {
return Optional.of(OnOffType.ON.equals(command) ? "1" : "0");
}
}
private State processDecaDecibel(State state, Tr064ChannelConfig channelConfig) {
Float value = state.as(DecimalType.class).floatValue() / 10;
- return new QuantityType(value, Units.DECIBEL);
+ return new QuantityType<>(value, Units.DECIBEL);
}
/**
*/
@ExtendWith(MockitoExtension.class)
@MockitoSettings(strictness = Strictness.LENIENT)
+@NonNullByDefault
class PhonebookProfileTest {
private static final String INTERNAL_PHONE_NUMBER = "999";
private static final ThingUID THING_UID = new ThingUID(BINDING_ID, THING_TYPE_FRITZBOX.getId(), "test");
private static final String MY_PHONEBOOK = UIDUtils.encode(THING_UID.getAsString()) + ":MyPhonebook";
- @NonNullByDefault
public static class ParameterSet {
public final State state;
public final State resultingState;
});
}
- private @Mock ProfileCallback mockCallback;
- private @Mock ProfileContext mockContext;
- private @Mock PhonebookProvider mockPhonebookProvider;
+ private @Mock @NonNullByDefault({}) ProfileCallback mockCallback;
+ private @Mock @NonNullByDefault({}) ProfileContext mockContext;
+ private @Mock @NonNullByDefault({}) PhonebookProvider mockPhonebookProvider;
- @NonNullByDefault
private final Phonebook phonebook = new Phonebook() {
@Override
public Optional<String> lookupNumber(String number, int matchCount) {