-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
160 changed files
with
6,764 additions
and
4,772 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
eclipse.preferences.version=1 | ||
encoding//src/io/openems/impl/scheduler/SimpleScheduler.java=UTF-8 | ||
encoding//src/main/java=UTF-8 | ||
encoding//src/test/java=UTF-8 | ||
encoding/<project>=UTF-8 | ||
encoding/src=UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 16 additions & 1 deletion
17
backend/src/main/java/io/openems/backend/metadata/api/device/MetadataDevice.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 2 additions & 6 deletions
8
backend/src/main/java/io/openems/backend/metadata/api/device/MetadataDeviceModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
package io.openems.backend.metadata.api.device; | ||
|
||
import java.util.Optional; | ||
|
||
import io.openems.common.exceptions.OpenemsException; | ||
|
||
public interface MetadataDeviceModel { | ||
/** | ||
* Gets the device for this apikey. | ||
* | ||
* Note: if there is more than one matching device it returns the first match. | ||
* Gets the devices for this apikey. | ||
* | ||
* @param apikey | ||
* @return device or null | ||
* @throws OpenemsException | ||
*/ | ||
public Optional<MetadataDevice> getDeviceForApikey(String apikey) throws OpenemsException; | ||
public MetadataDevices getDevicesForApikey(String apikey) throws OpenemsException; | ||
} |
46 changes: 46 additions & 0 deletions
46
backend/src/main/java/io/openems/backend/metadata/api/device/MetadataDevices.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package io.openems.backend.metadata.api.device; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashSet; | ||
import java.util.Iterator; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import com.google.gson.JsonArray; | ||
|
||
public class MetadataDevices implements Iterable<MetadataDevice> { | ||
private List<MetadataDevice> devices = new ArrayList<>(); | ||
|
||
public Set<String> getNames() { | ||
Set<String> names = new HashSet<>(); | ||
for (MetadataDevice device : this.devices) { | ||
names.add(device.getName()); | ||
} | ||
return names; | ||
} | ||
|
||
public String getNamesString() { | ||
return String.join(",", this.getNames()); | ||
} | ||
|
||
public boolean isEmpty() { | ||
return this.devices.isEmpty(); | ||
} | ||
|
||
public void add(MetadataDevice device) { | ||
this.devices.add(device); | ||
} | ||
|
||
@Override | ||
public Iterator<MetadataDevice> iterator() { | ||
return this.devices.iterator(); | ||
} | ||
|
||
public JsonArray toJson() { | ||
JsonArray j = new JsonArray(); | ||
for (MetadataDevice device : this.devices) { | ||
j.add(device.toJsonObject()); | ||
} | ||
return j; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.