<?xml version="1.0"?>
<?xml-stylesheet href="docbook.xsl" type="text/xsl" ?>
<book xmlns="http://docbook.org/ns/docbook" version="5.0">
  <info>
    <title>Schedule Service Specification</title>
    <titleabbrev>Schedule</titleabbrev>
    <releaseinfo>18.06</releaseinfo>
    <author>
      <orgname>ONVIF™</orgname>
      <uri>www.onvif.org</uri>
    </author>
    <pubdate>June 2018</pubdate>
    <mediaobject>
      <imageobject>
        <imagedata fileref="media/logo.png" contentwidth="60mm" />
      </imageobject>
    </mediaobject>
    <copyright>
      <year>2008-2020</year>
      <holder>ONVIF™ All rights reserved.</holder>
    </copyright>
    <legalnotice>
      <para>Recipients of this document may copy, distribute, publish, or display this document so long as this copyright notice, license and disclaimer are retained with all copies of the document. No license is granted to modify this document.</para>
      <para>THIS DOCUMENT IS PROVIDED "AS IS," AND THE CORPORATION AND ITS MEMBERS AND THEIR AFFILIATES, MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THIS DOCUMENT ARE SUITABLE FOR ANY PURPOSE; OR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.</para>
      <para>IN NO EVENT WILL THE CORPORATION OR ITS MEMBERS OR THEIR AFFILIATES BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL DAMAGES, ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THIS DOCUMENT, WHETHER OR NOT (1) THE CORPORATION, MEMBERS OR THEIR AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR (2) SUCH DAMAGES WERE REASONABLY FORESEEABLE, AND ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THIS DOCUMENT.  THE FOREGOING DISCLAIMER AND LIMITATION ON LIABILITY DO NOT APPLY TO, INVALIDATE, OR LIMIT REPRESENTATIONS AND WARRANTIES MADE BY THE MEMBERS AND THEIR RESPECTIVE AFFILIATES TO THE CORPORATION AND OTHER MEMBERS IN CERTAIN WRITTEN POLICIES OF THE CORPORATION.</para>
    </legalnotice>
    <revhistory>
      <revision>
        <revnumber>1.0</revnumber>
        <date>Jun 2015</date>
        <author>
          <personname>PACS WG</personname>
        </author>
        <revremark>First release</revremark>
      </revision>
      <revision>
        <revnumber>17.06</revnumber>
        <date>Jun-2017</date>
        <author>
          <personname>Hiroyuki Sano</personname>
        </author>
        <revremark>Change Request 2008, 2009, 2070, 2075, 2076, 2078, 2083</revremark>
      </revision>
      <revision>
        <revnumber>17.12</revnumber>
        <date>Dec-2017</date>
        <author>
          <personname>Hiroyuki Sano</personname>
        </author>
        <revremark>Change Request 2143, 2168</revremark>
      </revision>
      <revision>
        <revnumber>18.06</revnumber>
        <date>Jun-2018</date>
        <author>
          <personname>Patrik Björling Rygert</personname>
        </author>
        <revremark>Added support for client-supplied tokens</revremark>
      </revision>
    </revhistory>
  </info>
  <preface>
    <title>Contributors </title>
    <informaltable>
      <tgroup cols="2">
        <colspec colname="c1" colwidth="54*" />
        <colspec colname="c2" colwidth="46*" />
        <tbody valign="top">
          <row>
            <entry valign="bottom">
              <para>ASSA ABLOY</para>
            </entry>
            <entry valign="bottom">
              <para>Patrik Björling Rygert</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>ASSA ABLOY</para>
            </entry>
            <entry valign="bottom">
              <para>Mattias Rengstedt</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Axis Communications AB </para>
            </entry>
            <entry valign="bottom">
              <para>Marcus Johansson</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Axis Communications AB </para>
            </entry>
            <entry valign="bottom">
              <para>Robert Rosengren</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Axis Communications AB</para>
            </entry>
            <entry valign="bottom">
              <para>Derek Wang</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Axis Communications AB</para>
            </entry>
            <entry valign="bottom">
              <para>Emil Selinder</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Bosch</para>
            </entry>
            <entry valign="bottom">
              <para>Mohane Caliaperoumal</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Bosch</para>
            </entry>
            <entry valign="bottom">
              <para>Dirk Schreiber</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Honeywell</para>
            </entry>
            <entry valign="bottom">
              <para>Uvaraj Thangarajan</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Honeywell</para>
            </entry>
            <entry valign="bottom">
              <para>Neelendra Bhandari</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Honeywell</para>
            </entry>
            <entry valign="bottom">
              <para>Mayur Salgar</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Honeywell</para>
            </entry>
            <entry valign="bottom">
              <para>Vinay Ghule</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>PACOM</para>
            </entry>
            <entry valign="bottom">
              <para>Eugene Scully</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Siemens AG</para>
            </entry>
            <entry valign="bottom">
              <para>Lokeshwar K</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Siemens AG</para>
            </entry>
            <entry valign="bottom">
              <para>Suresh Raman</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Siemens AG</para>
            </entry>
            <entry valign="bottom">
              <para>Suresh Krishnamurthy</para>
            </entry>
          </row>
        </tbody>
      </tgroup>
    </informaltable>
  </preface>
  <chapter>
    <title>Scope</title>
    <section>
      <title>General</title>
      <para>This specification defines the web service interface for interaction with ONVIF devices which support time management features such as schedules and special days (sometimes referred to as holidays).</para>
      <para>Web service usage and common ONVIF functionality are outside the scope of this document. Please refer to [ONVIF Core Specification] for more information.</para>
    </section>
    <section>
      <title>Conventions</title>
      <para>The key words “shall”, “shall not”, “should”, “should not”, “may”, “need not”, “can”, “cannot” in this specification are to be interpreted as described in Annex H of [ISO/IEC Directives].</para>
    </section>
    <section>
      <title>Namespaces</title>
      <para>This document references the following namespaces:</para>
      <table>
        <title>Referenced namespaces (with prefix)</title>
        <tgroup cols="2">
          <colspec colname="c1" colwidth="13*" />
          <colspec colname="c2" colwidth="87*" />
          <thead>
            <row>
              <entry>
                <para> Prefix </para>
              </entry>
              <entry>
                <para> Namespace URI </para>
              </entry>
            </row>
          </thead>
          <tbody valign="top">
            <row>
              <entry>
                <para>env</para>
              </entry>
              <entry>
                <para>
                  <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.w3.org/2003/05/soap-envelope">http://www.w3.org/2003/05/soap-envelope</link>
                </para>
              </entry>
            </row>
            <row>
              <entry>
                <para>ter</para>
              </entry>
              <entry>
                <para>
                  <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.onvif.org/ver10/error">http://www.onvif.org/ver10/error</link>
                </para>
              </entry>
            </row>
            <row>
              <entry>
                <para>xs </para>
              </entry>
              <entry>
                <para>
                  <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</link>
                </para>
              </entry>
            </row>
            <row>
              <entry>
                <para>tt</para>
              </entry>
              <entry>
                <para>
                  <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.onvif.org/ver10/schema">http://www.onvif.org/ver10/schema</link>
                </para>
              </entry>
            </row>
            <row>
              <entry>
                <para>pt</para>
              </entry>
              <entry>
                <para>
                  <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.onvif.org/ver10/pacs">http://www.onvif.org/ver10/pacs</link>
                </para>
              </entry>
            </row>
            <row>
              <entry>
                <para>tns1</para>
              </entry>
              <entry>
                <para>
                  <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.onvif.org/ver10/topics">http://www.onvif.org/ver10/topics</link>
                </para>
              </entry>
            </row>
            <row>
              <entry>
                <para>tsc</para>
              </entry>
              <entry>
                <para>
                  <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.onvif.org/ver10/schedule/wsdl">http://www.onvif.org/ver10/schedule/wsdl</link>
                </para>
              </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
    </section>
  </chapter>
  <chapter>
    <title>Normative references</title>
    <para>The following documents, in whole or in part, are normatively referenced in this document and are indispensable for its application. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</para>
    <para>ONVIF Core Specification </para>
    <para role="reference">&lt;<link xmlns:xlink="http://www.w3.org/1999/xlink"
        xlink:href="http://www.onvif.org/specs/core/ONVIF-Core-Specification.pdf"/>&gt;</para>
    <para>ONVIF PACS Architecture and Design Considerations</para>
    <para role="reference">&lt;<link xmlns:xlink="http://www.w3.org/1999/xlink"
        xlink:href="https://www.onvif.org/specs/wp/ONVIF-PACS-Architecture-and-Design-Considerations.pdf"
      />&gt;</para>
    <para>RFC 5545, Internet Calendaring and Scheduling Core Object Specification (iCalendar), September 2009 </para>
    <para role="reference">&lt;<link xmlns:xlink="http://www.w3.org/1999/xlink"
        xlink:href="https://tools.ietf.org/html/rfc5545"/>&gt;</para>
    <para>RFC 5234, Augmented BNF for Syntax Specifications: ABNF, January 2008 </para>
    <para role="reference">&lt;<link xmlns:xlink="http://www.w3.org/1999/xlink"
        xlink:href="https://www.ietf.org/rfc/rfc5234.txt"/>&gt;</para>
    <para>ISO/IEC Directives, ISO/IEC Directives Part 2, Principles and rules for
      the structure and drafting of ISO and IEC documents, Edition 7.0, May 2016 </para>
    <para role="reference">&lt;<link xmlns:xlink="http://www.w3.org/1999/xlink"
        xlink:href="http://www.iec.ch/members_experts/refdocs/iec/isoiecdir-2%7Bed7.0%7Den.pdf"
      />&gt;</para>
  </chapter>
  <chapter>
    <title>Terms, definitions and abbreviations</title>
    <section>
      <title>Terms and definitions</title>
      <para>For the purposes of this document, the following terms and definitions apply.</para>
      <informaltable>
        <tgroup cols="2">
          <colspec colname="c1" colwidth="22*" />
          <colspec colname="c2" colwidth="78*" />
          <tbody valign="top">
            <row>
              <entry>
                <para>
                  <emphasis role="bold">iCalendar</emphasis>
                </para>
              </entry>
              <entry>
                <para>An industry standard format for exchanging scheduling and activity-recording information electronically. </para>
              </entry>
            </row>
            <row>
              <entry>
                <para>
                  <emphasis role="bold">Schedule</emphasis>
                </para>
              </entry>
              <entry>
                <para>A set of time periods, e.g. working hours (weekdays from 8 AM to 6 PM). It may also include one or more special days schedules. </para>
              </entry>
            </row>
            <row>
              <entry>
                <para>
                  <emphasis role="bold">Special Days</emphasis>
                </para>
              </entry>
              <entry>
                <para>A set of dates that require the regular Schedule to be overridden, e.g. holidays, half-days or working Sundays.</para>
              </entry>
            </row>
            <row>
              <entry>
                <para>
                  <emphasis role="bold">Special Days Schedule</emphasis>
                </para>
              </entry>
              <entry>
                <para>A schedule that defines time periods for a Special Day List.</para>
              </entry>
            </row>
            <row>
              <entry>
                <para>
                  <emphasis role="bold">Time Period</emphasis>
                </para>
              </entry>
              <entry>
                <para>A time period has a start time and an end time, e.g. 8 AM to 6 PM.</para>
              </entry>
            </row>
            <row>
              <entry>
                <para>
                  <emphasis role="bold">vEvent</emphasis>
                </para>
              </entry>
              <entry>
                <para>A component in iCalendar, specifying the properties of an event.</para>
              </entry>
            </row>
          </tbody>
        </tgroup>
      </informaltable>
    </section>
    <section>
      <title>Abbreviated terms</title>
      <informaltable>
        <tgroup cols="2">
          <colspec colname="c1" colwidth="22*" />
          <colspec colname="c2" colwidth="78*" />
          <tbody valign="top">
            <row>
              <entry>
                <para>
                  <emphasis role="bold">PACS</emphasis>
                </para>
              </entry>
              <entry valign="middle">
                <para>Physical Access Control System</para>
              </entry>
            </row>
          </tbody>
        </tgroup>
      </informaltable>
    </section>
  </chapter>
  <chapter>
    <title>Overview</title>
    <section>
      <title>General</title>
      <para>The schedule service provides functions to manage schedules and special days. </para>
      <para>Schedules can, for example, be used to define when access is granted or when a video camera should record. </para>
      <para>The schedule service supports schedules in both local time and UTC time. Typically a schedule is in local time.</para>
      <para>The following picture shows the main data structures involved in the schedule service:</para>
      <figure>
        <title>Main data structures in the schedule service</title>
        <mediaobject>
          <imageobject>
            <imagedata fileref="media/Schedule/image2.svg" contentwidth="126.92mm" />
          </imageobject>
        </mediaobject>
      </figure>
      <para>A group of special days may be used to define what times the facility is accessible during holidays. Another group of special days may be used to define what times the facility is accessible during half-working days.</para>
      <para>Special day groups are typically reused by different schedules. Consider the following example:</para>
      <para>A PACS system is shared by two sites; one in Sweden, and one in Poland. All Polish holidays are grouped in a special day group called "Polish holidays". All Swedish holidays are grouped in a special day group called "Swedish holidays". In addition Sweden have half-working days before some of the bank holidays, so another group is defined called "Swedish half-days".</para>
      <para>A schedule called "Polish employee schedule" is created, defining access to the office for Polish employees during all days of the week, including the weekend (e.g. access on Mondays-Fridays from 7 AM to 8 PM, and access on Saturday-Sunday from 10 AM to 2 PM). The schedule is linked to the "Polish holidays" group defining the access to work during these days (e.g. no access during holidays).</para>
      <para>Similarly, a schedule called "Swedish employee schedule" is created, defining access to the office for all Swedish employees during all days of the week, including the weekend. The schedule is linked to both the "Swedish holidays" group (e.g. no access) and the "Swedish half-days" group (e.g. access from 7 AM to 1 PM).</para>
      <para>Schedules and special days are defined by iCalendar vEvents. iCalendar is a very flexible format where recurrence types such as yearly, monthly, weekly, daily, etc., can be used.</para>
      <para>To briefly explain the iCalendar format, consider the following examples (only parts of the iCalendar structures are shown below):</para>
      <para>An iCalendar event starting at 8 PM on November 25, 2014, and ending at 2 AM on November 26, 2014:</para>
      <programlisting><![CDATA[BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTART:20141125T200000
DTEND:20141126T020000
END:VEVENT
END:VCALENDAR
]]></programlisting>
      <para>A weekly recurring iCalendar event each Tuesday and Thursday from 2 PM to 4 PM, where the first occurrence is on November 25, 2014, and the last occurrence is on December 9, 2014 (5 occurrences):</para>
      <programlisting><![CDATA[BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTART:20141125T140000
DTEND:20141125T160000
RRULE:FREQ=WEEKLY;COUNT=5;BYDAY=TU,TH
END:VEVENT
END:VCALENDAR
]]></programlisting>
      <para>The following example have exactly the same effect as the previous example, but the end date of the series is specified instead of the number of occurrences:</para>
      <programlisting><![CDATA[BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTART:20141125T140000
DTEND:20141125T160000
RRULE:FREQ=WEEKLY;UNTIL:20141209T140000;BYDAY=TU,TH
END:VEVENT
END:VCALENDAR
]]></programlisting>
      <para>Only a certain subset of the iCalendar specification is required to be supported to get a usable service. Support for additional features within the iCalendar specification is reflected in the ServiceCapabilities.</para>
    </section>
    <section>
      <title>Recurrence</title>
      <section>
        <title>General</title>
        <para>When the ExtendedRecurrenceSupported capability is set to true then extended iCalendar recurrence format is supported. Special days can still be used but may not be needed.</para>
        <para>For devices not supporting extended iCalendar recurrence, the ExtendedRecurrenceSupported capability should be set to false. The iCalendar “FREQ” and “BYDAY” keywords are used to define weekly recurring events per day in the week (see iCalendar examples above). When the ExtendedRecurrenceSupported capability is set to false, then the year of the start date of recurring events shall be set to 1970, and the occurrence count (optionally the until date) shall be omitted (i.e. forever recurring events). </para>
        <para>The following table shows the effect of the ExtendedRecurrenceSupported capability
          settings for schedule and special days respectively.</para>
        <table>
          <title>Recurrence support matrix</title>
          <tgroup cols="3">
            <colspec colname="c1" colwidth="25*" />
            <colspec colname="c2" colwidth="37*" />
            <colspec colname="c3" colwidth="37*" />
            <thead>
              <row>
                <entry />
                <entry namest="c2" nameend="c3">
                  <para> ExtendedRecurrenceSupported </para>
                </entry>
              </row>
              <row>
                <entry />
                <entry>
                  <para> FALSE </para>
                </entry>
                <entry>
                  <para> TRUE </para>
                </entry>
              </row>
            </thead>
            <tbody valign="top">
              <row>
                <entry>
                  <para>
                    <emphasis role="bold">Schedules</emphasis>
                  </para>
                </entry>
                <entry>
                  <para>Weekly recurrence</para>
                </entry>
                <entry>
                  <para>Extended recurrence</para>
                </entry>
              </row>
              <row>
                <entry>
                  <para>
                    <emphasis role="bold">Special days</emphasis>
                  </para>
                </entry>
                <entry>
                  <para>No recurrence allowed</para>
                </entry>
                <entry>
                  <para>Extended recurrence</para>
                </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <para xml:id="_Ref466931145">In the following subsections, the ABNF syntax is used [RFC 5234]. The rule names to the left of the equal sign (dtstart, dtend and recur-rule-part) are redefining the rules in [RFC 5545]. The rule names to the right of the equal sign (date-month, date-mday, time-hour, time-minute, time-second, bymolist, bywdaylist, bymodaylist, weekday and enddate) are defined according to [RFC 5545].</para>
      </section>
      <section>
        <title>Weekly recurrence</title>
        <para>Only the weekly iCalendar recurrence type shall be supported. Non-recurring events and other recurring types are not supported. </para>
        <para>The device shall only accept recurring events starting with the year ‘1970’ (the month and day is needed to match the week day of the recurrence). </para>
        <programlisting>dtstart = "DTSTART" ":" "1970" date-month date-mday
"T" time-hour time-minute time-second</programlisting>
        <para>The device shall only allow end dates no later than midnight of the date specified in the start date.</para>
        <programlisting>dtend = "DTEND" ":" "1970" date-month date-mday
"T" time-hour time-minute time-second</programlisting>
        <para>where date-month and date-mday shall be either the same as for dtstart or one day later but with time-hour = “00”, time-minute  = “00” and time-second  = “00”.</para>
        <para>Only local times are supported.</para>
        <para>The device shall not accept an occurrence count or until date in recurring events. The following recurrence pattern is allowed:</para>
        <programlisting>recur-rule-part = "WEEKLY" [ ";" "BYDAY" "=" (weekday *("," weekday)) ]</programlisting>
      </section>
      <section xml:id="_Ref466931014">
        <title>Extended recurrence</title>
        <para>The device shall support the following recurrence pattern:</para>
        <programlisting>recur-rule-part =
/ ( "YEARLY" ";" "BYMONTH" "=" bymolist )
/ ( "MONTHLY" )
/ ( "MONTHLY" ";" "BYDAY" "=" bywdaylist )
/ ( "MONTHLY" ";" "BYMONTHDAY" "=" bymodaylist )
/ ( "WEEKLY" )
/ ( "WEEKLY" ";" "BYDAY" "=" (weekday *("," weekday)) )
/ ( "DAILY" )
/ ( "HOURLY" )
/ ( "MINUTELY" )
/ ( "SECONDLY" ) )
[ ";" "INTERVAL" "=" 1*DIGIT ] 
[ ";" "COUNT" "=" 1*DIGIT / ";" "UNTIL" "=" enddate ]</programlisting>
      </section>
      <section>
        <title>Standard sc<emphasis role="bold">h</emphasis>edule recurrence</title>
        <para>Single occurrences in a series of recurring events can be deleted to create exceptions from the recurring events.</para>
        <para>The following picture illustrates a recurring series of events. Each vertical bar represents the 24-hour day, and the green parts represent events (time periods). Events occur each Monday, but there is an exception on the fourth Monday, when no event occurs.</para>
        <figure>
          <title>Recurring events with an exception</title>
          <mediaobject>
            <imageobject>
              <imagedata fileref="media/Schedule/image3.svg" contentwidth="145.95mm" />
            </imageobject>
          </mediaobject>
        </figure>
      </section>
      <section>
        <title>Special day recurrence</title>
        <para>In contrast to exceptions, the schedule service also support special days. Special days are used to define different behavior during for instance holidays or half working days. Examples of different behavior includes video recording with a different frame rate or different access times to a facility. Special days are grouped together and given names such as “US holidays”, “UK holidays”, “Swedish half-days”, etc.</para>
        <para>The following picture illustrates the same series of recurring events, but instead of an exception, the fourth Monday is treated as per special day with different behavior.</para>
        <figure>
          <title>Recurring events with a special day</title>
          <mediaobject>
            <imageobject>
              <imagedata fileref="media/Schedule/image4.svg" contentwidth="145.95mm" />
            </imageobject>
          </mediaobject>
        </figure>
        <para>In the PACS domain, supporting different behavior during special days is essential. Most traditional access control units on the market today only handle weekly recurrence. Generally they do not support exceptions, but they usually support special days. </para>
      </section>
    </section>
  </chapter>
  <chapter>
    <title>Schedules</title>
    <section>
      <title>Service capabilities</title>
      <section>
        <title>General</title>
        <para>The device shall provide service capabilities in two ways:</para>
        <orderedlist>
          <listitem>
            <para>With the GetServices method of Device service when IncludeCapability is true. Please refer to [ONVIF Core Specification] for more details.</para>
          </listitem>
          <listitem>
            <para>With the GetServiceCapabilities method.</para>
          </listitem>
        </orderedlist>
      </section>
      <section>
        <title>Data structures</title>
        <section>
          <title>ServiceCapabilities</title>
          <para>The service capabilities reflect optional functionality of a service. The
            information is static and does not change during device operation. The following
            capabilities are available:</para>
          <variablelist>
            <varlistentry>
              <term> MaxLimit </term>
              <listitem><para>The maximum number of entries returned by a single Get&lt;Entity&gt;List or
                Get&lt;Entity&gt; request. The device shall never return more than this number of
                entities in a single response.</para></listitem>
            </varlistentry>
            <varlistentry>
              <term> MaxSchedules </term>
              <listitem> <para>Indicates the maximum number of schedules the device supports. The device shall
                support at least one schedule.</para></listitem>
            </varlistentry>
            <varlistentry>
              <term> MaxTimePeriodsPerDay </term>
              <listitem><para>Indicates the maximum number of time periods per day the device supports in a
                schedule including special days schedule. The device shall support at least one time
                period per day.</para></listitem>
            </varlistentry>
            <varlistentry>
              <term> SpecialDaysSupported </term>
              <listitem><para>If this capability is supported, then the device shall support special
                days.</para></listitem>
            </varlistentry>
            <varlistentry>
              <term> MaxSpecialDayGroups </term>
              <listitem><para>Indicates the maximum number of special day group entities the device supports.
                The device shall support at least one SpecialDayGroup entity if SpecialDaysSupported
                is set to true. This value is ignored if SpecialDaysSupported is set to
                false.</para></listitem>
            </varlistentry>
            <varlistentry>
              <term> MaxDaysInSpecialDayGroup </term>
              <listitem><para>Indicates the maximum number of days per SpecialDayGroup entity the device
                supports. The device shall support at least one day per SpecialDayGroup entity if
                SpecialDaysSupported is set to true. This value is ignored if SpecialDaysSupported
                is set to false.</para></listitem>
            </varlistentry>
            <varlistentry>
              <term> MaxSpecialDaysSchedules </term>
              <listitem><para>Indicates the maximum number of SpecialDaysSchedule entities referred by a
                schedule that the device supports. This value is ignored if SpecialDaysSupported is
                set to false.</para></listitem>
            </varlistentry>
            <varlistentry>
              <term> ExtendedRecurrenceSupported </term>
              <listitem><para>If ExtendedRecurrenceSupported = true, schedules shall support extended
                recurrence according to section <xref linkend="_Ref466931014"/>.</para>
              <para>If ExtendedRecurrenceSupported = true and SpecialDaysSupported = true, then
                special days supports extended recurrence according to section <xref
                  linkend="_Ref466931014"/>.</para>
              <para>If ExtendedRecurrenceSupported = false, only weekly recurrence shall be
                supported for schedules (according to section <xref linkend="_Ref466931145"/>) and
                no recurrence shall be supported for special days.</para></listitem>
            </varlistentry>
            <varlistentry>
              <term> StateReportingSupported </term>
              <listitem><para>If this capability is set to true, the device shall implement the
                GetScheduleState command, and shall notify subscribing clients whenever schedules
                become active or inactive.</para></listitem>
            </varlistentry>
            <varlistentry>
              <term> ClientSuppliedTokenSupported </term>
              <listitem><para>Indicates that the client is allowed to supply the token when creating schedules
                and special day groups. To enable the use of the commands SetSchedule and
                SetSpecialDayGroup, the value must be set to true.</para></listitem>
            </varlistentry>
          </variablelist>
        </section>
      </section>
      <section>
        <title>GetServiceCapabilities command</title>
        <para>This operation returns the capabilities of the schedule service.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="text">This message is empty</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="param">Capabilities [tsc:ServiceCapabilities]</para>
              <para role="text">Set of indicators for function groups as described above.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="text">None</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">PRE_AUTH</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
    </section>
    <section>
      <title>Schedule information</title>
      <section>
        <title>General</title>
        <para>A schedule is a set of time periods which may also include one or more special day’s schedules. </para>
      </section>
      <section>
        <title>Data structures</title>
        <section>
          <title>ScheduleInfo</title>
          <para>The ScheduleInfo type represents the schedule as a physical object. The structure contains information of a specific schedule instance. </para>
          <para>The device shall provide the following fields for each ScheduleInfo instance:</para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">token</emphasis>
              </para>
              <para>A service unique identifier of the schedule.</para>
            </listitem>
            <listitem>
              <para>
                <emphasis role="bold">Name</emphasis>
              </para>
              <para>A user readable name. It shall be up to 64 characters.</para>
            </listitem>
          </itemizedlist>
          <para>To provide more information, the device may include the following optional fields:</para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">Description</emphasis>
              </para>
              <para>User readable description for the schedule. It shall be up to 1024 characters.</para>
            </listitem>
          </itemizedlist>
        </section>
        <section>
          <title>Schedule</title>
          <para>The schedule structure shall include all properties of the ScheduleInfo structure and also the standard events (iCalendar format) and a list of SpecialDaysSchedule instances.</para>
          <para>The device shall provide the following fields for each schedule instance:</para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">Standard</emphasis>
              </para>
              <para>An iCalendar structure that defines a number of events. Events can be recurring or non-recurring. The events can, for instance, be used to control when a camera should record or when a facility is accessible.</para>
              <para>Some devices might not be able to fully support all the features of iCalendar. Setting the service capability ExtendedRecurrenceSupported to false will enable more devices to be ONVIF compliant. Is of type string (but contains an iCalendar structure).</para>
            </listitem>
            <listitem>
              <para>
                <emphasis role="bold">SpecialDays</emphasis>
              </para>
              <para>For devices that are not able to support all the features of iCalendar, supporting special days is essential. Each SpecialDaysSchedule instance defines an alternate set of time periods that overrides the regular schedule for a specified list of special days. Is of type SpecialDaysSchedule.</para>
            </listitem>
          </itemizedlist>
        </section>
        <section>
          <title>SpecialDaysSchedule</title>
          <para>An override schedule that defines alternate time periods for a group of special days. </para>
          <para>If multiple SpecialDaysSchedule structures contain conflicting time ranges for the same special day, it will result in a union of the time periods.</para>
          <para>The picture below shows the use of SpecialDaysSchedule instances. A Schedule instance called “Employee schedule” holds an iCalendar structure defining the regular access, and also holds a number of SpecialDaysSchedule instances. Each SpecialDaysSchedule holds a token to a SpecialDayGroup and zero or more TimePeriod instances.</para>
          <para>In this example, the first SpecialDaysSchedule instance holds the token to the “Holidays” special day group, but holds no time periods. The result is that no access is granted on the special days listed in the “Holidays” special day group.</para>
          <para>The second SpecialDaysSchedule instance holds the token to the “Half-days” special day group, and also holds one time period “7 AM to 1 PM”, resulting in access granted during those hours for special days listed in the “Half-days” special day group.</para>
          <figure>
            <title>SpecialDaysSchedule example</title>
            <mediaobject>
              <imageobject>
                <imagedata fileref="media/Schedule/image5.svg" contentwidth="161.03mm" />
              </imageobject>
            </mediaobject>
          </figure>
          <para>If a special day is defined as part of a day (requires ExtendedRecurrenceSupported = true), then access shall only be granted when the time range and the part of the special day overlaps. </para>
          <para>Consider the example depicted in the figure below. Assume a standard schedule giving access on weekdays 6 AM to 6 PM (marked in green in <xref linkend="_Ref475006996" />), but not on weekends. Then assume a special day starting on Friday, June 10, at 2 PM and ending on Saturday, June 11, at 10 AM (marked in yellow in <xref linkend="_Ref475006996" />). If the special days’ schedule defines a time range of 8 AM to 4 PM (marked by dashed red lines in <xref linkend="_Ref475006996" />), then access will be granted from 6 AM to 4 PM on Friday, June 10, and from 8 AM to 10 AM on Saturday, June 11. See detailed example in section <xref linkend="_Ref466987127" />.</para>
          <figure xml:id="_Ref475006996">
            <title>Example of special day with time part</title>
            <mediaobject>
              <imageobject>
                <imagedata fileref="media/Schedule/image6.svg" contentwidth="160.50mm" />
              </imageobject>
            </mediaobject>
          </figure>
          <para>The device shall provide the following fields for each SpecialDaysSchedule instance:</para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">GroupToken</emphasis>
              </para>
              <para>Indicates the list of special days in a schedule.</para>
            </listitem>
            <listitem>
              <para>
                <emphasis role="bold">TimeRange</emphasis>
              </para>
              <para>Indicates the alternate time periods for the list of special days (overrides the regular schedule). For example, the regular schedule indicates that it is active from 8 AM to 5 PM on Mondays. However, this particular Monday is a special day, and the alternate time periods state that the schedule is active from 9 AM to 11 AM and 1 PM to 4 PM. </para>
              <para>If no time periods are defined, then no access is allowed. Is of type TimePeriod.</para>
            </listitem>
          </itemizedlist>
        </section>
        <section>
          <title>TimePeriod</title>
          <para>A time period defines a start and end time. For full day access, the start time = ”00:00:00” with no defined end time. For a time period with no end time, the schedule runs until midnight. If an end time is specified, it must always be greater than the start time, otherwise an InvalidArgVal fault shall be generated by the device.</para>
          <para>The device shall provide the following fields for each TimePeriod instance:</para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">From</emphasis>
              </para>
              <para>Indicates the start time.</para>
            </listitem>
          </itemizedlist>
          <para>To provide more information, the device may include the following optional fields:</para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">Until</emphasis>
              </para>
              <para>Indicates the end time. Is optional, if omitted, the period ends at midnight. The end time is exclusive, meaning that that exact moment in time is not part of the period. To determine if a moment in time (t) is part of a time period, the formula StartTime ≤ t &lt; EndTime is used.</para>
            </listitem>
          </itemizedlist>
        </section>
      </section>
      <section>
        <title>GetScheduleInfo command</title>
        <para>This operation requests a list of ScheduleInfo items matching the given tokens. </para>
        <para>The device shall ignore tokens it cannot resolve and shall return an empty list if there are no items matching the specified tokens. The device shall not return a fault in this case.</para>
        <para>If the number of requested items is greater than MaxLimit, a TooManyItems fault shall be returned.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">Token - unbounded [pt:ReferenceToken]</para>
              <para role="text">Tokens of ScheduleInfo items to get.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="param">ScheduleInfo - optional, unbounded [tsc:ScheduleInfo]</para>
              <para role="text">List of ScheduleInfo items.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">env:Sender  ter:InvalidArgs   ter:TooManyItems</para>
              <para role="text">Too many items were requested, see MaxLimit capability.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">READ_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
      <section>
        <title>GetScheduleInfoList command</title>
        <para>This operation requests a list of all ScheduleInfo items provided by the device.</para>
        <para>A call to this method shall return a StartReference when not all data is returned and more data is available. The reference shall be valid for retrieving the next set of data. Please refer to section 4.8.3 in [ONVIF PACS Architecture and Design Considerations] for more details.</para>
        <para>The number of items returned shall not be greater than the Limit parameter.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">Limit - optional [xs:int]</para>
              <para role="text">Maximum number of entries to return. If not specified, less than one or higher than what the device supports, the number of items is determined by the device.</para>
              <para role="param">StartReference - optional [xs:string]</para>
              <para role="text">Start returning entries from this start reference. If not specified, entries shall start from the beginning of the dataset.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="param">NextStartReference - optional [xs:string]</para>
              <para role="text">StartReference to use in next call to get the following items. If absent, no more items to get.</para>
              <para role="param">ScheduleInfo - optional, unbounded [tsc:ScheduleInfo]</para>
              <para role="text">List of ScheduleInfo items.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">env:Sender - ter:InvalidArgVal - ter:InvalidStartReference</para>
              <para role="text">StartReference is invalid or has timed out. Client needs to start fetching from the beginning.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">READ_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
      <section>
        <title>GetSchedules command</title>
        <para>This operation requests a list of Schedule items matching the given tokens. </para>
        <para>The device shall ignore tokens it cannot resolve and shall return an empty list if there are no items matching the specified tokens. The device shall not return a fault in this case.</para>
        <para>If the number of requested items is greater than MaxLimit, a TooManyItems fault shall be returned.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">Token - unbounded [pt:ReferenceToken]</para>
              <para role="text">Tokens of Schedule items to get</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="param">Schedule - optional, unbounded [tsc:Schedule]</para>
              <para role="text">List of schedule items.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">env:Sender  ter:InvalidArgs   ter:TooManyItems</para>
              <para role="text">Too many items were requested, see MaxLimit capability.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">READ_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
      <section>
        <title>GetScheduleList command</title>
        <para>This operation requests a list of all Schedule items provided by the device. </para>
        <para>A call to this method shall return a StartReference when not all data is returned and more data is available. The reference shall be valid for retrieving the next set of data. Please refer to section 4.8.3 in [ONVIF PACS Architecture and Design Considerations] for more details.</para>
        <para>The number of items returned shall not be greater than the Limit parameter.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">Limit - optional [xs:int]</para>
              <para role="text">Maximum number of entries to return. If not specified, less than one or higher than what the device supports, the number of items is determined by the device.</para>
              <para role="param">StartReference - optional [xs:string]</para>
              <para role="text">Start returning entries from this start reference. If not specified, entries shall start from the beginning of the dataset.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="param">NextStartReference - optional [xs:string]</para>
              <para role="text">StartReference to use in next call to get the following items. If absent, no more items to get.</para>
              <para role="param">ScheduleInfo - optional, unbounded [tsc:Schedule]</para>
              <para role="text">List of Schedule items.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">env:Sender - ter:InvalidArgVal - ter:InvalidStartReference</para>
              <para role="text">StartReference is invalid or has timed out. Client needs to start fetching from the beginning.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">READ_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
      <section>
        <title>CreateSchedule command</title>
        <para>This operation creates the specified schedule in the device. </para>
        <para>The token field of the Schedule structure shall be empty and the device shall allocate a token for the schedule. The allocated token shall be returned in the response. </para>
        <para>If the client sends any value in the token field, the device shall return InvalidArgVal as a generic fault code.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">Schedule [tsc:Schedule]</para>
              <para role="text">The Schedule to create</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="param">Token [pt:ReferenceToken]</para>
              <para role="text">The token of created Schedule</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">env:Receiver - ter:CapabilityViolated - ter:MaxSchedules</para>
              <para role="text">There is not enough space to add new schedule, see MaxSchedules capability</para>
              <para role="param">env:Sender - ter: CapabilityViolated - ter:MaxSpecialDaysSchedules</para>
              <para role="text">There are too many SpecialDaysSchedule entities referred in this schedule, see MaxSpecialDaysSchedules capability.</para>
              <para role="param">env:Sender - ter: CapabilityViolated - ter:MaxTimePeriodsPerDay</para>
              <para role="text">There are too many time periods in a day schedule, see MaxTimePeriodsPerDay capability.</para>
              <para role="param">env:Sender  ter:InvalidArgVal   ter:ReferenceNotFound</para>
              <para role="text">A referred entity token is not found (some devices may not validate referred entities).</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">WRITE_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
      <section>
        <title>SetSchedule command</title>
        <para>This method is used to synchronize a schedule in a client with the device.</para>
        <para>If a schedule with the specified token does not exist in the device, the schedule is created. If a schedule with the specified token exists, then the schedule is modified.</para>
        <para>A call to this method takes a Schedule structure as input parameter. The token field of the Schedule structure must not be empty.</para>
        <para>A device that signals support for the ClientSuppliedTokenSupported capability shall implement this command. </para>
        <para>If no token was specified in the request, the device shall return InvalidArgs as a generic fault code.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">Schedule [tsc:Schedule]</para>
              <para role="text">The Schedule item to create or modify</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="text">This is an empty message.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">env:Receiver - ter:CapabilityViolated - ter:ClientSuppliedTokenSupported</para>
              <para role="text">The device does not support that the client supplies the token</para>
              <para role="param">env:Receiver - ter:CapabilityViolated - ter:MaxSchedules</para>
              <para role="text">There is not enough space to add new schedule, see MaxSchedules capability</para>
              <para role="param">env:Sender - ter:CapabilityViolated - ter:MaxSpecialDaysSchedules</para>
              <para role="text">There are too many SpecialDaysSchedule entities referred in this schedule, see MaxSpecialDaysSchedules capability.</para>
              <para role="param">env:Sender - ter:CapabilityViolated - ter:MaxTimePeriodsPerDay</para>
              <para role="text">There are too many time periods in a day schedule, see MaxTimePeriodsPerDay capability.</para>
              <para role="param">env:Sender  ter:InvalidArgVal   ter:ReferenceNotFound</para>
              <para role="text">A referred entity token is not found (some devices may not validate referred entities).</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">WRITE_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
      <section>
        <title>ModifySchedule command</title>
        <para>This operation modifies the specified schedule. </para>
        <para>The token of the schedule to modify is specified in the token field of the Schedule structure and shall not be empty. All other fields in the structure shall overwrite the fields in the specified schedule.</para>
        <para>If no token was specified in the request, the device shall return InvalidArgs as a generic fault code.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">Schedule [tsc:Schedule]</para>
              <para role="text">The Schedule to modify/update</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="text">This is an empty message.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">env:Sender - ter:InvalidArgVal - ter:NotFound</para>
              <para role="text">The specified token not found.</para>
              <para role="param">env:Sender - ter:CapabilityViolated - ter:MaxSpecialDaysSchedules</para>
              <para role="text">There are too many SpecialDaysSchedule entities referred in this schedule, see MaxSpecialDaysSchedules capability.</para>
              <para role="param">env:Sender - ter: CapabilityViolated - ter:MaxTimePeriodsPerDay</para>
              <para role="text">There are too many time periods in a day schedule, see MaxTimePeriodsPerDay capability.</para>
              <para role="param">env:Sender  ter:InvalidArgVal   ter:ReferenceNotFound</para>
              <para role="text">A referred entity token is not found (some devices may not validate referred entities).</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">WRITE_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
      <section>
        <title>DeleteSchedule command</title>
        <para>This operation will delete the specified schedule. </para>
        <para>If it is associated with one or more entities some devices may not be able to delete the schedule, and consequently a ReferenceInUse fault shall be generated.</para>
        <para>If no token was specified in the request, the device shall return InvalidArgs as a generic fault code.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">Token [pt:ReferenceToken]</para>
              <para role="text">The token of the schedule to delete.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="text">This is an empty message.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">env:Sender  ter:InvalidArgVal   ter:NotFound</para>
              <para role="text">Schedule token is not found.</para>
              <para role="param">env:Sender  ter:InvalidArgVal   ter:ReferenceInUse</para>
              <para role="text">Failed to delete, Schedule token is in use</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">WRITE_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
    </section>
    <section>
      <title>Special day group information</title>
      <section>
        <title>General</title>
        <para>A special day group are days (or parts of days) that require the regular schedule to be overridden with an alternate schedule. For example holidays, half-days, working Sundays, etc.</para>
      </section>
      <section>
        <title>Data structures</title>
        <section>
          <title>SpecialDayGroupInfo</title>
          <para>The SpecialDayGroupInfo structure contains the basic information about the special days list. </para>
          <para>The device shall provide the following fields for each SpecialDayGroupInfo instance:</para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">token</emphasis>
              </para>
              <para>A service-unique identifier of the special day group.</para>
            </listitem>
            <listitem>
              <para>
                <emphasis role="bold">Name</emphasis>
              </para>
              <para>User readable name. It shall be up to 64 characters.</para>
            </listitem>
          </itemizedlist>
          <para>To provide more information, the device may include the following optional fields:</para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">Description</emphasis>
              </para>
              <para>User readable description for the special days. It shall be up to 1024 characters.</para>
            </listitem>
          </itemizedlist>
        </section>
        <section>
          <title> SpecialDayGroup</title>
          <para>The special day group structure shall include all properties of the SpecialDayGroupInfo structure and also a set of special days. A special day group are days (or parts of days) that require the regular schedule to be overridden with an alternate schedule. For example holidays, half-days, working Sundays, etc. </para>
          <para>The device shall provide the following fields for each SpecialDayGroup instance:</para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">Days</emphasis>
              </para>
              <para>An iCalendar structure that contains a group of special days. Is of type string (containing an iCalendar structure).</para>
            </listitem>
          </itemizedlist>
        </section>
      </section>
      <section>
        <title>GetSpecialDayGroupInfo command</title>
        <para>This operation requests a list of SpecialDayGroupInfo items matching the given tokens. </para>
        <para>The device shall ignore tokens it cannot resolve and shall return an empty list if there are no items matching specified tokens. The device shall not return a fault in this case.</para>
        <para>If the number of requested items is greater than MaxLimit, a TooManyItems fault shall be returned.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">Token - unbounded [pt:ReferenceToken]</para>
              <para role="text">Tokens of SpecialDayGroupInfo items to get.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="param">SpecialDayGroupInfo - optional, unbounded [tsc:SpecialDayGroupInfo]</para>
              <para role="text">List of SpecialDayGroupInfo items.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">env:Sender  ter:InvalidArgs   ter:TooManyItems</para>
              <para role="text">Too many items were requested, see MaxLimit capability.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">READ_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
      <section>
        <title>GetSpecialDayGroupInfoList command</title>
        <para>This operation requests a list of all SpecialDayGroupInfo items provided by the device.</para>
        <para>A call to this method shall return a StartReference when not all data is returned and more data is available. The reference shall be valid for retrieving the next set of data. Please refer to section 4.8.3 in [ONVIF PACS Architecture and Design Considerations] for more details.</para>
        <para>The number of items returned shall not be greater than the Limit parameter.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">xs:int Limit [0][1] xs:string StartReference [0][1]</para>
              <para role="text">Maximum number of entries to return. If not specified, less than one or higher than what the device supports, the number of items is determined by the device.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="param">xs:string NextStartReference [0][1] tsc:SpecialDayGroupInfo SpecialDayGroupInfo [0][unbounded]</para>
              <para role="text">StartReference to use in next call to get the following items. If absent, no more items to get.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">env:Sender - ter:InvalidArgVal - ter:InvalidStartReference</para>
              <para role="text">StartReference is invalid or has timed out. Client needs to start fetching from the beginning.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">READ_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
      <section>
        <title>GetSpecialDayGroups command</title>
        <para>This operation requests a list of SpecialDayGroup items matching the given tokens. </para>
        <para>The device shall ignore tokens it cannot resolve and shall return an empty list if there are no items matching the specified tokens. The device shall not return a fault in this case.</para>
        <para>If the number of requested items is greater than MaxLimit, a TooManyItems fault shall be returned.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">Token - unbounded [pt:ReferenceToken]</para>
              <para role="text">Tokens of the SpecialDayGroup items to get.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="param">SpecialDayGroup - optional, unbounded [tsc:SpecialDayGroup]</para>
              <para role="text">List of SpecialDayGroup items.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">env:Sender  ter:InvalidArgs   ter:TooManyItems</para>
              <para role="text">Too many items were requested, see MaxLimit capability.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">READ_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
      <section>
        <title>GetSpecialDayGroupList command</title>
        <para>This operation requests a list of all SpecialDayGroupList items provided by the device.</para>
        <para>A call to this method shall return a StartReference when not all data is returned and more data is available. The reference shall be valid for retrieving the next set of data. Please refer to section 4.8.3 in [ONVIF PACS Architecture and Design Considerations] for more details.</para>
        <para>The number of items returned shall not be greater than the Limit parameter.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">xs:int Limit [0][1] xs:string StartReference [0][1]</para>
              <para role="text">Maximum number of entries to return. If not specified, less than one or higher than what the device supports, the number of items is determined by the device.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="param">xs:string NextStartReference [0][1] tsc:SpecialDayGroup SpecialDayGroup [0][unbounded]</para>
              <para role="text">StartReference to use in next call to get the following items. If absent, no more items to get.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">env:Sender - ter:InvalidArgVal - ter:InvalidStartReference</para>
              <para role="text">StartReference is invalid or has timed out. Client needs to start fetching from the beginning.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">READ_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
      <section>
        <title>CreateSpecialDayGroup command</title>
        <para>This operation creates the specified special day group in the device. </para>
        <para>The token field of the SpecialDayGroup structure shall be empty and the device shall allocate a token for the special day group. The allocated token shall be returned in the response. </para>
        <para>If the client sends any value in the token field, the device shall return InvalidArgVal as a generic fault code.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">SpecialDayGroup [tsc:SpecialDayGroup]</para>
              <para role="text">The special day group to create.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="param">Token [pt:ReferenceToken]</para>
              <para role="text">The token of created special day group.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">env:Receiver - ter:CapabilityViolated - ter:MaxSpecialDayGroups</para>
              <para role="text">There is not enough space to add new SpecialDayGroup items, see the MaxSpecialDayGroups capability</para>
              <para role="param">env:Sender - ter:CapabilityViolated - ter:MaxDaysInSpecialDayGroup</para>
              <para role="text">There are too many special days in a SpecialDayGroup, see MaxDaysInSpecialDayGroup capability.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">WRITE_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
      <section>
        <title>SetSpecialDayGroup command</title>
        <para>This method is used to synchronize a special day group in a client with the device.</para>
        <para>If a special day group with the specified token does not exist in the device, the special day group is created. If a special day group with the specified token exists, then the special day group is modified.</para>
        <para>A call to this method takes a special day group structure as input parameter. The token field of the SpecialDayGroup structure shall not be empty.</para>
        <para>A device that signals support for the ClientSuppliedTokenSupported capability shall implement this command. </para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">SpecialDayGroup [tsc:SpecialDayGroup]</para>
              <para role="text">The SpecialDayGroup item to create or modify</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="text">This is an empty message.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">env:Receiver - ter:CapabilityViolated - ter:ClientSuppliedTokenSupported</para>
              <para role="text">The device does not support that the client supplies the token</para>
              <para role="param">env:Receiver - ter:CapabilityViolated - ter:MaxSpecialDayGroups</para>
              <para role="text">There is not enough space to add new SpecialDayGroup items, see the MaxSpecialDayGroups capability</para>
              <para role="param">env:Sender - ter:CapabilityViolated - ter:MaxDaysInSpecialDayGroup</para>
              <para role="text">There are too many special days in a SpecialDayGroup, see MaxDaysInSpecialDayGroup capability.</para>
              <para role="param">env:Sender  ter:InvalidArgVal   ter:MissingToken</para>
              <para role="text">The token of the special day group item must be specified.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">WRITE_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
      <section>
        <title>ModifySpecialDayGroup command</title>
        <para>This operation modifies the specified special day group.</para>
        <para>The token of the special day group to modify is specified in the token field of the SpecialDayGroup structure and shall not be empty. All other fields in the structure shall overwrite the fields in the specified special day group.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">SpecialDayGroup [tsc:SpecialDayGroup]</para>
              <para role="text">The SpecialDayGroup item to modify/update.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="text">This is an empty message.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">env:Sender - ter:InvalidArgVal - ter:NotFound</para>
              <para role="text">The specified token not found. </para>
              <para role="param">env:Sender - ter: CapabilityViolated - ter:MaxDaysInSpecialDayGroup</para>
              <para role="text">There are too many special days in a SpecialDayGroup, see MaxDaysInSpecialDayGroup capability.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">WRITE_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
      <section>
        <title>DeleteSpecialDayGroup command</title>
        <para>This method deletes the specified special day group.</para>
        <para>If it is associated with one or more <phrase>schedules </phrase>some devices may not be able to delete the special day group, and consequently a ReferenceInUse fault must be generated. </para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">Token [pt:ReferenceToken]</para>
              <para role="text">The token of the SpecialDayGroup item to delete.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="text">This is an empty message.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">env:Sender  ter:InvalidArgVal   ter:NotFound</para>
              <para role="text">Special day group token is not found.</para>
              <para role="param">env:Sender  ter:InvalidArgVal   ter:ReferenceInUse</para>
              <para role="text">Failed to delete, Special day group token is in use</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">WRITE_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
    </section>
    <section>
      <title>Schedule status</title>
      <section>
        <title>Data structures</title>
        <section>
          <title>ScheduleState</title>
          <para>The ScheduleState contains state information for a schedule. The two fields below forms four different states that a schedule can have.</para>
          <para>The device shall provide the following fields for each ScheduleState instance:</para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">Active</emphasis>
              </para>
              <para>Indicates that the current time is within the boundaries of the schedule or its special days schedules’ time periods. For example, if this schedule is being used for triggering automatic recording on a video source, the Active flag will be true when the schedule-based recording is supposed to record.</para>
            </listitem>
          </itemizedlist>
          <para>To provide more information, the device may include the following optional field:</para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">SpecialDay</emphasis>
              </para>
              <para>Indicates that the current time is within the boundaries of its special days schedules’ time periods. For example, if this schedule is being used for recording at a lower frame rate on a video source during special days, the SpecialDay flag will be true. If special days are not supported by the device, this field may be omitted and interpreted as false by the client.</para>
            </listitem>
          </itemizedlist>
          <para>
            <emphasis role="bold">Example:</emphasis>
          </para>
          <para>Consider a schedule defining a standard schedule that is active from 9 AM to 5 PM during week days. There are two different special day groups; one defining half working days, and one defining bank holidays. The special days schedule defines a time period from 9 AM to 1 PM on half working days.</para>
          <para>
            <xref linkend="_Ref475005468" /> depicts when the four different states occur:</para>
          <figure xml:id="_Ref475005468">
            <title>Schedule states</title>
            <mediaobject>
              <imageobject>
                <imagedata fileref="media/Schedule/image7.svg" contentwidth="160.76mm" />
              </imageobject>
            </mediaobject>
          </figure>
        </section>
      </section>
      <section>
        <title>GetScheduleState command</title>
        <para>This operation requests the ScheduleState for the schedule instance specified by the given token.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">Token [pt:ReferenceToken]</para>
              <para role="text">Token of schedule instance to get ScheduleState.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="param">ScheduleState [tsc:ScheduleState]</para>
              <para role="text">ScheduleState item.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">env:Sender  ter:InvalidArgVal   ter:NotFound</para>
              <para role="text">Schedule token is not found</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">READ_SYSTEM_SENSITIVE</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
    </section>
  </chapter>
  <chapter>
    <title>Notification topics</title>
    <section>
      <title>General</title>
      <para>This section defines notification topics specific to the schedule service. </para>
    </section>
    <section>
      <title>Event overview (informative)</title>
      <para>The schedule service specifies events when schedules or its special days are active and when schedules or special days are changed.</para>
      <para>The main topic for status changes are:</para>
      <itemizedlist>
        <listitem>
          <para>tns1:Schedule/State/Active</para>
        </listitem>
      </itemizedlist>
      <para>The main topics for configuration change notifications are:</para>
      <itemizedlist>
        <listitem>
          <para>tns1:Configuration/Schedule/Changed</para>
        </listitem>
        <listitem>
          <para>tns1:Configuration/Schedule/Removed</para>
        </listitem>
        <listitem>
          <para>tns1:Configuration/SpecialDays/Changed</para>
        </listitem>
        <listitem>
          <para>tns1:Configuration/SpecialDays/Removed</para>
        </listitem>
      </itemizedlist>
    </section>
    <section>
      <title>Status changes</title>
      <section>
        <title>General</title>
        <para>The device shall provide the status change events to inform subscribed clients when schedule entity status is changed. The device shall use the topics defined in this section associated with the respective message description.</para>
      </section>
      <section>
        <title>Schedule</title>
        <para>If the StateReportingSupported capability is set to true then the service/device shall be capable of generating the following event whenever a schedule or its special days becomes active or inactive based on the device time. It’s a property event that indicates if the schedule is active or not. </para>
        <programlisting><![CDATA[Topic: tns1:Schedule/State/Active
<tt:MessageDescription IsProperty="true">
  <tt:Source>
    <tt:SimpleItemDescription Name="ScheduleToken"
      Type="pt:ReferenceToken"/>
    <tt:SimpleItemDescription Name="Name"
      Type="xs:string"/>
  </tt:Source>
  <tt:Data>
    <tt:SimpleItemDescription Name="Active"
      Type="xs:boolean"/>
    <tt:SimpleItemDescription Name="SpecialDay"
      Type="xs:boolean"/>
  </tt:Data>
</tt:MessageDescription>
]]></programlisting>
      </section>
    </section>
    <section>
      <title>Configuration changes</title>
      <section>
        <title>General</title>
        <para>Whenever configuration data has been changed, added or been removed an ONVIF compliant device shall provide these events to inform subscribed clients.</para>
      </section>
      <section>
        <title>Schedule</title>
        <para>Whenever the configuration data for a schedule is changed (including SpecialDaysSchedule) or if a schedule is added, the device shall provide the following event:</para>
        <programlisting><![CDATA[Topic: tns1:Configuration/Schedule/Changed
<tt:MessageDescription IsProperty=”false”>
  <tt:Source>
    <tt:SimpleItemDescription Name=”ScheduleToken”
      Type=”pt:ReferenceToken”/>
  </tt:Source>
</tt: MessageDescription>
]]></programlisting>
        <para>Whenever a schedule is removed, the device shall provide the following event:</para>
        <programlisting><![CDATA[Topic: tns1:Configuration/Schedule/Removed
<tt:MessageDescription IsProperty=”false”>
  <tt:Source>
    <tt:SimpleItemDescription Name=”ScheduleToken”
      Type=”pt:ReferenceToken”/>
  </tt:Source>
</tt:MessageDescription>
]]></programlisting>
      </section>
      <section>
        <title>Special day group</title>
        <para>Whenever the configuration data for a SpecialDayGroup item is changed or added, the device shall provide the following event:</para>
        <programlisting><![CDATA[Topic: tns1:Configuration/SpecialDays/Changed
<tt:MessageDescription IsProperty=”false”>
  <tt:Source>
    <tt:SimpleItemDescription Name=”SpecialDaysToken”
      Type=”pt:ReferenceToken”/>
  </tt:Source>
</tt:MessageDescription>
]]></programlisting>
        <para>Whenever a SpecialDayGroup item is removed, the device shall provide the following event:</para>
        <programlisting><![CDATA[Topic: tns1:Configuration/SpecialDays/Removed
<tt:MessageDescription IsProperty=”false”>
  <tt:Source>
    <tt:SimpleItemDescription Name=”SpecialDaysToken”
      Type=”pt:ReferenceToken”/>
  </tt:Source>
</tt:MessageDescription>
]]></programlisting>
      </section>
    </section>
  </chapter>
  <appendix>
    <title>- Examples</title>
    <para>Note that all iCalendar structures in the examples below are not complete. Only the parts that are explanatory are included.</para>
    <section>
      <title>Access 24*7 for admin staff</title>
      <para>In the following example, the values of SpecialDaysSupported and ExtendedRecurrenceSupported are irrelevant.</para>
      <programlisting><![CDATA[<Schedule token=”402”>
  <Name>Access 24*7</Name>
  <Standard>
    BEGIN:VCALENDAR
    BEGIN:VEVENT
    SUMMARY:Access 24*7
    DTSTART:19700101T000000
    DTEND:19700102T000000
    RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR,SA,SU
    END:VEVENT
    END:VCALENDAR
  </Standard>
</Schedule>
]]></programlisting>
    </section>
    <section>
      <title>Access on Monday and Wednesday from 6 AM to 8 PM for cleaning staff</title>
      <para>In the following example, the values of SpecialDaysSupported and ExtendedRecurrenceSupported are irrelevant.</para>
      <programlisting><![CDATA[<Schedule token=”402”>
  <Name>Access on Monday and Wednesday from 6 AM to 8 PM</Name>
  <Standard>
    BEGIN:VCALENDAR
    BEGIN:VEVENT
    SUMMARY:Access on Monday and Wednesday from 6 AM to 8 PM
    DTSTART:19700105T060000
    DTEND:19700105T200000
    RRULE:FREQ=WEEKLY;BYDAY=MO,WE
    END:VEVENT
    END:VCALENDAR
  </Standard>
</Schedule>
]]></programlisting>
    </section>
    <section>
      <title>Access from Friday 6 PM to Monday 7 AM for maintenance staff</title>
      <para>This example can be realized in two different ways depending on the capabilities of the schedule service exposed by the device.</para>
      <para>
        <emphasis role="bold">Case A</emphasis>
      </para>
      <para>The following example is valid for ExtendedRecurrenceSupported=true. The value of SpecialDaysSupported is irrelevant.</para>
      <para>Note that if ExtendedRecurrenceSupported=false for the example below, the device will throw a fault because the year in DTSTART is not ‘1970’.</para>
      <programlisting><![CDATA[<Schedule token=”402”>
  <Name>Access from Friday 6 PM to Monday 7 AM for maintenance staff</Name>
  <Standard>
    BEGIN:VCALENDAR
    BEGIN:VEVENT
    SUMMARY:Access from Friday 6 PM to Monday 7 AM for maintenance staff
    DTSTART:20140523T180000
    DTEND:20140526T070000
    RRULE:FREQ=WEEKLY;BYDAY=FR
    END:VEVENT
    END:VCALENDAR
  </Standard>
</Schedule>
]]></programlisting>
      <para>
        <emphasis role="bold">Case B</emphasis>
      </para>
      <para>The following example is valid for SpecialDaysSupported=false. The value of ExtendedRecurrenceSupported is irrelevant.</para>
      <programlisting><![CDATA[<Schedule token=”402”>
  <Name>Access from Friday 6 PM to Monday 7 AM for maintenance staff</Name>
  <Standard>
    BEGIN:VCALENDAR
    BEGIN:VEVENT
    SUMMARY:Access from Friday 6 PM to Friday midnight
    DTSTART:19700102T180000
    DTEND:19700103T000000
    RRULE:FREQ=WEEKLY;BYDAY=FR
    END:VEVENT
    BEGIN:VEVENT
    SUMMARY:Access for all Saturdays and all Sundays
    DTSTART:19700103T000000
    DTEND:19700104T000000
    RRULE:FREQ=WEEKLY;BYDAY=SA,SU
    END:VEVENT
    BEGIN:VEVENT
    SUMMARY:Access from Sunday midnight to Monday 7 AM
    DTSTART:19700105T000000
    DTEND:19700105T070000
    RRULE:FREQ=WEEKLY;BYDAY=MO
    END:VEVENT
    END:VCALENDAR
  </Standard>
</Schedule>
]]></programlisting>
    </section>
    <section xml:id="_Ref393782791">
      <title>Access on Weekdays from 8 AM to 5 PM for employees</title>
      <para>In the following example, the values of SpecialDaysSupported and ExtendedRecurrenceSupported are irrelevant.</para>
      <programlisting><![CDATA[<Schedule token=”402”>
  <Name>Access on weekdays from 8 AM to 5 PM for employees</Name>
  <Standard>
    BEGIN:VCALENDAR
    BEGIN:VEVENT
    SUMMARY:Access on weekdays from 8 AM to 5 PM for employees
    DTSTART:19700101T080000
    DTEND: 19700101T170000
    RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR
    END:VEVENT
    END:VCALENDAR
  </Standard>
</Schedule>
]]></programlisting>
    </section>
    <section>
      <title>Access from January 15, 2014, to January 14, 2015, from 9 AM to 6 PM</title>
      <para>This example can be realized in two different ways depending on the capabilities of the schedule service exposed by the device.</para>
      <para>
        <emphasis role="bold">Case A</emphasis>
      </para>
      <para>The following example is valid for ExtendedRecurrenceSupported=true. The value of SpecialDaysSupported is irrelevant.</para>
      <programlisting><![CDATA[<Schedule token=”402”>
  <Name>Access from Jan 15, 2014, to Jan 14, 2015, from 9 AM to 6 PM</Name>
  <Standard>
    BEGIN:VCALENDAR
    BEGIN:VEVENT
    SUMMARY:Access from Jan 15, 2014, to Jan 14, 2015, from 9 AM to 6 PM
    DTSTART:20140115T090000
    DTEND:20150114T180000
    RRULE:FREQ=DAILY
    END:VEVENT
    END:VCALENDAR
  </Standard>
</Schedule>
]]></programlisting>
      <para>
        <emphasis role="bold">Case B</emphasis>
      </para>
      <para>The following example is valid for SpecialDaysSupported=false and ExtendedRecurrenceSupported=false.</para>
      <para>
        <emphasis role="underline">
          <emphasis role="bold">Note:</emphasis>
        </emphasis>
        <emphasis role="bold">
        </emphasis>This scenario cannot be directly implemented in the device using only the schedule if ExtendedRecurrenceSupported capability is not supported. PACS uses start and end dates in access policies which refer schedules. Alternately, the client or the host would need to break the schedule into weekly schedule (whatever recurrence the device supports) and download those schedules to the device whenever the schedule changes (January 15, 2014 and January 14, 2015).</para>
    </section>
    <section>
      <title>Special Days example 1</title>
      <para>An employee has access defined as per the schedule, refer example <xref linkend="_Ref393782791" />. However the site admin wants to restrict access to employees on Christmas day (Thursday) as it is a national holiday. The site admin has a special days entity called ‘National Holidays’ with December 25 added to it. The site admin modifies the schedule to add a special days schedule for the special days entity ‘National Holidays’ to override the access and disable employee from accessing the facility.</para>
      <para>The following example is valid for SpecialDaysSupported=true. The value of ExtendedRecurrenceSupported is irrelevant.</para>
      <programlisting><![CDATA[<SpecialDayGroup token=”8765”>
  <Name>National Holidays</Name>
  <Days>
    BEGIN:VCALENDAR
    PRODID:VERSION:2.0
    BEGIN:VEVENT
    SUMMARY:Christmas day
    DTSTART:20141225T000000
    DTEND:20141226T000000
    UID:Holiday@ONVIF.com
    END:VEVENT
    END:VCALENDAR
  </Days>
  <SpecialDayGroup>
    <Schedule token=”402”>
      <Name>Access on Monday and Wednesday from 8 AM to 5 PM. No access on Christmas day</Name>
      <Standard>
        BEGIN:VCALENDAR
        PRODID:VERSION:2.0
        BEGIN:VEVENT
        SUMMARY:Access on Monday and Wednesday from 8 AM to 5 PM
        DTSTART:19700105T080000
        DTEND:19700105T170000
        RRULE:FREQ=WEEKLY;BYDAY=MO,WE
        UID:Event@ONVIF.com
        END:VEVENT
        END:VCALENDAR
      </Standard>
      <SpecialDaysSchedule>
        <GroupToken>8765</GroupToken>
        <TimeRange></TimeRange>
        <!-- No time period indicates no access on referred special days -->
        </SpecialDaysSchedule>
      </Schedule>
]]></programlisting>
    </section>
    <section>
      <title>Special Days example 2</title>
      <para>A janitor has access defined as per schedule refer example <xref linkend="_Ref393782791" />, however the site admin wants to allow access to cleaning staff on Christmas day (Thursday) as it is a national holiday. The site admin has a special days entity called ‘National Holidays’ with December 25 added to it. The site admin modifies the schedule to add a special day schedule for the special days entity ‘National Holidays’ to override the access and allow janitor to access the facility.</para>
      <para>The following example is valid for SpecialDaysSupported=true. The value of ExtendedRecurrenceSupported is irrelevant.</para>
      <programlisting><![CDATA[<SpecialDayGroup token=”8765”>
  <Name>National Holidays</Name>
  <Days>
    BEGIN:VCALENDAR
    PRODID:VERSION:2.0
    BEGIN:VEVENT
    SUMMARY:Christmas day
    DTSTART:20141225T000000
    DTEND:20141226T000000
    UID:Holiday@ONVIF.com
    END:VEVENT
    END:VCALENDAR
  </Days>
  <SpecialDayGroup>
    <Schedule token=”402”>
      <Name>Access on Monday and Wednesday from 8 AM to 5 PM. No access on Christmas day</Name>
      <Standard>
        BEGIN:VCALENDAR
        PRODID:VERSION:2.0
        BEGIN:VEVENT
        SUMMARY:Access on Monday and Wednesday from 8 AM to 5 PM
        DTSTART:19700105T080000
        DTEND:19700105T170000
        RRULE:FREQ=WEEKLY;BYDAY=MO,WE
        UID:Event@ONVIF.com
        END:VEVENT
        END:VCALENDAR
      </Standard>
      <SpecialDaysSchedule>
        <GroupToken>8765</GroupToken>
        <TimeRange>
          <From>00:00:00</From>
        </TimeRange>
      </SpecialDaysSchedule>
    </Schedule>
]]></programlisting>
    </section>
    <section xml:id="_Ref466987127">
      <title>Special Days example 3</title>
      <para>A standard schedule gives access on weekdays 7 AM to 6 PM, but not on weekends. A special day starts on Friday, June 10, at 2 PM and ends on Saturday, June 11, at 10 AM.  The special days’ schedule defines a time range of 8 AM to 4 PM.</para>
      <programlisting><![CDATA[<SpecialDayGroup token=”7312”>
  <Name>Team building days</Name>
  <Days>
    BEGIN:VCALENDAR
    PRODID:VERSION:2.0
    BEGIN:VEVENT
    SUMMARY:Boot camp
    DTSTART:20160610T140000
    DTEND:20160611T100000
    UID:TeamBuilding@ONVIF.com
    END:VEVENT
    END:VCALENDAR
  </Days>
  <SpecialDayGroup>
    <Schedule token=”245”>
      <Name>Employee schedule 2016</Name>
      <Description>Access on weekdays from 7 AM to 6 PM.
        Access from 8 AM to 4 PM on Team building days</Description>
        <Standard>
          BEGIN:VCALENDAR
          PRODID:VERSION:2.0
          BEGIN:VEVENT
          SUMMARY:Access on weekdays from 7 AM to 6 PM
          DTSTART:20160101T070000
          DTEND:20161231T180000
          RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR
          UID:Workhours@ONVIF.com
          END:VEVENT
          END:VCALENDAR
        </Standard>
        <SpecialDaysSchedule>
          <GroupToken>7312</GroupToken>
          <StartTime>08:00:00</StartTime>
          <Until>16:00:00</Until>
        </SpecialDaysSchedule>
      </Schedule>
]]></programlisting>
    </section>
  </appendix>
  <appendix role="revhistory">
    <title>Revision History</title>
    <para />
  </appendix>
</book>
