appium-xcuitest-driver
Version:
Appium driver for iOS using XCUITest for backend
33 lines • 1.18 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BatteryInfoClient = void 0;
const remotexpc_utils_1 = require("./remotexpc-utils");
/**
* Advanced battery metrics from the device diagnostics service on real hardware.
*
* Requires **iOS/tvOS 18+** and the optional **`appium-ios-remotexpc`** package.
*/
class BatteryInfoClient {
udid;
constructor(udid) {
this.udid = udid;
}
/**
* Reads IOPMPowerSource data via RemoteXPC diagnostics.
*/
async getAdvancedInfo() {
try {
const Services = await (0, remotexpc_utils_1.getRemoteXPCServices)();
const diagnosticsService = await Services.startDiagnosticsService(this.udid);
return await diagnosticsService.ioregistry({
ioClass: 'IOPMPowerSource',
returnRawJson: true,
});
}
catch (err) {
throw (0, remotexpc_utils_1.wrapRemoteXPCConnectionError)(err, `Failed to read advanced battery info via RemoteXPC for '${this.udid}'`);
}
}
}
exports.BatteryInfoClient = BatteryInfoClient;
//# sourceMappingURL=battery-info-client.js.map