Scheduler Service

The Scheduler Service gives access to activity scheduling. The main purpose of this service is to support scheduling of DVR recordings, but it may be used for other types of event scheduling as well. The scheduler also keeps track of resource utilization, and only allows bookings for which it can guarantee the availability of the requested resources for the whole duration of the booking.

Using the Service

Scheduling a booking

A single booking can be scheduled with Schedule. Changes can be made to the booking with Reschedule. It is not possible to reschedule the start time of an already started booking. Bookings persist until they are removed with Remove.

The application can schedule a series of periodic bookings with the ScheduleSeries function. When a series has been scheduled the individual bookings can be retrieved with GetBookingIdsForSeries. When removing a series with RemoveSeries all its bookings will be removed as well.

Parameters and triggers

Additional information can be attached to booking and series. The application can store state related to the booking and series and it also allows different applications to communicate with each other.

For example, the metadata associated with the booking for a DVR recording that has just started may look like this:

"Channel" = "SVT1"
"Initiated by" = "17 (User in EPG application)"
"State" = "recording_started"
"Asset id" = "ijefs6esgua333d" 
Additional time triggered events can be added to bookings. The start time for triggers are relative to the start time of the booking and may appear during the booking,before the start time (time < 0) and after the stop time (time > duration). Triggers generates the event callback OnScheduledTrigger.

Resources and activities

The scheduler configuration is created at build time and consists of resources and activities. For more information and examples see the Scheduler Service Configuration. Resources define the available resources and each activity defines a set of resources which will be consumed when the activity is in use.

It does not matter whether the resources and activities are set up according to the hardware features of the set-top box (e.g. "this set-top box has 2 tuners") or based on some empirical results (e.g. "this set-top box can handle 2 simultaneous recordings").

It is also possible to define activities that consume no resources which could then be used for general purposes like scheduling reminders to the user or scheduling set-top box software updates.

The scheduler service is not aware of user activity which isn't planned in the scheduler. It is therefore important to either schedule all kinds of activities that consume system resources or have a configuration that will always reserve system resources required for features that should always be available (Live TV).

Selecting a booking category

Categories are used and defined by applications and provide a way of partitioning the scheduler database. Applications can use it to filter out bookings they have no interest in. A complex setup might use the following categories:

The categoryExpression parameter in the API functions GetBookingIds and SetCategorySubscription can contain wildcards. In the example above the category expression "dvr_recordings*" would select all bookings in both "dvr_recordings" and "dvr_recordings_with_low_priority". Specifying "*" as category expression selects every booking in the scheduler database.

Note! Currently only "*" is supported as an expression for SetCategorySubscription.

Only the duration is updated when a started booking is rescheduled

If a booking has been started, and the reschedule function is called, the scheduler does not care about the start time as long as the end time is after current time. The new end time is calculated based on the newly provided start time and duration.

When GetBooking is called after the reschedule of a started booking, the start time is the same as when the booking start event was fired, and only the duration is updated and calculated from the first start time and the new end time.

See also: TOI Scheduler Service Interface