Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backend: add health to telemetry #362

Merged
merged 1 commit into from
Apr 12, 2018
Merged

Conversation

JonasVautherin
Copy link
Collaborator

Fixes #333.

const dronecore::rpc::telemetry::SubscribeHealthRequest * /* request */,
grpc::ServerWriter<rpc::telemetry::HealthResponse> *writer) override
{
_telemetry.health_async([&writer](dronecore::Telemetry::Health health) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool

@@ -106,24 +121,46 @@ std::future<void> TelemetryServiceImplTest::subscribePositionAsync(std::vector<P
});
}

TEST_F(TelemetryServiceImplTest, doesNotSendPositionIfCallbackNotCalled)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice name: doesNotSendPositionIfCallbackNotCalled :-)

EXPECT_CALL(*_telemetry, health_async(_))
.Times(1);

std::vector<Health> healths;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why a vector ? Health is meant for a system/vehicle isn't it ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand the question. I collect the Health events sent by the drone in this vector, for the test...

How would you do it?

Copy link
Collaborator

@julianoes julianoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks all correct.

{
return str << "[gyrometer_calibration_ok: " << health.gyrometer_calibration_ok <<
", accelerometer_calibration_ok: " << health.accelerometer_calibration_ok <<
", magnetometer_calibration_ok: " << health.magnetometer_calibration_ok <<
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually start these lines with << and indent it in the same way. Just for next time.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not think about it and let astyle do it. But I prefer you're way. I'll change it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I'm actually moving that in the next PR, so I'll change it at this time :-).

@JonasVautherin JonasVautherin merged commit 85ba4cc into develop Apr 12, 2018
@JonasVautherin JonasVautherin deleted the 333-telemetry-health branch April 12, 2018 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants