Author: jerome
Date: 2009-02-05 14:30:49 +0100 (Thu, 05 Feb 2009)
New Revision: 3560
Modified:
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcInterface.java
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Listener/ExitControlListener.java
Log:
* Start all callbacks functions into threads.
Modified:
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcInterface.java
===================================================================
---
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcInterface.java
2009-02-04 15:55:02 UTC (rev 3559)
+++
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcInterface.java
2009-02-05 13:30:49 UTC (rev 3560)
@@ -216,16 +216,6 @@
fileBrowser = new FileBrowser();
fileBrowser.addPropertyChangeListener(this);
}
-
-
- /**
- * Receive start and stop events from resource to save/restore remote
control context.
- * @param name
- * @param value
- */
- public void onAllEvents(String name, String value){
- new AllEventsThread(this, value, "onAllEvents").start();
- }
private void initInterface(){
@@ -252,49 +242,8 @@
;
}
}
- }
-
-
- /**
- * Callback that gets the radio connaction event.
- * @param objects
- */
- public void onRadioConnected(String value, Double delay){
- if(!CcCommons.tux.radio.getConnected()) return;
- this.jStatusBar.setOnlineStatus(true);
- if(!SystemInformation.isUnix())
- CcCommons.tray.setIcon(CcCommons.tray_online);
-
- this.popupFileMenu = null;
- this.constructFileMenu();
- jFrame.pack();
- }
-
-
- /**
- * Callback that gets the server connection event.
- * @param objects
- */
- public void onTuxServerConnected(Boolean value, Double delay){
- CcCommons.tux.tts.setLocutor(CcCommons.settings.getSpeaker());
- if(!((CcCommons.settings.getPitch() < 200)) ||
(CcCommons.settings.getPitch() <= 0)) CcCommons.settings.setPitch(200);
- CcCommons.tux.tts.setPitch(CcCommons.settings.getPitch());
- if(CcCommons.tux.radio.getConnected()){
- onRadioConnected(null, null);
- }
}
-
- /**
- * Callback that gets the radio disconnection event.
- * @param objects
- */
- public void onRadioDisconnected(String value, Double delay){
- this.jStatusBar.setOnlineStatus(false);
- CcCommons.tray.setIcon(CcCommons.tray_offline);
- popupFileMenu.remove(1);
- popupFileMenu.remove(1);
- }
/**
* This function initializes jFrame
@@ -356,23 +305,146 @@
CcCommons.remoteControl.onStopRemoteButton("stopFromRemote");
CcCommons.remoteControl.setStaticStopEvent("stopFromRemote");
CcCommons.remoteControl.onDownRemoteButton("remoteListNextEntry");
-
CcCommons.remoteControl.onUpRemoteButton("remoteListPreviousEntry");
- CcCommons.remoteControl.onExitRemoteButton("exitCc");
+
CcCommons.remoteControl.onUpRemoteButton("remoteListPreviousEntry");
}
return jFrame;
}
+
- public void remoteListNextEntry(String value, Double delay){
+//***************************************************************************//
+//*********************** Callbacks functions *****************************//
+ /**
+ * Callback that gets the radio connaction event.
+ * @param objects
+ */
+ public void onRadioConnected(String value, Double delay)
+ {
+ new SThread(this, "radioConnected").start();
+ }
+
+
+ /**
+ * Callback that gets the server connection event.
+ * @param objects
+ */
+ public void onTuxServerConnected(Boolean value, Double delay)
+ {
+ new SThread(this, "serverConnected").start();
+ }
+
+
+ /**
+ * Callback that gets the radio disconnection event.
+ * @param objects
+ */
+ public void onRadioDisconnected(String value, Double delay)
+ {
+ new SThread(this, "radioDisconnected").start();
+ }
+
+
+ /**
+ * Receive start and stop events from resource to save/restore remote
control context.
+ * @param name
+ * @param value
+ */
+ public void onAllEvents(String name, String value)
+ {
+ new AllEventsThread(this, value, "onAllEvents").start();
+ }
+
+
+ /**
+ * remote control/wings callback actions "next" started in a thread.
+ * @param value
+ * @param delay
+ */
+ public void remoteListNextEntry(String value, Double delay)
+ {
new SThread(this, "next").start();
}
- public void remoteListPreviousEntry(String value, Double delay){
+
+ /**
+ * remote control/wings callback actions "previous" started in a
thread.
+ * @param value
+ * @param delay
+ */
+ public void remoteListPreviousEntry(String value, Double delay)
+ {
new SThread(this, "previous").start();
}
- public synchronized void next()
+ /**
+ * remote control/wings callback actions "playRemote" started in a
thread.
+ * @param value
+ * @param delay
+ */
+ public void playFromRemote(String value, Double delay)
{
+ new SThread(this, "playRemote").run();
+ }
+
+
+ /**
+ * remote control/wings callback actions "stopRemote" started in a
thread.
+ * @param value
+ * @param delay
+ */
+ public void stopFromRemote(String value, Double delay)
+ {
+ new SThread(this, "remoteStop").run();
+ }
+
+
+//*****************************************************************************//
+//************** Functions used into the callbacks threads.
****************//
+
+ /**
+ * Called when radio is connected.
+ */
+ public void radioConnected()
+ {
+ if(!CcCommons.tux.radio.getConnected()) return;
+ this.jStatusBar.setOnlineStatus(true);
+ if(!SystemInformation.isUnix())
+ CcCommons.tray.setIcon(CcCommons.tray_online);
+
+ this.popupFileMenu = null;
+ this.constructFileMenu();
+ jFrame.pack();
+ }
+
+ /**
+ * Called when cc is connected to the server.
+ */
+ public void serverConnected()
+ {
+ CcCommons.tux.tts.setLocutor(CcCommons.settings.getSpeaker());
+ if(!((CcCommons.settings.getPitch() < 200)) ||
(CcCommons.settings.getPitch() <= 0)) CcCommons.settings.setPitch(200);
+ CcCommons.tux.tts.setPitch(CcCommons.settings.getPitch());
+ if(CcCommons.tux.radio.getConnected()){
+ onRadioConnected(null, null);
+ }
+ }
+
+ /**
+ * Called when radio connection diapear.
+ */
+ public void radioDisconnected()
+ {
+ this.jStatusBar.setOnlineStatus(false);
+ CcCommons.tray.setIcon(CcCommons.tray_offline);
+ popupFileMenu.remove(1);
+ popupFileMenu.remove(1);
+ }
+
+ /**
+ * Go to next item into the favorites list.
+ */
+ public void next()
+ {
this.canPlayFromRemote = true;
if(CcCommons.type != CcConstants.TYPE_REMOTELIST)
this.showPlaylist(1);
@@ -380,7 +452,10 @@
}
- public synchronized void previous()
+ /**
+ * Go to previous item into the favorites list.
+ */
+ public void previous()
{
this.canPlayFromRemote = true;
if(CcCommons.type != CcConstants.TYPE_REMOTELIST)
@@ -389,6 +464,11 @@
}
+
+ /**
+ * Say the gadget/attitune name.
+ * @param texte
+ */
public void Say(String texte){
if(texte.contains("Gadget")){
texte = texte.replace("Gadget", "");
@@ -407,7 +487,11 @@
}
- public void stopFromRemote(String value, Double delay){
+ /**
+ * Stop the current started favorite.
+ */
+ public void remoteStop()
+ {
if(!this.canPlayFromRemote)
return;
@@ -421,8 +505,11 @@
}
- public void playFromRemote(String value, Double delay){
-
+ /**
+ * Play a favorites from the remote control or head button.
+ */
+ public void playRemote()
+ {
if(!this.canPlayFromRemote)
{
this.showPlaylist(1);
@@ -468,7 +555,11 @@
fileBrowser.playGadget(this.currentGadget,
this.currentGadgetParameters.getValues(), "run");
}
}
- }
+ }
+
+
+//********************************************************************//
+//********************* Graphical interface ************************//
/**
* This function initializes the container.
@@ -2730,7 +2821,8 @@
{
//Destroying first the alert fifos.
CcCommons.alertsFifo.destroy();
- if(CcCommons.type == CcConstants.TYPE_REMOTELIST) {
+ if(CcCommons.type == CcConstants.TYPE_REMOTELIST)
+ {
this.remotePlaylist.checkForEdition();
saveFavoritesParams();
saveGadgetAlertDatas();
Modified:
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Listener/ExitControlListener.java
===================================================================
---
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Listener/ExitControlListener.java
2009-02-04 15:55:02 UTC (rev 3559)
+++
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Listener/ExitControlListener.java
2009-02-05 13:30:49 UTC (rev 3560)
@@ -57,7 +57,6 @@
new SThread(this.sender, this.method).start();
CcCommons.tux.tts.stop();
fileBrowser.stopPlaying(CcConstants.TYPE_ATTITUNES,
FileBrowser.REMOTELIST_TYPE);
- //CcCommons.tux.server.disconnect();
CcCommons.tux.destroy();
try
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn