mirror of
https://github.com/oliverschmidt/contiki.git
synced 2025-01-10 11:29:38 +00:00
using firmware specified in applet attribute
This commit is contained in:
parent
0ae6a4185a
commit
2691abecaa
@ -26,7 +26,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: ESBMoteType.java,v 1.3 2008/02/12 15:12:38 fros4943 Exp $
|
* $Id: ESBMoteType.java,v 1.4 2008/04/03 14:01:33 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.mspmote;
|
package se.sics.cooja.mspmote;
|
||||||
@ -35,6 +35,7 @@ import java.awt.Container;
|
|||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
import java.awt.MediaTracker;
|
import java.awt.MediaTracker;
|
||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
|
import java.io.File;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
@ -81,6 +82,21 @@ public class ESBMoteType extends MspMoteType {
|
|||||||
|
|
||||||
public boolean configureAndInit(Container parentContainer, Simulation simulation,
|
public boolean configureAndInit(Container parentContainer, Simulation simulation,
|
||||||
boolean visAvailable) throws MoteTypeCreationException {
|
boolean visAvailable) throws MoteTypeCreationException {
|
||||||
|
if (GUI.isVisualizedInApplet()) {
|
||||||
|
String firmware = GUI.getExternalToolsSetting("ESB_FIRMWARE", "");
|
||||||
|
if (!firmware.equals("")) {
|
||||||
|
setELFFile(new File(firmware));
|
||||||
|
JOptionPane.showMessageDialog(GUI.getTopParentContainer(),
|
||||||
|
"Creating mote type from precompiled firmware: " + firmware,
|
||||||
|
"Compiled firmware file available", JOptionPane.INFORMATION_MESSAGE);
|
||||||
|
} else {
|
||||||
|
JOptionPane.showMessageDialog(GUI.getTopParentContainer(),
|
||||||
|
"No precompiled firmware found",
|
||||||
|
"Compiled firmware file not available", JOptionPane.ERROR_MESSAGE);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return configureAndInitMspType(parentContainer, simulation, visAvailable, target, targetNice);
|
return configureAndInitMspType(parentContainer, simulation, visAvailable, target, targetNice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: MspMoteType.java,v 1.4 2008/02/12 15:12:38 fros4943 Exp $
|
* $Id: MspMoteType.java,v 1.5 2008/04/03 14:00:21 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.mspmote;
|
package se.sics.cooja.mspmote;
|
||||||
@ -179,14 +179,19 @@ public abstract class MspMoteType implements MoteType {
|
|||||||
+ "If you want to use an already existing file, click 'Select'.\n\n"
|
+ "If you want to use an already existing file, click 'Select'.\n\n"
|
||||||
+ "To compile this file from source, click 'Compile'";
|
+ "To compile this file from source, click 'Compile'";
|
||||||
String title = "Select or compile " + targetNice + " firmware";
|
String title = "Select or compile " + targetNice + " firmware";
|
||||||
int answer = JOptionPane.showOptionDialog(GUI.getTopParentContainer(),
|
|
||||||
question, title, JOptionPane.YES_NO_OPTION,
|
|
||||||
JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
|
|
||||||
|
|
||||||
if (answer != JOptionPane.YES_OPTION && answer != JOptionPane.NO_OPTION) {
|
if (GUI.isVisualizedInApplet()) {
|
||||||
return false;
|
compileFromSource = false;
|
||||||
|
} else {
|
||||||
|
int answer = JOptionPane.showOptionDialog(GUI.getTopParentContainer(),
|
||||||
|
question, title, JOptionPane.YES_NO_OPTION,
|
||||||
|
JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
|
||||||
|
|
||||||
|
if (answer != JOptionPane.YES_OPTION && answer != JOptionPane.NO_OPTION) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
compileFromSource = answer != JOptionPane.YES_OPTION;
|
||||||
}
|
}
|
||||||
compileFromSource = answer != JOptionPane.YES_OPTION;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Description */
|
/* Description */
|
||||||
@ -234,6 +239,10 @@ public abstract class MspMoteType implements MoteType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GUI.isVisualizedInApplet()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Check dependency files
|
// Check dependency files
|
||||||
if (getELFFile() == null || !getELFFile().exists()) {
|
if (getELFFile() == null || !getELFFile().exists()) {
|
||||||
if (!visAvailable) {
|
if (!visAvailable) {
|
||||||
@ -884,6 +893,7 @@ public abstract class MspMoteType implements MoteType {
|
|||||||
smallPane = new JPanel(new BorderLayout());
|
smallPane = new JPanel(new BorderLayout());
|
||||||
label = new JLabel("Source file");
|
label = new JLabel("Source file");
|
||||||
smallPane.add(BorderLayout.WEST, label);
|
smallPane.add(BorderLayout.WEST, label);
|
||||||
|
logger.debug(">>>> " + getSourceFile());
|
||||||
if (getSourceFile() != null) {
|
if (getSourceFile() != null) {
|
||||||
label = new JLabel(getSourceFile().getName());
|
label = new JLabel(getSourceFile().getName());
|
||||||
label.setToolTipText(getSourceFile().getPath());
|
label.setToolTipText(getSourceFile().getPath());
|
||||||
@ -894,10 +904,17 @@ public abstract class MspMoteType implements MoteType {
|
|||||||
panel.add(smallPane);
|
panel.add(smallPane);
|
||||||
|
|
||||||
// Icon (if available)
|
// Icon (if available)
|
||||||
Icon moteTypeIcon = getMoteTypeIcon();
|
if (!GUI.isVisualizedInApplet()) {
|
||||||
if (moteTypeIcon != null) {
|
Icon moteTypeIcon = getMoteTypeIcon();
|
||||||
|
if (moteTypeIcon != null) {
|
||||||
|
smallPane = new JPanel(new BorderLayout());
|
||||||
|
label = new JLabel(moteTypeIcon);
|
||||||
|
smallPane.add(BorderLayout.CENTER, label);
|
||||||
|
panel.add(smallPane);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
smallPane = new JPanel(new BorderLayout());
|
smallPane = new JPanel(new BorderLayout());
|
||||||
label = new JLabel(moteTypeIcon);
|
label = new JLabel("No icon available in applet mode");
|
||||||
smallPane.add(BorderLayout.CENTER, label);
|
smallPane.add(BorderLayout.CENTER, label);
|
||||||
panel.add(smallPane);
|
panel.add(smallPane);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: SkyMoteType.java,v 1.2 2008/02/12 15:12:38 fros4943 Exp $
|
* $Id: SkyMoteType.java,v 1.3 2008/04/03 14:00:21 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.mspmote;
|
package se.sics.cooja.mspmote;
|
||||||
@ -35,6 +35,7 @@ import java.awt.Container;
|
|||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
import java.awt.MediaTracker;
|
import java.awt.MediaTracker;
|
||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
|
import java.io.File;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
@ -81,6 +82,21 @@ public class SkyMoteType extends MspMoteType {
|
|||||||
|
|
||||||
public boolean configureAndInit(Container parentContainer, Simulation simulation,
|
public boolean configureAndInit(Container parentContainer, Simulation simulation,
|
||||||
boolean visAvailable) throws MoteTypeCreationException {
|
boolean visAvailable) throws MoteTypeCreationException {
|
||||||
|
if (GUI.isVisualizedInApplet()) {
|
||||||
|
String firmware = GUI.getExternalToolsSetting("SKY_FIRMWARE", "");
|
||||||
|
if (!firmware.equals("")) {
|
||||||
|
setELFFile(new File(firmware));
|
||||||
|
JOptionPane.showMessageDialog(GUI.getTopParentContainer(),
|
||||||
|
"Creating mote type from precompiled firmware: " + firmware,
|
||||||
|
"Compiled firmware file available", JOptionPane.INFORMATION_MESSAGE);
|
||||||
|
} else {
|
||||||
|
JOptionPane.showMessageDialog(GUI.getTopParentContainer(),
|
||||||
|
"No precompiled firmware found",
|
||||||
|
"Compiled firmware file not available", JOptionPane.ERROR_MESSAGE);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return configureAndInitMspType(parentContainer, simulation, visAvailable, target, targetNice);
|
return configureAndInitMspType(parentContainer, simulation, visAvailable, target, targetNice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user