new interface format without passive/active

This commit is contained in:
fros4943 2008-10-28 17:02:13 +00:00
parent 0ccb368fba
commit 3ee86789e2
3 changed files with 21 additions and 33 deletions

View file

@ -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: ESBMote.java,v 1.4 2008/10/13 14:50:50 nifi Exp $ * $Id: ESBMote.java,v 1.5 2008/10/28 17:02:13 fros4943 Exp $
*/ */
package se.sics.cooja.mspmote; package se.sics.cooja.mspmote;
@ -75,31 +75,31 @@ public class ESBMote extends MspMote {
Position motePosition = new Position(this); Position motePosition = new Position(this);
Random random = new Random(); Random random = new Random();
motePosition.setCoordinates(random.nextDouble()*100, random.nextDouble()*100, random.nextDouble()*100); motePosition.setCoordinates(random.nextDouble()*100, random.nextDouble()*100, random.nextDouble()*100);
moteInterfaceHandler.addActiveInterface(motePosition); moteInterfaceHandler.addInterface(motePosition);
// Add log interface // Add log interface
Log moteLog = new ESBLog(this); Log moteLog = new ESBLog(this);
moteInterfaceHandler.addActiveInterface(moteLog); moteInterfaceHandler.addInterface(moteLog);
// Add time interface // Add time interface
Clock moteClock = new MspClock(this); Clock moteClock = new MspClock(this);
moteInterfaceHandler.addActiveInterface(moteClock); moteInterfaceHandler.addInterface(moteClock);
// Add led interface // Add led interface
LED moteLed = new ESBLED(this); LED moteLed = new ESBLED(this);
moteInterfaceHandler.addActiveInterface(moteLed); moteInterfaceHandler.addInterface(moteLed);
// Add button interface // Add button interface
Button moteButton = new ESBButton(this); Button moteButton = new ESBButton(this);
moteInterfaceHandler.addActiveInterface(moteButton); moteInterfaceHandler.addInterface(moteButton);
// Add ID interface // Add ID interface
MoteID moteID = new MspMoteID(this); MoteID moteID = new MspMoteID(this);
moteInterfaceHandler.addActiveInterface(moteID); moteInterfaceHandler.addInterface(moteID);
// Add radio interface // Add radio interface
myRadio = new TR1001Radio(this); myRadio = new TR1001Radio(this);
moteInterfaceHandler.addActiveInterface(myRadio); moteInterfaceHandler.addInterface(myRadio);
return moteInterfaceHandler; return moteInterfaceHandler;
} }

View file

@ -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: MspMote.java,v 1.14 2008/10/13 14:50:50 nifi Exp $ * $Id: MspMote.java,v 1.15 2008/10/28 17:02:13 fros4943 Exp $
*/ */
package se.sics.cooja.mspmote; package se.sics.cooja.mspmote;
@ -386,20 +386,8 @@ public abstract class MspMote implements Mote {
element.setText(getType().getIdentifier()); element.setText(getType().getIdentifier());
config.add(element); config.add(element);
// Active interface configs (if any) // Mote interfaces
for (MoteInterface moteInterface: getInterfaces().getAllActiveInterfaces()) { for (MoteInterface moteInterface: getInterfaces().getInterfaces()) {
element = new Element("interface_config");
element.setText(moteInterface.getClass().getName());
Collection<Element> interfaceXML = moteInterface.getConfigXML();
if (interfaceXML != null) {
element.addContent(interfaceXML);
config.add(element);
}
}
// Passive interface configs (if any)
for (MoteInterface moteInterface: getInterfaces().getAllPassiveInterfaces()) {
element = new Element("interface_config"); element = new Element("interface_config");
element.setText(moteInterface.getClass().getName()); element.setText(moteInterface.getClass().getName());

View file

@ -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: SkyMote.java,v 1.7 2008/10/13 14:50:50 nifi Exp $ * $Id: SkyMote.java,v 1.8 2008/10/28 17:02:13 fros4943 Exp $
*/ */
package se.sics.cooja.mspmote; package se.sics.cooja.mspmote;
@ -75,37 +75,37 @@ public class SkyMote extends MspMote {
Position motePosition = new Position(this); Position motePosition = new Position(this);
Random random = new Random(); Random random = new Random();
motePosition.setCoordinates(random.nextDouble()*100, random.nextDouble()*100, random.nextDouble()*100); motePosition.setCoordinates(random.nextDouble()*100, random.nextDouble()*100, random.nextDouble()*100);
moteInterfaceHandler.addActiveInterface(motePosition); moteInterfaceHandler.addInterface(motePosition);
// Add time interface // Add time interface
Clock moteClock = new MspClock(this); Clock moteClock = new MspClock(this);
moteInterfaceHandler.addActiveInterface(moteClock); moteInterfaceHandler.addInterface(moteClock);
// Add button interface // Add button interface
Button moteButton = new SkyButton(this); Button moteButton = new SkyButton(this);
moteInterfaceHandler.addActiveInterface(moteButton); moteInterfaceHandler.addInterface(moteButton);
// Add Flash interface // Add Flash interface
SkyFlash moteFlash = new SkyFlash(this); SkyFlash moteFlash = new SkyFlash(this);
moteInterfaceHandler.addActiveInterface(moteFlash); moteInterfaceHandler.addInterface(moteFlash);
// Add ID interface // Add ID interface
MoteID moteID = new MspMoteID(this); MoteID moteID = new MspMoteID(this);
moteInterfaceHandler.addActiveInterface(moteID); moteInterfaceHandler.addInterface(moteID);
// Add radio interface // Add radio interface
// SkyRadio moteRadio = new SkyRadio(this); // SkyRadio moteRadio = new SkyRadio(this);
// moteInterfaceHandler.addActiveInterface(moteRadio); // moteInterfaceHandler.addActiveInterface(moteRadio);
SkyByteRadio moteRadio = new SkyByteRadio(this); SkyByteRadio moteRadio = new SkyByteRadio(this);
moteInterfaceHandler.addActiveInterface(moteRadio); moteInterfaceHandler.addInterface(moteRadio);
// Add serial interface // Add serial interface
SkySerial moteSerial = new SkySerial(this); SkySerial moteSerial = new SkySerial(this);
moteInterfaceHandler.addActiveInterface(moteSerial); moteInterfaceHandler.addInterface(moteSerial);
// Add LED interface // Add LED interface
SkyLED moteLED = new SkyLED(this); SkyLED moteLED = new SkyLED(this);
moteInterfaceHandler.addActiveInterface(moteLED); moteInterfaceHandler.addInterface(moteLED);
return moteInterfaceHandler; return moteInterfaceHandler;
} }