Remove TODO file
[remote/remote-gui.git] / src / motecontrol / protocols / clientserver / MsgMoteIdList.java
bloba832605c633f86bdcf124556d9b901d9557dbf5c
1 package diku.distlab.motecontrolclientlib.protocols.clientserver;
3 import java.io.DataInput;
4 import java.io.DataOutput;
5 import java.util.ArrayList;
7 import diku.distlab.motecontrolclientlib.protocols.MsgIO;
8 import diku.distlab.motecontrolclientlib.protocols.MsgUint16;
9 import diku.distlab.motecontrolclientlib.protocols.MsgUint32;
11 public class MsgMoteIdList extends MsgIO {
13 ArrayList moteIds;
17 public MsgMoteIdList() {
18 super();
19 moteIds = new ArrayList();
22 public void read(DataInput is) throws Exception
24 MsgUint16 count = new MsgUint16();
25 MsgUint32 moteId;
26 clear();
27 count.read(is);
28 for (int i=0; i<count.getValue(); i++)
30 moteId = new MsgUint32();
31 moteId.read(is);
32 this.addMoteId(moteId);
36 public void write(DataOutput os) throws Exception
38 MsgUint16 count = new MsgUint16(moteIds.size());
39 MsgUint32 moteId;
40 count.write(os);
41 for (int i=0; i<count.getValue(); i++)
43 moteId = (MsgUint32)moteIds.get(i);
44 moteId.write(os);
48 public void clear()
50 moteIds.clear();
53 public int getLength()
55 return moteIds.size();
58 public void addMoteId(MsgUint32 moteId)
60 moteIds.add(moteId);
63 public MsgUint32 getMoteId(int index)
65 return (MsgUint32) moteIds.get(index);