@yume-chan/adb
Version:
TypeScript implementation of Android Debug Bridge (ADB) protocol.
67 lines • 1.89 kB
JavaScript
export const AdbBannerKey = {
Product: "ro.product.name",
Model: "ro.product.model",
Device: "ro.product.device",
Features: "features",
};
export class AdbBanner {
static parse(banner) {
let product;
let model;
let device;
let features = [];
const pieces = banner.split("::");
if (pieces.length > 1) {
const props = pieces[1];
for (const prop of props.split(";")) {
// istanbul ignore if
if (!prop) {
continue;
}
const keyValue = prop.split("=");
if (keyValue.length !== 2) {
continue;
}
const [key, value] = keyValue;
switch (key) {
case AdbBannerKey.Product:
product = value;
break;
case AdbBannerKey.Model:
model = value;
break;
case AdbBannerKey.Device:
device = value;
break;
case AdbBannerKey.Features:
features = value.split(",");
break;
}
}
}
return new AdbBanner(product, model, device, features);
}
get product() {
return this.
}
get model() {
return this.
}
get device() {
return this.
}
get features() {
return this.
}
constructor(product, model, device, features) {
this.
this.
this.
this.
}
}
//# sourceMappingURL=banner.js.map