Author: donsez
Date: Fri Oct 19 05:21:06 2007
New Revision: 586400

URL: http://svn.apache.org/viewvc?rev=586400&view=rev
Log:
add a sample bundle for controlling a Nabaztag bunny 
(http://www.nabaztag.com/en/index.html).
This bundle could be used for OSGi-based home automation demonstrations.

Added:
    felix/sandbox/donsez/bunny/
    felix/sandbox/donsez/bunny/pom.xml   (with props)
    felix/sandbox/donsez/bunny/src/
    felix/sandbox/donsez/bunny/src/main/
    felix/sandbox/donsez/bunny/src/main/java/
    felix/sandbox/donsez/bunny/src/main/java/org/
    felix/sandbox/donsez/bunny/src/main/java/org/apache/
    felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/
    felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/
    felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/activator/
    
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/activator/Activator.java
   (with props)
    felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/impl/
    
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/impl/BunnyCommand.java
   (with props)
    
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/impl/BunnyServiceActivator.java
   (with props)
    
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/impl/BunnyServiceModelImpl.java
   (with props)
    felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/model/
    
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/model/BunnyServiceModel.java
   (with props)
    felix/sandbox/donsez/bunny/src/main/resources/
    felix/sandbox/donsez/bunny/src/site/
    felix/sandbox/donsez/bunny/src/site/TODOLIST.txt   (with props)
    felix/sandbox/donsez/bunny/src/site/script.txt   (with props)

Added: felix/sandbox/donsez/bunny/pom.xml
URL: 
http://svn.apache.org/viewvc/felix/sandbox/donsez/bunny/pom.xml?rev=586400&view=auto
==============================================================================
--- felix/sandbox/donsez/bunny/pom.xml (added)
+++ felix/sandbox/donsez/bunny/pom.xml Fri Oct 19 05:21:06 2007
@@ -0,0 +1,97 @@
+<!--
+ 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://people.apache.org/~donsez/dev/felix/sandbox/</repositoryLocation>
+               <description>provides a simple service to manage a Nabaztag 
bunny (http://www.nabaztag.com/).</description>
+       </properties>  
+
+  <modelVersion>4.0.0</modelVersion>
+  <packaging>bundle</packaging>
+  <name>Bunny Service</name>
+  <artifactId>org.apache.felix.bunny</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.0.0</version>
+       </dependency>
+       
+       <dependency>
+               <groupId>org.apache.felix</groupId>
+               <artifactId>org.osgi.compendium</artifactId>
+               <version>0.9.0-SNAPSHOT</version>
+       </dependency>
+        
+       <dependency>
+               <groupId>org.apache.felix</groupId>
+               <artifactId>org.apache.felix.shell</artifactId>
+               <version>1.1.0-SNAPSHOT</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 -->
+               
+            
<Private-Package>${pom.artifactId}.impl,${pom.artifactId}.activator</Private-Package>
+            
<Import-Package>org.osgi.framework,org.apache.felix.shell</Import-Package>
+            <Export-Package>${pom.artifactId}.model</Export-Package>
+
+            
<Bundle-Activator>${pom.artifactId}.activator.Activator</Bundle-Activator>
+
+            <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+            <Bundle-Description>${description}</Bundle-Description>
+
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+<!--
+  <repositories>
+    <repository>
+      <id>apache.m2.incubator</id>
+      <name>Apache M2 Incubator Repository</name>
+      <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+    </repository>
+  </repositories>
+  <pluginRepositories>
+    <pluginRepository>
+      <id>apache.m2.incubator</id>
+      <name>Apache M2 Incubator Repository</name>
+      <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+    </pluginRepository>
+  </pluginRepositories>
+  -->
+</project>

Propchange: felix/sandbox/donsez/bunny/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/activator/Activator.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/activator/Activator.java?rev=586400&view=auto
==============================================================================
--- 
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/activator/Activator.java
 (added)
+++ 
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/activator/Activator.java
 Fri Oct 19 05:21:06 2007
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+package org.apache.felix.bunny.activator;
+
+import org.apache.felix.bunny.impl.BunnyCommand;
+import org.apache.felix.bunny.impl.BunnyServiceActivator;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+
+/**
+ * this class provides the activator.
+ * @author <a href="mailto:[EMAIL PROTECTED]">Felix Project Team</a>
+ */
+
+public class Activator implements BundleActivator {
+
+       BunnyServiceActivator bunnyServiceActivator;
+       BunnyCommand bunnyCommand;
+       
+       public void start(BundleContext bundleContext) throws Exception {
+               bunnyServiceActivator=new BunnyServiceActivator();              
+               bunnyServiceActivator.start(bundleContext);
+               
+               bunnyCommand=new BunnyCommand(bunnyServiceActivator);
+               bunnyCommand.start(bundleContext);
+       }
+       
+       public void stop(BundleContext bundleContext) throws Exception {
+               bunnyCommand.stop(bundleContext);
+               bunnyServiceActivator.stop(bundleContext);
+       }
+}

Propchange: 
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/activator/Activator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/impl/BunnyCommand.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/impl/BunnyCommand.java?rev=586400&view=auto
==============================================================================
--- 
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/impl/BunnyCommand.java
 (added)
+++ 
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/impl/BunnyCommand.java
 Fri Oct 19 05:21:06 2007
@@ -0,0 +1,143 @@
+/*
+ * 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.
+ */
+package org.apache.felix.bunny.impl;
+
+import java.io.PrintStream;
+import java.util.StringTokenizer;
+
+import org.apache.felix.bunny.model.BunnyServiceModel;
+import org.apache.felix.shell.Command;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * this class provides a shell command to control.
+ * @author <a href="mailto:[EMAIL PROTECTED]">Felix Project Team</a>
+ */
+
+public class BunnyCommand implements BundleActivator, Command {
+
+       private BunnyServiceModel bunnyServiceModel;
+
+       public BunnyCommand(BunnyServiceModel bunnyServiceModel) {
+               this.bunnyServiceModel=bunnyServiceModel;
+       }
+       
+       ServiceRegistration serviceRegistration=null;
+       
+       /**
+        * @see 
org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+        */
+       public void start(BundleContext bundleContext) throws Exception {
+               
serviceRegistration=bundleContext.registerService(Command.class.getName(), 
this, null);
+       }
+
+       /**
+        * @see 
org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+        */
+       public void stop(BundleContext bundleContext) throws Exception {
+               serviceRegistration.unregister();
+       }
+
+       /**
+        * @see org.apache.felix.shell.Command#execute(java.lang.String, 
java.io.PrintStream, java.io.PrintStream)
+        */
+       public void execute(String cmdline, PrintStream out, PrintStream err) {
+               StringTokenizer st=new StringTokenizer(cmdline, " ");
+               int n=st.countTokens();
+
+               if(n<2) {
+                       err.println(getFullUsage());
+                       return;
+               }
+               
+               st.nextToken(); // skip command name
+               
+               
+               String subcommand=st.nextToken();
+               n-=2;
+               
+               if("config".equals(subcommand) && n==2){
+                       String newSerialNumber=st.nextToken();
+                       String newToken=st.nextToken();
+                       bunnyServiceModel.configure(newSerialNumber, newToken, 
null);
+
+               } else if("voice".equals(subcommand) && n==1){
+                               String voice=st.nextToken();
+                               bunnyServiceModel.configure(null, null, voice);
+
+               } else if("trace".equals(subcommand) && n==1){
+                       String trace=st.nextToken();
+                       bunnyServiceModel.setTrace("on".equals(trace));
+
+               } else if("raw".equals(subcommand) && n==1){
+                       String encodedExtraURLParameters=st.nextToken();
+                       bunnyServiceModel.sendRawURL(encodedExtraURLParameters);
+
+               } else if("play".equals(subcommand) && n>1){
+                       long newLeftEarPosition=Long.parseLong(st.nextToken());
+                       long newRightEarPosition=Long.parseLong(st.nextToken());
+                       String textToSpeech=(n>2)? st.nextToken().replace('_', 
' ').replace('+', ' '):null;
+                       String chor=(n>3)? st.nextToken():null;
+                       bunnyServiceModel.play(newLeftEarPosition, 
newRightEarPosition, textToSpeech, chor, null);
+                       
+               } else if("ears".equals(subcommand) && n==0){
+                       bunnyServiceModel.getEarPositions();
+                       
+               } else {
+                       err.println(getFullUsage());
+                       return;
+               }
+       }
+
+       /**
+        * @see org.apache.felix.shell.Command#getName()
+        */
+       public String getName() {
+               return "bunny";
+       }
+       
+       /**
+        * @see org.apache.felix.shell.Command#getShortDescription()
+        */
+       public String getShortDescription() {
+               return "command to control a bunny";
+       }
+
+       /**
+        * @see org.apache.felix.shell.Command#getUsage()
+        */
+       public String getUsage() {
+               return  getName() + " [help|config|play|voice|ears|trace]";
+       }       
+
+       /**
+        * @see org.apache.felix.shell.Command#getUsage()
+        */
+       public String getFullUsage() {
+               return                  getName() + " config <serial number> 
<token> : configure the bunny' identifiers"
+               +"\n"+  getName() + " play <left ear pos> <right ear pos> <text 
to speech> [<choregraphy>]: speech a text and play a chroregraphy"
+               +"\n"+  getName() + " voice <voice>: set the default voice (eg 
julie22k,claire22s,caroline22k,bruno22k,graham22s,lucy22s,heather22k,ryan22k,aaron22s,laura22s)"
+               +"\n"+  getName() + " ears : get ears positions"
+               +"\n"+  getName() + " raw <url encoded params>: send the URL 
with raw encoded parameters"
+               +"\n"+  getName() + " trace <on|off> : set on|off the trace"
+               ;
+       }       
+}

Propchange: 
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/impl/BunnyCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/impl/BunnyServiceActivator.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/impl/BunnyServiceActivator.java?rev=586400&view=auto
==============================================================================
--- 
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/impl/BunnyServiceActivator.java
 (added)
+++ 
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/impl/BunnyServiceActivator.java
 Fri Oct 19 05:21:06 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+package org.apache.felix.bunny.impl;
+
+import org.apache.felix.bunny.model.BunnyServiceModel;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+
+/**
+ * this class provides an activator to instanciate a bunny service
+ * @author <a href="mailto:[EMAIL PROTECTED]">Felix Project Team</a>
+ */
+public class BunnyServiceActivator extends BunnyServiceModelImpl {
+
+       private ServiceRegistration serviceRegistration;
+       
+       public void start(BundleContext bundleContext) throws Exception {
+               
serviceRegistration=bundleContext.registerService(BunnyServiceModel.class.getName(),
 this, null);
+       }
+
+       public void stop(BundleContext bundleContext) throws Exception {
+               if(serviceRegistration!=null) serviceRegistration.unregister();
+       }
+
+}

Propchange: 
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/impl/BunnyServiceActivator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/impl/BunnyServiceModelImpl.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/impl/BunnyServiceModelImpl.java?rev=586400&view=auto
==============================================================================
--- 
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/impl/BunnyServiceModelImpl.java
 (added)
+++ 
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/impl/BunnyServiceModelImpl.java
 Fri Oct 19 05:21:06 2007
@@ -0,0 +1,232 @@
+/*
+ * 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.
+ */
+package org.apache.felix.bunny.impl;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.text.MessageFormat;
+
+import org.apache.felix.bunny.model.BunnyServiceModel;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+import quicktime.std.clocks.ExtremesCallBack;
+
+/**
+ * this class provides implementation of a bunny service.
+ * @author <a href="mailto:[EMAIL PROTECTED]">Felix Project Team</a>
+ */
+
+public class BunnyServiceModelImpl implements BunnyServiceModel {
+
+       private long rightEarPosition = 0;
+
+       private long leftEarPosition = 0;
+
+       private String key = "0";
+
+       private String serialNumber = "00904BBDA700";
+
+       private String token = "1100000035";
+
+       private String voice = "julie22k";
+
+       private boolean trace=true;
+
+
+       public BunnyServiceModelImpl() {
+               loadConfiguration();
+       }
+
+       /**
+        * load the configuration from the property file in the bundle private 
file
+        * system
+        */
+       private void loadConfiguration() {
+               // TODO
+       }
+
+       /**
+        * load the configuration from the property file in the bundle private 
file
+        * system
+        */
+       private void saveConfiguration() {
+               // TODO
+       }
+
+
+       public void play(
+                       long newLeftEarPosition,
+                       long newRightEarPosition,
+                       String textToSpeech,
+                       String chor,
+                       String voice
+       ) {
+
+               Object[] arguments = new Object[5];
+
+               String urlString = "http://api.nabaztag.com/vl/FR/api.jsp?";;
+               urlString += 
"key={0}&sn={1}&token={2}&posleft={3}&posright={4}";
+               // urlString+="&ears=ok"; // send the ears position
+
+               arguments[0] = key;
+               arguments[1] = serialNumber;
+               arguments[2] = token;
+               arguments[3] = new Long(newLeftEarPosition);
+               arguments[4] = new Long(newRightEarPosition);
+
+               MessageFormat messageFormat = new MessageFormat(urlString);
+               urlString = messageFormat.format(arguments);
+
+               if (textToSpeech!=null) {
+                       urlString += "&tts="+URLEncoder.encode(textToSpeech);
+               }
+               
+               if (voice!=null) {
+                       urlString += "&voice=" + voice;
+               } else if (this.voice!=null) {
+                       urlString += "&voice=" + this.voice;
+               }
+
+               if (chor!=null) {
+                       urlString += "&chor="+chor;
+               }
+
+               sendUrl(urlString);
+               
+               leftEarPosition = newLeftEarPosition;
+               rightEarPosition = newRightEarPosition;
+               // update();
+       }
+
+
+       public void sendRawURL(String encodedExtraURLParameters){
+               Object[] arguments = new Object[3];
+
+               String urlString = "http://api.nabaztag.com/vl/FR/api.jsp?";;
+               urlString += "key={0}&sn={1}&token={2}&";
+
+               arguments[0] = key;
+               arguments[1] = serialNumber;
+               arguments[2] = token;
+
+               MessageFormat messageFormat = new MessageFormat(urlString);
+               urlString = messageFormat.format(arguments);
+
+               urlString += encodedExtraURLParameters;
+       
+               sendUrl(urlString);
+               
+       }
+       
+       
+       public void getEarPositions() {
+               Object[] arguments = new Object[3];
+
+               String urlString = "http://api.nabaztag.com/vl/FR/api.jsp?";;
+               urlString += "key={0}&sn={1}&token={2}&ears=ok";
+               // urlString+="&ears=ok"; // send the ears position
+
+               arguments[0] = key;
+               arguments[1] = serialNumber;
+               arguments[2] = token;
+
+               MessageFormat messageFormat = new MessageFormat(urlString);
+               urlString = messageFormat.format(arguments);
+
+               sendUrl(urlString);
+       }
+
+       
+       void sendUrl(String urlString){
+               if(trace) System.out.println("Bunny Request:" + urlString);
+
+               URL url;
+               try {
+                       url = new URL(urlString);
+               } catch (MalformedURLException e) {
+                       if(trace) e.printStackTrace();
+                       return;
+               }
+
+               try {
+                       HttpURLConnection httpURLConnection = 
(HttpURLConnection) url
+                                       .openConnection();
+                       httpURLConnection.connect();
+                       InputStream in = httpURLConnection.getInputStream();
+                       int length = httpURLConnection.getContentLength();
+                       if(length==-1) {
+                               if(trace) System.out.print("Bunny Reply 
(length=unknown):");
+                               BufferedReader br  = new BufferedReader(new 
InputStreamReader(in));
+                               String line;
+                               while((line=br.readLine())!=null){
+                                       if(trace) System.out.println(line);     
                                
+                               }
+                               br.close();
+                               
+                       } else {
+                               if(trace) System.out.print("Bunny Reply 
(length="+length+"):");
+                       
+                               for (; length != 0; --length) {
+                                       if(trace) System.out.print((char) 
in.read());
+                               }
+                               if(trace) System.out.println();
+                               in.close();
+                       }
+
+               } catch (IOException e) {
+                       if(trace) e.printStackTrace();
+               }
+       }
+       
+       
+       public void configure(
+                       String newSerialNumber,
+                       String newToken,
+                       String newVoice) {
+               if(newSerialNumber!=null)
+                       serialNumber = newSerialNumber;
+               if(newToken!=null)
+                       token = newToken;
+               if (newVoice!=null && !voice.equals(""))
+                       voice = newVoice;
+
+               saveConfiguration();
+       }
+
+
+       public java.lang.Long getLeftEarPositionStateVariableValue() {
+               return new Long(leftEarPosition);
+       }
+
+       public java.lang.Long getRightEarPositionStateVariableValue() {
+               return new Long(rightEarPosition);
+       }
+
+       public void setTrace(boolean trace) {
+               this.trace=trace;
+       }
+}

Propchange: 
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/impl/BunnyServiceModelImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/model/BunnyServiceModel.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/model/BunnyServiceModel.java?rev=586400&view=auto
==============================================================================
--- 
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/model/BunnyServiceModel.java
 (added)
+++ 
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/model/BunnyServiceModel.java
 Fri Oct 19 05:21:06 2007
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ */
+package org.apache.felix.bunny.model;
+
+/**
+ * this interface defines a bunny service.
+ * @author <a href="mailto:[EMAIL PROTECTED]">Felix Project Team</a>
+ */
+public interface BunnyServiceModel {
+
+       /**
+        * This method sets the bunny' serial number and token and sets the 
default voice 
+        * @param newSerialNumber
+        * @param newToken
+        * @param voice
+        */
+
+       public void configure(String newSerialNumber,String newToken, String 
voice);
+       /**
+        * This method speackes the text and plays a choregraphy of leds and 
ears 
+        * @param newLeftEarPosition in parameter
+        * @param newRightEarPosition in parameter
+        * @param textToSpeech in parameter
+        * @param chor in parameter
+        * @param voice in parameter
+        */
+       public void play(long newLeftEarPosition, long newRightEarPosition,
+                       String textToSpeech, String chor, String voice);
+
+       
+       /**
+        * send the URL with raw URL parameters
+        * @param encodedExtraURLParameters
+        */
+       public void sendRawURL(String encodedExtraURLParameters);
+
+       /**
+        * trace the ears positions
+        */
+       public void getEarPositions();
+
+
+       /**
+        * get the left ear position
+        * @return
+        */
+       public java.lang.Long getLeftEarPositionStateVariableValue();
+
+       /**
+        * get the right ear position
+        * @return
+        */
+       public java.lang.Long getRightEarPositionStateVariableValue();
+
+       /**
+        * set on or off the trace
+        */
+       public void setTrace(boolean b);
+}

Propchange: 
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/bunny/model/BunnyServiceModel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/bunny/src/site/TODOLIST.txt
URL: 
http://svn.apache.org/viewvc/felix/sandbox/donsez/bunny/src/site/TODOLIST.txt?rev=586400&view=auto
==============================================================================
--- felix/sandbox/donsez/bunny/src/site/TODOLIST.txt (added)
+++ felix/sandbox/donsez/bunny/src/site/TODOLIST.txt Fri Oct 19 05:21:06 2007
@@ -0,0 +1,7 @@
+1) parse rsp response to get positions ... see 
http://api.nabaztag.com/docs/home.html
+2) save and load the configuration (sn,token,voice)
+3) add choregraphy classes utilities
+
+
+Links
+* http://api.nabaztag.com/docs/home.html
\ No newline at end of file

Propchange: felix/sandbox/donsez/bunny/src/site/TODOLIST.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/bunny/src/site/script.txt
URL: 
http://svn.apache.org/viewvc/felix/sandbox/donsez/bunny/src/site/script.txt?rev=586400&view=auto
==============================================================================
--- felix/sandbox/donsez/bunny/src/site/script.txt (added)
+++ felix/sandbox/donsez/bunny/src/site/script.txt Fri Oct 19 05:21:06 2007
@@ -0,0 +1,31 @@
+
+bunny trace on
+bunny voice bruno22k
+bunny play 1 16 salut+didier
+
+bunny voice aaron22s
+bunny play 8 8 
hello+world+the+sun+shines+today+but+the+weather+may+be+cloudy+this+afternoon
+
+bunny voice claire22k
+bunny play 8 8 salut+didier 
10,0,motor,1,20,0,0,200,led,2,0,238,0,2,led,1,250,0,0,3,led,2,0,0,0
+# Bunny 
Request:http://api.nabaztag.com/vl/FR/api.jsp?key=0&sn=00904BBDA71F&token=1163675935&posleft=1&posright=16&tts=salut+didier&voice=julie22k&chor=10,0,motor,1,20,0,0,200,led,2,0,238,0,2,led,1,250,0,0,3,led,2,0,0,0
+# Bunny Reply (length=unknown):<?xml version="1.0" 
encoding="UTF-8"?><rsp><message>EARPOSITIONSEND</message><comment>Your ears 
command has been sent</comment><message>TTSSEND</message><comment>Your text has 
been sent</comment><message>CHORSEND</message><comment>Your chor has been 
sent</comment></rsp>
+
+bunny ears
+# Bunny 
Request:http://api.nabaztag.com/vl/FR/api.jsp?key=0&sn=00904BBDA71F&token=1163675935&ears=ok
+# Bunny Reply (length=unknown):<?xml version="1.0" 
encoding="UTF-8"?><rsp><message>POSITIONEAR</message><leftposition>1</leftposition><rightposition>16</rightposition></rsp>
+
+
+# send actions with the raw sub-command
+bunny raw action=2
+bunny raw action=3
+bunny raw action=4
+bunny raw action=5
+bunny raw action=6
+bunny raw action=7
+bunny raw action=8
+bunny raw action=9
+bunny raw action=10
+bunny raw action=11
+
+

Propchange: felix/sandbox/donsez/bunny/src/site/script.txt
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to