1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-06 03:50:04 +02:00
OpenSTF/lib/roles/device/plugins/solo.js
2014-03-17 11:11:56 +09:00

31 lines
853 B
JavaScript

var syrup = require('syrup')
var logger = require('../../../util/logger')
var wire = require('../../../wire')
var wireutil = require('../../../wire/util')
module.exports = syrup()
.dependency(require('../support/sub'))
.dependency(require('../support/push'))
.dependency(require('../support/channels'))
.define(function(options, sub, push, channels) {
var log = logger.createLogger('device:plugins:solo')
var channel = wireutil.makePrivateChannel()
log.info('Subscribing to permanent channel "%s"', channel)
sub.subscribe(channel)
channels.register(channel, Infinity)
return {
channel: channel
, poke: function() {
push.send([
wireutil.global
, wireutil.envelope(new wire.DevicePokeMessage(
options.serial
, channel
))
])
}
}
})