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:
parent
f59040375b
commit
8e264badb7
|
@ -64,6 +64,9 @@ public class MicaZCompileDialog extends AbstractCompileDialog {
|
||||||
super(parent, simulation, moteType);
|
super(parent, simulation, moteType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Class<? extends MoteInterface>[] getAllMoteInterfaces() {
|
||||||
|
return ((MicaZMoteType)moteType).getAllMoteInterfaceClasses();
|
||||||
|
}
|
||||||
public Class<? extends MoteInterface>[] getDefaultMoteInterfaces() {
|
public Class<? extends MoteInterface>[] getDefaultMoteInterfaces() {
|
||||||
return ((MicaZMoteType)moteType).getAllMoteInterfaceClasses();
|
return ((MicaZMoteType)moteType).getAllMoteInterfaceClasses();
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,6 +198,9 @@ public class ESBMoteType extends MspMoteType {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Class<? extends MoteInterface>[] getDefaultMoteInterfaceClasses() {
|
||||||
|
return getAllMoteInterfaceClasses();
|
||||||
|
}
|
||||||
public Class<? extends MoteInterface>[] getAllMoteInterfaceClasses() {
|
public Class<? extends MoteInterface>[] getAllMoteInterfaceClasses() {
|
||||||
return new Class[] {
|
return new Class[] {
|
||||||
Position.class,
|
Position.class,
|
||||||
|
|
|
@ -179,6 +179,22 @@ public class Exp5438MoteType extends MspMoteType {
|
||||||
return null;
|
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() {
|
public Class<? extends MoteInterface>[] getAllMoteInterfaceClasses() {
|
||||||
return new Class[] {
|
return new Class[] {
|
||||||
Position.class,
|
Position.class,
|
||||||
|
@ -189,6 +205,8 @@ public class Exp5438MoteType extends MspMoteType {
|
||||||
MspClock.class,
|
MspClock.class,
|
||||||
MspMoteID.class,
|
MspMoteID.class,
|
||||||
Msp802154Radio.class,
|
Msp802154Radio.class,
|
||||||
|
CC1101Radio.class,
|
||||||
|
CC1120Radio.class,
|
||||||
UsciA1Serial.class,
|
UsciA1Serial.class,
|
||||||
Exp5438LED.class,
|
Exp5438LED.class,
|
||||||
/*Exp5438LCD.class,*/ /* TODO */
|
/*Exp5438LCD.class,*/ /* TODO */
|
||||||
|
|
|
@ -71,6 +71,9 @@ public class JCreateMoteType extends AbstractMspMoteType {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
public Class<? extends MoteInterface>[] getDefaultMoteInterfaceClasses() {
|
||||||
|
return getAllMoteInterfaceClasses();
|
||||||
|
}
|
||||||
public Class<? extends MoteInterface>[] getAllMoteInterfaceClasses() {
|
public Class<? extends MoteInterface>[] getAllMoteInterfaceClasses() {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Class<? extends MoteInterface>[] list = createMoteInterfaceList(
|
Class<? extends MoteInterface>[] list = createMoteInterfaceList(
|
||||||
|
|
|
@ -71,8 +71,11 @@ public class MspCompileDialog extends AbstractCompileDialog {
|
||||||
addCompilationTipsTab(tabbedPane);
|
addCompilationTipsTab(tabbedPane);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Class<? extends MoteInterface>[] getAllMoteInterfaces() {
|
||||||
|
return ((MspMoteType)moteType).getAllMoteInterfaceClasses();
|
||||||
|
}
|
||||||
public Class<? extends MoteInterface>[] getDefaultMoteInterfaces() {
|
public Class<? extends MoteInterface>[] getDefaultMoteInterfaces() {
|
||||||
return ((MspMoteType)moteType).getAllMoteInterfaceClasses();
|
return ((MspMoteType)moteType).getDefaultMoteInterfaceClasses();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addCompilationTipsTab(JTabbedPane parent) {
|
private void addCompilationTipsTab(JTabbedPane parent) {
|
||||||
|
|
|
@ -320,6 +320,7 @@ public abstract class MspMoteType implements MoteType {
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract Class<? extends MoteInterface>[] getAllMoteInterfaceClasses();
|
public abstract Class<? extends MoteInterface>[] getAllMoteInterfaceClasses();
|
||||||
|
public abstract Class<? extends MoteInterface>[] getDefaultMoteInterfaceClasses();
|
||||||
public abstract File getExpectedFirmwareFile(File source);
|
public abstract File getExpectedFirmwareFile(File source);
|
||||||
|
|
||||||
private static ELF loadELF(String filepath) throws IOException {
|
private static ELF loadELF(String filepath) throws IOException {
|
||||||
|
|
|
@ -69,7 +69,9 @@ public class SentillaUSBMoteType extends AbstractMspMoteType {
|
||||||
return new SentillaUSBMote(this, simulation);
|
return new SentillaUSBMote(this, simulation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public Class<? extends MoteInterface>[] getDefaultMoteInterfaceClasses() {
|
||||||
|
return getAllMoteInterfaceClasses();
|
||||||
|
}
|
||||||
public Class<? extends MoteInterface>[] getAllMoteInterfaceClasses() {
|
public Class<? extends MoteInterface>[] getAllMoteInterfaceClasses() {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Class<? extends MoteInterface>[] list = createMoteInterfaceList(
|
Class<? extends MoteInterface>[] list = createMoteInterfaceList(
|
||||||
|
|
|
@ -202,6 +202,9 @@ public class SkyMoteType extends MspMoteType {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Class<? extends MoteInterface>[] getDefaultMoteInterfaceClasses() {
|
||||||
|
return getAllMoteInterfaceClasses();
|
||||||
|
}
|
||||||
public Class<? extends MoteInterface>[] getAllMoteInterfaceClasses() {
|
public Class<? extends MoteInterface>[] getAllMoteInterfaceClasses() {
|
||||||
return new Class[] {
|
return new Class[] {
|
||||||
Position.class,
|
Position.class,
|
||||||
|
|
|
@ -179,6 +179,9 @@ public class TyndallMoteType extends MspMoteType {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Class<? extends MoteInterface>[] getDefaultMoteInterfaceClasses() {
|
||||||
|
return getAllMoteInterfaceClasses();
|
||||||
|
}
|
||||||
public Class<? extends MoteInterface>[] getAllMoteInterfaceClasses() {
|
public Class<? extends MoteInterface>[] getAllMoteInterfaceClasses() {
|
||||||
return new Class[] {
|
return new Class[] {
|
||||||
Position.class,
|
Position.class,
|
||||||
|
|
|
@ -69,7 +69,9 @@ public class WismoteMoteType extends AbstractMspMoteType {
|
||||||
return new WismoteMote(this, simulation);
|
return new WismoteMote(this, simulation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public Class<? extends MoteInterface>[] getDefaultMoteInterfaceClasses() {
|
||||||
|
return getAllMoteInterfaceClasses();
|
||||||
|
}
|
||||||
public Class<? extends MoteInterface>[] getAllMoteInterfaceClasses() {
|
public Class<? extends MoteInterface>[] getAllMoteInterfaceClasses() {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Class<? extends MoteInterface>[] list = createMoteInterfaceList(
|
Class<? extends MoteInterface>[] list = createMoteInterfaceList(
|
||||||
|
|
|
@ -70,7 +70,10 @@ public class Z1MoteType extends AbstractMspMoteType {
|
||||||
return new Z1Mote(this, simulation);
|
return new Z1Mote(this, simulation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public Class<? extends MoteInterface>[] getDefaultMoteInterfaceClasses() {
|
||||||
|
return getAllMoteInterfaceClasses();
|
||||||
|
}
|
||||||
|
|
||||||
public Class<? extends MoteInterface>[] getAllMoteInterfaceClasses() {
|
public Class<? extends MoteInterface>[] getAllMoteInterfaceClasses() {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Class<? extends MoteInterface>[] list = createMoteInterfaceList(
|
Class<? extends MoteInterface>[] list = createMoteInterfaceList(
|
||||||
|
|
|
@ -372,7 +372,7 @@ public abstract class AbstractCompileDialog extends JDialog {
|
||||||
((JCheckBox) c).setSelected(false);
|
((JCheckBox) c).setSelected(false);
|
||||||
}
|
}
|
||||||
if (moteType.getMoteInterfaceClasses() != null) {
|
if (moteType.getMoteInterfaceClasses() != null) {
|
||||||
for (Class<? extends MoteInterface> intfClass: getDefaultMoteInterfaces()) {
|
for (Class<? extends MoteInterface> intfClass: getAllMoteInterfaces()) {
|
||||||
addMoteInterface(intfClass, false);
|
addMoteInterface(intfClass, false);
|
||||||
}
|
}
|
||||||
for (Class<? extends MoteInterface> intf: moteType.getMoteInterfaceClasses()) {
|
for (Class<? extends MoteInterface> intf: moteType.getMoteInterfaceClasses()) {
|
||||||
|
@ -380,6 +380,9 @@ public abstract class AbstractCompileDialog extends JDialog {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Select default mote interfaces */
|
/* Select default mote interfaces */
|
||||||
|
for (Class<? extends MoteInterface> intfClass: getAllMoteInterfaces()) {
|
||||||
|
addMoteInterface(intfClass, false);
|
||||||
|
}
|
||||||
for (Class<? extends MoteInterface> intfClass: getDefaultMoteInterfaces()) {
|
for (Class<? extends MoteInterface> intfClass: getDefaultMoteInterfaces()) {
|
||||||
addMoteInterface(intfClass, true);
|
addMoteInterface(intfClass, true);
|
||||||
}
|
}
|
||||||
|
@ -714,6 +717,7 @@ public abstract class AbstractCompileDialog extends JDialog {
|
||||||
};
|
};
|
||||||
|
|
||||||
public abstract Class<? extends MoteInterface>[] getDefaultMoteInterfaces();
|
public abstract Class<? extends MoteInterface>[] getDefaultMoteInterfaces();
|
||||||
|
public abstract Class<? extends MoteInterface>[] getAllMoteInterfaces();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Currently selected mote interface classes
|
* @return Currently selected mote interface classes
|
||||||
|
|
|
@ -199,24 +199,27 @@ public class ContikiMoteCompileDialog extends AbstractCompileDialog {
|
||||||
return ContikiMoteType.getExpectedFirmwareFile(source);
|
return ContikiMoteType.getExpectedFirmwareFile(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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>>();
|
||||||
|
|
||||||
|
/* Load mote interface classes */
|
||||||
|
for (String intfName : intfNames) {
|
||||||
|
Class<? extends MoteInterface> intfClass =
|
||||||
|
gui.tryLoadClass(this, MoteInterface.class, intfName);
|
||||||
|
|
||||||
|
if (intfClass == null) {
|
||||||
|
logger.warn("Failed to load mote interface class: " + intfName);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
classes.add(intfClass);
|
||||||
|
}
|
||||||
|
return classes.toArray(new Class[0]);
|
||||||
|
}
|
||||||
public Class<? extends MoteInterface>[] getDefaultMoteInterfaces() {
|
public Class<? extends MoteInterface>[] getDefaultMoteInterfaces() {
|
||||||
ProjectConfig projectConfig = moteType.getConfig();
|
return getAllMoteInterfaces();
|
||||||
String[] intfNames = projectConfig.getStringArrayValue(ContikiMoteType.class, "MOTE_INTERFACES");
|
|
||||||
ArrayList<Class<? extends MoteInterface>> classes = new ArrayList<Class<? extends MoteInterface>>();
|
|
||||||
|
|
||||||
/* Load mote interface classes */
|
|
||||||
for (String intfName : intfNames) {
|
|
||||||
Class<? extends MoteInterface> intfClass =
|
|
||||||
gui.tryLoadClass(this, MoteInterface.class, intfName);
|
|
||||||
|
|
||||||
if (intfClass == null) {
|
|
||||||
logger.warn("Failed to load mote interface class: " + intfName);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
classes.add(intfClass);
|
|
||||||
}
|
|
||||||
return classes.toArray(new Class[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addAdvancedTab(JTabbedPane parent) {
|
private void addAdvancedTab(JTabbedPane parent) {
|
||||||
|
|
Loading…
Reference in a new issue