1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 18:29:17 +02:00

add filesystem(file explorer) support, done

This commit is contained in:
hzsunshx 2015-09-22 17:16:46 +08:00
parent b258837757
commit 1dccda5e2a
11 changed files with 174 additions and 74 deletions

View file

@ -65,68 +65,22 @@ module.exports = syrup.serial()
})
})
router.on(wire.FileSystemListMessage, function(channel, message){
var reply = wireutil.reply(options.serial)
adb.readdir(options.serial, message.dir)
.then(function(files){
push.send([
channel,
reply.okay('success', files)
])
})
.catch(function(err){
log.error('Dir list %s failed\n%s', message.dir, err.stack)
push.send([
channel,
reply.fail(err.message)
])
})
})
return plugin;
// function projectionFormat() {
// return util.format(
// '%dx%d@%dx%d/%d'
// , display.properties.width
// , display.properties.height
// , display.properties.width
// , display.properties.height
// , display.properties.rotation
// )
// }
// plugin.capture = function() {
// log.info('Capturing screenshot')
// var file = util.format('/data/local/tmp/minicap_%d.jpg', Date.now())
// return minicap.run(util.format(
// '-P %s -s >%s', projectionFormat(), file))
// .then(adbkit.util.readAll)
// .then(function() {
// return adb.stat(options.serial, file)
// })
// .then(function(stats) {
// if (stats.size === 0) {
// throw new Error('Empty screenshot; possibly secure screen?')
// }
// return adb.pull(options.serial, file)
// .then(function(transfer) {
// return storage.store('image', transfer, {
// filename: util.format('%s.jpg', options.serial)
// , contentType: 'image/jpeg'
// , knownLength: stats.size
// })
// })
// })
// .finally(function() {
// return adb.shell(options.serial, ['rm', '-f', file])
// .then(adbkit.util.readAll)
// })
// }
// router.on(wire.ScreenCaptureMessage, function(channel) {
// var reply = wireutil.reply(options.serial)
// plugin.capture()
// .then(function(file) {
// push.send([
// channel
// , reply.okay('success', file)
// ])
// })
// .catch(function(err) {
// log.error('Screen capture failed', err.stack)
// push.send([
// channel
// , reply.fail(err.message)
// ])
// })
// })
// return plugin
})