Method Summary
| getDevices ( ) → Array.<ToiStorageService.ToiDeviceInfo> |
Returns the currently connected storage devices. |
|
prepareDvrStorage
(
|
Prepare a device for DVR/timeshift usage. This may include partitioning, formatting and enabling the device for DVR/timeshift. The device will enter ToiStorageService.DEVICE_STATE_BUSY, then it goes through ToiStorageService.DEVICE_STATE_CONNECTING to its final state, which will be notified by ToiStorageDeviceStateChangedEvent. If the operation has successfully completed, the device will be in state ToiStorageService.DEVICE_STATE_DVR_STORAGE. If the operation fails, the reason will be indicated in the operation's error code. |
|
prepareForRemoval
(
|
Release a device to prepare for physical removal. The device will enter ToiStorageService.DEVICE_STATE_BUSY firstly. If the operation has successfully completed, the device will be in ToiStorageService.DEVICE_STATE_SAFE_TO_REMOVE and safe to be removed. |
|
reconnect
(
|
Reconnect the device which is ready to remove. If the operation has successfully completed, the device will be in one of the states ToiStorageService.DEVICE_STATE_DVR_STORAGE, ToiStorageService.DEVICE_STATE_CONTENT_STORAGE, and ToiStorageService.DEVICE_STATE_UNUSABLE. The final state will be indicated by ToiStorageDeviceStateChangedEvent. |
|
repair
(
|
Attempt repair of the given storage device. The device will enter ToiStorageService.DEVICE_STATE_BUSY, then it goes through ToiStorageService.DEVICE_STATE_CONNECTING to its final state, which will be notified by ToiStorageDeviceStateChangedEvent. If the operation has successfully completed, the device will be in state ToiStorageService.DEVICE_STATE_DVR_STORAGE or ToiStorageService.DEVICE_STATE_CONTENT_STORAGE. If the operation fails, the reason will be indicated in the operation's error code. |
Inherited Methods
|
addEventListener
(
|
This method registers an event listener for a specific event. Multiple listeners can be added for the same event. Events are broadcast to all registered listeners. |
|
removeEventListener
(
|
This method removes an event listener for a specific event. |
Type Definitions
|
Type for the unique storage device identifier. |
|
|
|
|
|
This represents the different kinds of states a storage device can be in. |
|
|
This represents the different kinds of file system status a storage device can have. |
|
|
Indicates the health of a storage device. |
|
Events
Constants
Methods
This method registers an event listener for a specific event. Multiple listeners can be added for the same event. Events are broadcast to all registered listeners.
Inherited From:
Parameters:
-
Name Type Description typenumber The event type of the event to subscribe to.
listenerToiEventListener The JavaScript function that will receive events.
Throws:
-
ToiInvalidArgumentException Raised if the event type is not supported by this object or if the listener is not a valid JavaScript function. This exception is also raised if the application calls addEventListener with the same combination of type and listener twice.
Returns the currently connected storage devices.
Returns:
-
Type: Array.<ToiStorageService.ToiDeviceInfo>
The connected storage devices.
Prepare a device for DVR/timeshift usage. This may include partitioning, formatting and enabling the device for DVR/timeshift. The device will enter ToiStorageService.DEVICE_STATE_BUSY, then it goes through ToiStorageService.DEVICE_STATE_CONNECTING to its final state, which will be notified by ToiStorageDeviceStateChangedEvent.
If the operation has successfully completed, the device will be in state ToiStorageService.DEVICE_STATE_DVR_STORAGE.
If the operation fails, the reason will be indicated in the operation's error code.
Note:
- Be very careful to use this method because it will wipe any existing data.
Parameters:
-
Name Type Description callbacksAsyncCallback Object with callback functions for the asynchronous operation. No result is produced by this method, so callbacks.onResult() will not be invoked.
deviceIdToiStorageService.ToiDeviceId The identifier for the device to be prepared.
Throws:
-
ToiInvalidArgumentException Raised if the operation identifier is invalid. Raised if the device identifier is invalid.
ToiOperationNotSupportedException Raised if the operation is not supported on this device due to hardware limitations.
ToiInvalidPreconditionException Raised if the device is not in ToiStorageService.DEVICE_STATE_DVR_STORAGE, ToiStorageService.DEVICE_STATE_CONTENT_STORAGE, or ToiStorageService.DEVICE_STATE_UNUSABLE.
Returns:
-
Type: ToiAsynchronousOperation
operation The asynchronous operation created by the function.
Release a device to prepare for physical removal. The device will enter ToiStorageService.DEVICE_STATE_BUSY firstly. If the operation has successfully completed, the device will be in ToiStorageService.DEVICE_STATE_SAFE_TO_REMOVE and safe to be removed.
See also:
Parameters:
-
Name Type Description callbacksAsyncCallback Object with callback functions for the asynchronous operation. No result is produced by this method, so callbacks.onResult() will not be invoked.
deviceIdToiStorageService.ToiDeviceId The identifier for the device prepared for removal.
Throws:
-
ToiInvalidArgumentException Raised if the operation identifier is invalid. Raised if the device identifier is invalid.
ToiInvalidPreconditionException Raised if the device is in ToiStorageService.DEVICE_STATE_BUSY or ToiStorageService.DEVICE_STATE_SAFE_TO_REMOVE.
Returns:
-
Type: ToiAsynchronousOperation
operation The asynchronous operation created by the function.
Reconnect the device which is ready to remove.
If the operation has successfully completed, the device will be in one of the states ToiStorageService.DEVICE_STATE_DVR_STORAGE, ToiStorageService.DEVICE_STATE_CONTENT_STORAGE, and ToiStorageService.DEVICE_STATE_UNUSABLE.
The final state will be indicated by ToiStorageDeviceStateChangedEvent.
Parameters:
-
Name Type Description callbacksAsyncCallback Object with callback functions for the asynchronous operation. No result is produced by this method, so callbacks.onResult() will not be invoked.
deviceIdToiStorageService.ToiDeviceId The identifier for the device prepared for removal.
Throws:
-
ToiInvalidArgumentException Raised if the operation identifier is invalid. Raised if the device identifier is invalid.
ToiInvalidPreconditionException Raised if the device is not in ToiStorageService.DEVICE_STATE_SAFE_TO_REMOVE.
Returns:
-
Type: ToiAsynchronousOperation
operation The asynchronous operation created by the function.
This method removes an event listener for a specific event.
Inherited From:
Parameters:
-
Name Type Description typenumber The event type of the event to remove the listener from.
listenerToiEventListener The JavaScript function that was previously added as an event listener.
Throws:
-
ToiInvalidArgumentException Raised if the event type is not supported by this object or if the listener is not a valid JavaScript function. This exception is also raised if the listener has not previously been added.
Attempt repair of the given storage device. The device will enter ToiStorageService.DEVICE_STATE_BUSY, then it goes through ToiStorageService.DEVICE_STATE_CONNECTING to its final state, which will be notified by ToiStorageDeviceStateChangedEvent.
If the operation has successfully completed, the device will be in state ToiStorageService.DEVICE_STATE_DVR_STORAGE or ToiStorageService.DEVICE_STATE_CONTENT_STORAGE.
If the operation fails, the reason will be indicated in the operation's error code.
Parameters:
-
Name Type Description callbacksAsyncCallback Object with callback functions for the asynchronous operation. No result is produced by this method, so callbacks.onResult() will not be invoked.
deviceIdToiStorageService.ToiDeviceId The identifier for the device to be repaired.
Throws:
-
ToiInvalidArgumentException Raised if the operation identifier is invalid. Raised if the device identifier is invalid.
ToiInvalidPreconditionException Raised if the device is not in ToiStorageService.DEVICE_STATE_DVR_STORAGE, or ToiStorageService.DEVICE_STATE_UNUSABLE.
Returns:
-
Type: ToiAsynchronousOperation
operation The asynchronous operation created by the function.
Members
This is an Event identifier for ToiStorageDeviceAddedEvent.
This notification is sent when a storage device has been added to the system.
This is an Event identifier for ToiStorageDeviceFullEvent.
This notification is sent when an HDD runs out of free storage space. The callback will occur periodically as long as the HDD is full and operations such as DVR recordings will not be possible until the requested number of bytes are freed. When this has been resolved, the callback will occur a final time with spaceRequired set to 0 to indicate that enough free space is now available.
This is an Event identifier for ToiStorageDeviceRemovedEvent.
This notification is sent when a storage device has been physically removed from the system. The device will no longer be available in the list of connected storage devices by ToiStorageService#getDevices.
There is no specific state to represent a device that has been removed from the system, so the state in the provided device information will be the state the device had when the actual removal occurred.
This is an Event identifier for ToiStorageDeviceStateChangedEvent.
This notification is sent when a storage device has changed state. The reason can be mapped to the defined reason constants.
This is an Event identifier for ToiStorageDeviceTemperatureReachedEvent.
This notification is sent when some predefined HDD temperature threshold has been reached.
A maintenance operation is ongoing (formatting, repair etc).
The device is in the process of being connected. This is an interim state. Once connected/requested, device will try to mount and finally enter any of ToiStorageService.DEVICE_STATE_DVR_STORAGE, ToiStorageService.DEVICE_STATE_CONTENT_STORAGE, and ToiStorageService.DEVICE_STATE_UNUSABLE, or unmount to ToiStorageService.DEVICE_STATE_SAFE_TO_REMOVE.
The device has been connected as a generic content storage in the system.
The device has been connected as a DVR storage in the system.
The system has released all dependencies to the storage device and will gracefully handle a physical removal of the device.
The storage device has not been recognized or fulfilled the criteria to be connected as a storage for recordings or other content, possibly due to errors, access failures or unsupported file system. Until application has taken further actions it is not usable from a platform perspective.
The file system had errors but they have been corrected.
The file system had errors that could not be corrected. A reformat is required to get the file system working.
The file system is completely broken or not supported.
No errors discovered on the file system.
The device was expected to be found but could not be detected.
The device reported S.M.A.R.T errors or other fatal failures.
The device reported ATA errors or other low-level I/O communication errors.
The device reported no problems.
Information about the storage device itself.
Struct fields
| Name | Description |
|---|---|
| capacity | Total disk space on storage device. Type: number |
| health
[optional] |
Indicates the health of the storage device. Type: ToiStorageService.ToiHealth |
| id | A unique identfier of the storage device. The identifier value is a hash created based on static information from the storage device to ensure it is reasonably unique and persistent between reboots if no major change to the device has been made. Type: ToiStorageService.ToiDeviceId |
| isApproved | True if this device is supported by Arris. Type: boolean |
| model | Persistent device model. Type: string |
| serialNumber | Persistent storage identification. Type: string |
| state | The current device state. Type: ToiStorageService.ToiDeviceState |
| status
[optional] |
Detailed storage information for a device when it has reached ToiStorageService.DEVICE_STATE_DVR_STORAGE. Type: ToiStorageService.ToiStorageStatus |
| temperature
[optional] |
Current storage temperature. It will only be set if S.M.A.R.T support is available. Type: number |
Information about the storage status.
Struct fields
| Name | Description |
|---|---|
| fileSystemStatus | Partition file system check result from last connection. Type: ToiStorageService.ToiFileSystemStatus |
| freeCapacity | This is the amount of space currently available. Type: number |
| isWritable | Set to true if file system is mounted as read/write. Type: boolean |