@viamrobotics/sdk 0.2.1-rc.0 → 0.2.2-rc.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.
- package/dist/events.d.ts +2 -0
- package/dist/gen/component/gantry/v1/gantry_pb.d.ts +52 -0
- package/dist/gen/component/gantry/v1/gantry_pb_service.d.ts +19 -0
- package/dist/main.es.js +220 -52
- package/dist/main.umd.js +3 -3
- package/dist/robot/client.d.ts +3 -1
- package/dist/robot/robot.d.ts +14 -0
- package/package.json +1 -1
package/dist/robot/client.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Credentials } from '@viamrobotics/rpc/src/dial';
|
|
2
2
|
import type { grpc } from '@improbable-eng/grpc-web';
|
|
3
|
+
import { EventDispatcher } from '../events';
|
|
3
4
|
import proto from '../gen/robot/v1/robot_pb';
|
|
4
5
|
import type { PoseInFrame, ResourceName, Transform } from '../gen/common/v1/common_pb';
|
|
5
6
|
import { ArmServiceClient } from '../gen/component/arm/v1/arm_pb_service';
|
|
@@ -40,7 +41,7 @@ declare abstract class ServiceClient {
|
|
|
40
41
|
*
|
|
41
42
|
* @group Clients
|
|
42
43
|
*/
|
|
43
|
-
export declare class RobotClient implements Robot {
|
|
44
|
+
export declare class RobotClient extends EventDispatcher implements Robot {
|
|
44
45
|
private readonly serviceHost;
|
|
45
46
|
private readonly webrtcOptions;
|
|
46
47
|
private readonly sessionOptions;
|
|
@@ -91,6 +92,7 @@ export declare class RobotClient implements Robot {
|
|
|
91
92
|
createServiceClient<T extends ServiceClient>(SC: new (serviceHost: string, options?: grpc.RpcOptions) => T): T;
|
|
92
93
|
get peerConnection(): RTCPeerConnection | undefined;
|
|
93
94
|
disconnect(): Promise<void>;
|
|
95
|
+
isConnected(): boolean;
|
|
94
96
|
connect(authEntity?: string | undefined, creds?: Credentials | undefined): Promise<void>;
|
|
95
97
|
getOperations(): Promise<proto.Operation[]>;
|
|
96
98
|
cancelOperation(id: string): Promise<void>;
|
package/dist/robot/robot.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { PoseInFrame, ResourceName, Transform } from '../gen/common/v1/common_pb';
|
|
2
2
|
import type { StructType } from '../types';
|
|
3
|
+
import { DISCONNECTED, RECONNECTED } from '../events';
|
|
3
4
|
import type proto from '../gen/robot/v1/robot_pb';
|
|
4
5
|
import type { ResponseStream } from '../gen/robot/v1/robot_pb_service';
|
|
5
6
|
export type RobotStatusStream = ResponseStream<proto.Status[]>;
|
|
7
|
+
type Callback = (args: unknown) => void;
|
|
6
8
|
export interface Robot {
|
|
7
9
|
/**
|
|
8
10
|
* Get the list of operations currently running on the robot.
|
|
@@ -116,4 +118,16 @@ export interface Robot {
|
|
|
116
118
|
* @alpha
|
|
117
119
|
*/
|
|
118
120
|
streamStatus(resourceNames?: ResourceName.AsObject[], durationMs?: number): RobotStatusStream;
|
|
121
|
+
/**
|
|
122
|
+
* Call a function when an event of either 'reconnected' or 'disconnected' is
|
|
123
|
+
* triggered. Note that these events will only be triggered on WebRTC
|
|
124
|
+
* connections.
|
|
125
|
+
*
|
|
126
|
+
* @param type - The event ('reconnected' or 'disconnected') that was
|
|
127
|
+
* triggered.
|
|
128
|
+
* @param listener - The function to call
|
|
129
|
+
* @alpha
|
|
130
|
+
*/
|
|
131
|
+
on: (type: typeof RECONNECTED | typeof DISCONNECTED, listener: Callback) => void;
|
|
119
132
|
}
|
|
133
|
+
export {};
|