<!--
........................................................................................................................
Description:
    The rule file is used for controlling the oriention
    sensor channel for automatic UI rotation.
........................................................................................................................
-->
<script xmlns="http://www.nokia.com/ns/cep/script/1.0/"
xmlns:cep="http://www.nokia.com/ns/cep/1.0/">

<!--
........................................................................................................................
Description:
    Activate orientation events from sensor.
........................................................................................................................
-->
   <if>
        <and>
            <!-- Sensor setting is currently ON -->
            <equals>
                <contextRef source='Sensor' type='Setting.Active' value='On'/>
            </equals>
            <and>
               <equals>
                  <contextRef source='SysAp' type='LightEvent.GripOpenState' value='False'/>
               </equals>
               <or>
                   <!-- Key lock is disabled -->
                   <contextChanged>
                       <contextRef source='SysAp' type='LightEvent.KeyLockState' value='False'/>
                   </contextChanged>
                   
                   <!-- Device lock is disabled -->
                   <contextChanged>
                       <contextRef source='SysAp' type='LightEvent.DeviceLockState' value='False'/>
                   </contextChanged>   
                   <contextChanged>
                       <contextRef source='SysAp' type='LightEvent.GripOpenState' value='False'/>
                   </contextChanged>           
                   <equals>
                       <contextRef source='Device' type='Display.Light.Status' value='On'/>
                   </equals>
               </or>
           </and>
        </and>
       <actions>
           <!-- Activate orientation channel (0x01) from sensor source with feature id: fea.autorotateui -->
           <sourceCommand uid='0x10282DF0'>
               <sensorCommand channelId='0x01' id='activate' featureId='fea.autorotateui'/>
           </sourceCommand>
       </actions>
   </if>
   <else>
       <actions>
           <!-- Activate orientation channel (0x01) from sensor source with feature id: fea.autorotateui -->
           <sourceCommand uid='0x10282DF0'>
               <sensorCommand channelId='0x01' id='deactivate' featureId='fea.autorotateui'/>
           </sourceCommand>
       </actions>
   </else>
</script>