Skip to content

Commit

Permalink
RSDK-9439 Add state to GetMachineStatusResponse (#603)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjirewis authored Dec 11, 2024
1 parent a6d8a8e commit 93c5ecd
Show file tree
Hide file tree
Showing 4 changed files with 290 additions and 157 deletions.
12 changes: 12 additions & 0 deletions gen/js/robot/v1/robot_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,9 @@ export class GetMachineStatusResponse extends jspb.Message {
getConfig(): ConfigStatus | undefined;
setConfig(value?: ConfigStatus): void;

getState(): GetMachineStatusResponse.StateMap[keyof GetMachineStatusResponse.StateMap];
setState(value: GetMachineStatusResponse.StateMap[keyof GetMachineStatusResponse.StateMap]): void;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetMachineStatusResponse.AsObject;
static toObject(includeInstance: boolean, msg: GetMachineStatusResponse): GetMachineStatusResponse.AsObject;
Expand All @@ -1128,7 +1131,16 @@ export namespace GetMachineStatusResponse {
export type AsObject = {
resourcesList: Array<ResourceStatus.AsObject>,
config?: ConfigStatus.AsObject,
state: GetMachineStatusResponse.StateMap[keyof GetMachineStatusResponse.StateMap],
}

export interface StateMap {
STATE_UNSPECIFIED: 0;
STATE_INITIALIZING: 1;
STATE_RUNNING: 2;
}

export const State: StateMap;
}

export class ResourceStatus extends jspb.Message {
Expand Down
42 changes: 41 additions & 1 deletion gen/js/robot/v1/robot_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ goog.exportSymbol('proto.viam.robot.v1.GetCloudMetadataRequest', null, global);
goog.exportSymbol('proto.viam.robot.v1.GetCloudMetadataResponse', null, global);
goog.exportSymbol('proto.viam.robot.v1.GetMachineStatusRequest', null, global);
goog.exportSymbol('proto.viam.robot.v1.GetMachineStatusResponse', null, global);
goog.exportSymbol('proto.viam.robot.v1.GetMachineStatusResponse.State', null, global);
goog.exportSymbol('proto.viam.robot.v1.GetOperationsRequest', null, global);
goog.exportSymbol('proto.viam.robot.v1.GetOperationsResponse', null, global);
goog.exportSymbol('proto.viam.robot.v1.GetSessionsRequest', null, global);
Expand Down Expand Up @@ -8841,7 +8842,8 @@ proto.viam.robot.v1.GetMachineStatusResponse.toObject = function(includeInstance
var f, obj = {
resourcesList: jspb.Message.toObjectList(msg.getResourcesList(),
proto.viam.robot.v1.ResourceStatus.toObject, includeInstance),
config: (f = msg.getConfig()) && proto.viam.robot.v1.ConfigStatus.toObject(includeInstance, f)
config: (f = msg.getConfig()) && proto.viam.robot.v1.ConfigStatus.toObject(includeInstance, f),
state: jspb.Message.getFieldWithDefault(msg, 3, 0)
};

if (includeInstance) {
Expand Down Expand Up @@ -8888,6 +8890,10 @@ proto.viam.robot.v1.GetMachineStatusResponse.deserializeBinaryFromReader = funct
reader.readMessage(value,proto.viam.robot.v1.ConfigStatus.deserializeBinaryFromReader);
msg.setConfig(value);
break;
case 3:
var value = /** @type {!proto.viam.robot.v1.GetMachineStatusResponse.State} */ (reader.readEnum());
msg.setState(value);
break;
default:
reader.skipField();
break;
Expand Down Expand Up @@ -8933,9 +8939,25 @@ proto.viam.robot.v1.GetMachineStatusResponse.serializeBinaryToWriter = function(
proto.viam.robot.v1.ConfigStatus.serializeBinaryToWriter
);
}
f = message.getState();
if (f !== 0.0) {
writer.writeEnum(
3,
f
);
}
};


/**
* @enum {number}
*/
proto.viam.robot.v1.GetMachineStatusResponse.State = {
STATE_UNSPECIFIED: 0,
STATE_INITIALIZING: 1,
STATE_RUNNING: 2
};

/**
* repeated ResourceStatus resources = 1;
* @return {!Array<!proto.viam.robot.v1.ResourceStatus>}
Expand Down Expand Up @@ -9011,6 +9033,24 @@ proto.viam.robot.v1.GetMachineStatusResponse.prototype.hasConfig = function() {
};


/**
* optional State state = 3;
* @return {!proto.viam.robot.v1.GetMachineStatusResponse.State}
*/
proto.viam.robot.v1.GetMachineStatusResponse.prototype.getState = function() {
return /** @type {!proto.viam.robot.v1.GetMachineStatusResponse.State} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
};


/**
* @param {!proto.viam.robot.v1.GetMachineStatusResponse.State} value
* @return {!proto.viam.robot.v1.GetMachineStatusResponse} returns this
*/
proto.viam.robot.v1.GetMachineStatusResponse.prototype.setState = function(value) {
return jspb.Message.setProto3EnumField(this, 3, value);
};





Expand Down
10 changes: 10 additions & 0 deletions proto/viam/robot/v1/robot.proto
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,18 @@ message ShutdownResponse {}
message GetMachineStatusRequest {}

message GetMachineStatusResponse {
enum State {
STATE_UNSPECIFIED = 0;
// the machine is reachable but still in the process of configuring initial
// modules and resources.
STATE_INITIALIZING = 1;
// the machine has finished initializing.
STATE_RUNNING = 2;
}

repeated ResourceStatus resources = 1;
ConfigStatus config = 2;
State state = 3;
}

message ResourceStatus {
Expand Down
Loading

0 comments on commit 93c5ecd

Please sign in to comment.