Add device-find, client-find server commands
Reviewed By: passy Differential Revision: D36098171 fbshipit-source-id: f0d0bbefcafc57a6413f9ffe8da271419c0d4deb
This commit is contained in:
committed by
Facebook GitHub Bot
parent
50111ef24b
commit
3dd7583fdc
@@ -209,6 +209,9 @@ export type FlipperServerCommands = {
|
|||||||
'get-config': () => Promise<FlipperServerConfig>;
|
'get-config': () => Promise<FlipperServerConfig>;
|
||||||
'get-changelog': () => Promise<string>;
|
'get-changelog': () => Promise<string>;
|
||||||
'device-list': () => Promise<DeviceDescription[]>;
|
'device-list': () => Promise<DeviceDescription[]>;
|
||||||
|
'device-find': (
|
||||||
|
deviceSerial: string,
|
||||||
|
) => Promise<DeviceDescription | undefined>;
|
||||||
'device-take-screenshot': (serial: string) => Promise<string>; // base64 encoded buffer
|
'device-take-screenshot': (serial: string) => Promise<string>; // base64 encoded buffer
|
||||||
'device-start-screencapture': (
|
'device-start-screencapture': (
|
||||||
serial: string,
|
serial: string,
|
||||||
@@ -225,6 +228,7 @@ export type FlipperServerCommands = {
|
|||||||
'device-navigate': (serial: string, location: string) => Promise<void>;
|
'device-navigate': (serial: string, location: string) => Promise<void>;
|
||||||
'metro-command': (serial: string, command: string) => Promise<void>;
|
'metro-command': (serial: string, command: string) => Promise<void>;
|
||||||
'client-list': () => Promise<ClientDescription[]>;
|
'client-list': () => Promise<ClientDescription[]>;
|
||||||
|
'client-find': (clientId: string) => Promise<ClientDescription | undefined>;
|
||||||
'client-request': (clientId: string, payload: any) => Promise<void>;
|
'client-request': (clientId: string, payload: any) => Promise<void>;
|
||||||
'client-request-response': (
|
'client-request-response': (
|
||||||
clientId: string,
|
clientId: string,
|
||||||
|
|||||||
@@ -340,6 +340,9 @@ export class FlipperServerImpl implements FlipperServer {
|
|||||||
),
|
),
|
||||||
'get-config': async () => this.config,
|
'get-config': async () => this.config,
|
||||||
'get-changelog': getChangelog,
|
'get-changelog': getChangelog,
|
||||||
|
'device-find': async (deviceSerial) => {
|
||||||
|
return this.devices.get(deviceSerial)?.info;
|
||||||
|
},
|
||||||
'device-list': async () => {
|
'device-list': async () => {
|
||||||
return Array.from(this.devices.values()).map((d) => d.info);
|
return Array.from(this.devices.values()).map((d) => d.info);
|
||||||
},
|
},
|
||||||
@@ -363,6 +366,9 @@ export class FlipperServerImpl implements FlipperServer {
|
|||||||
}
|
}
|
||||||
device.sendCommand(command);
|
device.sendCommand(command);
|
||||||
},
|
},
|
||||||
|
'client-find': async (clientId) => {
|
||||||
|
return this.server.connections.get(clientId)?.client;
|
||||||
|
},
|
||||||
'client-list': async () => {
|
'client-list': async () => {
|
||||||
return Array.from(this.server.connections.values()).map((c) => c.client);
|
return Array.from(this.server.connections.values()).map((c) => c.client);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user