declare module 'rclnodejs' { type ServiceRequestMessage = T extends ServiceTypeClassName ? InstanceType : T extends { Request: new (...args: any[]) => infer R } ? R : object; type ServiceResponseMessage = T extends ServiceTypeClassName ? InstanceType : T extends { Response: new (...args: any[]) => infer R } ? R : object; /** * Callback for receiving service requests from a client. * * @param request - The request sent to the service * @param response - The response to the client. * * @remarks * Use {@link Response.send | response.send()} to send response object to client * * See {@link Node.createService | Node.createService} * See {@link Client.sendRequest | Client.sendRequest} * See {@link Client} * See {@link Service} * See {@link Response.send | Response.send} */ type ServiceRequestHandler> = ( request: ServiceRequestMessage, response: ServiceResponse ) => void; /** * Callback for receiving service requests from a client. * * @param request - The request sent to the service * @param response - The response to the client. * * @deprecated use {@link ServiceRequestHandler | ServiceRequestHandler} */ type ServiceRequestCallback> = ServiceRequestHandler; /** * A service response to a client request. * * @remarks * Use {@link response.template | response.template} to get an empty result message. */ class ServiceResponse> { /** * Get an empty response message object. * The template will be a message of type: .msg._Response. * e.g., example_interface/srv/AddTwoInts_Response */ readonly template: ServiceResponseMessage; /** * The service that this response object is attaching to. */ readonly service: Service; /** * Send this response to client (the service caller) * * @param response - Response message. * * @remarks * see {@link Response.template} */ send(response: ServiceResponseMessage): void; } /** * A ROS Service server. */ interface ROSService extends Entity { /** * Name of the service. */ readonly serviceName: string; /** * Configure introspection. * @param clock - Clock to use for service event timestamps * @param QoSProfile - QOS profile for the service event publisher * @param introspectionState - The state to set introspection to */ configureIntrospection( clock: Clock, serviceEventPubQOS: QoS, introspectionState: ServiceIntrospectionStates ): void; /** * Get the options of this service. * @return The options of this service. */ getOptions(): object; /** * Get the logger name for this service. */ readonly loggerName: string; } }