diff --git a/lib/roles/device/plugins/service.js b/lib/roles/device/plugins/service.js index ffacad45..1060d9cf 100644 --- a/lib/roles/device/plugins/service.js +++ b/lib/roles/device/plugins/service.js @@ -286,6 +286,13 @@ module.exports = syrup.serial() ) } + plugin.rotate = function(rotation) { + return runAgentCommand( + apk.wire.MessageType.SET_ROTATION + , new apk.wire.SetRotationRequest(rotation, false) + ) + } + plugin.freezeRotation = function(rotation) { return runAgentCommand( apk.wire.MessageType.SET_ROTATION @@ -510,12 +517,7 @@ module.exports = syrup.serial() plugin.type(message.text) }) .on(wire.RotateMessage, function(channel, message) { - if (message.rotation >= 0) { - plugin.freezeRotation(message.rotation) - } - else { - plugin.thawRotation() - } + plugin.rotate(message.rotation) }) }) .return(plugin)