diff --git a/src/components/camera/camera.ts b/src/components/camera/camera.ts index b557195de..83a9b005f 100644 --- a/src/components/camera/camera.ts +++ b/src/components/camera/camera.ts @@ -1,3 +1,4 @@ +import type { Struct } from '@bufbuild/protobuf'; import type { DistortionParameters, IntrinsicParameters, @@ -31,7 +32,7 @@ export interface Camera extends Resource { * @param mimeType - A specific MIME type to request. This is not necessarily * the same type that will be returned. */ - getImage: (mimeType?: MimeType) => Promise; + getImage: (mimeType?: MimeType, extra?: Struct) => Promise; /** * Render a frame from a camera to an HTTP response. @@ -39,10 +40,10 @@ export interface Camera extends Resource { * @param mimeType - A specific MIME type to request. This is not necessarily * the same type that will be returned. */ - renderFrame: (mimeType?: MimeType) => Promise; + renderFrame: (mimeType?: MimeType, extra?: Struct) => Promise; /** Return a point cloud from a camera. */ - getPointCloud: () => Promise; + getPointCloud: (extra?: Struct) => Promise; /** Return the camera properties. */ getProperties: () => Promise; diff --git a/src/components/camera/client.ts b/src/components/camera/client.ts index 26fea0ed2..bd620a710 100644 --- a/src/components/camera/client.ts +++ b/src/components/camera/client.ts @@ -1,4 +1,4 @@ -import type { JsonValue, Struct } from '@bufbuild/protobuf'; +import { type JsonValue, Struct } from '@bufbuild/protobuf'; import type { CallOptions, PromiseClient } from '@connectrpc/connect'; import { GetPropertiesRequest } from '../../gen/component/base/v1/base_pb'; import { CameraService } from '../../gen/component/camera/v1/camera_connect'; @@ -31,10 +31,15 @@ export class CameraClient implements Camera { this.options = options; } - async getImage(mimeType: MimeType = '', callOptions = this.callOptions) { + async getImage( + mimeType: MimeType = '', + extra = {}, + callOptions = this.callOptions + ) { const request = new GetImageRequest({ name: this.name, mimeType, + extra: Struct.fromJson(extra), }); this.options.requestLogger?.(request); @@ -43,10 +48,15 @@ export class CameraClient implements Camera { return resp.image; } - async renderFrame(mimeType: MimeType = '', callOptions = this.callOptions) { + async renderFrame( + mimeType: MimeType = '', + extra = {}, + callOptions = this.callOptions + ) { const request = new RenderFrameRequest({ name: this.name, mimeType, + extra: Struct.fromJson(extra), }); this.options.requestLogger?.(request); @@ -55,10 +65,11 @@ export class CameraClient implements Camera { return new Blob([resp.data], { type: mimeType }); } - async getPointCloud(callOptions = this.callOptions) { + async getPointCloud(extra = {}, callOptions = this.callOptions) { const request = new GetPointCloudRequest({ name: this.name, mimeType: PointCloudPCD, + extra: Struct.fromJson(extra), }); this.options.requestLogger?.(request);