Skip to content

Commit

Permalink
Remove helper
Browse files Browse the repository at this point in the history
  • Loading branch information
hexbabe committed Dec 4, 2024
1 parent adda63c commit bffda3f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
8 changes: 6 additions & 2 deletions components/camera/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,19 @@ func (c *client) NextPointCloud(ctx context.Context) (pointcloud.PointCloud, err

ctx, getPcdSpan := trace.StartSpan(ctx, "camera::client::NextPointCloud::GetPointCloud")

ext, err := data.GetExtraFromContext(ctx)
extra := make(map[string]interface{})
if ctx.Value(data.FromDMContextKey{}) == true {
extra[data.FromDMString] = true
}
extraStruct, err := goprotoutils.StructToStructPb(extra)
if err != nil {
return nil, err
}

resp, err := c.client.GetPointCloud(ctx, &pb.GetPointCloudRequest{
Name: c.name,
MimeType: utils.MimeTypePCD,
Extra: ext,
Extra: extraStruct,
})
getPcdSpan.End()
if err != nil {
Expand Down
10 changes: 0 additions & 10 deletions data/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,3 @@ func InvalidInterfaceErr(api resource.API) error {
func FailedToReadErr(component, method string, err error) error {
return errors.Errorf("failed to get reading of method %s of component %s: %v", method, component, err)
}

// GetExtraFromContext sets the extra struct with "fromDataManagement": true if the flag is true in the context.
// Deprecated: Use camera.FromContext instead.
func GetExtraFromContext(ctx context.Context) (*structpb.Struct, error) {
extra := make(map[string]interface{})
if ctx.Value(FromDMContextKey{}) == true {
extra[FromDMString] = true
}
return protoutils.StructToStructPb(extra)
}

0 comments on commit bffda3f

Please sign in to comment.