diff --git a/src/Point/Components/PointMachine/PointMachineState.cs b/src/Point/Components/PointMachine/PointMachineState.cs deleted file mode 100644 index 81f5220..0000000 --- a/src/Point/Components/PointMachine/PointMachineState.cs +++ /dev/null @@ -1,15 +0,0 @@ -using ReportedPointPosition = EulynxLive.Messages.Baseline4R1.PointPointPositionMessageReportedPointPosition; -using ReportedDegradedPointPosition = EulynxLive.Messages.Baseline4R1.PointPointPositionMessageReportedDegradedPointPosition; -using PointMachineStateMessage = EulynxLive.Point.Proto.PointMachineStateMessage.Types; - -namespace EulynxLive.Point.Components -{ - public class PointMachineState - { - public ReportedPointPosition PointPosition { get; set; } - public ReportedDegradedPointPosition DegradedPointPosition { get; set; } - public PointMachineStateMessage.Target Target { get; set; } - public PointMachineStateMessage.AbilityToMove AbilityToMove { get; set; } - public PointMachineStateMessage.LastPointPosition LastPointPosition { get; set; } - } -} diff --git a/src/Point/Services/PointService.cs b/src/Point/Services/PointService.cs index 3878411..2708e0b 100644 --- a/src/Point/Services/PointService.cs +++ b/src/Point/Services/PointService.cs @@ -59,25 +59,5 @@ public override Task GetPointPosition(Empty request, Serve return Task.FromResult(response); } - public override Task EstablishPointMachineState(PointMachineStateMessage request, ServerCallContext context) - { - // Perform validation - if (request.Crucial == PointMachineStateMessage.Types.Crucial.Crucial && !_point.AllPointMachinesCrucial) { - throw new InvalidOperationException("Point has only crucial point machines"); - } - - _point.PointState.PointPosition = request.PointPosition.ConvertToReportedPointPosition(); - - return Task.FromResult(new Empty()); - } - - public override Task GetPointMachineState(Empty request, ServerCallContext context) - { - return Task.FromResult(new PointMachineStateMessage() - { - Crucial = _point.AllPointMachinesCrucial ? PointMachineStateMessage.Types.Crucial.Crucial : PointMachineStateMessage.Types.Crucial.NonCrucial, - PointPosition = _point.PointState.PointPosition.ConvertToProtoMessage(), - }); - } } } diff --git a/src/Point/rasta-point-web/src/proto/PointServiceClientPb.ts b/src/Point/rasta-point-web/src/proto/PointServiceClientPb.ts index d1b08a5..20958d1 100644 --- a/src/Point/rasta-point-web/src/proto/PointServiceClientPb.ts +++ b/src/Point/rasta-point-web/src/proto/PointServiceClientPb.ts @@ -384,91 +384,5 @@ export class PointClient { this.methodDescriptorReset); } - methodDescriptorEstablishPointMachineState = new grpcWeb.MethodDescriptor( - '/point.Point/EstablishPointMachineState', - grpcWeb.MethodType.UNARY, - point_pb.PointMachineStateMessage, - google_protobuf_empty_pb.Empty, - (request: point_pb.PointMachineStateMessage) => { - return request.serializeBinary(); - }, - google_protobuf_empty_pb.Empty.deserializeBinary - ); - - establishPointMachineState( - request: point_pb.PointMachineStateMessage, - metadata: grpcWeb.Metadata | null): Promise; - - establishPointMachineState( - request: point_pb.PointMachineStateMessage, - metadata: grpcWeb.Metadata | null, - callback: (err: grpcWeb.RpcError, - response: google_protobuf_empty_pb.Empty) => void): grpcWeb.ClientReadableStream; - - establishPointMachineState( - request: point_pb.PointMachineStateMessage, - metadata: grpcWeb.Metadata | null, - callback?: (err: grpcWeb.RpcError, - response: google_protobuf_empty_pb.Empty) => void) { - if (callback !== undefined) { - return this.client_.rpcCall( - this.hostname_ + - '/point.Point/EstablishPointMachineState', - request, - metadata || {}, - this.methodDescriptorEstablishPointMachineState, - callback); - } - return this.client_.unaryCall( - this.hostname_ + - '/point.Point/EstablishPointMachineState', - request, - metadata || {}, - this.methodDescriptorEstablishPointMachineState); - } - - methodDescriptorGetPointMachineState = new grpcWeb.MethodDescriptor( - '/point.Point/GetPointMachineState', - grpcWeb.MethodType.UNARY, - google_protobuf_empty_pb.Empty, - point_pb.PointMachineStateMessage, - (request: google_protobuf_empty_pb.Empty) => { - return request.serializeBinary(); - }, - point_pb.PointMachineStateMessage.deserializeBinary - ); - - getPointMachineState( - request: google_protobuf_empty_pb.Empty, - metadata: grpcWeb.Metadata | null): Promise; - - getPointMachineState( - request: google_protobuf_empty_pb.Empty, - metadata: grpcWeb.Metadata | null, - callback: (err: grpcWeb.RpcError, - response: point_pb.PointMachineStateMessage) => void): grpcWeb.ClientReadableStream; - - getPointMachineState( - request: google_protobuf_empty_pb.Empty, - metadata: grpcWeb.Metadata | null, - callback?: (err: grpcWeb.RpcError, - response: point_pb.PointMachineStateMessage) => void) { - if (callback !== undefined) { - return this.client_.rpcCall( - this.hostname_ + - '/point.Point/GetPointMachineState', - request, - metadata || {}, - this.methodDescriptorGetPointMachineState, - callback); - } - return this.client_.unaryCall( - this.hostname_ + - '/point.Point/GetPointMachineState', - request, - metadata || {}, - this.methodDescriptorGetPointMachineState); - } - } diff --git a/src/Point/rasta-point-web/src/proto/point_pb.d.ts b/src/Point/rasta-point-web/src/proto/point_pb.d.ts index 31bead6..b20e17f 100644 --- a/src/Point/rasta-point-web/src/proto/point_pb.d.ts +++ b/src/Point/rasta-point-web/src/proto/point_pb.d.ts @@ -103,64 +103,6 @@ export namespace PointDegradedPositionMessage { } } -export class PointMachineStateMessage extends jspb.Message { - getPointposition(): PointPosition; - setPointposition(value: PointPosition): PointMachineStateMessage; - - getTarget(): PointMachineStateMessage.Target; - setTarget(value: PointMachineStateMessage.Target): PointMachineStateMessage; - - getAbilitytomove(): PointMachineStateMessage.AbilityToMove; - setAbilitytomove(value: PointMachineStateMessage.AbilityToMove): PointMachineStateMessage; - - getLastpointposition(): PointMachineStateMessage.LastPointPosition; - setLastpointposition(value: PointMachineStateMessage.LastPointPosition): PointMachineStateMessage; - - getCrucial(): PointMachineStateMessage.Crucial; - setCrucial(value: PointMachineStateMessage.Crucial): PointMachineStateMessage; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): PointMachineStateMessage.AsObject; - static toObject(includeInstance: boolean, msg: PointMachineStateMessage): PointMachineStateMessage.AsObject; - static serializeBinaryToWriter(message: PointMachineStateMessage, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): PointMachineStateMessage; - static deserializeBinaryFromReader(message: PointMachineStateMessage, reader: jspb.BinaryReader): PointMachineStateMessage; -} - -export namespace PointMachineStateMessage { - export type AsObject = { - pointposition: PointPosition, - target: PointMachineStateMessage.Target, - abilitytomove: PointMachineStateMessage.AbilityToMove, - lastpointposition: PointMachineStateMessage.LastPointPosition, - crucial: PointMachineStateMessage.Crucial, - } - - export enum Target { - TARGET_UNDEFINED = 0, - TARGET_LEFT = 1, - TARGET_RIGHT = 2, - TARGET_NONE = 3, - } - - export enum AbilityToMove { - ABILITYTOMOVE_UNDEFINED = 0, - ABILITYTOMOVE_ABLE = 1, - ABILITYTOMOVE_UNABLE = 2, - } - - export enum LastPointPosition { - LASTPOINTPOSITION_UNDEFINED = 0, - LASTPOINTPOSITION_NONE = 1, - } - - export enum Crucial { - CRUCIAL_UNDEFINED = 0, - CRUCIAL_CRUCIAL = 1, - CRUCIAL_NONCRUCIAL = 2, - } -} - export enum PointPosition { RIGHT = 0, LEFT = 1, diff --git a/src/Point/rasta-point-web/src/proto/point_pb.js b/src/Point/rasta-point-web/src/proto/point_pb.js index 1ddd997..f40bf83 100644 --- a/src/Point/rasta-point-web/src/proto/point_pb.js +++ b/src/Point/rasta-point-web/src/proto/point_pb.js @@ -28,11 +28,6 @@ goog.exportSymbol('proto.point.AbilityToMoveMessage', null, global); goog.exportSymbol('proto.point.GenericSCIMessage', null, global); goog.exportSymbol('proto.point.PointDegradedPosition', null, global); goog.exportSymbol('proto.point.PointDegradedPositionMessage', null, global); -goog.exportSymbol('proto.point.PointMachineStateMessage', null, global); -goog.exportSymbol('proto.point.PointMachineStateMessage.AbilityToMove', null, global); -goog.exportSymbol('proto.point.PointMachineStateMessage.Crucial', null, global); -goog.exportSymbol('proto.point.PointMachineStateMessage.LastPointPosition', null, global); -goog.exportSymbol('proto.point.PointMachineStateMessage.Target', null, global); goog.exportSymbol('proto.point.PointPosition', null, global); goog.exportSymbol('proto.point.PointPositionMessage', null, global); goog.exportSymbol('proto.point.PreventedPosition', null, global); @@ -142,27 +137,6 @@ if (goog.DEBUG && !COMPILED) { */ proto.point.PointDegradedPositionMessage.displayName = 'proto.point.PointDegradedPositionMessage'; } -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.point.PointMachineStateMessage = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.point.PointMachineStateMessage, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.point.PointMachineStateMessage.displayName = 'proto.point.PointMachineStateMessage'; -} @@ -897,292 +871,6 @@ proto.point.PointDegradedPositionMessage.prototype.setPosition = function(value) }; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.point.PointMachineStateMessage.prototype.toObject = function(opt_includeInstance) { - return proto.point.PointMachineStateMessage.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.point.PointMachineStateMessage} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.point.PointMachineStateMessage.toObject = function(includeInstance, msg) { - var f, obj = { - pointposition: jspb.Message.getFieldWithDefault(msg, 1, 0), - target: jspb.Message.getFieldWithDefault(msg, 2, 0), - abilitytomove: jspb.Message.getFieldWithDefault(msg, 3, 0), - lastpointposition: jspb.Message.getFieldWithDefault(msg, 4, 0), - crucial: jspb.Message.getFieldWithDefault(msg, 5, 0) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.point.PointMachineStateMessage} - */ -proto.point.PointMachineStateMessage.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.point.PointMachineStateMessage; - return proto.point.PointMachineStateMessage.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.point.PointMachineStateMessage} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.point.PointMachineStateMessage} - */ -proto.point.PointMachineStateMessage.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {!proto.point.PointPosition} */ (reader.readEnum()); - msg.setPointposition(value); - break; - case 2: - var value = /** @type {!proto.point.PointMachineStateMessage.Target} */ (reader.readEnum()); - msg.setTarget(value); - break; - case 3: - var value = /** @type {!proto.point.PointMachineStateMessage.AbilityToMove} */ (reader.readEnum()); - msg.setAbilitytomove(value); - break; - case 4: - var value = /** @type {!proto.point.PointMachineStateMessage.LastPointPosition} */ (reader.readEnum()); - msg.setLastpointposition(value); - break; - case 5: - var value = /** @type {!proto.point.PointMachineStateMessage.Crucial} */ (reader.readEnum()); - msg.setCrucial(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.point.PointMachineStateMessage.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.point.PointMachineStateMessage.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.point.PointMachineStateMessage} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.point.PointMachineStateMessage.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getPointposition(); - if (f !== 0.0) { - writer.writeEnum( - 1, - f - ); - } - f = message.getTarget(); - if (f !== 0.0) { - writer.writeEnum( - 2, - f - ); - } - f = message.getAbilitytomove(); - if (f !== 0.0) { - writer.writeEnum( - 3, - f - ); - } - f = message.getLastpointposition(); - if (f !== 0.0) { - writer.writeEnum( - 4, - f - ); - } - f = message.getCrucial(); - if (f !== 0.0) { - writer.writeEnum( - 5, - f - ); - } -}; - - -/** - * @enum {number} - */ -proto.point.PointMachineStateMessage.Target = { - TARGET_UNDEFINED: 0, - TARGET_LEFT: 1, - TARGET_RIGHT: 2, - TARGET_NONE: 3 -}; - -/** - * @enum {number} - */ -proto.point.PointMachineStateMessage.AbilityToMove = { - ABILITYTOMOVE_UNDEFINED: 0, - ABILITYTOMOVE_ABLE: 1, - ABILITYTOMOVE_UNABLE: 2 -}; - -/** - * @enum {number} - */ -proto.point.PointMachineStateMessage.LastPointPosition = { - LASTPOINTPOSITION_UNDEFINED: 0, - LASTPOINTPOSITION_NONE: 1 -}; - -/** - * @enum {number} - */ -proto.point.PointMachineStateMessage.Crucial = { - CRUCIAL_UNDEFINED: 0, - CRUCIAL_CRUCIAL: 1, - CRUCIAL_NONCRUCIAL: 2 -}; - -/** - * optional PointPosition pointPosition = 1; - * @return {!proto.point.PointPosition} - */ -proto.point.PointMachineStateMessage.prototype.getPointposition = function() { - return /** @type {!proto.point.PointPosition} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {!proto.point.PointPosition} value - * @return {!proto.point.PointMachineStateMessage} returns this - */ -proto.point.PointMachineStateMessage.prototype.setPointposition = function(value) { - return jspb.Message.setProto3EnumField(this, 1, value); -}; - - -/** - * optional Target target = 2; - * @return {!proto.point.PointMachineStateMessage.Target} - */ -proto.point.PointMachineStateMessage.prototype.getTarget = function() { - return /** @type {!proto.point.PointMachineStateMessage.Target} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {!proto.point.PointMachineStateMessage.Target} value - * @return {!proto.point.PointMachineStateMessage} returns this - */ -proto.point.PointMachineStateMessage.prototype.setTarget = function(value) { - return jspb.Message.setProto3EnumField(this, 2, value); -}; - - -/** - * optional AbilityToMove abilityToMove = 3; - * @return {!proto.point.PointMachineStateMessage.AbilityToMove} - */ -proto.point.PointMachineStateMessage.prototype.getAbilitytomove = function() { - return /** @type {!proto.point.PointMachineStateMessage.AbilityToMove} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); -}; - - -/** - * @param {!proto.point.PointMachineStateMessage.AbilityToMove} value - * @return {!proto.point.PointMachineStateMessage} returns this - */ -proto.point.PointMachineStateMessage.prototype.setAbilitytomove = function(value) { - return jspb.Message.setProto3EnumField(this, 3, value); -}; - - -/** - * optional LastPointPosition lastPointPosition = 4; - * @return {!proto.point.PointMachineStateMessage.LastPointPosition} - */ -proto.point.PointMachineStateMessage.prototype.getLastpointposition = function() { - return /** @type {!proto.point.PointMachineStateMessage.LastPointPosition} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); -}; - - -/** - * @param {!proto.point.PointMachineStateMessage.LastPointPosition} value - * @return {!proto.point.PointMachineStateMessage} returns this - */ -proto.point.PointMachineStateMessage.prototype.setLastpointposition = function(value) { - return jspb.Message.setProto3EnumField(this, 4, value); -}; - - -/** - * optional Crucial crucial = 5; - * @return {!proto.point.PointMachineStateMessage.Crucial} - */ -proto.point.PointMachineStateMessage.prototype.getCrucial = function() { - return /** @type {!proto.point.PointMachineStateMessage.Crucial} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); -}; - - -/** - * @param {!proto.point.PointMachineStateMessage.Crucial} value - * @return {!proto.point.PointMachineStateMessage} returns this - */ -proto.point.PointMachineStateMessage.prototype.setCrucial = function(value) { - return jspb.Message.setProto3EnumField(this, 5, value); -}; - - /** * @enum {number} */ diff --git a/src/ProtobufInterfaces/proto/point.proto b/src/ProtobufInterfaces/proto/point.proto index cdef07d..7941d5d 100644 --- a/src/ProtobufInterfaces/proto/point.proto +++ b/src/ProtobufInterfaces/proto/point.proto @@ -33,9 +33,6 @@ service Point { rpc GetDegradedPointPosition (google.protobuf.Empty) returns (PointDegradedPositionMessage) {} rpc SendGenericMessage (GenericSCIMessage) returns (google.protobuf.Empty) {} rpc Reset (google.protobuf.Empty) returns (google.protobuf.Empty) {} - - rpc EstablishPointMachineState (PointMachineStateMessage) returns (google.protobuf.Empty) {} - rpc GetPointMachineState (google.protobuf.Empty) returns (PointMachineStateMessage) {} } enum AbilityToMove { @@ -65,35 +62,3 @@ message PointPositionMessage { message PointDegradedPositionMessage { PointDegradedPosition position = 1; } - -message PointMachineStateMessage { - enum Target { - Target_UNDEFINED = 0; - Target_Left = 1; - Target_Right = 2; - Target_None = 3; - } - - enum AbilityToMove { - AbilityToMove_UNDEFINED = 0; - AbilityToMove_Able = 1; - AbilityToMove_Unable = 2; - } - - enum LastPointPosition { - LastPointPosition_UNDEFINED = 0; - LastPointPosition_None = 1; - } - - enum Crucial { - Crucial_UNDEFINED = 0; - Crucial_Crucial = 1; - Crucial_NonCrucial = 2; - } - - PointPosition pointPosition = 1; - Target target = 2; - AbilityToMove abilityToMove = 3; - LastPointPosition lastPointPosition = 4; - Crucial crucial = 5; -}