Skip to content

Commit

Permalink
Incorporate review findings
Browse files Browse the repository at this point in the history
  • Loading branch information
BjoernAtBosch committed Nov 20, 2024
1 parent 745de29 commit b295ae6
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 17 deletions.
3 changes: 2 additions & 1 deletion sdk/include/sdk/grpc/VehicleDataBrokerClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ class BrokerAsyncGrpcFacade;
*/
class VehicleDataBrokerClient : public IVehicleDataBrokerClient {
public:
explicit VehicleDataBrokerClient(const std::string& vdbAddress, std::string vdbServiceName);
explicit VehicleDataBrokerClient(const std::string& vdbAddress,
const std::string& vdbServiceName);
explicit VehicleDataBrokerClient(const std::string& vdbserviceName);

~VehicleDataBrokerClient() override;
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/sdk/grpc/BrokerAsyncGrpcFacade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

namespace velocitas {

BrokerAsyncGrpcFacade::BrokerAsyncGrpcFacade(std::shared_ptr<grpc::Channel> channel)
BrokerAsyncGrpcFacade::BrokerAsyncGrpcFacade(const std::shared_ptr<grpc::Channel>& channel)
: m_stub{sdv::databroker::v1::Broker::NewStub(channel)} {}

void BrokerAsyncGrpcFacade::GetDatapoints(
Expand All @@ -39,7 +39,7 @@ void BrokerAsyncGrpcFacade::GetDatapoints(

applyContextModifier(*callData);

auto grpcResultHandler = [callData, replyHandler, errorHandler](grpc::Status status) {
const auto grpcResultHandler = [callData, replyHandler, errorHandler](grpc::Status status) {
try {
if (status.ok()) {
replyHandler(callData->m_reply);
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/sdk/grpc/BrokerAsyncGrpcFacade.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace velocitas {

class BrokerAsyncGrpcFacade : public AsyncGrpcFacade, GrpcClient {
public:
explicit BrokerAsyncGrpcFacade(std::shared_ptr<grpc::Channel> channel);
explicit BrokerAsyncGrpcFacade(const std::shared_ptr<grpc::Channel>& channel);

void GetDatapoints(
const std::vector<std::string>& datapoints,
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/sdk/grpc/VehicleDataBrokerClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
namespace velocitas {

VehicleDataBrokerClient::VehicleDataBrokerClient(const std::string& vdbAddress,
std::string vdbServiceName) {
const std::string& vdbServiceName) {
logger().info("Connecting to data broker service '{}' via '{}'", vdbServiceName, vdbAddress);
m_asyncBrokerFacade = std::make_shared<BrokerAsyncGrpcFacade>(
grpc::CreateChannel(vdbAddress, grpc::InsecureChannelCredentials()));
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/sdk/vdb/grpc/common/TypeConversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

namespace velocitas {

Timestamp convertFromGrpcTimestamp(const google::protobuf::Timestamp& grpcTimestamp) {
Timestamp convertFromGrpcTimestamp(const google::protobuf::Timestamp& grpcTimestamp) noexcept {
return {grpcTimestamp.seconds(), grpcTimestamp.nanos()};
}

Expand Down
2 changes: 1 addition & 1 deletion sdk/src/sdk/vdb/grpc/common/TypeConversions.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace velocitas {

class Timestamp;

Timestamp convertFromGrpcTimestamp(const google::protobuf::Timestamp& grpcTimestamp);
Timestamp convertFromGrpcTimestamp(const google::protobuf::Timestamp& grpcTimestamp) noexcept;

} // namespace velocitas

Expand Down
8 changes: 4 additions & 4 deletions sdk/src/sdk/vdb/grpc/kuksa_val_v2/BrokerAsyncGrpcFacade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@

namespace velocitas::kuksa_val_v2 {

BrokerAsyncGrpcFacade::BrokerAsyncGrpcFacade(std::shared_ptr<grpc::Channel> channel)
BrokerAsyncGrpcFacade::BrokerAsyncGrpcFacade(const std::shared_ptr<grpc::Channel>& channel)
: m_stub{kuksa::val::v2::VAL::NewStub(channel)} {}

void BrokerAsyncGrpcFacade::GetValues(
kuksa::val::v2::GetValuesRequest&& request,
kuksa::val::v2::GetValuesRequest request,
std::function<void(const kuksa::val::v2::GetValuesResponse& reply)> replyHandler,
std::function<void(const grpc::Status& status)> errorHandler) {
auto callData = std::make_shared<GrpcSingleResponseCall<kuksa::val::v2::GetValuesRequest,
Expand Down Expand Up @@ -57,7 +57,7 @@ void BrokerAsyncGrpcFacade::GetValues(
}

void BrokerAsyncGrpcFacade::BatchActuate(
kuksa::val::v2::BatchActuateRequest&& request,
kuksa::val::v2::BatchActuateRequest request,
std::function<void(const kuksa::val::v2::BatchActuateResponse& reply)> replyHandler,
std::function<void(const grpc::Status& status)> errorHandler) {
auto callData =
Expand Down Expand Up @@ -88,7 +88,7 @@ void BrokerAsyncGrpcFacade::BatchActuate(
}

void BrokerAsyncGrpcFacade::Subscribe(
kuksa::val::v2::SubscribeRequest&& request,
kuksa::val::v2::SubscribeRequest request,
std::function<void(const kuksa::val::v2::SubscribeResponse& reply)> itemHandler,
std::function<void(const grpc::Status& status)> errorHandler) {
auto callData =
Expand Down
8 changes: 4 additions & 4 deletions sdk/src/sdk/vdb/grpc/kuksa_val_v2/BrokerAsyncGrpcFacade.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ namespace velocitas::kuksa_val_v2 {

class BrokerAsyncGrpcFacade : public AsyncGrpcFacade, GrpcClient {
public:
explicit BrokerAsyncGrpcFacade(std::shared_ptr<grpc::Channel> channel);
explicit BrokerAsyncGrpcFacade(const std::shared_ptr<grpc::Channel>& channel);

void GetValues(kuksa::val::v2::GetValuesRequest&& request,
void GetValues(kuksa::val::v2::GetValuesRequest request,
std::function<void(const kuksa::val::v2::GetValuesResponse& reply)> replyHandler,
std::function<void(const grpc::Status& status)> errorHandler);

void
Subscribe(kuksa::val::v2::SubscribeRequest&& request,
Subscribe(kuksa::val::v2::SubscribeRequest request,
std::function<void(const kuksa::val::v2::SubscribeResponse& update)> updateHandler,
std::function<void(const grpc::Status& status)> errorHandler);

void BatchActuate(
kuksa::val::v2::BatchActuateRequest&& request,
kuksa::val::v2::BatchActuateRequest request,
std::function<void(const kuksa::val::v2::BatchActuateResponse& reply)> replyHandler,
std::function<void(const grpc::Status& status)> errorHandler);

Expand Down
2 changes: 1 addition & 1 deletion sdk/src/sdk/vdb/grpc/kuksa_val_v2/BrokerClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int assertProtobufArrayLimits(size_t numElements) {

} // namespace

BrokerClient::BrokerClient(const std::string& vdbAddress, std::string vdbServiceName) {
BrokerClient::BrokerClient(const std::string& vdbAddress, const std::string& vdbServiceName) {
logger().info("Connecting to data broker service '{}' via '{}'", vdbServiceName, vdbAddress);
m_asyncBrokerFacade = std::make_shared<BrokerAsyncGrpcFacade>(
grpc::CreateChannel(vdbAddress, grpc::InsecureChannelCredentials()));
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/sdk/vdb/grpc/kuksa_val_v2/BrokerClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class BrokerAsyncGrpcFacade;
*/
class BrokerClient : public IVehicleDataBrokerClient {
public:
explicit BrokerClient(const std::string& vdbAddress, std::string vdbServiceName);
explicit BrokerClient(const std::string& vdbAddress, const std::string& vdbServiceName);
explicit BrokerClient(const std::string& vdbserviceName);

~BrokerClient() override;
Expand Down

0 comments on commit b295ae6

Please sign in to comment.