public Tuple getTuple() throws IllegalArgumentException { int r = 0; int t = 0; Tuple content = new Tuple(); Tuple envelope = new Tuple(); System.out.println("ACCELERATION TASK DEFINITION"); System.out.println("Insert the reporting period in SECONDS (= " + Constants.SECOND + " ms)"); try { r = Integer.parseInt(reader.readLine()); } catch (Exception e) { throw new IllegalArgumentException(e); } System.out.println("Insert the total number of reporting periods (-1 for an infinite task)"); try { t = Integer.parseInt(reader.readLine()); if (t == -1) { t = Constants.INFINITE_OP_TIME; } } catch (Exception e) { throw new IllegalArgumentException(e); } content.add(new Field().actualField(new Uint8(Constants.TASK_TYPE))); content.add(new Field().actualField(new Uint8(Constants.ACCELERATION))); content.add(new Field().actualField(new Uint16(r))); content.add(new Field().actualField(new Uint16(t))); envelope.add(new Field().actualField(new Uint8(Constants.DISSEMINATION_TYPE))); envelope.add(new Field().actualField(new Uint16(Constants.DISSEMINATE_A_NEW_TUPLE))); envelope.add(new Field().actualField(new Uint16(Constants.ACCELERATION))); envelope.add( new Field() .actualField( new Uint8Array(Properties.TUPLE_DISS_PAYLOAD_SIZE) .setValue(Serializer.toSerial(content)))); return envelope; }