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:
parent
ce45090ba0
commit
4e5eef7458
2 changed files with 31 additions and 25 deletions
|
@ -8,7 +8,9 @@ module.exports = syrup()
|
||||||
.dependency(require('../support/sub'))
|
.dependency(require('../support/sub'))
|
||||||
.dependency(require('../support/push'))
|
.dependency(require('../support/push'))
|
||||||
.dependency(require('../support/channels'))
|
.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 log = logger.createLogger('device:plugins:solo')
|
||||||
var channel = wireutil.makePrivateChannel()
|
var channel = wireutil.makePrivateChannel()
|
||||||
|
|
||||||
|
@ -16,6 +18,34 @@ module.exports = syrup()
|
||||||
sub.subscribe(channel)
|
sub.subscribe(channel)
|
||||||
channels.register(channel, Infinity)
|
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 {
|
return {
|
||||||
channel: channel
|
channel: channel
|
||||||
, poke: function() {
|
, poke: function() {
|
||||||
|
|
|
@ -38,30 +38,6 @@ var wireutil = {
|
||||||
)
|
)
|
||||||
.encodeNB()
|
.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
|
module.exports = wireutil
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue