|
@@ -1,7 +1,10 @@
|
|
|
package de.tu_darmstadt.tk.SmartHomeNetworkSim.core;
|
|
|
|
|
|
+import java.util.Collection;
|
|
|
+
|
|
|
|
|
|
- * Protocol according to which the packages are created
|
|
|
+ * Protocol according to which the packages are created. Can contain different
|
|
|
+ * Roles.
|
|
|
*
|
|
|
* @author Andreas T. Meyer-Berg
|
|
|
*/
|
|
@@ -9,7 +12,59 @@ public interface Protocol {
|
|
|
|
|
|
|
|
|
* Generates the next Packet
|
|
|
+ *
|
|
|
+ * @param timestep
|
|
|
+ * Time the package should be sent
|
|
|
* @return next Packet
|
|
|
*/
|
|
|
public Packet generateNextPaket(long timestep);
|
|
|
+
|
|
|
+
|
|
|
+ * Returns the number of different roles the participating SmartDevices
|
|
|
+ * could have
|
|
|
+ *
|
|
|
+ * @return number of different roles
|
|
|
+ */
|
|
|
+ public int getNumberOfRoles();
|
|
|
+
|
|
|
+
|
|
|
+ * Returns the textual Representation of the different Roles. The Array
|
|
|
+ * should contain {@codeNumberOfRoles} Strings. {@codeArray[role]} should be
|
|
|
+ * a human-readable String representation of the Role at Position
|
|
|
+ * {@code role}.
|
|
|
+ *
|
|
|
+ * @return String Representations of the roles
|
|
|
+ */
|
|
|
+ public String[] getRoles();
|
|
|
+
|
|
|
+
|
|
|
+ * Returns all SmartDevices of the given Role. Returns null, if the role
|
|
|
+ * number was invalid.
|
|
|
+ *
|
|
|
+ * @param role
|
|
|
+ * Position of the role in {@code getNumberOfRoles}
|
|
|
+ * @return SmartDevices of Role with index {@code role}
|
|
|
+ */
|
|
|
+ public Collection<SmartDevice> getDevicesWithRole(int role);
|
|
|
+
|
|
|
+
|
|
|
+ * Adds a new smartDevice to the role, returns {@code true} if if was
|
|
|
+ * assigned successfully, {@code false} if it wasn't. (Either invalid role
|
|
|
+ * number or maximum number of devices for the role reached)
|
|
|
+ *
|
|
|
+ * @param device
|
|
|
+ * SmartDevice that should be assigned to the given role
|
|
|
+ * @param role
|
|
|
+ * Position of the role in {@code getNumberOfRoles}
|
|
|
+ * @return whether the Device was added
|
|
|
+ */
|
|
|
+ public boolean addDeviceOfRole(SmartDevice device, int role);
|
|
|
+
|
|
|
+
|
|
|
+ * Remove a device from the Protocol
|
|
|
+ *
|
|
|
+ * @param device
|
|
|
+ * device that should be removed
|
|
|
+ */
|
|
|
+ public void removeDevice(SmartDevice device);
|
|
|
}
|