mirror of
https://github.com/openstf/stf
synced 2025-10-04 18:29:17 +02:00
Remove numeric flags in favor of plain string data. Scales better.
This commit is contained in:
parent
f173e6650a
commit
01339b089e
3 changed files with 4 additions and 73 deletions
|
@ -145,30 +145,6 @@ devutil.killProcsByComm = function(adb, serial, comm, bin, mode) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
devutil.platform = function(platform) {
|
|
||||||
switch (platform) {
|
|
||||||
case 'android':
|
|
||||||
return wire.DevicePlatform.ANDROID
|
|
||||||
default:
|
|
||||||
throw new Error(util.format('Unmapped platform "%s"', platform))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
devutil.manufacturer = function(manufacturer) {
|
|
||||||
var sanitized = manufacturer.toUpperCase().replace(/ /g, '_')
|
|
||||||
|
|
||||||
if (wire.DeviceManufacturer[sanitized]) {
|
|
||||||
return wire.DeviceManufacturer[sanitized]
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (sanitized) {
|
|
||||||
case 'LGE':
|
|
||||||
return wire.DeviceManufacturer.LG
|
|
||||||
default:
|
|
||||||
throw new Error(util.format('Unmapped manufacturer "%s"', manufacturer))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
devutil.makeIdentity = function(serial, properties) {
|
devutil.makeIdentity = function(serial, properties) {
|
||||||
var model = properties['ro.product.model']
|
var model = properties['ro.product.model']
|
||||||
, brand = properties['ro.product.brand']
|
, brand = properties['ro.product.brand']
|
||||||
|
@ -193,8 +169,8 @@ devutil.makeIdentity = function(serial, properties) {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
serial: serial
|
serial: serial
|
||||||
, platform: devutil.platform('android')
|
, platform: 'Android'
|
||||||
, manufacturer: devutil.manufacturer(manufacturer)
|
, manufacturer: manufacturer.toUpperCase()
|
||||||
, operator: operator
|
, operator: operator
|
||||||
, model: model
|
, model: model
|
||||||
, version: version
|
, version: version
|
||||||
|
|
|
@ -16,12 +16,6 @@ module.exports = function(wire) {
|
||||||
, absent: 'ABSENT'
|
, absent: 'ABSENT'
|
||||||
}[type]]
|
}[type]]
|
||||||
}
|
}
|
||||||
, toDeviceType: function(type) {
|
|
||||||
return wire.DeviceStatus[{
|
|
||||||
device: 'PHYSICAL'
|
|
||||||
, emulator: 'VIRTUAL'
|
|
||||||
}[type]]
|
|
||||||
}
|
|
||||||
, envelope: function(type, message) {
|
, envelope: function(type, message) {
|
||||||
return new wire.Envelope(type, message.encode()).encodeNB()
|
return new wire.Envelope(type, message.encode()).encodeNB()
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,45 +58,6 @@ message DeviceStatusMessage {
|
||||||
required string provider = 3;
|
required string provider = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum DeviceType {
|
|
||||||
PHYSICAL = 1;
|
|
||||||
VIRTUAL = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message DeviceTypeMessage {
|
|
||||||
required string serial = 1;
|
|
||||||
required DeviceType type = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum DevicePlatform {
|
|
||||||
ANDROID = 100;
|
|
||||||
IOS = 200;
|
|
||||||
FIREFOX = 300;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum DeviceManufacturer {
|
|
||||||
ACER = 1100;
|
|
||||||
APPLE = 1200;
|
|
||||||
ASUS = 1300;
|
|
||||||
CASIO = 1400;
|
|
||||||
FUJITSU = 1500;
|
|
||||||
HTC = 1600;
|
|
||||||
HUAWEI = 1700;
|
|
||||||
KYOCERA = 1800;
|
|
||||||
LG = 1900;
|
|
||||||
MOTOROLA = 2000;
|
|
||||||
NEC = 2100;
|
|
||||||
PANASONIC = 2200;
|
|
||||||
PANTECH = 2300;
|
|
||||||
RIM = 2400;
|
|
||||||
SAMSUNG = 2500;
|
|
||||||
SHARP = 2600;
|
|
||||||
SONY = 2700;
|
|
||||||
SONY_ERICSSON = 2800;
|
|
||||||
TOSHIBA = 2900;
|
|
||||||
ZTE = 3000;
|
|
||||||
}
|
|
||||||
|
|
||||||
message DeviceDisplayMessage {
|
message DeviceDisplayMessage {
|
||||||
required uint32 id = 1;
|
required uint32 id = 1;
|
||||||
required uint32 width = 2;
|
required uint32 width = 2;
|
||||||
|
@ -112,8 +73,8 @@ message DeviceDisplayMessage {
|
||||||
|
|
||||||
message DeviceIdentityMessage {
|
message DeviceIdentityMessage {
|
||||||
required string serial = 1;
|
required string serial = 1;
|
||||||
required DevicePlatform platform = 2;
|
required string platform = 2;
|
||||||
required DeviceManufacturer manufacturer = 3;
|
required string manufacturer = 3;
|
||||||
required string operator = 4;
|
required string operator = 4;
|
||||||
required string model = 5;
|
required string model = 5;
|
||||||
required string version = 6;
|
required string version = 6;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue