mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-25 02:05:15 +02:00
Expose input services.
This commit is contained in:
@@ -259,8 +259,10 @@ module.exports = function(options) {
|
||||
return monkey.connectStream(conn)
|
||||
})
|
||||
.then(function(monkey) {
|
||||
services.monkey =
|
||||
vitals.register('device:remote:monkey:monkey', monkey)
|
||||
services.monkey = vitals.register(
|
||||
'device:remote:monkey:monkey'
|
||||
, Promise.promisifyAll(monkey)
|
||||
)
|
||||
})
|
||||
})
|
||||
.then(function() {
|
||||
@@ -289,8 +291,10 @@ module.exports = function(options) {
|
||||
return monkey.connectStream(conn)
|
||||
})
|
||||
.then(function(monkey) {
|
||||
services.input =
|
||||
vitals.register('device:remote:input:monkey', monkey)
|
||||
services.input = vitals.register(
|
||||
'device:remote:input:monkey'
|
||||
, Promise.promisifyAll(monkey)
|
||||
)
|
||||
})
|
||||
})
|
||||
.then(function() {
|
||||
@@ -349,6 +353,30 @@ module.exports = function(options) {
|
||||
}
|
||||
channels.keepalive(channel)
|
||||
})
|
||||
.on(wire.TouchDownMessage, function(channel, message) {
|
||||
services.input.touchDownAsync(message.x, message.y)
|
||||
})
|
||||
.on(wire.TouchMoveMessage, function(channel, message) {
|
||||
services.input.touchMoveAsync(message.x, message.y)
|
||||
})
|
||||
.on(wire.TouchUpMessage, function(channel, message) {
|
||||
services.input.touchUpAsync(message.x, message.y)
|
||||
})
|
||||
.on(wire.TapMessage, function(channel, message) {
|
||||
services.input.tapAsync(message.x, message.y)
|
||||
})
|
||||
.on(wire.TypeMessage, function(channel, message) {
|
||||
services.input.typeAsync(message.text)
|
||||
})
|
||||
.on(wire.KeyDownMessage, function(channel, message) {
|
||||
services.input.keyDownAsync(message.key)
|
||||
})
|
||||
.on(wire.KeyUpMessage, function(channel, message) {
|
||||
services.input.keyUpAsync(message.key)
|
||||
})
|
||||
.on(wire.KeyPressMessage, function(channel, message) {
|
||||
services.input.pressAsync(message.key)
|
||||
})
|
||||
.on(wire.ShellCommandMessage, function(channel, message) {
|
||||
log.info('Running shell command "%s"', message.command.join(' '))
|
||||
adb.shellAsync(options.serial, message.command)
|
||||
|
||||
Reference in New Issue
Block a user