Skip to content

Commit 97e7b7a

Browse files
committed
remove copy paste errors, we are not a component and lint
1 parent 802741a commit 97e7b7a

File tree

11 files changed

+72
-71
lines changed

11 files changed

+72
-71
lines changed

src/viam/api/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,6 @@ target_sources(viamapi
306306
${PROTO_GEN_DIR}/component/encoder/v1/encoder.pb.cc
307307
${PROTO_GEN_DIR}/component/gantry/v1/gantry.grpc.pb.cc
308308
${PROTO_GEN_DIR}/component/gantry/v1/gantry.pb.cc
309-
${PROTO_GEN_DIR}/component/discovery/v1/discovery.grpc.pb.cc
310-
${PROTO_GEN_DIR}/component/discovery/v1/discovery.pb.cc
311309
${PROTO_GEN_DIR}/component/generic/v1/generic.grpc.pb.cc
312310
${PROTO_GEN_DIR}/component/generic/v1/generic.pb.cc
313311
${PROTO_GEN_DIR}/component/gripper/v1/gripper.grpc.pb.cc
@@ -332,6 +330,8 @@ target_sources(viamapi
332330
${PROTO_GEN_DIR}/module/v1/module.pb.cc
333331
${PROTO_GEN_DIR}/robot/v1/robot.grpc.pb.cc
334332
${PROTO_GEN_DIR}/robot/v1/robot.pb.cc
333+
${PROTO_GEN_DIR}/service/discovery/v1/discovery.grpc.pb.cc
334+
${PROTO_GEN_DIR}/service/discovery/v1/discovery.pb.cc
335335
${PROTO_GEN_DIR}/service/generic/v1/generic.grpc.pb.cc
336336
${PROTO_GEN_DIR}/service/generic/v1/generic.pb.cc
337337
${PROTO_GEN_DIR}/service/mlmodel/v1/mlmodel.grpc.pb.cc
@@ -366,8 +366,6 @@ target_sources(viamapi
366366
${PROTO_GEN_DIR}/../../viam/api/component/encoder/v1/encoder.pb.h
367367
${PROTO_GEN_DIR}/../../viam/api/component/gantry/v1/gantry.grpc.pb.h
368368
${PROTO_GEN_DIR}/../../viam/api/component/gantry/v1/gantry.pb.h
369-
${PROTO_GEN_DIR}/../../viam/api/component/discovery/v1/discovery.grpc.pb.h
370-
${PROTO_GEN_DIR}/../../viam/api/component/discovery/v1/discovery.pb.h
371369
${PROTO_GEN_DIR}/../../viam/api/component/generic/v1/generic.grpc.pb.h
372370
${PROTO_GEN_DIR}/../../viam/api/component/generic/v1/generic.pb.h
373371
${PROTO_GEN_DIR}/../../viam/api/component/gripper/v1/gripper.grpc.pb.h
@@ -393,6 +391,8 @@ target_sources(viamapi
393391
${PROTO_GEN_DIR}/../../viam/api/robot/v1/robot.grpc.pb.h
394392
${PROTO_GEN_DIR}/../../viam/api/robot/v1/robot.pb.h
395393
${PROTO_GEN_DIR}/../../viam/api/tagger/v1/tagger.grpc.pb.h
394+
${PROTO_GEN_DIR}/../../viam/api/service/discovery/v1/discovery.grpc.pb.h
395+
${PROTO_GEN_DIR}/../../viam/api/service/discovery/v1/discovery.pb.h
396396
${PROTO_GEN_DIR}/../../viam/api/service/generic/v1/generic.grpc.pb.h
397397
${PROTO_GEN_DIR}/../../viam/api/service/generic/v1/generic.pb.h
398398
${PROTO_GEN_DIR}/../../viam/api/service/mlmodel/v1/mlmodel.grpc.pb.h

src/viam/examples/modules/complex/proto/buf.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ deps:
44
- remote: buf.build
55
owner: googleapis
66
repository: googleapis
7-
commit: e93e34f48be043dab55be31b4b47f458
8-
digest: shake256:93dbe51c27606999eef918360df509485a4d272e79aaed6d0016940379a9b06d316fc5228b7b50cca94bb310f34c5fc5955ce7474f655f0d0a224c4121dda3c1
7+
commit: 546238c53f7340c6a2a6099fb863bc1b
8+
digest: shake256:8d75c12f391e392b24c076d05117b47aeddb090add99c70247a8f4389b906a65f61a933c68e54ed8b73a050b967b6b712ba194348b67c3ab3ee26cc2cb25852c

src/viam/sdk/services/discovery.hpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,24 @@ namespace sdk {
1414
/// @defgroup Discovery Classes related to the Discovery service.
1515

1616
/// @class Discovery discovery.hpp "services/discovery.hpp"
17-
/// @brief A `Discovery` service is used to discover resources that are physically connected to your machine.
18-
/// @ingroup Discovery
17+
/// @brief A `Discovery` service is used to discover resources that are physically connected to
18+
/// your machine.
19+
/// @ingroup Discovery
1920
///
2021
/// This acts as an abstract parent class to be inherited from by any drivers representing
2122
/// specific discovery implementations. This class cannot be used on its own.
2223

2324
class Discovery : public Service {
2425
public:
25-
2626
/// @brief Discover valid viam configuration of resources that are physically
2727
/// connected to your machine.
2828
inline std::vector<ResourceConfig> discover_resources() {
29-
return discover_resources({})
29+
return discover_resources({});
3030
}
3131

32-
/// @brief Discover valid viam configuration of resources that are physically
33-
/// connected to your machine.
34-
virtual std::vector<ResourceConfig> discover_resources(
35-
const ProtoStruct& extra) = 0;
32+
/// @brief Discover valid viam configuration of resources that are physically
33+
/// connected to your machine.
34+
virtual std::vector<ResourceConfig> discover_resources(const ProtoStruct& extra) = 0;
3635

3736
/// @brief Do an arbitrary command.
3837
/// @param command Freeform fields that are service-specific.
@@ -45,9 +44,8 @@ class Discovery : public Service {
4544
explicit Discovery(std::string name);
4645
};
4746

48-
4947
template <>
50-
struct API::traits<Navigation> {
48+
struct API::traits<Discovery> {
5149
static API api();
5250
};
5351

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include <viam/sdk/services/private/discovery_client.hpp>
1+
#include <viam/sdk/services/private/discovery_client.hpp>
22

33
#include <viam/api/service/discovery/v1/discovery.grpc.pb.h>
44
#include <viam/api/service/discovery/v1/discovery.pb.h>
@@ -10,25 +10,22 @@ namespace sdk {
1010
namespace impl {
1111

1212
DiscoveryClient::DiscoveryClient(std::string name std::shared_ptr<grpc::Channel> channel)
13-
: Discovery(std::move(name)),
14-
stub_(viam::service::discovery::v1::DiscoveryService::NewStub(channel)),
15-
channel_(std::move(channel)) {}
16-
13+
: Discovery(std::move(name)),
14+
stub_(viam::service::discovery::v1::DiscoveryService::NewStub(channel)),
15+
channel_(std::move(channel)) {}
16+
1717
std::vector<ResourceConfig> DiscoveryClient::discover_resources(const ProtoStruct& extra) {
1818
return make_client_helper(this, *stub_, &StubType::DiscoverResources)
1919
.with(extra)
20-
.invoke([](auto& response) {return from_proto(response);});
20+
.invoke([](auto& response) { return from_proto(response); });
2121
}
2222

2323
ProtoStruct DiscoveryClient::do_command(const ProtoStruct& extra) {
2424
return make_client_helper(this, *stub_, &StubType::DoCommand)
25-
.with([&](auto& request) {*request.mutable_command() = to_proto(command); })
26-
.invoke([](auto& response) {return from_proto(response.result());});
25+
.with([&](auto& request) { *request.mutable_command() = to_proto(command); })
26+
.invoke([](auto& response) { return from_proto(response.result()); });
2727
}
2828

29-
30-
} // namespace impl
31-
32-
33-
} //namespace sdk
34-
} //namespace viam
29+
} // namespace impl
30+
} // namespace sdk
31+
} // namespace viam

src/viam/sdk/services/private/discovery_client.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ class DiscoveryClient : public Discovery {
3434
std::shared_ptr<grpc::Channel> channel_;
3535
};
3636

37-
} // namespace impl
38-
} // namespace sdk
39-
} // namespace viam
37+
} // namespace impl
38+
} // namespace sdk
39+
} // namespace viam

src/viam/sdk/services/private/discovery_server.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ ::grpc::Status DiscoveryServer::DiscoverResources(
1515
::viam::service::discovery::v1::DiscoverResourcesResponse* response) noexcept {
1616
return make_service_helper<Discovery>(
1717
"DiscoveryServer::DiscoverResources", this, request)([&](auto& helper, auto& discovery) {
18-
const std::vector<ResourceConfig> resources = discovery->discover_resources(helper.getExtra());
18+
const std::vector<ResourceConfig> resources =
19+
discovery->discover_resources(helper.getExtra());
1920
for (const auto& resource : resources) {
2021
*response->mutable_resources()->Add() = to_proto(resource);
2122
}
@@ -31,8 +32,8 @@ ::grpc::Status DiscoveryServer::DoCommand(
3132
const ProtoStruct result = discovery->do_command(from_proto(request->command()));
3233
*response->mutable_result() = to_proto(result);
3334
});
34-
}
35+
}
3536

36-
} // namespace impl
37-
} // namespace sdk
38-
} // namespace viam
37+
} // namespace impl
38+
} // namespace sdk
39+
} // namespace viam

src/viam/sdk/services/private/discovery_server.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/// @file services/private/discovery_server.hpp
2-
///
2+
///
33
/// @brief Implements a gRPC server for the `Discovery` service
44
#pragma once
55

66
#include <viam/api/service/discovery/v1/discovery.grpc.pb.h>
77
#include <viam/api/service/discovery/v1/discovery.pb.h>
88

9-
#include <viam/sdk/services/discovery.hpp>
109
#include <viam/sdk/resource/resource_manager.hpp>
1110
#include <viam/sdk/resource/resource_server_base.hpp>
11+
#include <viam/sdk/services/discovery.hpp>
1212

1313
namespace viam {
1414
namespace sdk {
@@ -18,11 +18,12 @@ namespace impl {
1818
/// @brief gRPC server implementation of a `Discovery` service.
1919
/// @ingroup Discovery
2020

21-
class ArmServer : public ResourceServer, public viam::service::discovery::v1::DiscoveryService::Service {
22-
public:
21+
class DiscoveryServer : public ResourceServer,
22+
public viam::service::discovery::v1::DiscoveryService::Service {
23+
public:
2324
using interface_type = Discovery;
2425
using service_type = service::discovery::v1::DiscoveryService;
25-
26+
2627
explicit DiscoveryServer(std::shared_ptr<ResourceManager> manager);
2728

2829
::grpc::Status DiscoverResources(
@@ -34,7 +35,6 @@ class ArmServer : public ResourceServer, public viam::service::discovery::v1::Di
3435
::grpc::ServerContext* context,
3536
const ::viam::service::discovery::v1::DoCommandRequest* request,
3637
::viam::service::discovery::v1::DoCommandResponse* response) noexcept override;
37-
3838
};
3939

4040
} // namespace impl

src/viam/sdk/tests/mocks/mock_discovery.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ sdk::ProtoStruct MockDiscovery::do_command(const sdk::ProtoStruct& command) {
1919
return (peek_command = command);
2020
}
2121

22-
23-
} // namespace discovery
24-
} // namespace sdktests
25-
} // namespace viam
22+
} // namespace discovery
23+
} // namespace sdktests
24+
} // namespace viam

src/viam/sdk/tests/mocks/mock_discovery.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class MockDiscovery : public sdk::Discovery {
1919
sdk::ProtoStruct peek_command;
2020
};
2121

22-
} // namespace discovery
23-
} // namespace sdktests
24-
} // namespace viam
25-
22+
} // namespace discovery
23+
} // namespace sdktests
24+
} // namespace viam

src/viam/sdk/tests/test_discovery.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ BOOST_AUTO_TEST_CASE(mock_get_api) {
2929
BOOST_AUTO_TEST_CASE(test_discover_resources) {
3030
std::shared_ptr<MockDiscovery> mock = MockDiscovery::get_mock_discovery();
3131
client_to_mock_pipeline<Discovery>(mock, [](Discovery& client) {
32-
const auto & resources = client.discover_resources();
32+
const auto& resources = client.discover_resources();
3333
BOOST_CHECK_EQUAL(resource, fake_discovered_resources());
3434
});
3535
}
3636

37-
BOOST_AUTO_TEST_CASE(test_do_command) {
37+
BOOST_AUTO_TEST_CASE(test_do_command) {
3838
std::shared_ptr<MockDiscovery> mock = MockDiscovery::get_mock_discovery();
3939
client_to_mock_pipeline<Discovery>(mock, [](Discovery& client) {
4040
ProtoStruct expected = fake_map();
@@ -46,5 +46,5 @@ BOOST_AUTO_TEST_CASE(test_do_command) {
4646
});
4747
}
4848

49-
} // namespace sdktests
50-
} // namespace viam
49+
} // namespace sdktests
50+
} // namespace viam

0 commit comments

Comments
 (0)