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 ww . j av a 2 s . 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 SetRotationRequestHandler extends AbstractServoHandler implements PacketListener { private static final Logger LOG = LoggerFactory.getLogger(SetRotationRequestHandler.class); public SetRotationRequestHandler(MaestroServoController servos, int rotationControllingServo) { super (servos, rotationControllingServo); } @Override public void onPacket(Packet packet) { final Optional<Integer> value = packet.get("target"); if (!value.isPresent()) throw new IllegalArgumentException("Set rotation request with no target rotation."); final int target = value.get(); LOG.trace("Setting rotation to {}", target); super.setTarget(target); } }