@viamrobotics/sdk 0.4.0-rc.0 → 0.5.0-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.
@@ -1,8 +1,14 @@
1
+ import { type Duration as PBDuration } from 'google-protobuf/google/protobuf/duration_pb';
2
+ import pb from '../../gen/component/board/v1/board_pb';
1
3
  import type { Resource, StructType } from '../../types';
2
4
  interface Status {
3
5
  analogs: Record<string, number>;
4
6
  digitalInterrupts: Record<string, number>;
5
7
  }
8
+ type ValueOf<T> = T[keyof T];
9
+ export declare const PowerMode: pb.PowerModeMap;
10
+ export type PowerMode = ValueOf<typeof pb.PowerMode>;
11
+ export type Duration = PBDuration.AsObject;
6
12
  /**
7
13
  * Represents a physical general purpose compute board that contains various
8
14
  * components such as analog readers, and digital interrupts.
@@ -48,7 +54,7 @@ export interface Board extends Resource {
48
54
  * Set the PWM frequency of the given pin of a board.
49
55
  *
50
56
  * @param pin - The pin.
51
- * @param frequencyHz - The PWN frequency, in hertz. 0 will use the board's
57
+ * @param frequencyHz - The PWM frequency, in hertz. 0 will use the board's
52
58
  * default PWM frequency.
53
59
  */
54
60
  setPWMFrequency(pin: string, frequencyHz: number, extra?: StructType): Promise<void>;
@@ -58,6 +64,13 @@ export interface Board extends Resource {
58
64
  * @param analogReader - The name of the analog reader.
59
65
  */
60
66
  readAnalogReader(analogReader: string, extra?: StructType): Promise<number>;
67
+ /**
68
+ * Write an analog value to a pin on the board.
69
+ *
70
+ * @param pin - The pin name.
71
+ * @param value - An integer value to write.
72
+ */
73
+ writeAnalog(pin: string, value: number, extra?: StructType): Promise<void>;
61
74
  /**
62
75
  * Return the current value of the interrupt which is based on the type of
63
76
  * interrupt.
@@ -65,5 +78,13 @@ export interface Board extends Resource {
65
78
  * @param digitalInterruptName - The name of the digital interrupt.
66
79
  */
67
80
  getDigitalInterruptValue(digitalInterruptName: string, extra?: StructType): Promise<number>;
81
+ /**
82
+ * Set power mode of the board.
83
+ *
84
+ * @param name - The name of the board.
85
+ * @param powerMode - The requested power mode.
86
+ * @param duration - The requested duration to stay in power mode.
87
+ */
88
+ setPowerMode(name: string, powerMode: PowerMode, duration: Duration, extra?: StructType): Promise<void>;
68
89
  }
69
90
  export {};
@@ -1,7 +1,7 @@
1
1
  import type { RobotClient } from '../../robot';
2
2
  import type { Options, StructType } from '../../types';
3
3
  import pb from '../../gen/component/board/v1/board_pb';
4
- import type { Board } from './board';
4
+ import type { Board, Duration, PowerMode } from './board';
5
5
  /**
6
6
  * A gRPC-web client for the Board component.
7
7
  *
@@ -31,6 +31,8 @@ export declare class BoardClient implements Board {
31
31
  getPWMFrequency(pin: string, extra?: {}): Promise<number>;
32
32
  setPWMFrequency(pin: string, frequencyHz: number, extra?: {}): Promise<void>;
33
33
  readAnalogReader(analogReader: string, extra?: {}): Promise<number>;
34
+ writeAnalog(pin: string, value: number, extra?: {}): Promise<void>;
34
35
  getDigitalInterruptValue(digitalInteruptName: string, extra?: {}): Promise<number>;
36
+ setPowerMode(name: string, powerMode: PowerMode, duration?: Duration, extra?: {}): Promise<void>;
35
37
  doCommand(command: StructType): Promise<StructType>;
36
38
  }
@@ -1,2 +1,2 @@
1
- export type { Board } from './board/board';
1
+ export { type Board, type Duration, PowerMode } from './board/board';
2
2
  export { BoardClient } from './board/client';
@@ -405,6 +405,56 @@ export namespace ReadAnalogReaderResponse {
405
405
  }
406
406
  }
407
407
 
408
+ export class WriteAnalogRequest extends jspb.Message {
409
+ getName(): string;
410
+ setName(value: string): void;
411
+
412
+ getPin(): string;
413
+ setPin(value: string): void;
414
+
415
+ getValue(): number;
416
+ setValue(value: number): void;
417
+
418
+ hasExtra(): boolean;
419
+ clearExtra(): void;
420
+ getExtra(): google_protobuf_struct_pb.Struct | undefined;
421
+ setExtra(value?: google_protobuf_struct_pb.Struct): void;
422
+
423
+ serializeBinary(): Uint8Array;
424
+ toObject(includeInstance?: boolean): WriteAnalogRequest.AsObject;
425
+ static toObject(includeInstance: boolean, msg: WriteAnalogRequest): WriteAnalogRequest.AsObject;
426
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
427
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
428
+ static serializeBinaryToWriter(message: WriteAnalogRequest, writer: jspb.BinaryWriter): void;
429
+ static deserializeBinary(bytes: Uint8Array): WriteAnalogRequest;
430
+ static deserializeBinaryFromReader(message: WriteAnalogRequest, reader: jspb.BinaryReader): WriteAnalogRequest;
431
+ }
432
+
433
+ export namespace WriteAnalogRequest {
434
+ export type AsObject = {
435
+ name: string,
436
+ pin: string,
437
+ value: number,
438
+ extra?: google_protobuf_struct_pb.Struct.AsObject,
439
+ }
440
+ }
441
+
442
+ export class WriteAnalogResponse extends jspb.Message {
443
+ serializeBinary(): Uint8Array;
444
+ toObject(includeInstance?: boolean): WriteAnalogResponse.AsObject;
445
+ static toObject(includeInstance: boolean, msg: WriteAnalogResponse): WriteAnalogResponse.AsObject;
446
+ static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
447
+ static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
448
+ static serializeBinaryToWriter(message: WriteAnalogResponse, writer: jspb.BinaryWriter): void;
449
+ static deserializeBinary(bytes: Uint8Array): WriteAnalogResponse;
450
+ static deserializeBinaryFromReader(message: WriteAnalogResponse, reader: jspb.BinaryReader): WriteAnalogResponse;
451
+ }
452
+
453
+ export namespace WriteAnalogResponse {
454
+ export type AsObject = {
455
+ }
456
+ }
457
+
408
458
  export class GetDigitalInterruptValueRequest extends jspb.Message {
409
459
  getBoardName(): string;
410
460
  setBoardName(value: string): void;
@@ -86,6 +86,15 @@ type BoardServiceReadAnalogReader = {
86
86
  readonly responseType: typeof component_board_v1_board_pb.ReadAnalogReaderResponse;
87
87
  };
88
88
 
89
+ type BoardServiceWriteAnalog = {
90
+ readonly methodName: string;
91
+ readonly service: typeof BoardService;
92
+ readonly requestStream: false;
93
+ readonly responseStream: false;
94
+ readonly requestType: typeof component_board_v1_board_pb.WriteAnalogRequest;
95
+ readonly responseType: typeof component_board_v1_board_pb.WriteAnalogResponse;
96
+ };
97
+
89
98
  type BoardServiceGetDigitalInterruptValue = {
90
99
  readonly methodName: string;
91
100
  readonly service: typeof BoardService;
@@ -124,6 +133,7 @@ export class BoardService {
124
133
  static readonly SetPWMFrequency: BoardServiceSetPWMFrequency;
125
134
  static readonly DoCommand: BoardServiceDoCommand;
126
135
  static readonly ReadAnalogReader: BoardServiceReadAnalogReader;
136
+ static readonly WriteAnalog: BoardServiceWriteAnalog;
127
137
  static readonly GetDigitalInterruptValue: BoardServiceGetDigitalInterruptValue;
128
138
  static readonly SetPowerMode: BoardServiceSetPowerMode;
129
139
  static readonly GetGeometries: BoardServiceGetGeometries;
@@ -242,6 +252,15 @@ export class BoardServiceClient {
242
252
  requestMessage: component_board_v1_board_pb.ReadAnalogReaderRequest,
243
253
  callback: (error: ServiceError|null, responseMessage: component_board_v1_board_pb.ReadAnalogReaderResponse|null) => void
244
254
  ): UnaryResponse;
255
+ writeAnalog(
256
+ requestMessage: component_board_v1_board_pb.WriteAnalogRequest,
257
+ metadata: grpc.Metadata,
258
+ callback: (error: ServiceError|null, responseMessage: component_board_v1_board_pb.WriteAnalogResponse|null) => void
259
+ ): UnaryResponse;
260
+ writeAnalog(
261
+ requestMessage: component_board_v1_board_pb.WriteAnalogRequest,
262
+ callback: (error: ServiceError|null, responseMessage: component_board_v1_board_pb.WriteAnalogResponse|null) => void
263
+ ): UnaryResponse;
245
264
  getDigitalInterruptValue(
246
265
  requestMessage: component_board_v1_board_pb.GetDigitalInterruptValueRequest,
247
266
  metadata: grpc.Metadata,
package/dist/main.d.ts CHANGED
@@ -59,7 +59,7 @@ export { type Base, type BaseProperties, BaseClient } from './components/base';
59
59
  * @group Raw Protobufs
60
60
  */
61
61
  export { default as boardApi } from './gen/component/board/v1/board_pb';
62
- export { type Board, BoardClient } from './components/board';
62
+ export { type Board, BoardClient, type Duration, PowerMode, } from './components/board';
63
63
  /**
64
64
  * Raw Protobuf interfaces for a Camera component.
65
65
  *