Skip to content

Instantly share code, notes, and snippets.

@tonisives
Created August 10, 2017 13:26
Show Gist options
  • Save tonisives/4264c2f559896512cfbbb8975a3de08f to your computer and use it in GitHub Desktop.
Save tonisives/4264c2f559896512cfbbb8975a3de08f to your computer and use it in GitHub Desktop.
// create 7 HVAC states where weekdays are inactive and weekend is active
AutoHvacState[] states = new AutoHvacState[7];
for (int i = 0; i < 7; i++) {
AutoHvacState state;
if (i < 5)
state = new AutoHvacState(false, i, 0, 0);
else
state = new AutoHvacState(true, i, 7, 30);
states[i] = state;
}
// set other climate values
boolean autoHvacConstant = false;
float driverTemp = 21.5f;
float passengerTemp = 21.5f;
// get the command bytes
byte[] commandBytes = Command.Climate.setClimateProfile(states, autoHvacConstant, driverTemp, passengerTemp);
// send the command
Manager.getInstance().getTelematics().sendCommand(commandBytes, serial, new Telematics.CommandCallback() {
@Override
public void onCommandResponse(byte[] bytes) {
onCommandReceived(bytes);
}
@Override
public void onCommandFailed(TelematicsError telematicsError) {
Log.e(TAG, "send telematics command error: " + telematicsError.getMessage());
onCommandError(telematicsError.getCode(), telematicsError.getMessage());
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment