示例#1
0
        public override Task <GetValueForVariablePathResponse> GetValueForVariablePath(
            GetValueForVariablePathRequest request,
            ServerCallContext context)
        {
            RemoteFrame frame = frameStore.GetObject(request.Frame.Id);
            RemoteValue value = frame.GetValueForVariablePath(request.VariablePath);

            var response = new GetValueForVariablePathResponse();

            if (value != null)
            {
                response.Value = GrpcFactoryUtils.CreateValue(value, valueStore.AddObject(value));
            }
            return(Task.FromResult(response));
        }
示例#2
0
        public RemoteValue GetValueForVariablePath(string varPath)
        {
            var request = new GetValueForVariablePathRequest
            {
                Frame        = grpcSbFrame,
                VariablePath = varPath
            };
            GetValueForVariablePathResponse response = null;

            if (connection.InvokeRpc(() =>
            {
                response = client.GetValueForVariablePath(request);
            }))
            {
                if (response.Value != null && response.Value.Id != 0)
                {
                    return(valueFactory.Create(connection, response.Value));
                }
            }
            return(null);
        }