feat(companion): add publishHeartbeat helper across platform clients
This commit is contained in:
@@ -38,6 +38,14 @@ export type SharedStatusInput = Omit<
|
||||
'platform'
|
||||
>;
|
||||
|
||||
export interface HeartbeatStatusInput {
|
||||
appVersion?: SharedStatusInput['appVersion'];
|
||||
deviceName?: SharedStatusInput['deviceName'];
|
||||
statusText?: SharedStatusInput['statusText'];
|
||||
batteryPct?: SharedStatusInput['batteryPct'];
|
||||
powerSource?: SharedStatusInput['powerSource'];
|
||||
}
|
||||
|
||||
export interface PlatformBootstrapResult {
|
||||
register: NodeRegisterResult;
|
||||
capabilities: NodeCapabilitiesResult;
|
||||
@@ -96,6 +104,16 @@ export class MacOSCompanionClient {
|
||||
});
|
||||
}
|
||||
|
||||
publishHeartbeat(input: HeartbeatStatusInput = {}): Promise<NodeStatusSetResult> {
|
||||
return this.setStatus({
|
||||
appVersion: input.appVersion,
|
||||
deviceName: input.deviceName,
|
||||
statusText: input.statusText ?? 'heartbeat',
|
||||
batteryPct: input.batteryPct,
|
||||
powerSource: input.powerSource ?? 'unknown',
|
||||
});
|
||||
}
|
||||
|
||||
setLocation(location: SetNodeLocationInput): Promise<NodeLocationSetResult> {
|
||||
return this.runtime.setNodeLocation(location);
|
||||
}
|
||||
@@ -195,6 +213,16 @@ export class IOSCompanionClient {
|
||||
});
|
||||
}
|
||||
|
||||
publishHeartbeat(input: HeartbeatStatusInput = {}): Promise<NodeStatusSetResult> {
|
||||
return this.setStatus({
|
||||
appVersion: input.appVersion,
|
||||
deviceName: input.deviceName,
|
||||
statusText: input.statusText ?? 'heartbeat',
|
||||
batteryPct: input.batteryPct,
|
||||
powerSource: input.powerSource ?? 'unknown',
|
||||
});
|
||||
}
|
||||
|
||||
setLocation(location: SetNodeLocationInput): Promise<NodeLocationSetResult> {
|
||||
return this.runtime.setNodeLocation(location);
|
||||
}
|
||||
@@ -294,6 +322,16 @@ export class AndroidCompanionClient {
|
||||
});
|
||||
}
|
||||
|
||||
publishHeartbeat(input: HeartbeatStatusInput = {}): Promise<NodeStatusSetResult> {
|
||||
return this.setStatus({
|
||||
appVersion: input.appVersion,
|
||||
deviceName: input.deviceName,
|
||||
statusText: input.statusText ?? 'heartbeat',
|
||||
batteryPct: input.batteryPct,
|
||||
powerSource: input.powerSource ?? 'unknown',
|
||||
});
|
||||
}
|
||||
|
||||
setLocation(location: SetNodeLocationInput): Promise<NodeLocationSetResult> {
|
||||
return this.runtime.setNodeLocation(location);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user