Message buildAddrMsg(int dest, Message msg, int msgSize) { AddressMsg addrMsg = new AddressMsg(AddressMsg.DEFAULT_MESSAGE_SIZE + msgSize); String moteid = Env.getenv("MOTEID"); int source = 0xFFFF; if (moteid != null) { source = Integer.parseInt(moteid); } addrMsg.dataSet(msg.dataGet(), 0, addrMsg.offset_data(0), msgSize); addrMsg.set_dest(dest); addrMsg.set_source(source); return addrMsg; }