Back to project page rcdroid.
The source code is released under:
Copyright (c) 2013, Jamie Furness (jamie@jamierf.co.uk) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following...
If you think the Android project rcdroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.jamierf.rcdroid.logic.packets; /* w w w.j a v a2s . c o m*/ import com.google.common.base.Optional; import com.jamierf.maestro.MaestroServoController; import com.jamierf.rcdroid.http.Packet; import com.jamierf.rcdroid.http.listener.PacketListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class SetSpeedRequestHandler extends AbstractServoHandler implements PacketListener { private static final Logger LOG = LoggerFactory.getLogger(SetSpeedRequestHandler.class); public SetSpeedRequestHandler(MaestroServoController servos, int speedControllingServo) { super (servos, speedControllingServo); } @Override public void onPacket(Packet packet) { final Optional<Integer> value = packet.get("target"); if (!value.isPresent()) throw new IllegalArgumentException("Set speed request with no target speed."); final int target = value.get(); LOG.trace("Setting speed to {}", target); super.setTarget(target); } }