mirror of
https://github.com/openstf/stf
synced 2025-10-05 02:29:26 +02:00
Rename "roles" to "units". Put units in their own folders.
This commit is contained in:
parent
7d9d64ddcb
commit
3a9b193f68
63 changed files with 105 additions and 105 deletions
33
lib/units/device/plugins/sd.js
Normal file
33
lib/units/device/plugins/sd.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
var syrup = require('syrup')
|
||||
|
||||
var logger = require('../../../util/logger')
|
||||
var wire = require('../../../wire')
|
||||
var wireutil = require('../../../wire/util')
|
||||
|
||||
module.exports = syrup.serial()
|
||||
.dependency(require('./service'))
|
||||
.dependency(require('../support/router'))
|
||||
.dependency(require('../support/push'))
|
||||
.define(function(options, service, router, push) {
|
||||
var log = logger.createLogger('device:plugins:sd')
|
||||
|
||||
router.on(wire.SdStatusMessage, function(channel, message) {
|
||||
var reply = wireutil.reply(options.serial)
|
||||
log.info('Getting SD card status')
|
||||
service.getSdStatus(message)
|
||||
.timeout(30000)
|
||||
.then(function(mounted) {
|
||||
push.send([
|
||||
channel
|
||||
, reply.okay(mounted ? 'sd_mounted' : 'sd_unmounted')
|
||||
])
|
||||
})
|
||||
.catch(function(err) {
|
||||
log.error('Getting SD card Status', err.stack)
|
||||
push.send([
|
||||
channel
|
||||
, reply.fail(err.message)
|
||||
])
|
||||
})
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue