androvac/app/src/main/java/eu/worn/apps/androvac/RoboVac11sRemote.java

58 lines
1.9 KiB
Java

package eu.worn.apps.androvac;
import java.util.Calendar;
public class RoboVac11sRemote {
public IRModulation modulation = new EufyIRModulation();
private Calendar schedule = null;
private byte[] buildMessage(byte command) {
byte msg[] = new byte[6];
Calendar now = Calendar.getInstance();
msg[0] = (byte) 0x68;
msg[1] = command;
msg[2] = (byte) now.get(Calendar.HOUR_OF_DAY);
msg[3] = (byte) now.get(Calendar.MINUTE);
if (schedule != null)
msg[4] = (byte) (schedule.get(Calendar.HOUR_OF_DAY) * 4 +
schedule.get(Calendar.MINUTE) / 15);
else
msg[4] = (byte) 0xff;
msg[5] = (byte) (msg[0] + msg[1] + msg[2] + msg[3] + msg[4]);
return msg;
}
public RoboVac11sRemote() {
schedule = null;
}
public void setSchedule(Calendar s) {
schedule = s;
}
public Calendar getSchedule() {
return schedule;
}
public byte[] cleanAuto() { return buildMessage((byte) 0x5d); }
public byte[] cleanSpot() { return buildMessage((byte) 0x8c); }
public byte[] cleanEdge() { return buildMessage((byte) 0x9c); }
public byte[] cleanRoom() { return buildMessage((byte) 0xad); }
public byte[] powerStandard() { return buildMessage((byte) 0x1e); }
public byte[] powerMax() { return buildMessage((byte) 0x1c); }
public byte[] powerBoostIQ() { return buildMessage((byte) 0x1d); }
public byte[] moveForward() { return buildMessage((byte) 0x2f); }
public byte[] moveBackward() { return buildMessage((byte) 0x7f); }
public byte[] moveCCW() { return buildMessage((byte) 0x3f); }
public byte[] moveCW() { return buildMessage((byte) 0x6f); }
public byte[] returnBase() { return buildMessage((byte) 0xef); }
public byte[] stop() { return buildMessage((byte) 0x4f); }
}