@aiot-toolkit/emulator 2.0.5-widget-provider-beta.2 → 2.0.6-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +173 -173
  2. package/lib/emulatorutil/constants.js +11 -11
  3. package/lib/emulatorutil/running.js +14 -6
  4. package/lib/index.d.ts +5 -2
  5. package/lib/index.js +48 -0
  6. package/lib/instance/common.d.ts +5 -2
  7. package/lib/instance/common.js +26 -5
  8. package/lib/instance/dev.d.ts +4 -1
  9. package/lib/instance/dev.js +9 -9
  10. package/lib/instance/index.js +7 -7
  11. package/lib/instance/minisound.js +6 -6
  12. package/lib/instance/miwear.d.ts +5 -1
  13. package/lib/instance/miwear.js +44 -22
  14. package/lib/instance/miwear5.d.ts +0 -1
  15. package/lib/instance/miwear5.js +0 -1
  16. package/lib/instance/pre.d.ts +4 -1
  17. package/lib/instance/pre.js +9 -9
  18. package/lib/instance/vela5.d.ts +5 -0
  19. package/lib/instance/vela5.js +63 -4
  20. package/lib/shared/index.d.ts +9 -0
  21. package/lib/shared/index.js +16 -4
  22. package/lib/static/advancedFeatures.ini +1 -1
  23. package/lib/static/avdConfigIni.json +45 -39
  24. package/lib/static/debugger_ip.cfg +1 -1
  25. package/lib/static/proto/README.MD +2 -2
  26. package/lib/static/proto/emulator_controller.proto +1476 -1321
  27. package/lib/static/proto/rtc_service.proto +117 -117
  28. package/lib/static/proto/ui_controller_service.proto +147 -0
  29. package/lib/typing/Instance.js +3 -3
  30. package/lib/typing/Vvd.d.ts +3 -3
  31. package/lib/typing/Vvd.js +1 -2
  32. package/lib/utils/file.d.ts +8 -0
  33. package/lib/utils/file.js +48 -1
  34. package/lib/utils/index.js +19 -19
  35. package/lib/vvd/grpc/index.d.ts +16 -7
  36. package/lib/vvd/grpc/index.js +89 -11
  37. package/lib/vvd/grpc/types/GrpcClient.d.ts +43 -2
  38. package/lib/vvd/grpc/types/UiControllerClient.d.ts +23 -0
  39. package/lib/vvd/grpc/types/index.d.ts +3 -0
  40. package/lib/vvd/grpc/types/index.js +38 -0
  41. package/lib/vvd/grpc/types/proto-types.d.ts +178 -0
  42. package/lib/vvd/grpc/types/proto-types.js +50 -0
  43. package/lib/vvd/index.d.ts +7 -3
  44. package/lib/vvd/index.js +141 -50
  45. package/lib/vvd/logcat.js +3 -3
  46. package/package.json +4 -8
  47. package/lib/vvd/grpc/types/KeyEvent.d.ts +0 -19
  48. package/lib/vvd/grpc/types/KeyEvent.js +0 -20
  49. package/lib/vvd/grpc/types/MouseEvent.d.ts +0 -30
  50. /package/lib/vvd/grpc/types/{MouseEvent.js → UiControllerClient.js} +0 -0
@@ -3,15 +3,20 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.GrpcEmulator = void 0;
6
7
  exports.createGrpcClient = createGrpcClient;
7
- exports.default = void 0;
8
8
  var _path = _interopRequireDefault(require("path"));
9
9
  var _protoLoader = require("@grpc/proto-loader");
10
10
  var _grpcError = require("./grpcError");
11
11
  var _grpcJs = require("@grpc/grpc-js");
12
+ var _protoTypes = require("./types/proto-types");
13
+ var _connectivityState = require("@grpc/grpc-js/build/src/connectivity-state");
12
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ // eslint-disable-next-line no-restricted-imports
16
+
13
17
  class GrpcEmulator {
14
18
  connected = false;
19
+ state = (() => _connectivityState.ConnectivityState.IDLE)();
15
20
  constructor(eConf, protoPath) {
16
21
  this.eConf = eConf;
17
22
  this.protoPath = protoPath;
@@ -29,9 +34,28 @@ class GrpcEmulator {
29
34
  const mateInfo = new _grpcJs.Metadata();
30
35
  mateInfo.set('Authorization', `Bearer ${this.token}`);
31
36
  this.authMate = mateInfo;
32
- this.client = new this.controller.EmulatorController(`127.0.0.1:${eConf['grpc.port']}`, _grpcJs.credentials.createInsecure());
37
+ this.client = new this.controller.EmulatorController(`127.0.0.1:${eConf['grpc.port']}`, _grpcJs.credentials.createInsecure(), {
38
+ 'grpc.max_receive_message_length': 32 * 1024 * 1024,
39
+ // 32MB
40
+ 'grpc.max_send_message_length': 32 * 1024 * 1024 // 32MB
41
+ });
42
+ const watchState = e => {
43
+ if (e) {
44
+ console.error('watchConnectivityState error:', e);
45
+ }
46
+ const currentState = this.client.getChannel().getConnectivityState(false);
47
+ this.state = currentState;
48
+ if (currentState !== _connectivityState.ConnectivityState.SHUTDOWN) {
49
+ this.client.getChannel().watchConnectivityState(currentState, this.deadline, watchState);
50
+ }
51
+ };
52
+ watchState();
53
+ this.uiClient = new this.controller.UiController(`127.0.0.1:${eConf['grpc.port']}`, _grpcJs.credentials.createInsecure());
33
54
  }
34
55
  close() {
56
+ this.screenshotStream?.destroy();
57
+ this.logcatStream?.destroy();
58
+ this.client.getChannel().close();
35
59
  this.client.close();
36
60
  }
37
61
  getAuthMeta() {
@@ -56,18 +80,21 @@ class GrpcEmulator {
56
80
  });
57
81
  });
58
82
  }
59
- async startStream(onStreamScreenshot) {
83
+ async streamScreenshot(imageFormat) {
60
84
  await this.waitForReady();
61
85
  if (this.screenshotStream) {
62
86
  this.screenshotStream.destroy();
63
87
  }
64
- this.screenshotStream = this.client.streamScreenshot(this.controller.Image, this.authMate);
65
- this.screenshotStream.on('data', response => {
66
- onStreamScreenshot(response.image);
67
- });
68
- this.screenshotStream.on('error', err => {
69
- console.error(err.message);
88
+ const params = imageFormat || {
89
+ format: _protoTypes.ImageFormatType.PNG
90
+ };
91
+ this.screenshotStream = this.client.streamScreenshot(params, this.authMate);
92
+ // don't delete it, otherwise crash process when emulator exit
93
+ this.screenshotStream.on('error', () => {
94
+ // TODO: not care at now
95
+ // console.error('streamScreenshot error:', err)
70
96
  });
97
+ return this.screenshotStream;
71
98
  }
72
99
  getScreenshot() {
73
100
  return new Promise((resolve, reject) => {
@@ -109,9 +136,60 @@ class GrpcEmulator {
109
136
  if (err) console.error(err);
110
137
  });
111
138
  }
139
+ showExtendedControls() {
140
+ let paneIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
141
+ if (!this.uiClient) return Promise.reject('UiController not available');
142
+ return new Promise((resolve, reject) => {
143
+ this.uiClient.showExtendedControls({
144
+ index: paneIndex
145
+ }, this.authMate, (err, response) => {
146
+ if (err) return reject(err);
147
+ resolve(response);
148
+ });
149
+ });
150
+ }
151
+ closeExtendedControls() {
152
+ if (!this.uiClient) return Promise.reject('UiController not available');
153
+ return new Promise((resolve, reject) => {
154
+ this.uiClient.closeExtendedControls({}, this.authMate, (err, response) => {
155
+ if (err) return reject(err);
156
+ resolve(response);
157
+ });
158
+ });
159
+ }
160
+ setSensor(sensorValue) {
161
+ if (!this.client) return Promise.reject('grpc client not available');
162
+ return new Promise((resolve, reject) => {
163
+ this.client.setSensor(sensorValue, this.authMate, (err, response) => {
164
+ if (err) return reject(err);
165
+ resolve(response);
166
+ });
167
+ });
168
+ }
169
+ getSensor(sensorValue) {
170
+ if (!this.client) return Promise.reject('grpc client not available');
171
+ return new Promise((resolve, reject) => {
172
+ this.client.getSensor(sensorValue, this.authMate, (err, response) => {
173
+ if (err) return reject(err);
174
+ resolve(response);
175
+ });
176
+ });
177
+ }
178
+ async streamLogcat(params) {
179
+ await this.waitForReady();
180
+ if (this.logcatStream) {
181
+ this.logcatStream.destroy();
182
+ }
183
+ const logMessage = params || {};
184
+ this.logcatStream = this.client.streamLogcat(logMessage, this.authMate);
185
+ this.logcatStream.on('error', err => {
186
+ console.error('streamLogcat error:', err?.message || err);
187
+ });
188
+ return this.logcatStream;
189
+ }
112
190
  }
113
- exports.default = GrpcEmulator;
191
+ exports.GrpcEmulator = GrpcEmulator;
114
192
  function createGrpcClient(eConf) {
115
- const protoPath = _path.default.join(__dirname, '../../static/proto/emulator_controller.proto');
193
+ const protoPath = [_path.default.resolve(__dirname, '../../static/proto/emulator_controller.proto'), _path.default.resolve(__dirname, '../../static/proto/ui_controller_service.proto')];
116
194
  return new GrpcEmulator(eConf, protoPath);
117
195
  }
@@ -1,4 +1,45 @@
1
- import { Client } from '@grpc/grpc-js';
1
+ import { Client, Metadata, ServiceError, ClientUnaryCall } from '@grpc/grpc-js';
2
+ import type { PhysicalModelValue, ClipData, BatteryState, GpsState, Fingerprint, TouchEvent, PhoneCall, PhoneResponse, SmsMessage, PhoneNumber, EmulatorStatus, ImageFormat, Image, AudioFormat, LogMessage, VmRunState, DisplayConfigurations, BrightnessValue, DisplayMode, RotationRadian, Velocity, Posture, SensorValue, KeyboardEvent, MouseEvent } from './proto-types';
2
3
  export interface GrpcClient extends Client {
3
- [i: string]: any;
4
+ setSensor(request: SensorValue, metadata: Metadata, callback: (error: ServiceError | null, response: {}) => void): ClientUnaryCall;
5
+ getSensor(request: SensorValue, metadata: Metadata, callback: (error: ServiceError | null, response: SensorValue) => void): ClientUnaryCall;
6
+ streamSensor(request: SensorValue, metadata: Metadata): NodeJS.ReadStream;
7
+ setPhysicalModel(request: PhysicalModelValue, metadata: Metadata, callback: (error: ServiceError | null, response: {}) => void): ClientUnaryCall;
8
+ getPhysicalModel(request: PhysicalModelValue, metadata: Metadata, callback: (error: ServiceError | null, response: PhysicalModelValue) => void): ClientUnaryCall;
9
+ streamPhysicalModel(request: PhysicalModelValue, metadata: Metadata): NodeJS.ReadStream;
10
+ setClipboard(request: ClipData, metadata: Metadata, callback: (error: ServiceError | null, response: {}) => void): ClientUnaryCall;
11
+ getClipboard(request: {}, metadata: Metadata, callback: (error: ServiceError | null, response: ClipData) => void): ClientUnaryCall;
12
+ streamClipboard(request: {}, metadata: Metadata): NodeJS.ReadStream;
13
+ setBattery(request: BatteryState, metadata: Metadata, callback: (error: ServiceError | null, response: {}) => void): ClientUnaryCall;
14
+ getBattery(request: {}, metadata: Metadata, callback: (error: ServiceError | null, response: BatteryState) => void): ClientUnaryCall;
15
+ setGps(request: GpsState, metadata: Metadata, callback: (error: ServiceError | null, response: {}) => void): ClientUnaryCall;
16
+ getGps(request: {}, metadata: Metadata, callback: (error: ServiceError | null, response: GpsState) => void): ClientUnaryCall;
17
+ sendFingerprint(request: Fingerprint, metadata: Metadata, callback: (error: ServiceError | null, response: {}) => void): ClientUnaryCall;
18
+ sendKey(request: KeyboardEvent, metadata: Metadata, callback: (error: ServiceError | null, response: {}) => void): ClientUnaryCall;
19
+ sendTouch(request: TouchEvent, metadata: Metadata, callback: (error: ServiceError | null, response: {}) => void): ClientUnaryCall;
20
+ sendMouse(request: MouseEvent, metadata: Metadata, callback: (error: ServiceError | null, response: {}) => void): ClientUnaryCall;
21
+ injectWheel(metadata: Metadata): NodeJS.WritableStream;
22
+ streamInputEvent(metadata: Metadata): NodeJS.WritableStream;
23
+ sendPhone(request: PhoneCall, metadata: Metadata, callback: (error: ServiceError | null, response: PhoneResponse) => void): ClientUnaryCall;
24
+ sendSms(request: SmsMessage, metadata: Metadata, callback: (error: ServiceError | null, response: PhoneResponse) => void): ClientUnaryCall;
25
+ setPhoneNumber(request: PhoneNumber, metadata: Metadata, callback: (error: ServiceError | null, response: PhoneResponse) => void): ClientUnaryCall;
26
+ getStatus(request: {}, metadata: Metadata, callback: (error: ServiceError | null, response: EmulatorStatus) => void): ClientUnaryCall;
27
+ getScreenshot(request: ImageFormat, metadata: Metadata, callback: (error: ServiceError | null, response: Image) => void): ClientUnaryCall;
28
+ streamScreenshot(request: ImageFormat, metadata: Metadata): NodeJS.ReadStream;
29
+ streamAudio(request: AudioFormat, metadata: Metadata): NodeJS.ReadStream;
30
+ injectAudio(metadata: Metadata): NodeJS.WritableStream;
31
+ getLogcat(request: LogMessage, metadata: Metadata, callback: (error: ServiceError | null, response: LogMessage) => void): ClientUnaryCall;
32
+ streamLogcat(request: LogMessage, metadata: Metadata): NodeJS.ReadStream;
33
+ setVmState(request: VmRunState, metadata: Metadata, callback: (error: ServiceError | null, response: {}) => void): ClientUnaryCall;
34
+ getVmState(request: {}, metadata: Metadata, callback: (error: ServiceError | null, response: VmRunState) => void): ClientUnaryCall;
35
+ setDisplayConfigurations(request: DisplayConfigurations, metadata: Metadata, callback: (error: ServiceError | null, response: DisplayConfigurations) => void): ClientUnaryCall;
36
+ getDisplayConfigurations(request: {}, metadata: Metadata, callback: (error: ServiceError | null, response: DisplayConfigurations) => void): ClientUnaryCall;
37
+ streamNotification(request: {}, metadata: Metadata): NodeJS.ReadStream;
38
+ getBrightness(request: BrightnessValue, metadata: Metadata, callback: (error: ServiceError | null, response: BrightnessValue) => void): ClientUnaryCall;
39
+ setBrightness(request: BrightnessValue, metadata: Metadata, callback: (error: ServiceError | null, response: {}) => void): ClientUnaryCall;
40
+ getDisplayMode(request: {}, metadata: Metadata, callback: (error: ServiceError | null, response: DisplayMode) => void): ClientUnaryCall;
41
+ setDisplayMode(request: DisplayMode, metadata: Metadata, callback: (error: ServiceError | null, response: {}) => void): ClientUnaryCall;
42
+ rotateVirtualSceneCamera(request: RotationRadian, metadata: Metadata, callback: (error: ServiceError | null, response: {}) => void): ClientUnaryCall;
43
+ setVirtualSceneCameraVelocity(request: Velocity, metadata: Metadata, callback: (error: ServiceError | null, response: {}) => void): ClientUnaryCall;
44
+ setPosture(request: Posture, metadata: Metadata, callback: (error: ServiceError | null, response: {}) => void): ClientUnaryCall;
4
45
  }
@@ -0,0 +1,23 @@
1
+ import { Metadata, ServiceError, ClientUnaryCall } from '@grpc/grpc-js';
2
+ export interface PaneEntry {
3
+ index: number;
4
+ }
5
+ export interface ThemingStyle {
6
+ style: number;
7
+ }
8
+ export interface ExtendedControlsStatus {
9
+ visibilityChanged: boolean;
10
+ }
11
+ export interface UserConfigEntry {
12
+ key: string;
13
+ value: string;
14
+ }
15
+ export interface UserConfig {
16
+ entries: UserConfigEntry[];
17
+ }
18
+ export interface UiControllerClient {
19
+ showExtendedControls(request: PaneEntry, metadata: Metadata, callback: (error: ServiceError | null, response: ExtendedControlsStatus) => void): ClientUnaryCall;
20
+ closeExtendedControls(request: {}, metadata: Metadata, callback: (error: ServiceError | null, response: ExtendedControlsStatus) => void): ClientUnaryCall;
21
+ setUiTheme(request: ThemingStyle, metadata: Metadata, callback: (error: ServiceError | null, response: {}) => void): ClientUnaryCall;
22
+ getUserConfig(request: {}, metadata: Metadata, callback: (error: ServiceError | null, response: UserConfig) => void): ClientUnaryCall;
23
+ }
@@ -0,0 +1,3 @@
1
+ export * from './GrpcClient';
2
+ export * from './proto-types';
3
+ export * from './UiControllerClient';
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _GrpcClient = require("./GrpcClient");
7
+ Object.keys(_GrpcClient).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _GrpcClient[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _GrpcClient[key];
14
+ }
15
+ });
16
+ });
17
+ var _protoTypes = require("./proto-types");
18
+ Object.keys(_protoTypes).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _protoTypes[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _protoTypes[key];
25
+ }
26
+ });
27
+ });
28
+ var _UiControllerClient = require("./UiControllerClient");
29
+ Object.keys(_UiControllerClient).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _UiControllerClient[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _UiControllerClient[key];
36
+ }
37
+ });
38
+ });
@@ -0,0 +1,178 @@
1
+ export interface PhysicalModelValue {
2
+ target: number;
3
+ status?: number;
4
+ value?: {
5
+ data: number[];
6
+ };
7
+ }
8
+ export interface ClipData {
9
+ text: string;
10
+ }
11
+ export interface BatteryState {
12
+ hasBattery: boolean;
13
+ isPresent: boolean;
14
+ charger: number;
15
+ chargeLevel: number;
16
+ health: number;
17
+ status: number;
18
+ }
19
+ export interface GpsState {
20
+ passiveUpdate: boolean;
21
+ latitude: number;
22
+ longitude: number;
23
+ speed?: number;
24
+ bearing?: number;
25
+ altitude?: number;
26
+ satellites?: number;
27
+ }
28
+ export interface Fingerprint {
29
+ isTouching: boolean;
30
+ touchId: number;
31
+ }
32
+ export interface TouchEvent {
33
+ touches: Array<{
34
+ x: number;
35
+ y: number;
36
+ identifier: number;
37
+ pressure: number;
38
+ touch_major?: number;
39
+ touch_minor?: number;
40
+ expiration?: number;
41
+ }>;
42
+ display?: number;
43
+ }
44
+ export interface PhoneCall {
45
+ operation: number;
46
+ number: string;
47
+ }
48
+ export interface PhoneResponse {
49
+ response: number;
50
+ }
51
+ export interface SmsMessage {
52
+ srcAddress: string;
53
+ text: string;
54
+ }
55
+ export interface PhoneNumber {
56
+ number: string;
57
+ }
58
+ export interface EmulatorStatus {
59
+ version: string;
60
+ uptime: number;
61
+ booted: boolean;
62
+ vmConfig: any;
63
+ hardwareConfig: Record<string, any>;
64
+ }
65
+ export interface ImageFormat {
66
+ format: number;
67
+ rotation?: any;
68
+ width?: number;
69
+ height?: number;
70
+ display?: number;
71
+ transport?: any;
72
+ }
73
+ export interface Image {
74
+ format: ImageFormat;
75
+ image: Buffer;
76
+ seq?: number;
77
+ timestampUs?: number;
78
+ }
79
+ export interface AudioFormat {
80
+ samplingRate: number;
81
+ channels: number;
82
+ format: number;
83
+ mode?: number;
84
+ }
85
+ export interface LogMessage {
86
+ contents?: string;
87
+ start?: number;
88
+ next?: number;
89
+ sort?: number;
90
+ entries?: any[];
91
+ }
92
+ export interface VmRunState {
93
+ state: number;
94
+ }
95
+ export interface DisplayConfigurations {
96
+ displays: any[];
97
+ userConfigurable: number;
98
+ maxDisplays: number;
99
+ }
100
+ export interface BrightnessValue {
101
+ target: number;
102
+ value: number;
103
+ }
104
+ export interface DisplayMode {
105
+ value: number;
106
+ }
107
+ export interface RotationRadian {
108
+ x: number;
109
+ y: number;
110
+ z: number;
111
+ }
112
+ export interface Velocity {
113
+ x: number;
114
+ y: number;
115
+ z: number;
116
+ }
117
+ export interface Posture {
118
+ value: number;
119
+ }
120
+ export interface SensorValue {
121
+ target: number;
122
+ status?: number;
123
+ value?: {
124
+ data: number[];
125
+ };
126
+ }
127
+ export interface KeyboardEvent {
128
+ codeType?: number;
129
+ eventType?: number;
130
+ keyCode?: number | string;
131
+ key?: string;
132
+ text?: string;
133
+ }
134
+ export interface MouseEvent {
135
+ x?: number;
136
+ y?: number;
137
+ buttons?: number;
138
+ display?: number;
139
+ }
140
+ export declare enum SensorType {
141
+ ACCELERATION = 0,
142
+ GYROSCOPE = 1,
143
+ MAGNETIC_FIELD = 2,
144
+ ORIENTATION = 3,
145
+ TEMPERATURE = 4,
146
+ PROXIMITY = 5,
147
+ LIGHT = 6,
148
+ PRESSURE = 7,
149
+ HUMIDITY = 8,
150
+ MAGNETIC_FIELD_UNCALIBRATED = 9,
151
+ GYROSCOPE_UNCALIBRATED = 10,
152
+ HEART_RATE = 14,
153
+ RGBC_LIGHT = 15,
154
+ ACCELERATION_UNCALIBRATED = 17
155
+ }
156
+ export declare enum SensorState {
157
+ OK = 0,
158
+ NO_SERVICE = -3,
159
+ DISABLED = -2,
160
+ UNKNOWN = -1
161
+ }
162
+ export declare enum KeyEventType {
163
+ KEYDOWN = 0,
164
+ KEYUP = 1,
165
+ KEYPRESS = 2
166
+ }
167
+ export declare enum KeyCodeType {
168
+ USB = 0,
169
+ EVDEV = 1,
170
+ XKB = 2,
171
+ WIN = 3,
172
+ MAC = 4
173
+ }
174
+ export declare enum ImageFormatType {
175
+ PNG = 0,
176
+ RGBA8888 = 1,
177
+ RGB888 = 2
178
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SensorType = exports.SensorState = exports.KeyEventType = exports.KeyCodeType = exports.ImageFormatType = void 0;
7
+ let SensorType = exports.SensorType = /*#__PURE__*/function (SensorType) {
8
+ SensorType[SensorType["ACCELERATION"] = 0] = "ACCELERATION";
9
+ SensorType[SensorType["GYROSCOPE"] = 1] = "GYROSCOPE";
10
+ SensorType[SensorType["MAGNETIC_FIELD"] = 2] = "MAGNETIC_FIELD";
11
+ SensorType[SensorType["ORIENTATION"] = 3] = "ORIENTATION";
12
+ SensorType[SensorType["TEMPERATURE"] = 4] = "TEMPERATURE";
13
+ SensorType[SensorType["PROXIMITY"] = 5] = "PROXIMITY";
14
+ SensorType[SensorType["LIGHT"] = 6] = "LIGHT";
15
+ SensorType[SensorType["PRESSURE"] = 7] = "PRESSURE";
16
+ SensorType[SensorType["HUMIDITY"] = 8] = "HUMIDITY";
17
+ SensorType[SensorType["MAGNETIC_FIELD_UNCALIBRATED"] = 9] = "MAGNETIC_FIELD_UNCALIBRATED";
18
+ SensorType[SensorType["GYROSCOPE_UNCALIBRATED"] = 10] = "GYROSCOPE_UNCALIBRATED";
19
+ SensorType[SensorType["HEART_RATE"] = 14] = "HEART_RATE";
20
+ SensorType[SensorType["RGBC_LIGHT"] = 15] = "RGBC_LIGHT";
21
+ SensorType[SensorType["ACCELERATION_UNCALIBRATED"] = 17] = "ACCELERATION_UNCALIBRATED";
22
+ return SensorType;
23
+ }({});
24
+ let SensorState = exports.SensorState = /*#__PURE__*/function (SensorState) {
25
+ SensorState[SensorState["OK"] = 0] = "OK";
26
+ SensorState[SensorState["NO_SERVICE"] = -3] = "NO_SERVICE";
27
+ SensorState[SensorState["DISABLED"] = -2] = "DISABLED";
28
+ SensorState[SensorState["UNKNOWN"] = -1] = "UNKNOWN";
29
+ return SensorState;
30
+ }({});
31
+ let KeyEventType = exports.KeyEventType = /*#__PURE__*/function (KeyEventType) {
32
+ KeyEventType[KeyEventType["KEYDOWN"] = 0] = "KEYDOWN";
33
+ KeyEventType[KeyEventType["KEYUP"] = 1] = "KEYUP";
34
+ KeyEventType[KeyEventType["KEYPRESS"] = 2] = "KEYPRESS";
35
+ return KeyEventType;
36
+ }({});
37
+ let KeyCodeType = exports.KeyCodeType = /*#__PURE__*/function (KeyCodeType) {
38
+ KeyCodeType[KeyCodeType["USB"] = 0] = "USB";
39
+ KeyCodeType[KeyCodeType["EVDEV"] = 1] = "EVDEV";
40
+ KeyCodeType[KeyCodeType["XKB"] = 2] = "XKB";
41
+ KeyCodeType[KeyCodeType["WIN"] = 3] = "WIN";
42
+ KeyCodeType[KeyCodeType["MAC"] = 4] = "MAC";
43
+ return KeyCodeType;
44
+ }({});
45
+ let ImageFormatType = exports.ImageFormatType = /*#__PURE__*/function (ImageFormatType) {
46
+ ImageFormatType[ImageFormatType["PNG"] = 0] = "PNG";
47
+ ImageFormatType[ImageFormatType["RGBA8888"] = 1] = "RGBA8888";
48
+ ImageFormatType[ImageFormatType["RGB888"] = 2] = "RGB888";
49
+ return ImageFormatType;
50
+ }({});
@@ -1,13 +1,15 @@
1
1
  import { IVvdParams, IVvdResourcePaths, SDKParts, SDKDownloadOpt, SkinInfo, VelaImageType } from '../typing/Vvd';
2
2
  import { IStartOptions, IStartWithSerialPort } from '../typing/Instance';
3
+ import { EmulatorConfig } from '../emulatorutil';
3
4
  import { findInstance } from '../instance';
4
5
  import type { DownloadFileOptions } from 'ipull';
5
- import GrpcEmulator from './grpc';
6
+ import { GrpcEmulator } from './grpc';
7
+ export declare const isHeadlessEnvironment: () => boolean;
6
8
  export declare class VvdManager {
7
9
  private vvdHome;
8
10
  private sdkHome;
9
11
  binFiles: string[];
10
- constructor(vvdResourcePaths: IVvdResourcePaths);
12
+ constructor(vvdResourcePaths?: IVvdResourcePaths);
11
13
  static getDebuggerCfgFile(): string;
12
14
  /**
13
15
  * 创建Vela端的 VVD ,统一保存在 .vela/vvd 目录下
@@ -18,7 +20,7 @@ export declare class VvdManager {
18
20
  * @returns
19
21
  */
20
22
  createVvd(vvdParams: IVvdParams): boolean;
21
- getVvdDir(vvdName: string): string;
23
+ getVvdDir(vvdName: string): any;
22
24
  /** 根据AVD名字获取模拟器的详细信息 */
23
25
  getVvdInfo(vvdName: string): IVvdParams;
24
26
  /** 根据名字删除AVD */
@@ -49,11 +51,13 @@ export declare class VvdManager {
49
51
  /** 重置自定义的镜像目录 */
50
52
  resetImageDir(vvdName: string): void;
51
53
  getEmulatorBinPath(sdkHome: string): string;
54
+ oldEmulatorMigrate(vvdName: string): Promise<void>;
52
55
  getVvdStartCmd(options: IStartOptions | IStartWithSerialPort): Promise<string>;
53
56
  startVvd(options: IStartOptions | IStartWithSerialPort): Promise<{
54
57
  coldBoot: boolean;
55
58
  emulatorInstance: ReturnType<typeof findInstance>;
56
59
  getAgent: () => GrpcEmulator;
60
+ grpcConfig: EmulatorConfig;
57
61
  }>;
58
62
  stopVvd(name: string, timeout?: number): Promise<void>;
59
63
  /** 获取模拟器平台的名称,darwin-aarch64 linux-aarch64 windows-x86_64等 */