Add phone number and imei to device identity.

This commit is contained in:
Simo Kinnunen
2014-04-02 13:08:59 +09:00
parent a891e5de49
commit 5183485a53
6 changed files with 47 additions and 1 deletions

View File

@@ -303,6 +303,25 @@ module.exports = syrup.serial()
})
}
function getProperties(properties) {
return runServiceCommand(
apk.serviceProto.RequestType.GET_PROPERTIES
, new apk.serviceProto.GetPropertiesRequest(properties)
)
.timeout(15000)
.then(function(data) {
var response = apk.serviceProto.GetPropertiesResponse.decode(data)
if (response.success) {
var mapped = Object.create(null)
response.properties.forEach(function(property) {
mapped[property.name] = property.value
})
return mapped
}
throw new Error('Unable to get properties')
})
}
function runServiceCommand(type, cmd) {
var resolver = Promise.defer()
service.writer.write(new apk.serviceProto.RequestEnvelope(
@@ -372,6 +391,7 @@ module.exports = syrup.serial()
}
, copy: getClipboard
, getBrowsers: getBrowsers
, getProperties: getProperties
}
})
})