mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-19 04:53:28 +02:00
Separate device functionality into plugins.
This commit is contained in:
20
lib/roles/device/plugins/heartbeat.js
Normal file
20
lib/roles/device/plugins/heartbeat.js
Normal file
@@ -0,0 +1,20 @@
|
||||
var syrup = require('syrup')
|
||||
|
||||
var wire = require('../../../wire')
|
||||
var wireutil = require('../../../wire/util')
|
||||
|
||||
module.exports = syrup()
|
||||
.dependency(require('./push'))
|
||||
.define(function(options, push) {
|
||||
function heartbeat() {
|
||||
push.send([
|
||||
wireutil.heartbeat
|
||||
, wireutil.envelope(new wire.DeviceHeartbeatMessage(
|
||||
options.serial
|
||||
))
|
||||
])
|
||||
setTimeout(heartbeat, options.heartbeatInterval)
|
||||
}
|
||||
|
||||
heartbeat()
|
||||
})
|
||||
Reference in New Issue
Block a user