Increment/decrement servicesAvailable in rules for 'adding an available service' and 'removing an available service' based on the original requested control types provided in the original getNetworkServices() call (from: http://lists.w3.org/Archives/Public/public-device-apis/2012Oct/0020.html)
authorRich Tibbett <richt@opera.com>
Mon, 04 Feb 2013 15:52:32 +0100
changeset 375 f290bbd84426
parent 374 07e931de937f
child 376 631133236bc9
Increment/decrement servicesAvailable in rules for 'adding an available service' and 'removing an available service' based on the original requested control types provided in the original getNetworkServices() call (from: http://lists.w3.org/Archives/Public/public-device-apis/2012Oct/0020.html)
discovery-api/Overview.src.html
--- a/discovery-api/Overview.src.html	Mon Feb 04 15:24:33 2013 +0100
+++ b/discovery-api/Overview.src.html	Mon Feb 04 15:52:32 2013 +0100
@@ -483,6 +483,8 @@
             <li>Let <var>services manager</var> be a new <a href="#networkservices"><code>NetworkServices</code></a>
             object.
             </li>
+            <li>Store <var>requested control types</var> against <var>services manager</var> as an internal variable.
+            </li>
             <li>Set <var>services manager</var>'s <a href=
             "#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute to the number of
             items currently found in the <a>list of available service records</a> whose <code>type</code> property
@@ -1032,16 +1034,8 @@
         </li>
         <li>For each <var>service manager</var> in the <a>list of active service managers</a> run the following steps:
           <ol class="rule">
-            <li>Let <var>'service type in current service manager' flag</var> be <code>false</code>.
-            </li>
             <li>For each <var>active service</var> in <var>service manager</var> run the following steps:
               <ol class="rule">
-                <li>If <var>network service record</var>'s <code>type</code> property does not equal <var>active
-                service</var>'s <code>type</code> attribute then abort any remaining sub-steps for this <var>active
-                service</var> and continue at the next available <var>active service</var>.
-                </li>
-                <li>Set the <var>'service type in current service manager' flag</var> to <code>true</code>.
-                </li>
                 <li>If the <var>network service record</var>'s <code>id</code> property equals the <var>active
                 service</var>'s <code>id</code> attribute then set <var>active service</var>'s <a href=
                 "#dom-networkservice-online"><code>online</code></a> attribute to <code>true</code> and then <a href=
@@ -1054,6 +1048,20 @@
                 </li>
               </ol>
             </li>
+            <li>Let <var>'service type in current service manager' flag</var> be <code>false</code>.
+            </li>
+            <li>For each <var>requested control type</var> of the <var>requested control types</var> in <var>service
+            manager</var> run the following steps:
+              <ol class="rule">
+                <li>If <var>network service record</var>'s <code>type</code> property does not equal <var>requested
+                control type</var> then abort any remaining sub-steps and continue at the next available <var>requested
+                control type</var>.
+                </li>
+                <li>Set the <var>'service type in current service manager' flag</var> to <code>true</code>, abort any
+                remaining sub-steps and continue.
+                </li>
+              </ol>
+            </li>
             <li>If the <var>'service type in current service manager' flag</var> is set to <code>true</code> then
             increment <var>service manager</var>'s <a href=
             "#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute by <code>1</code> and
@@ -1093,12 +1101,6 @@
                 </li>
                 <li>For each <var>active service</var> in <var>service manager</var> run the following steps:
                   <ol class="rule">
-                    <li>If <var>existing service record</var>'s <code>type</code> property does not equal the
-                    <var>active service</var>'s <code>type</code> attribute then abort any remaining sub-steps for this
-                    <var>active service</var> and continue at the next available <var>active service</var>.
-                    </li>
-                    <li>Set the <var>'service type in current service manager' flag</var> to <code>true</code>.
-                    </li>
                     <li>If <var>existing service record</var>'s <code>id</code> property equals the <var>active
                     service</var>'s <code>id</code> attribute and <var>active service</var>'s <a href=
                     "#dom-networkservice-online"><code>online</code></a> attribute is currently set to
@@ -1113,6 +1115,18 @@
                     </li>
                   </ol>
                 </li>
+                <li>For each <var>requested control type</var> of the <var>requested control types</var> in
+                <var>service manager</var> run the following steps:
+                  <ol class="rule">
+                    <li>If <var>existing service record</var>'s <code>type</code> property does not equal
+                    <var>requested control type</var> then abort any remaining sub-steps and continue at the next
+                    available <var>requested control type</var>.
+                    </li>
+                    <li>Set the <var>'service type in current service manager' flag</var> to <code>true</code>, abort
+                    any remaining sub-steps and continue.
+                    </li>
+                  </ol>
+                </li>
                 <li>If the <var>'service type in current service manager' flag</var> is set to <code>true</code> then
                 decrement <var>service manager</var>'s <a href=
                 "#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute by <code>1</code>