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 2007/11/02 11:38:04 UTC
svn commit: r591296 - in /felix/sandbox/donsez/bunny/src:
main/java/org/apache/felix/sandbox/bunny/impl/
main/java/org/apache/felix/sandbox/bunny/model/ site/
Author: donsez
Date: Fri Nov 2 03:37:58 2007
New Revision: 591296
URL: http://svn.apache.org/viewvc?rev=591296&view=rev
Log:
add a configuration parameter baseURL to set the base url of the Nabaztag server or proxy
Modified:
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/sandbox/bunny/impl/BunnyCommand.java
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/sandbox/bunny/impl/BunnyServiceActivator.java
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/sandbox/bunny/impl/BunnyServiceModelImpl.java
felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/sandbox/bunny/model/BunnyServiceModel.java
felix/sandbox/donsez/bunny/src/site/TODOLIST.txt
felix/sandbox/donsez/bunny/src/site/script.txt
Modified: felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/sandbox/bunny/impl/BunnyCommand.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/sandbox/bunny/impl/BunnyCommand.java?rev=591296&r1=591295&r2=591296&view=diff
==============================================================================
--- felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/sandbox/bunny/impl/BunnyCommand.java (original)
+++ felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/sandbox/bunny/impl/BunnyCommand.java Fri Nov 2 03:37:58 2007
@@ -77,11 +77,15 @@
if("config".equals(subcommand) && n==2){
String newSerialNumber=st.nextToken();
String newToken=st.nextToken();
- bunnyServiceModel.configure(newSerialNumber, newToken, null);
+ bunnyServiceModel.configure(newSerialNumber, newToken, null, null);
+
+ } else if("baseurl".equals(subcommand) && n==1){
+ String baseurl=st.nextToken();
+ bunnyServiceModel.configure(null, null, baseurl, null);
} else if("voice".equals(subcommand) && n==1){
String voice=st.nextToken();
- bunnyServiceModel.configure(null, null, voice);
+ bunnyServiceModel.configure(null, null, null, voice);
} else if("trace".equals(subcommand) && n==1){
String trace=st.nextToken();
@@ -150,6 +154,7 @@
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() + " baseurl <baseurl>: set the default base url of the Nabaztag server or proxy"
+"\n"+ getName() + " ears : get ears positions"
+"\n"+ getName() + " raw <url encoded params>: send the URL with raw encoded parameters"
+"\n"+ getName() + " sleep : sleep the bunny"
Modified: felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/sandbox/bunny/impl/BunnyServiceActivator.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/sandbox/bunny/impl/BunnyServiceActivator.java?rev=591296&r1=591295&r2=591296&view=diff
==============================================================================
--- felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/sandbox/bunny/impl/BunnyServiceActivator.java (original)
+++ felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/sandbox/bunny/impl/BunnyServiceActivator.java Fri Nov 2 03:37:58 2007
@@ -81,6 +81,7 @@
configure(
(String) configurationProperties.get("serialNumber"),
(String) configurationProperties.get("token"),
+ (String) configurationProperties.get("baseUrl"),
(String) configurationProperties.get("voice")
);
@@ -144,5 +145,4 @@
this.play(newLeftEarPosition, newRightEarPosition, textToSpeech, chor, voice);
}
-
}
Modified: felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/sandbox/bunny/impl/BunnyServiceModelImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/sandbox/bunny/impl/BunnyServiceModelImpl.java?rev=591296&r1=591295&r2=591296&view=diff
==============================================================================
--- felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/sandbox/bunny/impl/BunnyServiceModelImpl.java (original)
+++ felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/sandbox/bunny/impl/BunnyServiceModelImpl.java Fri Nov 2 03:37:58 2007
@@ -18,8 +18,6 @@
*/
package org.apache.felix.sandbox.bunny.impl;
-import java.net.URLEncoder;
-import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
@@ -38,7 +36,7 @@
public class BunnyServiceModelImpl implements BunnyServiceModel {
- private static String baseUrlString = "http://api.nabaztag.com/vl/FR/api.jsp?";
+ private String baseUrlString = "http://api.nabaztag.com/vl/FR/api.jsp";
protected long rightEarPosition = 0;
@@ -46,9 +44,9 @@
private String key = "0";
- private String serialNumber = "00904BBDA700";
+ private String serialNumber = "123456789ABC";
- private String token = "1100000035";
+ private String token = "0000000000";
private String voice = "julie22k";
@@ -84,7 +82,7 @@
public void play(long newLeftEarPosition, long newRightEarPosition,
String textToSpeech, String chor, String voice) {
- String urlString = baseUrlString;
+ String urlString = baseUrlString+'?';
Map parameters=new HashMap();
parameters.put("key",key);
@@ -130,7 +128,7 @@
public void sendRawURL(String encodedExtraURLParameters) {
Object[] arguments = new Object[3];
- String urlString = baseUrlString;
+ String urlString = baseUrlString+'?';
urlString += encodedExtraURLParameters;
Map parameters=new HashMap();
@@ -143,7 +141,8 @@
public void getEarPositions() {
-
+ String urlString = baseUrlString+'?';
+
Map parameters=new HashMap();
parameters.put("key",key);
parameters.put("sn",serialNumber);
@@ -152,7 +151,7 @@
parameters.put("ears","ok"); // send the ears position
- Document document=RESTFulClient.invoke(baseUrlString,parameters);
+ Document document=RESTFulClient.invoke(urlString,parameters);
if(document!=null) {
NodeList nodeList;
nodeList=document.getElementsByTagName("leftposition");
@@ -172,12 +171,14 @@
}
public void configure(String newSerialNumber, String newToken,
- String newVoice) {
+ String newBaseURL, String newVoice) {
if (newSerialNumber != null && !newSerialNumber.equals(""))
serialNumber = newSerialNumber;
if (newToken != null && !newToken.equals(""))
token = newToken;
- if (newVoice != null && !voice.equals(""))
+ if (newBaseURL != null && !newBaseURL.equals(""))
+ baseUrlString = newBaseURL;
+ if (newVoice != null && !newVoice.equals(""))
voice = newVoice;
saveConfiguration();
Modified: felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/sandbox/bunny/model/BunnyServiceModel.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/sandbox/bunny/model/BunnyServiceModel.java?rev=591296&r1=591295&r2=591296&view=diff
==============================================================================
--- felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/sandbox/bunny/model/BunnyServiceModel.java (original)
+++ felix/sandbox/donsez/bunny/src/main/java/org/apache/felix/sandbox/bunny/model/BunnyServiceModel.java Fri Nov 2 03:37:58 2007
@@ -28,10 +28,11 @@
* This method sets the bunny' serial number and token and sets the default voice
* @param newSerialNumber
* @param newToken
+ * @param baseURL
* @param voice
*/
- public void configure(String newSerialNumber,String newToken, String voice);
+ public void configure(String newSerialNumber,String newToken, String baseURL, String voice);
/**
* This method speackes the text and plays a choregraphy of leds and ears
* @param newLeftEarPosition in parameter
Modified: felix/sandbox/donsez/bunny/src/site/TODOLIST.txt
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/bunny/src/site/TODOLIST.txt?rev=591296&r1=591295&r2=591296&view=diff
==============================================================================
--- felix/sandbox/donsez/bunny/src/site/TODOLIST.txt (original)
+++ felix/sandbox/donsez/bunny/src/site/TODOLIST.txt Fri Nov 2 03:37:58 2007
@@ -1,7 +1,8 @@
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
-
+4) test it with
Links
-* http://api.nabaztag.com/docs/home.html
\ No newline at end of file
+* http://api.nabaztag.com/docs/home.html
+* OpenNab (http://sourceforge.net/projects/opennab/) An open PHP-based proxy framework for the NabaztagĀ (http://www.nabaztag.com/) electronic pet.
Modified: felix/sandbox/donsez/bunny/src/site/script.txt
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/bunny/src/site/script.txt?rev=591296&r1=591295&r2=591296&view=diff
==============================================================================
--- felix/sandbox/donsez/bunny/src/site/script.txt (original)
+++ felix/sandbox/donsez/bunny/src/site/script.txt Fri Nov 2 03:37:58 2007
@@ -31,7 +31,7 @@
# with EventAdmin (event.topics is org/apache/felix/sandbox/bunny)
-obr install "Event Admin"
+obr start "Apacke Felix Event Admin"
start eventadmincmd/eventadmincmd.jar
eventadmin subscribe org/apache/felix/sandbox/bunny
eventadmin send org/apache/felix/sandbox/bunny voice=aaron22s&tts=hello+world+the+sun+shines+today+but+the+weather+may+be+cloudy+this+afternoon
@@ -48,5 +48,7 @@
bunny raw action=9
bunny raw action=10
bunny raw action=11
+# bunny raw action=12
+# bunny raw action=13