ManageDeviceFactory
Summary
Defines a factory to manage devices.
Devices are categorized by state. Either "accepted", "refused", "pending" or "incoming". An "incoming" device is a newly connected device manifesting after retrieving the list of known devices from the server. A "pending" device is a connected device not in server's list of known devices.
Item Index
Methods
addDevice
Syntax
addDevice
-
device
-
state
Summary
Adds a new device to the manage interface as a connected device.
addHistoric
Syntax
addHistoric
-
id
-
historic
Summary
Adds a device historic.
addSchedule
Syntax
addSchedule
-
id
-
schedule
Summary
Adds a device schedule.
getDevice
Syntax
Summary
Retrieves a device by its id.
Search is made on all devices, accepted, pending, refused and incoming devices.
Parameters:
-
id
StringThe device id
Returns:
The device or null if not found
getDevices
Syntax
Summary
Gets all devices from server.
Returns:
A promise resolving with the list of devices categorized by state (either "pending", "accepted" or "refused")
getDevicesByState
Syntax
Summary
Gets devices corresponding to the given state.
Parameters:
-
state
StringThe state to look for
Returns:
The list of devices
isGroupSchedulesCollision
Syntax
Summary
Checks if there are collisions between device's schedules and group's schedules.
Returns:
true if there is at least one collision, false otherwise
isValidSchedule
Syntax
Summary
Checks if a schedule is not in collision with other schedules.
Device schedule should not be in collision with device's group schedules if inside the group.
Parameters:
Returns:
The error if validation failed, null otherwise
remove
Syntax
Summary
Removes a device.
Parameters:
-
id
StringThe device id
Returns:
The removed device
removeHistoric
Syntax
removeHistoric
-
id
-
historicId
Summary
Removes a device historic.
removeHistory
Syntax
removeHistory
-
id
Summary
Removes a device's history.
Parameters:
-
id
StringThe device id
removeSchedule
Syntax
removeSchedule
-
id
-
scheduleId
Summary
Removes a device's schedule.
setDevicesProperty
Syntax
setDevicesProperty
-
property
-
value
Summary
Sets a property on all devices.
Parameters:
-
property
StringThe name of the property to set
-
value
MixedThe value for the property
setProperty
Syntax
setProperty
-
id
-
property
-
value
Summary
Updates a device's property.
updateDeviceState
Syntax
updateDeviceState
-
id
-
newState
Summary
Updates a device's state.
updateDeviceStatusMessage
Syntax
updateDeviceStatusMessage
-
id
Summary
Updates device's status message depending on its actual status. Device's status message is a human readable explanation about the device's status.
Parameters:
-
id
StringThe device id