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

Properly react to ProbeMessage.

This commit is contained in:
Simo Kinnunen 2014-03-17 11:46:26 +09:00
parent ce45090ba0
commit 4e5eef7458
2 changed files with 31 additions and 25 deletions

View file

@ -8,7 +8,9 @@ module.exports = syrup()
.dependency(require('../support/sub'))
.dependency(require('../support/push'))
.dependency(require('../support/channels'))
.define(function(options, sub, push, channels) {
.dependency(require('../support/router'))
.dependency(require('./identity'))
.define(function(options, sub, push, channels, router, identity) {
var log = logger.createLogger('device:plugins:solo')
var channel = wireutil.makePrivateChannel()
@ -16,6 +18,34 @@ module.exports = syrup()
sub.subscribe(channel)
channels.register(channel, Infinity)
router.on(wire.ProbeMessage, function(channel, message) {
push.send([
wireutil.global
, wireutil.envelope(new wire.DeviceIdentityMessage(
options.serial
, identity.platform
, identity.manufacturer
, identity.operator
, identity.model
, identity.version
, identity.abi
, identity.sdk
, new wire.DeviceDisplayMessage(
identity.display.id
, identity.display.width
, identity.display.height
, identity.display.orientation
, identity.display.xdpi
, identity.display.ydpi
, identity.display.fps
, identity.display.density
, identity.display.secure
, identity.display.url
)
))
])
})
return {
channel: channel
, poke: function() {

View file

@ -38,30 +38,6 @@ var wireutil = {
)
.encodeNB()
}
, makeDeviceIdentityMessage: function(serial, identity) {
return wireutil.envelope(new wire.DeviceIdentityMessage(
serial
, identity.platform
, identity.manufacturer
, identity.operator
, identity.model
, identity.version
, identity.abi
, identity.sdk
, new wire.DeviceDisplayMessage(
identity.display.id
, identity.display.width
, identity.display.height
, identity.display.orientation
, identity.display.xdpi
, identity.display.ydpi
, identity.display.fps
, identity.display.density
, identity.display.secure
, identity.display.url
)
))
}
}
module.exports = wireutil