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
* 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;
@ -75,31 +75,31 @@ public class ESBMote extends MspMote {
Position motePosition = new Position(this);
Random random = new Random();
motePosition.setCoordinates(random.nextDouble()*100, random.nextDouble()*100, random.nextDouble()*100);
moteInterfaceHandler.addActiveInterface(motePosition);
moteInterfaceHandler.addInterface(motePosition);
// Add log interface
Log moteLog = new ESBLog(this);
moteInterfaceHandler.addActiveInterface(moteLog);
moteInterfaceHandler.addInterface(moteLog);
// Add time interface
Clock moteClock = new MspClock(this);
moteInterfaceHandler.addActiveInterface(moteClock);
moteInterfaceHandler.addInterface(moteClock);
// Add led interface
LED moteLed = new ESBLED(this);
moteInterfaceHandler.addActiveInterface(moteLed);
moteInterfaceHandler.addInterface(moteLed);
// Add button interface
Button moteButton = new ESBButton(this);
moteInterfaceHandler.addActiveInterface(moteButton);
moteInterfaceHandler.addInterface(moteButton);
// Add ID interface
MoteID moteID = new MspMoteID(this);
moteInterfaceHandler.addActiveInterface(moteID);
moteInterfaceHandler.addInterface(moteID);
// Add radio interface
myRadio = new TR1001Radio(this);
moteInterfaceHandler.addActiveInterface(myRadio);
moteInterfaceHandler.addInterface(myRadio);
return moteInterfaceHandler;
}

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* 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;
@ -386,20 +386,8 @@ public abstract class MspMote implements Mote {
element.setText(getType().getIdentifier());
config.add(element);
// Active interface configs (if any)
for (MoteInterface moteInterface: getInterfaces().getAllActiveInterfaces()) {
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()) {
// Mote interfaces
for (MoteInterface moteInterface: getInterfaces().getInterfaces()) {
element = new Element("interface_config");
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
* 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;
@ -75,37 +75,37 @@ public class SkyMote extends MspMote {
Position motePosition = new Position(this);
Random random = new Random();
motePosition.setCoordinates(random.nextDouble()*100, random.nextDouble()*100, random.nextDouble()*100);
moteInterfaceHandler.addActiveInterface(motePosition);
moteInterfaceHandler.addInterface(motePosition);
// Add time interface
Clock moteClock = new MspClock(this);
moteInterfaceHandler.addActiveInterface(moteClock);
moteInterfaceHandler.addInterface(moteClock);
// Add button interface
Button moteButton = new SkyButton(this);
moteInterfaceHandler.addActiveInterface(moteButton);
moteInterfaceHandler.addInterface(moteButton);
// Add Flash interface
SkyFlash moteFlash = new SkyFlash(this);
moteInterfaceHandler.addActiveInterface(moteFlash);
moteInterfaceHandler.addInterface(moteFlash);
// Add ID interface
MoteID moteID = new MspMoteID(this);
moteInterfaceHandler.addActiveInterface(moteID);
moteInterfaceHandler.addInterface(moteID);
// Add radio interface
// SkyRadio moteRadio = new SkyRadio(this);
// moteInterfaceHandler.addActiveInterface(moteRadio);
SkyByteRadio moteRadio = new SkyByteRadio(this);
moteInterfaceHandler.addActiveInterface(moteRadio);
moteInterfaceHandler.addInterface(moteRadio);
// Add serial interface
SkySerial moteSerial = new SkySerial(this);
moteInterfaceHandler.addActiveInterface(moteSerial);
moteInterfaceHandler.addInterface(moteSerial);
// Add LED interface
SkyLED moteLED = new SkyLED(this);
moteInterfaceHandler.addActiveInterface(moteLED);
moteInterfaceHandler.addInterface(moteLED);
return moteInterfaceHandler;
}