protoutils

package
v0.55.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: AGPL-3.0 Imports: 17 Imported by: 1

Documentation

Overview

Package protoutils are a collection of util methods for using proto in rdk

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertMapToProtoAny added in v0.52.0

func ConvertMapToProtoAny(input map[string]interface{}) (map[string]*anypb.Any, error)

ConvertMapToProtoAny converts a map of string keys and interface{} values to a map of string keys and *anypb.Any values, where each value in the input map is converted to a protobuf Any type.

func ConvertOrientationToProto added in v0.0.6

func ConvertOrientationToProto(o spatialmath.Orientation) *commonpb.Orientation

ConvertOrientationToProto TODO.

func ConvertProtoToOrientation added in v0.0.6

func ConvertProtoToOrientation(o *commonpb.Orientation) spatialmath.Orientation

ConvertProtoToOrientation TODO.

func ConvertStringMapToAnyPBMap added in v0.1.0

func ConvertStringMapToAnyPBMap(params map[string]string) (map[string]*anypb.Any, error)

ConvertStringMapToAnyPBMap takes a string map and parses each value to an Any proto type.

func ConvertStringToAnyPB added in v0.1.0

func ConvertStringToAnyPB(str string) (*anypb.Any, error)

ConvertStringToAnyPB takes a string and parses it to an Any pb type.

func ConvertVectorProtoToR3 added in v0.0.6

func ConvertVectorProtoToR3(v *commonpb.Vector3) r3.Vector

ConvertVectorProtoToR3 TODO.

func ConvertVectorR3ToProto added in v0.0.6

func ConvertVectorR3ToProto(v r3.Vector) *commonpb.Vector3

ConvertVectorR3ToProto TODO.

func DoFromResourceClient added in v0.2.20

func DoFromResourceClient(ctx context.Context, svc ClientDoCommander, name string,
	cmd map[string]interface{},
) (map[string]interface{}, error)

DoFromResourceClient is a helper to allow DoCommand() calls from any client.

func DoFromResourceServer added in v0.2.20

func DoFromResourceServer(
	ctx context.Context,
	res resource.Resource,
	req *commonpb.DoCommandRequest,
) (*commonpb.DoCommandResponse, error)

DoFromResourceServer is a helper to allow DoCommand() calls from any server.

func MessageToProtoV1 added in v0.2.5

func MessageToProtoV1(msg interface{}) protov1.Message

MessageToProtoV1 converts a message to a protov1.Message. It is assumed it is either a proto.Message or a protov1.Message.

func ReadingGoToProto added in v0.0.8

func ReadingGoToProto(readings map[string]interface{}) (map[string]*structpb.Value, error)

ReadingGoToProto converts go readings to proto readings.

func ReadingProtoToGo added in v0.0.8

func ReadingProtoToGo(readings map[string]*structpb.Value) (map[string]interface{}, error)

ReadingProtoToGo converts proto readings to go readings.

func ResourceNameFromProto

func ResourceNameFromProto(name *commonpb.ResourceName) resource.Name

ResourceNameFromProto converts a proto ResourceName to its rdk counterpart.

func ResourceNameToProto

func ResourceNameToProto(name resource.Name) *commonpb.ResourceName

ResourceNameToProto converts a resource.Name to its proto counterpart.

Types

type ClientDoCommander added in v0.2.20

type ClientDoCommander interface {
	// DoCommand sends/receives arbitrary commands
	DoCommand(ctx context.Context, in *commonpb.DoCommandRequest,
		opts ...grpc.CallOption) (*commonpb.DoCommandResponse, error)
}

ClientDoCommander is a gRPC client that allows the execution of DoCommand.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL