You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by do...@apache.org on 2010/07/11 18:56:23 UTC
svn commit: r963111 - in /felix/sandbox/donsez/upnp.lowpower: ./ src/
src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/felix/ src/main/java/org/apache/felix/upnp/
src/main/java/org/apache/felix/upnp/lowpowe...
Author: donsez
Date: Sun Jul 11 16:56:22 2010
New Revision: 963111
URL: http://svn.apache.org/viewvc?rev=963111&view=rev
Log:
create a UPnP device to demonstrate the UPnP LowPower spec. v 1.0 http://upnp.org/specs/lp/lp1/
Added:
felix/sandbox/donsez/upnp.lowpower/ (with props)
felix/sandbox/donsez/upnp.lowpower/LICENSE
felix/sandbox/donsez/upnp.lowpower/NOTICE
felix/sandbox/donsez/upnp.lowpower/pom.xml
felix/sandbox/donsez/upnp.lowpower/src/
felix/sandbox/donsez/upnp.lowpower/src/main/
felix/sandbox/donsez/upnp.lowpower/src/main/java/
felix/sandbox/donsez/upnp.lowpower/src/main/java/org/
felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/
felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/
felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/
felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/
felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/activator/
felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/activator/impl/
felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/activator/impl/Activator.java
felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/controlpoint/
felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/controlpoint/LowPowerDeviceProxyImpl.java
felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/controlpoint/LowPowerProxyProxyImpl.java
felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/device/
felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/device/LowPower.java
felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/impl/
felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/impl/LowPowerDeviceModelImpl.java
felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/impl/LowPowerProxyModelImpl.java
felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/model/
felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/model/LowPowerDeviceModel.java
felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/model/LowPowerProxyModel.java
felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/service/
felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/service/LowPowerDevice.java
felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/service/LowPowerProxy.java
felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/widget/
felix/sandbox/donsez/upnp.lowpower/src/main/resources/
felix/sandbox/donsez/upnp.lowpower/src/main/resources/icon/
felix/sandbox/donsez/upnp.lowpower/src/main/resources/icon/power.png (with props)
Propchange: felix/sandbox/donsez/upnp.lowpower/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Jul 11 16:56:22 2010
@@ -0,0 +1,5 @@
+.classpath
+.project
+.settings
+doc
+target
Added: felix/sandbox/donsez/upnp.lowpower/LICENSE
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.lowpower/LICENSE?rev=963111&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.lowpower/LICENSE (added)
+++ felix/sandbox/donsez/upnp.lowpower/LICENSE Sun Jul 11 16:56:22 2010
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
Added: felix/sandbox/donsez/upnp.lowpower/NOTICE
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.lowpower/NOTICE?rev=963111&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.lowpower/NOTICE (added)
+++ felix/sandbox/donsez/upnp.lowpower/NOTICE Sun Jul 11 16:56:22 2010
@@ -0,0 +1,13 @@
+Apache Felix (sandbox) UPnP LowPower Demonstrator
+Copyright 2010 The Apache Software Foundation
+
+I. Included Software
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+Licensed under the Apache License 2.0.
+
+II. Used Software
+
+III. License Summary
+- Apache License 2.0
Added: felix/sandbox/donsez/upnp.lowpower/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.lowpower/pom.xml?rev=963111&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.lowpower/pom.xml (added)
+++ felix/sandbox/donsez/upnp.lowpower/pom.xml Sun Jul 11 16:56:22 2010
@@ -0,0 +1,80 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project>
+
+ <properties>
+ <repositoryLocation>http://www.apache.org/~donsez/dev/osgi/</repositoryLocation>
+ <description>provides an UPnP Device providing LowPower services.</description>
+ </properties>
+
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>bundle</packaging>
+ <name>Apache Felix UPnP LowPower Demonstrator</name>
+ <artifactId>org.apache.felix.upnp.lowpower</artifactId>
+ <groupId>org.apache.felix.sandbox</groupId>
+ <version>0.1.0</version>
+ <description>${description}</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>1.4.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>1.4.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix.sandbox</groupId>
+ <artifactId>org.apache.felix.upnp.devicegen.util</artifactId>
+ <version>0.1.0</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+
+ <!-- docs in http://cwiki.apache.org/FELIX/bundle-plugin-for-maven-bnd.html and http://cwiki.apache.org/FELIX/osgi-plugin-for-maven-2.html -->
+
+ <Export-Service>org.osgi.service.upnp.UPnPDevice</Export-Service>
+
+ <Private-Package>org.apache.felix.upnp.lowpower.*</Private-Package>
+ <Import-Package>*</Import-Package>
+ <Bundle-Activator>${pom.artifactId}.activator.impl.Activator</Bundle-Activator>
+
+ <Bundle-DocURL>${repositoryLocation}${pom.artifactId}/index.html</Bundle-DocURL>
+ <Bundle-Url>${repositoryLocation}${pom.artifactId}/${pom.artifactId}-${pom.version}.jar</Bundle-Url>
+ <Bundle-Source>${repositoryLocation}${pom.artifactId}/${pom.artifactId}-${pom.version}-src.jar</Bundle-Source>
+
+ <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+ <Bundle-Description>${description}</Bundle-Description>
+ <Bundle-Vendor>Apache Software Foundation</Bundle-Vendor>
+
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/activator/impl/Activator.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/activator/impl/Activator.java?rev=963111&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/activator/impl/Activator.java (added)
+++ felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/activator/impl/Activator.java Sun Jul 11 16:56:22 2010
@@ -0,0 +1,25 @@
+/*
+ */
+package org.apache.felix.upnp.lowpower.activator.impl;
+
+import org.apache.felix.upnp.lowpower.device.LowPower;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class Activator implements BundleActivator {
+
+ LowPower lowPower;
+
+ public void start(BundleContext bundleContext) throws Exception {
+ lowPower=new LowPower(bundleContext,null);
+ lowPower.start(bundleContext);
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ lowPower.stop(bundleContext);
+ }
+}
Added: felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/controlpoint/LowPowerDeviceProxyImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/controlpoint/LowPowerDeviceProxyImpl.java?rev=963111&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/controlpoint/LowPowerDeviceProxyImpl.java (added)
+++ felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/controlpoint/LowPowerDeviceProxyImpl.java Sun Jul 11 16:56:22 2010
@@ -0,0 +1,169 @@
+
+/*
+__BANNER__
+*/
+// this file was generated at 11-July-2010 04:42 PM by ${author}
+package org.apache.felix.upnp.lowpower.controlpoint;
+
+import org.apache.felix.upnp.devicegen.holder.*;
+import org.apache.felix.upnp.lowpower.model.*;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPException;
+import org.osgi.service.upnp.UPnPService;
+
+
+public class LowPowerDeviceProxyImpl implements LowPowerDeviceModel {
+
+ private UPnPService upnpService;
+ LowPowerDeviceProxyImpl(UPnPService upnpService){
+ super();
+ this.upnpService=upnpService;
+ }
+
+
+ /**
+ * This method is "add description here"
+ * wakeupMethod out parameter
+
+ * powerSupplyStatus out parameter
+
+
+ */
+ public void getPowerManagementInfo(
+ StringHolder wakeupMethod,
+
+StringHolder powerSupplyStatus
+ ) throws UPnPException {
+
+ UPnPAction upnpAction = upnpService.getAction("getPowerManagementInfo");
+
+ Dictionary _parameters = new Hashtable();
+
+ // TODO _parameters.put("InParam", inparam);
+
+ Dictionary _result;
+ try {
+ _result = upnpAction.invoke(_parameters);
+ } catch (UPnPException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new UPnPException(UPnPException.DEVICE_INTERNAL_ERROR,e.getMessage());
+ }
+
+ // TODO outparam.setType((Type) _result.get("OutParam"));
+ }
+
+
+ /**
+ * This method is "add description here"
+ * recommendedSleepPeriod in parameter
+
+ * recommendedPowerState in parameter
+
+ * sleepPeriod out parameter
+
+ * powerState out parameter
+
+
+ */
+ public void goToSleep(
+ int recommendedSleepPeriod,
+
+java.lang.String recommendedPowerState,
+
+IntegerHolder sleepPeriod,
+
+StringHolder powerState
+ ) throws UPnPException {
+
+ UPnPAction upnpAction = upnpService.getAction("goToSleep");
+
+ Dictionary _parameters = new Hashtable();
+
+ // TODO _parameters.put("InParam", inparam);
+
+ Dictionary _result;
+ try {
+ _result = upnpAction.invoke(_parameters);
+ } catch (UPnPException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new UPnPException(UPnPException.DEVICE_INTERNAL_ERROR,e.getMessage());
+ }
+
+ // TODO outparam.setType((Type) _result.get("OutParam"));
+ }
+
+
+ /**
+ * This method is "add description here"
+
+ */
+ public void wakeup(
+
+ ) throws UPnPException {
+
+ UPnPAction upnpAction = upnpService.getAction("wakeup");
+
+ Dictionary _parameters = new Hashtable();
+
+ // TODO _parameters.put("InParam", inparam);
+
+ Dictionary _result;
+ try {
+ _result = upnpAction.invoke(_parameters);
+ } catch (UPnPException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new UPnPException(UPnPException.DEVICE_INTERNAL_ERROR,e.getMessage());
+ }
+
+ // TODO outparam.setType((Type) _result.get("OutParam"));
+ }
+
+
+
+ // Those listeners are used for the subscription to state variable change
+
+ // TODO current listeners list
+
+ public void addListenerOnExternalPowerSupplySourceStateVariableValue(/*TODO Listener listener*/){
+ // TODO java.lang.Integer
+ return;
+ }
+ public void removeListenerOnExternalPowerSupplySourceStateVariableValue(/*TODO Listener listener*/){
+ // TODO
+ return;
+ }
+
+ // TODO current listeners list
+
+ public void addListenerOnBatteryLowStateVariableValue(/*TODO Listener listener*/){
+ // TODO java.lang.Boolean
+ return;
+ }
+ public void removeListenerOnBatteryLowStateVariableValue(/*TODO Listener listener*/){
+ // TODO
+ return;
+ }
+
+
+
+ // Those getters are used for ??? may be not useful !!!
+
+ public java.lang.Integer getExternalPowerSupplySourceStateVariableValue(){
+ // TODO
+ return null;
+ }
+
+ public java.lang.Boolean getBatteryLowStateVariableValue(){
+ // TODO
+ return null;
+ }
+
+
+
+}
Added: felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/controlpoint/LowPowerProxyProxyImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/controlpoint/LowPowerProxyProxyImpl.java?rev=963111&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/controlpoint/LowPowerProxyProxyImpl.java (added)
+++ felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/controlpoint/LowPowerProxyProxyImpl.java Sun Jul 11 16:56:22 2010
@@ -0,0 +1,106 @@
+
+/*
+__BANNER__
+*/
+// this file was generated at 11-July-2010 04:42 PM by ${author}
+package org.apache.felix.upnp.lowpower.controlpoint;
+
+import org.apache.felix.upnp.devicegen.holder.*;
+import org.apache.felix.upnp.lowpower.model.*;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPException;
+import org.osgi.service.upnp.UPnPService;
+
+
+public class LowPowerProxyProxyImpl implements LowPowerProxyModel {
+
+ private UPnPService upnpService;
+ LowPowerProxyProxyImpl(UPnPService upnpService){
+ super();
+ this.upnpService=upnpService;
+ }
+
+
+ /**
+ * This method is "add description here"
+ * searchCriteria in parameter
+
+ * powerState in parameter
+
+ * deviceList out parameter
+
+
+ */
+ public void searchSleepingDevices(
+ java.lang.String searchCriteria,
+
+int powerState,
+
+StringHolder deviceList
+ ) throws UPnPException {
+
+ UPnPAction upnpAction = upnpService.getAction("searchSleepingDevices");
+
+ Dictionary _parameters = new Hashtable();
+
+ // TODO _parameters.put("InParam", inparam);
+
+ Dictionary _result;
+ try {
+ _result = upnpAction.invoke(_parameters);
+ } catch (UPnPException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new UPnPException(UPnPException.DEVICE_INTERNAL_ERROR,e.getMessage());
+ }
+
+ // TODO outparam.setType((Type) _result.get("OutParam"));
+ }
+
+
+ /**
+ * This method is "add description here"
+ * uuid in parameter
+
+ * success out parameter
+
+
+ */
+ public void wakeupDevice(
+ java.lang.String uuid,
+
+BooleanHolder success
+ ) throws UPnPException {
+
+ UPnPAction upnpAction = upnpService.getAction("wakeupDevice");
+
+ Dictionary _parameters = new Hashtable();
+
+ // TODO _parameters.put("InParam", inparam);
+
+ Dictionary _result;
+ try {
+ _result = upnpAction.invoke(_parameters);
+ } catch (UPnPException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new UPnPException(UPnPException.DEVICE_INTERNAL_ERROR,e.getMessage());
+ }
+
+ // TODO outparam.setType((Type) _result.get("OutParam"));
+ }
+
+
+
+ // Those listeners are used for the subscription to state variable change
+
+
+
+ // Those getters are used for ??? may be not useful !!!
+
+
+
+}
Added: felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/device/LowPower.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/device/LowPower.java?rev=963111&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/device/LowPower.java (added)
+++ felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/device/LowPower.java Sun Jul 11 16:56:22 2010
@@ -0,0 +1,134 @@
+
+/*
+__BANNER__
+*/
+// this file was generated at 11-July-2010 04:42 PM by ${author}
+package org.apache.felix.upnp.lowpower.device;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.felix.upnp.devicegen.util.AbstractUPnPDevice;
+import org.apache.felix.upnp.devicegen.util.DeviceIcon;
+import org.apache.felix.upnp.lowpower.impl.LowPowerDeviceModelImpl;
+import org.apache.felix.upnp.lowpower.impl.LowPowerProxyModelImpl;
+import org.apache.felix.upnp.lowpower.model.LowPowerDeviceModel;
+import org.apache.felix.upnp.lowpower.model.LowPowerProxyModel;
+import org.apache.felix.upnp.lowpower.service.LowPowerDevice;
+import org.apache.felix.upnp.lowpower.service.LowPowerProxy;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.upnp.UPnPDevice;
+import org.osgi.service.upnp.UPnPIcon;
+import org.osgi.service.upnp.UPnPService;
+
+
+
+
+public class LowPower extends AbstractUPnPDevice {
+
+ public LowPower(BundleContext context, AbstractUPnPDevice parent) {
+ super(context,parent);
+
+ DEVICE_ID="uuid:felix-lowpower";
+
+ // ServiceModel Declaration List
+ LowPowerDeviceModel myLowPowerDeviceModel=new LowPowerDeviceModelImpl(context);
+ LowPowerProxyModel myLowPowerProxyModel = new LowPowerProxyModelImpl(context);
+
+
+ // Icon Lists
+
+ List iconsList=new LinkedList();
+
+ iconsList.add(
+ new DeviceIcon(
+ "image/png", // MimeType
+ 48, //Width
+ 48, // Height
+ 0, // ??
+ 16, // Depth
+ "/icon/power.png", // URL
+ LowPower.class.getClassLoader()
+ )
+ );
+
+ icons=(UPnPIcon[])iconsList.toArray(new UPnPIcon[]{});
+
+
+ // Service List
+
+ List servicesList=new LinkedList();
+
+
+ /*
+ SCPDURL=URL to service description
+ controlURL=URL for control
+ eventSubURL=URL for eventing
+ */
+ servicesList.add(
+ new LowPowerDevice(
+ this,
+ "urn:upnp-org:serviceId:LowPowerDevice:1",
+ "urn:schemas-upnp-org:service:LowPowerDevice:1",
+ "1",
+ myLowPowerDeviceModel
+ )
+ );
+
+
+ /*
+ SCPDURL=URL to service description
+ controlURL=URL for control
+ eventSubURL=URL for eventing
+ */
+ servicesList.add(
+ new LowPowerProxy(
+ this,
+ "urn:upnp-org:serviceId:LowPowerProxy:1",
+ "urn:schemas-upnp-org:service:LowPowerProxy:1",
+ "1",
+ myLowPowerProxyModel
+ )
+ );
+
+ services=(UPnPService[])servicesList.toArray(new UPnPService[]{});
+
+
+ // Embedded Device List
+
+ //children=new LinkedList();
+
+
+ }
+
+ protected void setupDeviceProperties(){
+ dictionary.put(UPnPDevice.TYPE,"urn:schemas-upnp-org:device:LowPower:1");
+ dictionary.put(UPnPDevice.FRIENDLY_NAME,"LowPower Device and Proxy UPnP Device");
+ dictionary.put(UPnPDevice.MANUFACTURER,"Felix team");
+ dictionary.put(UPnPDevice.MANUFACTURER_URL,"http://www.apache.org/~donsez");
+ dictionary.put(UPnPDevice.MODEL_DESCRIPTION,"LowPower Device and Proxy UPnP Device");
+ dictionary.put(UPnPDevice.MODEL_NAME,"LowPower Device and Proxy");
+ dictionary.put(UPnPDevice.MODEL_NUMBER,"123");
+ dictionary.put(UPnPDevice.MODEL_URL,"http://www.apache.org/~donsez/dev/osgi/upnp.devicegen/readme.html");
+ dictionary.put(UPnPDevice.SERIAL_NUMBER,"123456789");
+ dictionary.put(UPnPDevice.UDN,getUDN());
+ dictionary.put(UPnPDevice.ID,dictionary.get(UPnPDevice.UDN));
+ dictionary.put(UPnPDevice.UPC,"upc:felix-lowpower");
+ dictionary.put(UPnPDevice.PRESENTATION_URL,"http://www.apache.org/~donsez/dev/osgi/upnp.devicegen/readme.html");
+
+ if(parent!=null) {
+ dictionary.put(UPnPDevice.PARENT_UDN,parent.getUDN());
+ }
+
+ if(children!=null && children.size()!=0){
+ String[] childrenUDN=new String[children.size()];
+ Iterator iter=children.iterator();
+ for(int i=0;iter.hasNext();i++){
+ childrenUDN[i]=((AbstractUPnPDevice)iter.next()).getUDN();
+ }
+ dictionary.put(UPnPDevice.CHILDREN_UDN,childrenUDN);
+ }
+
+ }
+}
Added: felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/impl/LowPowerDeviceModelImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/impl/LowPowerDeviceModelImpl.java?rev=963111&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/impl/LowPowerDeviceModelImpl.java (added)
+++ felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/impl/LowPowerDeviceModelImpl.java Sun Jul 11 16:56:22 2010
@@ -0,0 +1,152 @@
+/*
+ __BANNER__
+ */
+// this file was generated at 11-July-2010 04:42 PM by ${author}
+package org.apache.felix.upnp.lowpower.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.felix.upnp.devicegen.holder.*;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.upnp.UPnPException;
+import org.apache.felix.upnp.lowpower.model.*;
+import org.apache.felix.upnp.lowpower.service.LowPowerDevice.PowerStateStateVariable;
+import org.apache.felix.upnp.lowpower.service.LowPowerDevice.SleepPeriodStateVariable;
+
+public class LowPowerDeviceModelImpl implements LowPowerDeviceModel {
+
+ private boolean isWindowsPlatform = false;
+ private boolean isLinuxPlatform = false;
+
+ public LowPowerDeviceModelImpl(BundleContext context) {
+ setPlatform();
+ }
+
+ /**
+ * This method is "add description here" wakeupMethod out parameter
+ *
+ * powerSupplyStatus out parameter
+ */
+ public void getPowerManagementInfo(
+ StringHolder wakeupMethod,
+ StringHolder powerSupplyStatus) throws UPnPException {
+ throw new UPnPException(UPnPException.DEVICE_INTERNAL_ERROR,
+ "Not implemented");
+ }
+
+ /**
+ * This method is "add description here" recommendedSleepPeriod in parameter
+ *
+ * recommendedPowerState in parameter
+ *
+ * sleepPeriod out parameter
+ *
+ * powerState out parameter
+ */
+ public void goToSleep(int recommendedSleepPeriod,java.lang.String recommendedPowerState,IntegerHolder sleepPeriod,StringHolder powerState) throws UPnPException {
+
+
+ int _recommendedPowerState;
+ try {
+ _recommendedPowerState=Integer.parseInt(recommendedPowerState);
+ } catch (NumberFormatException e) {
+ throw new UPnPException(UPnPException.INVALID_ARGS, "Invalid recommendedPowerState");
+ }
+ switch(_recommendedPowerState) {
+ case PowerStateStateVariable.POWERSTATE_ACTIVE: break;
+ case PowerStateStateVariable.POWERSTATE_TRANSPARENT: break;
+ case PowerStateStateVariable.POWERSTATE_DEEPSLEEP: break;
+ case PowerStateStateVariable.POWERSTATE_OFFLINE: break;
+ default: throw new UPnPException(UPnPException.INVALID_ARGS, "Invalid recommendedPowerState");
+ }
+
+ if(_recommendedPowerState==PowerStateStateVariable.POWERSTATE_DEEPSLEEP && isWindowsPlatform) {
+ sleepPeriod.setValue(SleepPeriodStateVariable.SLEEPPERIOD_INFINITE);
+ powerState.setValue(Integer.toString(PowerStateStateVariable.POWERSTATE_DEEPSLEEP));
+ Thread t=new Thread(new Runnable() {
+ public void run() {
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ }
+ hibernate();
+ }
+ });
+ t.setName("LowPower GoToSleep");
+ t.start();
+ return;
+ } else {
+ throw new UPnPException(LowPowerDeviceModel.ERROR_GOTOSLEEP_POWERSTATE_NOT_IMPLEMENTED, "Not implemented");
+ }
+ }
+
+ /*
+ * os.name can be AIX Digital Unix FreeBSD HP UX Irix Linux Mac OS Mac OS X MPE/iX
+ * Netware 4.11 OS/2 Solaris Windows 2000 Windows 7 Windows 95 Windows 98
+ * Windows NT Windows Vista Windows XP
+ */
+
+ private void setPlatform() {
+ String osName = System.getProperty("os.name").toLowerCase();
+ if (osName.startsWith("windows"))
+ isWindowsPlatform = true;
+ if (osName.startsWith("linux"))
+ isLinuxPlatform = true;
+ }
+
+ public void hibernate() {
+ if (isWindowsPlatform) {
+ exec("C:\\WINDOWS\\system32", new String[] { "rundll32.exe",
+ "powrprof.dll,SetSuspendState", "Hibernate" }, null);
+ } else if (isLinuxPlatform) {
+ // TODO
+ }
+ }
+
+ private void exec(String dir, String[] args, Map/*<String, String>*/ environment) {
+ ProcessBuilder pb = new ProcessBuilder(args);
+ if (environment != null) {
+ Map/*<String, String>*/ env = pb.environment();
+ env.clear();
+ Iterator iter=environment.entrySet().iterator();
+ while(iter.hasNext()) {
+ Map.Entry/*<String, String>*/ e= (Map.Entry) iter.next();
+ env.put(e.getKey(), e.getValue());
+ }
+ }
+ pb.directory(new File(dir));
+ try {
+ Process p = pb.start();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * This method is "add description here"
+ */
+ public void wakeup(
+
+ ) throws UPnPException {
+ // TODO
+ throw new UPnPException(UPnPException.DEVICE_INTERNAL_ERROR,
+ "Not implemented");
+ }
+
+ // Those getters are used for the first notification just after a
+ // subscription
+
+ public java.lang.Integer getExternalPowerSupplySourceStateVariableValue() {
+ // TODO
+ return null;
+ }
+
+ public java.lang.Boolean getBatteryLowStateVariableValue() {
+ // TODO
+ return null;
+ }
+
+}
Added: felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/impl/LowPowerProxyModelImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/impl/LowPowerProxyModelImpl.java?rev=963111&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/impl/LowPowerProxyModelImpl.java (added)
+++ felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/impl/LowPowerProxyModelImpl.java Sun Jul 11 16:56:22 2010
@@ -0,0 +1,50 @@
+/*
+ __BANNER__
+ */
+// this file was generated at 11-July-2010 04:42 PM by ${author}
+package org.apache.felix.upnp.lowpower.impl;
+
+import org.apache.felix.upnp.devicegen.holder.*;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.upnp.UPnPException;
+import org.apache.felix.upnp.lowpower.model.*;
+
+public class LowPowerProxyModelImpl implements LowPowerProxyModel {
+
+ public LowPowerProxyModelImpl(BundleContext context) {
+ }
+
+ /**
+ * This method is "add description here" searchCriteria in parameter
+ *
+ * powerState in parameter
+ *
+ * deviceList out parameter
+ */
+ public void searchSleepingDevices(java.lang.String searchCriteria,
+
+ int powerState,
+
+ StringHolder deviceList) throws UPnPException {
+ // TODO
+ throw new UPnPException(UPnPException.DEVICE_INTERNAL_ERROR,
+ "Not implemented");
+ }
+
+ /**
+ * This method is "add description here" uuid in parameter
+ *
+ * success out parameter
+ */
+ public void wakeupDevice(java.lang.String uuid,
+
+ BooleanHolder success) throws UPnPException {
+ // TODO
+ throw new UPnPException(UPnPException.DEVICE_INTERNAL_ERROR,
+ "Not implemented");
+ }
+
+ // Those getters are used for the first notification just after a
+ // subscription
+
+}
Added: felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/model/LowPowerDeviceModel.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/model/LowPowerDeviceModel.java?rev=963111&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/model/LowPowerDeviceModel.java (added)
+++ felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/model/LowPowerDeviceModel.java Sun Jul 11 16:56:22 2010
@@ -0,0 +1,57 @@
+/*
+ __BANNER__
+ */
+// this file was generated at 11-July-2010 04:42 PM by ${author}
+package org.apache.felix.upnp.lowpower.model;
+
+import org.apache.felix.upnp.devicegen.holder.*;
+import org.osgi.service.upnp.UPnPException;
+
+public interface LowPowerDeviceModel {
+
+ // Error codes for GoToSleep section 2.5.3.5
+
+ public final static int ERROR_GOTOSLEEP_REJECTPOWERSTATE = 705;
+ public final static int ERROR_GOTOSLEEP_POWERSTATE_NOT_IMPLEMENTED = 706;
+
+ /**
+ * This method is "add description here" wakeupMethod out parameter
+ *
+ * powerSupplyStatus out parameter
+ */
+ public void getPowerManagementInfo(StringHolder wakeupMethod,
+
+ StringHolder powerSupplyStatus) throws UPnPException;
+
+ // TODO return the type of the return argument when specified
+
+ /**
+ * This method is "add description here" recommendedSleepPeriod in parameter
+ *
+ * recommendedPowerState in parameter
+ *
+ * sleepPeriod out parameter
+ *
+ * powerState out parameter
+ */
+ public void goToSleep(int recommendedSleepPeriod,
+ String recommendedPowerState, IntegerHolder sleepPeriod,
+ StringHolder powerState) throws UPnPException;
+
+ /**
+ * This method is "add description here"
+ */
+ public void wakeup(
+
+ ) throws UPnPException;
+
+ // TODO return the type of the return argument when specified
+
+ // Those getters are used for the first notification just after a
+ // subscription
+
+ public java.lang.Integer getExternalPowerSupplySourceStateVariableValue();
+
+ public java.lang.Boolean getBatteryLowStateVariableValue();
+
+}
Added: felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/model/LowPowerProxyModel.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/model/LowPowerProxyModel.java?rev=963111&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/model/LowPowerProxyModel.java (added)
+++ felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/model/LowPowerProxyModel.java Sun Jul 11 16:56:22 2010
@@ -0,0 +1,53 @@
+
+/*
+__BANNER__
+*/
+// this file was generated at 11-July-2010 04:42 PM by ${author}
+package org.apache.felix.upnp.lowpower.model;
+
+import org.apache.felix.upnp.devicegen.holder.*;
+import org.osgi.service.upnp.UPnPException;
+
+
+public interface LowPowerProxyModel {
+
+ /**
+ * This method is "add description here"
+ * searchCriteria in parameter
+
+ * powerState in parameter
+
+ * deviceList out parameter
+
+
+ */
+ public void searchSleepingDevices(
+ java.lang.String searchCriteria,
+
+int powerState,
+
+StringHolder deviceList
+ ) throws UPnPException;
+ // TODO return the type of the return argument when specified
+
+
+ /**
+ * This method is "add description here"
+ * uuid in parameter
+
+ * success out parameter
+
+
+ */
+ public void wakeupDevice(
+ java.lang.String uuid,
+
+BooleanHolder success
+ ) throws UPnPException;
+ // TODO return the type of the return argument when specified
+
+
+
+ // Those getters are used for the first notification just after a subscription
+
+}
Added: felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/service/LowPowerDevice.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/service/LowPowerDevice.java?rev=963111&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/service/LowPowerDevice.java (added)
+++ felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/service/LowPowerDevice.java Sun Jul 11 16:56:22 2010
@@ -0,0 +1,526 @@
+/*
+ __BANNER__
+ */
+// this file was generated at 11-July-2010 04:42 PM by ${author}
+package org.apache.felix.upnp.lowpower.service;
+
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.osgi.framework.*;
+import org.osgi.service.upnp.*;
+import org.apache.felix.upnp.devicegen.util.*;
+import org.apache.felix.upnp.devicegen.holder.*;
+
+import org.apache.felix.upnp.lowpower.impl.*;
+import org.apache.felix.upnp.lowpower.model.*;
+
+public class LowPowerDevice extends AbstractUPnPService {
+
+ private LowPowerDeviceModel model;
+
+ /**
+ * constructor
+ */
+ public LowPowerDevice(UPnPDevice upnpDevice, String serviceId,
+ String serviceType, String version, LowPowerDeviceModel model) {
+ super(upnpDevice, serviceId, serviceType, version);
+ this.model = model;
+
+ stateVariables = new HashMap();
+
+ stateVariables.put("ExternalPowerSupplySource",
+ new ExternalPowerSupplySourceStateVariable(this, model));
+
+ stateVariables.put("BatteryLow", new BatteryLowStateVariable(this,
+ model));
+
+ stateVariables.put("PowerSupplyStatus",
+ new PowerSupplyStatusStateVariable(this, model));
+
+ stateVariables.put("SleepPeriod", new SleepPeriodStateVariable(this,
+ model));
+
+ stateVariables.put("PowerState", new PowerStateStateVariable(this,
+ model));
+
+ stateVariables.put("WakeupMethod", new WakeupMethodStateVariable(this,
+ model));
+
+ actions = new HashMap();
+
+ actions.put("GetPowerManagementInfo", new GetPowerManagementInfoAction(
+ this, model));
+
+ actions.put("GoToSleep", new GoToSleepAction(this, model));
+
+ actions.put("Wakeup", new WakeupAction(this, model));
+
+ }
+
+ // UPnPStateVariable classes
+
+ // class ExternalPowerSupplySourceStateVariable
+ public class ExternalPowerSupplySourceStateVariable extends
+ AbstractUPnPStateVariable
+
+ implements UPnPStateVariableDescriptor {
+
+ public final static byte EXTERNALPOWERSUPPLYSOURCE_AC = 1;
+ public final static byte EXTERNALPOWERSUPPLYSOURCE_INTERNAL = 0;
+
+ public final static String NAME = "ExternalPowerSupplySource";
+ public final static String DATATYPE = "i4";
+
+ // HERE specific state variable members
+ private LowPowerDeviceModel model;
+
+ public ExternalPowerSupplySourceStateVariable(UPnPService upnpService,
+ LowPowerDeviceModel model) {
+ super(upnpService, NAME, DATATYPE, null, // TODO defaultValue
+ // changed for
+ null, // TODO step changed for
+ null, // TODO step changed for
+ null, // TODO minimum changed for
+ null, // TODO maximum changed for
+ // sendEventsAttribute
+ true, true // TODO required changed for OR
+ );
+
+ this.model = model;
+
+ }
+
+ // TODO
+
+ public void start(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+ /**
+ * invoked for the first notification just after a subscription
+ *
+ * @see it.cnr.isti.niche.osgi.upnp.util.UPnPStateVariableDescriptor#getValue()
+ */
+ public Object getValue() {
+
+ return model.getExternalPowerSupplySourceStateVariableValue();
+
+ }
+ };
+
+ // class BatteryLowStateVariable
+ public class BatteryLowStateVariable extends AbstractUPnPStateVariable
+
+ implements UPnPStateVariableDescriptor {
+
+ public final static String NAME = "BatteryLow";
+ public final static String DATATYPE = "boolean";
+
+ // HERE specific state variable members
+ private LowPowerDeviceModel model;
+
+ public BatteryLowStateVariable(UPnPService upnpService,
+ LowPowerDeviceModel model) {
+ super(upnpService, NAME, DATATYPE, null, // TODO defaultValue
+ // changed for
+ null, // TODO step changed for
+ null, // TODO step changed for
+ null, // TODO minimum changed for
+ null, // TODO maximum changed for
+ // sendEventsAttribute
+ true, true // TODO required changed for OR
+ );
+
+ this.model = model;
+
+ }
+
+ // TODO
+
+ public void start(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+ /**
+ * invoked for the first notification just after a subscription
+ *
+ * @see it.cnr.isti.niche.osgi.upnp.util.UPnPStateVariableDescriptor#getValue()
+ */
+ public Object getValue() {
+
+ return model.getBatteryLowStateVariableValue();
+
+ }
+ };
+
+ // class PowerSupplyStatusStateVariable
+ public class PowerSupplyStatusStateVariable extends
+ AbstractUPnPStateVariable
+
+ {
+
+ public final static String NAME = "PowerSupplyStatus";
+ public final static String DATATYPE = "string";
+
+ // HERE specific state variable members
+ private LowPowerDeviceModel model;
+
+ public PowerSupplyStatusStateVariable(UPnPService upnpService,
+ LowPowerDeviceModel model) {
+ super(upnpService, NAME, DATATYPE, null, // TODO defaultValue
+ // changed for
+ null, // TODO step changed for
+ null, // TODO step changed for
+ null, // TODO minimum changed for
+ null, // TODO maximum changed for
+ // sendEventsAttribute
+ false, true // TODO required changed for OR
+ );
+
+ this.model = model;
+
+ }
+
+ // TODO
+
+ public void start(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+ /**
+ * invoked for the first notification just after a subscription
+ *
+ * @see it.cnr.isti.niche.osgi.upnp.util.UPnPStateVariableDescriptor#getValue()
+ */
+ public Object getValue() {
+ return null;
+ }
+ };
+
+ // class SleepPeriodStateVariable
+ public class SleepPeriodStateVariable extends AbstractUPnPStateVariable
+
+ {
+
+ public final static int SLEEPPERIOD_INFINITE = -1;
+
+
+ public final static String NAME = "SleepPeriod";
+ public final static String DATATYPE = "i4";
+
+ // HERE specific state variable members
+ private LowPowerDeviceModel model;
+
+ public SleepPeriodStateVariable(UPnPService upnpService,
+ LowPowerDeviceModel model) {
+ super(upnpService, NAME, DATATYPE, null, // TODO defaultValue
+ // changed for
+ null, // TODO step changed for
+ null, // TODO step changed for
+ null, // TODO minimum changed for
+ null, // TODO maximum changed for
+ // sendEventsAttribute
+ false, true // TODO required changed for OR
+ );
+
+ this.model = model;
+
+ }
+
+ // TODO
+
+ public void start(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+ /**
+ * invoked for the first notification just after a subscription
+ *
+ * @see it.cnr.isti.niche.osgi.upnp.util.UPnPStateVariableDescriptor#getValue()
+ */
+ public Object getValue() {
+ return null;
+ }
+ };
+
+ // class PowerStateStateVariable
+ public class PowerStateStateVariable extends AbstractUPnPStateVariable
+
+ {
+
+ // PowerState value
+ public final static int POWERSTATE_ACTIVE=0;
+ public final static int POWERSTATE_TRANSPARENT=1;
+ public final static int POWERSTATE_DEEPSLEEP=2;
+ public final static int POWERSTATE_OFFLINE=4;
+
+
+
+
+
+ public final static String NAME = "PowerState";
+ public final static String DATATYPE = "string";
+
+ // HERE specific state variable members
+ private LowPowerDeviceModel model;
+
+ public PowerStateStateVariable(UPnPService upnpService,
+ LowPowerDeviceModel model) {
+ super(upnpService, NAME, DATATYPE, null, // TODO defaultValue
+ // changed for
+ null, // TODO step changed for
+ null, // TODO step changed for
+ null, // TODO minimum changed for
+ null, // TODO maximum changed for
+ // sendEventsAttribute
+ false, true // TODO required changed for OR
+ );
+
+ this.model = model;
+
+ }
+
+ // TODO
+
+ public void start(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+ /**
+ * invoked for the first notification just after a subscription
+ *
+ * @see it.cnr.isti.niche.osgi.upnp.util.UPnPStateVariableDescriptor#getValue()
+ */
+ public Object getValue() {
+ return null;
+ }
+ };
+
+ // class WakeupMethodStateVariable
+ public class WakeupMethodStateVariable extends AbstractUPnPStateVariable
+
+ {
+
+ public final static String NAME = "WakeupMethod";
+ public final static String DATATYPE = "string";
+
+ // HERE specific state variable members
+ private LowPowerDeviceModel model;
+
+ public WakeupMethodStateVariable(UPnPService upnpService,
+ LowPowerDeviceModel model) {
+ super(upnpService, NAME, DATATYPE, null, // TODO defaultValue
+ // changed for
+ null, // TODO step changed for
+ null, // TODO step changed for
+ null, // TODO minimum changed for
+ null, // TODO maximum changed for
+ // sendEventsAttribute
+ false, true // TODO required changed for OR
+ );
+
+ this.model = model;
+
+ }
+
+ // TODO
+
+ public void start(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+ /**
+ * invoked for the first notification just after a subscription
+ *
+ * @see it.cnr.isti.niche.osgi.upnp.util.UPnPStateVariableDescriptor#getValue()
+ */
+ public Object getValue() {
+ return null;
+ }
+ };
+
+ // UPnPAction classes
+
+ public class GetPowerManagementInfoAction extends AbstractUPnPAction {
+
+ LowPowerDeviceModel model;
+
+ // HERE specific action members
+
+ public GetPowerManagementInfoAction(UPnPService upnpService,
+ LowPowerDeviceModel model) {
+ super(upnpService, "GetPowerManagementInfo", "");
+ this.model = model;
+
+ addOutArg("WakeupMethod", upnpService
+ .getStateVariable("WakeupMethod"));
+
+ addOutArg("PowerSupplyStatus", upnpService
+ .getStateVariable("PowerSupplyStatus"));
+
+ }
+
+ /**
+ * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+ */
+ public Dictionary invoke(Dictionary _args) throws Exception {
+
+ StringHolder wakeupMethod = new StringHolder();
+ StringHolder powerSupplyStatus = new StringHolder();
+
+ // invoke model
+
+ model.getPowerManagementInfo(wakeupMethod,
+
+ powerSupplyStatus);
+
+ // build returned Dictionary
+ Dictionary _result = new Hashtable();
+
+ _result.put("WakeupMethod", wakeupMethod.getObject());
+ // java.lang.String
+ _result.put("PowerSupplyStatus", powerSupplyStatus.getObject());
+ // java.lang.String
+ return _result.isEmpty() ? null : _result;
+ }
+
+ public void start(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+ };
+
+ public class GoToSleepAction extends AbstractUPnPAction {
+
+ LowPowerDeviceModel model;
+
+ // HERE specific action members
+
+ public GoToSleepAction(UPnPService upnpService,
+ LowPowerDeviceModel model) {
+ super(upnpService, "GoToSleep", "");
+ this.model = model;
+
+ addInArg("RecommendedSleepPeriod", upnpService
+ .getStateVariable("SleepPeriod"));
+
+ addInArg("RecommendedPowerState", upnpService
+ .getStateVariable("PowerState"));
+
+ addOutArg("SleepPeriod", upnpService
+ .getStateVariable("SleepPeriod"));
+
+ addOutArg("PowerState", upnpService.getStateVariable("PowerState"));
+
+ }
+
+ /**
+ * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+ */
+ public Dictionary invoke(Dictionary _args) throws Exception {
+
+ java.lang.Integer recommendedSleepPeriod = (java.lang.Integer) _args
+ .get("RecommendedSleepPeriod");
+ java.lang.String recommendedPowerState = (java.lang.String) _args
+ .get("RecommendedPowerState");
+ IntegerHolder sleepPeriod = new IntegerHolder();
+ StringHolder powerState = new StringHolder();
+
+ // invoke model
+
+ model.goToSleep(IntegerHolder.toValue(recommendedSleepPeriod),
+
+ StringHolder.toValue(recommendedPowerState),
+
+ sleepPeriod,
+
+ powerState);
+
+ // build returned Dictionary
+ Dictionary _result = new Hashtable();
+
+ _result.put("SleepPeriod", sleepPeriod.getObject());
+ // java.lang.Integer
+ _result.put("PowerState", powerState.getObject());
+ // java.lang.String
+ return _result.isEmpty() ? null : _result;
+ }
+
+ public void start(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+ };
+
+ public class WakeupAction extends AbstractUPnPAction {
+
+ LowPowerDeviceModel model;
+
+ // HERE specific action members
+
+ public WakeupAction(UPnPService upnpService, LowPowerDeviceModel model) {
+ super(upnpService, "Wakeup", "");
+ this.model = model;
+
+ }
+
+ /**
+ * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+ */
+ public Dictionary invoke(Dictionary _args) throws Exception {
+
+ // invoke model
+
+ model.wakeup(
+
+ );
+
+ // build returned Dictionary
+ Dictionary _result = new Hashtable();
+
+ return _result.isEmpty() ? null : _result;
+ }
+
+ public void start(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+ };
+
+}
Added: felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/service/LowPowerProxy.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/service/LowPowerProxy.java?rev=963111&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/service/LowPowerProxy.java (added)
+++ felix/sandbox/donsez/upnp.lowpower/src/main/java/org/apache/felix/upnp/lowpower/service/LowPowerProxy.java Sun Jul 11 16:56:22 2010
@@ -0,0 +1,533 @@
+
+/*
+__BANNER__
+*/
+// this file was generated at 11-July-2010 04:42 PM by ${author}
+package org.apache.felix.upnp.lowpower.service;
+
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.osgi.framework.*;
+import org.osgi.service.upnp.*;
+import org.apache.felix.upnp.devicegen.util.*;
+import org.apache.felix.upnp.devicegen.holder.*;
+
+import org.apache.felix.upnp.lowpower.impl.*;
+import org.apache.felix.upnp.lowpower.model.*;
+
+
+
+public class LowPowerProxy extends AbstractUPnPService {
+
+
+ private LowPowerProxyModel model;
+
+ /**
+ * constructor
+ */
+ public LowPowerProxy(
+ UPnPDevice upnpDevice,
+ String serviceId,
+ String serviceType,
+ String version,
+ LowPowerProxyModel model
+ ){
+ super(
+ upnpDevice,
+ serviceId,
+ serviceType,
+ version
+ );
+ this.model=model;
+
+
+ stateVariables=new HashMap();
+
+
+
+ stateVariables.put(
+ "DeviceListInfo",
+ new DeviceListInfoStateVariable(this,model)
+ );
+
+
+
+ stateVariables.put(
+ "A_ARG_TYPE_PowerState",
+ new A_ARG_TYPE_PowerStateStateVariable(this,model)
+ );
+
+
+
+ stateVariables.put(
+ "A_ARG_TYPE_Success",
+ new A_ARG_TYPE_SuccessStateVariable(this,model)
+ );
+
+
+
+ stateVariables.put(
+ "A_ARG_TYPE_SearchCriteria",
+ new A_ARG_TYPE_SearchCriteriaStateVariable(this,model)
+ );
+
+
+
+ stateVariables.put(
+ "A_ARG_TYPE_UUID",
+ new A_ARG_TYPE_UUIDStateVariable(this,model)
+ );
+
+ actions=new HashMap();
+
+
+
+ actions.put(
+ "SearchSleepingDevices",
+ new SearchSleepingDevicesAction(this,model)
+ );
+
+
+
+ actions.put(
+ "WakeupDevice",
+ new WakeupDeviceAction(this,model)
+ );
+
+ }
+
+ // UPnPStateVariable classes
+
+
+
+// class DeviceListInfoStateVariable
+public class DeviceListInfoStateVariable
+ extends AbstractUPnPStateVariable
+
+ {
+
+ public final static String NAME="DeviceListInfo";
+ public final static String DATATYPE="string";
+
+ // HERE specific state variable members
+ private LowPowerProxyModel model;
+
+ public DeviceListInfoStateVariable(
+ UPnPService upnpService,
+ LowPowerProxyModel model
+ ){
+ super(
+ upnpService,
+ NAME,
+ DATATYPE,
+ null, // TODO defaultValue changed for
+ null, // TODO step changed for
+ null, // TODO step changed for
+ null, // TODO minimum changed for
+ null, // TODO maximum changed for
+ // sendEventsAttribute
+ false,
+ true // TODO required changed for OR
+ );
+
+ this.model=model;
+
+
+ }
+
+ // TODO
+
+ public void start(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+
+ /**
+ * invoked for the first notification just after a subscription
+ * @see it.cnr.isti.niche.osgi.upnp.util.UPnPStateVariableDescriptor#getValue()
+ */
+ public Object getValue(){
+ return null;
+ }
+};
+
+
+// class A_ARG_TYPE_PowerStateStateVariable
+public class A_ARG_TYPE_PowerStateStateVariable
+ extends AbstractUPnPStateVariable
+
+ {
+
+ public final static String NAME="A_ARG_TYPE_PowerState";
+ public final static String DATATYPE="i4";
+
+ // HERE specific state variable members
+ private LowPowerProxyModel model;
+
+ public A_ARG_TYPE_PowerStateStateVariable(
+ UPnPService upnpService,
+ LowPowerProxyModel model
+ ){
+ super(
+ upnpService,
+ NAME,
+ DATATYPE,
+ null, // TODO defaultValue changed for
+ null, // TODO step changed for
+ null, // TODO step changed for
+ null, // TODO minimum changed for 1
+ null, // TODO maximum changed for 7
+ // sendEventsAttribute
+ false,
+ true // TODO required changed for OR
+ );
+
+ this.model=model;
+
+
+ }
+
+ // TODO
+
+ public void start(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+
+ /**
+ * invoked for the first notification just after a subscription
+ * @see it.cnr.isti.niche.osgi.upnp.util.UPnPStateVariableDescriptor#getValue()
+ */
+ public Object getValue(){
+ return null;
+ }
+};
+
+
+// class A_ARG_TYPE_SuccessStateVariable
+public class A_ARG_TYPE_SuccessStateVariable
+ extends AbstractUPnPStateVariable
+
+ {
+
+ public final static String NAME="A_ARG_TYPE_Success";
+ public final static String DATATYPE="boolean";
+
+ // HERE specific state variable members
+ private LowPowerProxyModel model;
+
+ public A_ARG_TYPE_SuccessStateVariable(
+ UPnPService upnpService,
+ LowPowerProxyModel model
+ ){
+ super(
+ upnpService,
+ NAME,
+ DATATYPE,
+ null, // TODO defaultValue changed for
+ null, // TODO step changed for
+ null, // TODO step changed for
+ null, // TODO minimum changed for
+ null, // TODO maximum changed for
+ // sendEventsAttribute
+ false,
+ true // TODO required changed for OR
+ );
+
+ this.model=model;
+
+
+ }
+
+ // TODO
+
+ public void start(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+
+ /**
+ * invoked for the first notification just after a subscription
+ * @see it.cnr.isti.niche.osgi.upnp.util.UPnPStateVariableDescriptor#getValue()
+ */
+ public Object getValue(){
+ return null;
+ }
+};
+
+
+// class A_ARG_TYPE_SearchCriteriaStateVariable
+public class A_ARG_TYPE_SearchCriteriaStateVariable
+ extends AbstractUPnPStateVariable
+
+ {
+
+ public final static String NAME="A_ARG_TYPE_SearchCriteria";
+ public final static String DATATYPE="string";
+
+ // HERE specific state variable members
+ private LowPowerProxyModel model;
+
+ public A_ARG_TYPE_SearchCriteriaStateVariable(
+ UPnPService upnpService,
+ LowPowerProxyModel model
+ ){
+ super(
+ upnpService,
+ NAME,
+ DATATYPE,
+ null, // TODO defaultValue changed for
+ null, // TODO step changed for
+ null, // TODO step changed for
+ null, // TODO minimum changed for
+ null, // TODO maximum changed for
+ // sendEventsAttribute
+ false,
+ true // TODO required changed for OR
+ );
+
+ this.model=model;
+
+
+ }
+
+ // TODO
+
+ public void start(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+
+ /**
+ * invoked for the first notification just after a subscription
+ * @see it.cnr.isti.niche.osgi.upnp.util.UPnPStateVariableDescriptor#getValue()
+ */
+ public Object getValue(){
+ return null;
+ }
+};
+
+
+// class A_ARG_TYPE_UUIDStateVariable
+public class A_ARG_TYPE_UUIDStateVariable
+ extends AbstractUPnPStateVariable
+
+ {
+
+ public final static String NAME="A_ARG_TYPE_UUID";
+ public final static String DATATYPE="string";
+
+ // HERE specific state variable members
+ private LowPowerProxyModel model;
+
+ public A_ARG_TYPE_UUIDStateVariable(
+ UPnPService upnpService,
+ LowPowerProxyModel model
+ ){
+ super(
+ upnpService,
+ NAME,
+ DATATYPE,
+ null, // TODO defaultValue changed for
+ null, // TODO step changed for
+ null, // TODO step changed for
+ null, // TODO minimum changed for
+ null, // TODO maximum changed for
+ // sendEventsAttribute
+ false,
+ true // TODO required changed for OR
+ );
+
+ this.model=model;
+
+
+ }
+
+ // TODO
+
+ public void start(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+
+ /**
+ * invoked for the first notification just after a subscription
+ * @see it.cnr.isti.niche.osgi.upnp.util.UPnPStateVariableDescriptor#getValue()
+ */
+ public Object getValue(){
+ return null;
+ }
+};
+
+
+ // UPnPAction classes
+
+
+
+public class SearchSleepingDevicesAction extends AbstractUPnPAction {
+
+ LowPowerProxyModel model;
+
+ // HERE specific action members
+
+ public SearchSleepingDevicesAction(
+ UPnPService upnpService,
+ LowPowerProxyModel model
+ ){
+ super(
+ upnpService,
+ "SearchSleepingDevices",
+ ""
+ );
+ this.model=model;
+
+ addInArg(
+ "SearchCriteria",
+ upnpService.getStateVariable("A_ARG_TYPE_SearchCriteria")
+ );
+
+ addInArg(
+ "PowerState",
+ upnpService.getStateVariable("A_ARG_TYPE_PowerState")
+ );
+
+ addOutArg(
+ "DeviceList",
+ upnpService.getStateVariable("DeviceListInfo")
+ );
+
+ }
+
+ /**
+ * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+ */
+ public Dictionary invoke(Dictionary _args) throws Exception {
+
+ java.lang.String searchCriteria = (java.lang.String) _args.get("SearchCriteria");
+ java.lang.Integer powerState = (java.lang.Integer) _args.get("PowerState");
+ StringHolder deviceList = new StringHolder();
+
+
+ // invoke model
+
+ model.searchSleepingDevices(
+ StringHolder.toValue(
+ searchCriteria)
+ ,
+
+IntegerHolder.toValue(
+ powerState)
+ ,
+
+deviceList
+ );
+
+ // build returned Dictionary
+ Dictionary _result = new Hashtable();
+
+ _result.put("DeviceList",deviceList.getObject());
+ // java.lang.String
+ return _result.isEmpty()?null:_result;
+ }
+
+
+ public void start(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+};
+
+
+public class WakeupDeviceAction extends AbstractUPnPAction {
+
+ LowPowerProxyModel model;
+
+ // HERE specific action members
+
+ public WakeupDeviceAction(
+ UPnPService upnpService,
+ LowPowerProxyModel model
+ ){
+ super(
+ upnpService,
+ "WakeupDevice",
+ ""
+ );
+ this.model=model;
+
+ addInArg(
+ "Uuid",
+ upnpService.getStateVariable("A_ARG_TYPE_UUID")
+ );
+
+ addOutArg(
+ "Success",
+ upnpService.getStateVariable("A_ARG_TYPE_Success")
+ );
+
+ }
+
+ /**
+ * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+ */
+ public Dictionary invoke(Dictionary _args) throws Exception {
+
+ java.lang.String uuid = (java.lang.String) _args.get("Uuid");
+ BooleanHolder success = new BooleanHolder();
+
+
+ // invoke model
+
+ model.wakeupDevice(
+ StringHolder.toValue(
+ uuid)
+ ,
+
+success
+ );
+
+ // build returned Dictionary
+ Dictionary _result = new Hashtable();
+
+ _result.put("Success",success.getObject());
+ // java.lang.Boolean
+ return _result.isEmpty()?null:_result;
+ }
+
+
+ public void start(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ // TODO
+ }
+};
+
+}
Added: felix/sandbox/donsez/upnp.lowpower/src/main/resources/icon/power.png
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.lowpower/src/main/resources/icon/power.png?rev=963111&view=auto
==============================================================================
Binary file - no diff available.
Propchange: felix/sandbox/donsez/upnp.lowpower/src/main/resources/icon/power.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream