Method Summary
|
denyActivity
(
|
This method gets called if the application is not able to grant an activity for whatever reason. |
| getActivities ( ) → Array.<ToiResourceService.ToiActivityInfo> |
Get all the active activities. |
| getResources ( ) → Array.<ToiResourceService.ToiResourceInfo> |
Get the information of all the system resources. |
|
getSessionActivities
(
|
Get list of activities in a session. |
|
grantActivity
(
|
This method notifies the resource service that a requested activity can proceed. |
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
|
Activity identifier. |
|
|
State identifier used to identify the activity state. |
|
|
Indicates the availability/Status of a resource. |
|
|
Different kind of system resources. |
|
|
Name of the resource. |
|
|
|
|
|
Different types of resources. |
|
Events
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.
This method gets called if the application is not able to grant an activity for whatever reason.
Parameters:
-
Name Type Description idToiResourceService.ToiActivityId Pending Activity that is denied by the application.
Throws:
-
ToiInvalidArgumentException Raised if Activity Id is not valid.
ToiInvalidPreconditionException Raised if current state of activity is not pending.
Get all the active activities.
Returns:
-
Type: Array.<ToiResourceService.ToiActivityInfo>
Information of all the active activities.
Get the information of all the system resources.
Returns:
-
Type: Array.<ToiResourceService.ToiResourceInfo>
All available and allocated resources.
Get list of activities in a session.
Parameters:
-
Name Type Description sessionIdToiMediaSession.ToiSessionId SessionId of the session of which activity info is required.
Throws:
-
ToiInvalidArgumentException Raised if SessionId is not valid.
Returns:
-
Type: Array.<ToiResourceService.ToiActivityInfo>
Information of all the active activities.
This method notifies the resource service that a requested activity can proceed.
Parameters:
-
Name Type Description idToiResourceService.ToiActivityId Activity that is being granted.
Throws:
-
ToiInvalidArgumentException Raised if Activity Id is not valid.
ToiInvalidPreconditionException Raised if current state of activity is not pending.
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.
Members
This is an Event identifier for ToiResourceActivitiesAddedEvent.
Tells the observer that a set of activities is added.
This is an Event identifier for ToiResourceActivitiesChangedEvent.
Tells the observer that an activity has changed state.
This is an Event identifier for ToiResourceActivitiesRemovedEvent.
Tells the observer that a set of activities is removed.
This is an Event identifier for ToiResourceResourcesAddedEvent.
Tells the observer that a set of available resources is added. Considering that generally resources of type ToiResourceService.RESOURCE_TYPE_DYNAMIC_POOL and ToiResourceService.RESOURCE_TYPE_ENUMERABLE are added to the list of resources maintained by resource manager during the box bootup, before any observer is registered to get the event notifications from resource manager, OnResourcesAdded event notification may not be received for the resources of type ToiResourceService.RESOURCE_TYPE_DYNAMIC_POOL and ToiResourceService.RESOURCE_TYPE_ENUMERABLE. Resources of type ToiResourceService.RESOURCE_TYPE_DYNAMIC_ALLOCATION are instantiated and added to resource manager much later so observers will get notification of this event only for the resources ToiResourceService.RESOURCE_TYPE_DYNAMIC_ALLOCATION.
This is an Event identifier for ToiResourceResourcesChangedEvent.
Tells the observer that a set of available resources has changed.
This is an Event identifier for ToiResourceResourcesRemovedEvent.
Tells the observer that a set of available resources is removed. Once added to resource manager, resources of type ToiResourceService.RESOURCE_TYPE_DYNAMIC_POOL and ToiResourceService.RESOURCE_TYPE_ENUMERABLE will never get removed, so this event is not applicable for the resources of type ToiResourceService.RESOURCE_TYPE_ENUMERABLE and ToiResourceService.RESOURCE_TYPE_DYNAMIC_POOL. This notification will be received by the observers only for the resources of type ToiResourceService.RESOURCE_TYPE_DYNAMIC_ALLOCATION, when these resources are destroyed and in turn removed from the list of resources manintained by resource manager.
Consumer activity.
Player activity.
Producer activity.
Recorder activity.
The resource is allocated. This state is currently used for resources of type ToiResourceService.RESOURCE_TYPE_ENUMERABLE and ToiResourceService.RESOURCE_TYPE_DYNAMIC_ALLOCATION, or when the resource can't be instantiated any more for resource of ToiResourceService.RESOURCE_TYPE_DYNAMIC_POOL.
The resource is free.
This state is only for the resource of type ToiResourceService.RESOURCE_TYPE_DYNAMIC_POOL to indicate that the resource is partly allocated. It means part of resource of type ToiResourceService.RESOURCE_TYPE_DYNAMIC_POOL is instantiated to type ToiResourceService.RESOURCE_TYPE_DYNAMIC_ALLOCATION, but quota is still available to permit more instantiations. When it is not possible to instantiate more, state of ToiResourceService.RESOURCE_TYPE_DYNAMIC_POOL changes to ToiResourceService.AVAILABILITY_ALLOCATED.
Invalid activity id definition.
Decryptor resources.
Disk reader resources.
Disk writer resources.
Network input resource.
Network output resource.
Transcoder resources.
Tuner resource.
A dynamic resource that is instantiated when a resource of type ToiResourceService.RESOURCE_TYPE_DYNAMIC_POOL is allocated.
A non enumerable or dynamic resource pool. When a resource is allocated from this pool it will cause instantiation of dynamic resource of type ToiResourceService.RESOURCE_TYPE_DYNAMIC_ALLOCATION.
Normal enumerable resource.
The activity has been granted resources and is active.
The activity has released all resources and is inactive.
The activity is pending grant from the application.
Information about an activity such as current state and resources used.
Struct fields
| Name | Description |
|---|---|
| id | The activity identifier. Type: ToiResourceService.ToiActivityId |
| resources | Required resources. Type: Array.<ToiResourceService.ToiResourceInfo> |
| sessionId | The session the activity is using, -1 if not applicable. Type: ToiMediaSession.ToiSessionId |
| state | The activity state. Type: ToiResourceService.ToiActivityState |
| type | The activity type. Type: ToiResourceService.ToiActivityType |
| url | The URL use for the activity. Empty string if not applicable. Type: string |
Information about a system resource.
Struct fields
| Name | Description |
|---|---|
| availability | The availability status of the resource. Type: ToiResourceService.ToiAvailability |
| name | The Name of the resource. For eg, the resource ToiResourceService.RESOURCE_TUNER& can have Name that is tuner Number. Like "0", "1", "2", etc. Type: ToiResourceService.ToiResourceName |
| resource | The system resource. Type: ToiResourceService.ToiResource |
| sharedActivities | All the activities sharing this resource. Type: Array.<ToiResourceService.ToiActivityId> |
| type | The system resource type. Type: ToiResourceService.ToiResourceType |