added new mote type method that returns the by-default used mote interfaces, as opposed to all compatible mote

interfaces

this allows the user to override default settings in the create-new-mote-type dialogs
This commit is contained in:
Fredrik Osterlind 2013-08-14 13:25:53 +02:00
parent f59040375b
commit 8e264badb7
13 changed files with 73 additions and 22 deletions

View file

@ -64,6 +64,9 @@ public class MicaZCompileDialog extends AbstractCompileDialog {
super(parent, simulation, moteType);
}
public Class<? extends MoteInterface>[] getAllMoteInterfaces() {
return ((MicaZMoteType)moteType).getAllMoteInterfaceClasses();
}
public Class<? extends MoteInterface>[] getDefaultMoteInterfaces() {
return ((MicaZMoteType)moteType).getAllMoteInterfaceClasses();
}

View file

@ -198,6 +198,9 @@ public class ESBMoteType extends MspMoteType {
return true;
}
public Class<? extends MoteInterface>[] getDefaultMoteInterfaceClasses() {
return getAllMoteInterfaceClasses();
}
public Class<? extends MoteInterface>[] getAllMoteInterfaceClasses() {
return new Class[] {
Position.class,

View file

@ -179,6 +179,22 @@ public class Exp5438MoteType extends MspMoteType {
return null;
}
public Class<? extends MoteInterface>[] getDefaultMoteInterfaceClasses() {
return new Class[] {
Position.class,
RimeAddress.class,
IPAddress.class,
Mote2MoteRelations.class,
MoteAttributes.class,
MspClock.class,
MspMoteID.class,
Msp802154Radio.class,
UsciA1Serial.class,
Exp5438LED.class,
/*Exp5438LCD.class,*/ /* TODO */
MspDebugOutput.class
};
}
public Class<? extends MoteInterface>[] getAllMoteInterfaceClasses() {
return new Class[] {
Position.class,
@ -189,6 +205,8 @@ public class Exp5438MoteType extends MspMoteType {
MspClock.class,
MspMoteID.class,
Msp802154Radio.class,
CC1101Radio.class,
CC1120Radio.class,
UsciA1Serial.class,
Exp5438LED.class,
/*Exp5438LCD.class,*/ /* TODO */

View file

@ -71,6 +71,9 @@ public class JCreateMoteType extends AbstractMspMoteType {
}
@Override
public Class<? extends MoteInterface>[] getDefaultMoteInterfaceClasses() {
return getAllMoteInterfaceClasses();
}
public Class<? extends MoteInterface>[] getAllMoteInterfaceClasses() {
@SuppressWarnings("unchecked")
Class<? extends MoteInterface>[] list = createMoteInterfaceList(

View file

@ -71,9 +71,12 @@ public class MspCompileDialog extends AbstractCompileDialog {
addCompilationTipsTab(tabbedPane);
}
public Class<? extends MoteInterface>[] getDefaultMoteInterfaces() {
public Class<? extends MoteInterface>[] getAllMoteInterfaces() {
return ((MspMoteType)moteType).getAllMoteInterfaceClasses();
}
public Class<? extends MoteInterface>[] getDefaultMoteInterfaces() {
return ((MspMoteType)moteType).getDefaultMoteInterfaceClasses();
}
private void addCompilationTipsTab(JTabbedPane parent) {
JTextArea textArea = new JTextArea();

View file

@ -320,6 +320,7 @@ public abstract class MspMoteType implements MoteType {
}
public abstract Class<? extends MoteInterface>[] getAllMoteInterfaceClasses();
public abstract Class<? extends MoteInterface>[] getDefaultMoteInterfaceClasses();
public abstract File getExpectedFirmwareFile(File source);
private static ELF loadELF(String filepath) throws IOException {

View file

@ -69,7 +69,9 @@ public class SentillaUSBMoteType extends AbstractMspMoteType {
return new SentillaUSBMote(this, simulation);
}
@Override
public Class<? extends MoteInterface>[] getDefaultMoteInterfaceClasses() {
return getAllMoteInterfaceClasses();
}
public Class<? extends MoteInterface>[] getAllMoteInterfaceClasses() {
@SuppressWarnings("unchecked")
Class<? extends MoteInterface>[] list = createMoteInterfaceList(

View file

@ -202,6 +202,9 @@ public class SkyMoteType extends MspMoteType {
return null;
}
public Class<? extends MoteInterface>[] getDefaultMoteInterfaceClasses() {
return getAllMoteInterfaceClasses();
}
public Class<? extends MoteInterface>[] getAllMoteInterfaceClasses() {
return new Class[] {
Position.class,

View file

@ -179,6 +179,9 @@ public class TyndallMoteType extends MspMoteType {
return null;
}
public Class<? extends MoteInterface>[] getDefaultMoteInterfaceClasses() {
return getAllMoteInterfaceClasses();
}
public Class<? extends MoteInterface>[] getAllMoteInterfaceClasses() {
return new Class[] {
Position.class,

View file

@ -69,7 +69,9 @@ public class WismoteMoteType extends AbstractMspMoteType {
return new WismoteMote(this, simulation);
}
@Override
public Class<? extends MoteInterface>[] getDefaultMoteInterfaceClasses() {
return getAllMoteInterfaceClasses();
}
public Class<? extends MoteInterface>[] getAllMoteInterfaceClasses() {
@SuppressWarnings("unchecked")
Class<? extends MoteInterface>[] list = createMoteInterfaceList(

View file

@ -70,7 +70,10 @@ public class Z1MoteType extends AbstractMspMoteType {
return new Z1Mote(this, simulation);
}
@Override
public Class<? extends MoteInterface>[] getDefaultMoteInterfaceClasses() {
return getAllMoteInterfaceClasses();
}
public Class<? extends MoteInterface>[] getAllMoteInterfaceClasses() {
@SuppressWarnings("unchecked")
Class<? extends MoteInterface>[] list = createMoteInterfaceList(

View file

@ -372,7 +372,7 @@ public abstract class AbstractCompileDialog extends JDialog {
((JCheckBox) c).setSelected(false);
}
if (moteType.getMoteInterfaceClasses() != null) {
for (Class<? extends MoteInterface> intfClass: getDefaultMoteInterfaces()) {
for (Class<? extends MoteInterface> intfClass: getAllMoteInterfaces()) {
addMoteInterface(intfClass, false);
}
for (Class<? extends MoteInterface> intf: moteType.getMoteInterfaceClasses()) {
@ -380,6 +380,9 @@ public abstract class AbstractCompileDialog extends JDialog {
}
} else {
/* Select default mote interfaces */
for (Class<? extends MoteInterface> intfClass: getAllMoteInterfaces()) {
addMoteInterface(intfClass, false);
}
for (Class<? extends MoteInterface> intfClass: getDefaultMoteInterfaces()) {
addMoteInterface(intfClass, true);
}
@ -714,6 +717,7 @@ public abstract class AbstractCompileDialog extends JDialog {
};
public abstract Class<? extends MoteInterface>[] getDefaultMoteInterfaces();
public abstract Class<? extends MoteInterface>[] getAllMoteInterfaces();
/**
* @return Currently selected mote interface classes

View file

@ -199,7 +199,7 @@ public class ContikiMoteCompileDialog extends AbstractCompileDialog {
return ContikiMoteType.getExpectedFirmwareFile(source);
}
public Class<? extends MoteInterface>[] getDefaultMoteInterfaces() {
public Class<? extends MoteInterface>[] getAllMoteInterfaces() {
ProjectConfig projectConfig = moteType.getConfig();
String[] intfNames = projectConfig.getStringArrayValue(ContikiMoteType.class, "MOTE_INTERFACES");
ArrayList<Class<? extends MoteInterface>> classes = new ArrayList<Class<? extends MoteInterface>>();
@ -218,6 +218,9 @@ public class ContikiMoteCompileDialog extends AbstractCompileDialog {
}
return classes.toArray(new Class[0]);
}
public Class<? extends MoteInterface>[] getDefaultMoteInterfaces() {
return getAllMoteInterfaces();
}
private void addAdvancedTab(JTabbedPane parent) {