Skip to content

LogiTune/DJ

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DJ

Generating Go code from protobufs

  • Install the tooling (once):
    • protoc (e.g., via your package manager)
    • Go plugins:
      go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
      go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
  • Generate stubs for all proto files under proto/:
    • ./scripts/gen-proto.sh
  • The script writes Go files next to the protos (e.g., proto/logi.pb.go, proto/logi_grpc.pb.go) using module-aware import paths defined via option go_package in each proto.
  • When adding new proto files to proto/, re-run the script to regenerate the Go code.

Checking the gRPC server with grpcurl

  • Without reflection (current setup for logicontroller):
    • List services/methods:
      grpcurl -plaintext -proto proto/logi.proto localhost:50051 list
      grpcurl -plaintext -proto proto/logi.proto localhost:50051 list logi.v1.MusicPlayerService
    • Call methods:
      grpcurl -plaintext -proto proto/logi.proto -d '{}' localhost:50051 logi.v1.MusicPlayerService.TogglePlayPause
      grpcurl -plaintext -proto proto/logi.proto -d '{}' localhost:50051 logi.v1.MusicPlayerService.Reset
  • If you enable reflection in the server (add reflection.Register(grpcServer) in logicontroller), you can omit -proto and just run:
    grpcurl -plaintext localhost:50051 list and invoke methods directly.

About

Component to interact between Strudel and Logitech Options

Resources

Stars

Watchers

Forks

Contributors