-
Notifications
You must be signed in to change notification settings - Fork 1
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
Rev 1 #7
Rev 1 #7
Conversation
Changes ported from High-Level-RoveComm-for-C++-Development branch
Moved functions into proper header files and reformatted code into correct documentation
Added semicolon to end of class to resolve issue
GetManifest is no longer a required function
…RDT/RoveComm_CPP into topic/rovecomm-cpp-dev
…I can implement singlethreading first.
…veComm_CPP into topic/adam-edits
572ff6d
to
b6c1e1f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job on being the first one to have a PR! A majority of the code needs comments, you should be able to read through your comments in English and understand what the code does. Who knows, you might catch a few bugs just going back through and commenting everything! Testing to make sure everything works is needed.
It also appears that the check are failing now. It seems there's a multiple definition of a lock_guard somewhere.
|
||
namespace rovecomm | ||
{ | ||
const int ROVECOMM_ETHERNET_UDP_MAX_SUBSCRIBERS = 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment to the end of each line explaining what the constants does. Similar to how AutonomyConstants.h is written.
src/RoveComm/RoveCommConstants.h
Outdated
namespace System | ||
{ | ||
// pass to RoveCommServer::Fetch() signifying any data id. This is not a valid data id. | ||
const int ANY = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This constant name is not very descriptive.
const int ROVECOMM_VERSION = 3; | ||
const int ROVECOMM_ETHERNET_TCP_MAX_CONNECTIONS = 5; | ||
|
||
namespace System |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this namespace here? Needs docs to explain what it is for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are going to keep this namespace make sure it is written in lowercase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When writing log statements, think about what you would want to see printed to the console when running an application that includes RoveComm. At the current moment, I am thinking that there is going to be a lot of excess data in the console so I would advise making some of the logs that are currently, LOG_INFO
be LOG_DEBUG
so that when everything is working well we don't have an overwhelmed console.
Overall, just make sure to review the API Docs, https://missourimrdt.github.io/Autonomy_Software/md_CONTRIBUTING.html, for Autonomy to make sure that your naming conventions are correct.
src/RoveComm/RoveComm.h
Outdated
#include "RoveCommPacket.h" | ||
#include "RoveCommServer.h" | ||
|
||
extern RoveCommServerManager RoveComm; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of this file is you include "RoveComm.h" in your external project however, the RoveComm Object shouldn't be created here.
* @brief Base class for network thread management. | ||
* | ||
* @file RoveCommPacket.h | ||
* @author Eli Byrd ([email protected]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add yourself as an author to this header.
|
||
// TODO: make this a real singleton ^^^ | ||
|
||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add guard lock comment
src/RoveCommGlobals.cpp
Outdated
@@ -1,89 +1,10 @@ | |||
/****************************************************************************** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This header should be added back.
* | ||
* | ||
* @file RoveCommGlobals.cpp | ||
* @author Eli Byrd ([email protected]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But also add your name as an author
* distributed into other projects. | ||
* | ||
* @file AutonomyLogging.cpp | ||
* @author Eli Byrd ([email protected]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add yourself as an author to this header.
src/RoveComm/RoveCommEthernetTcp.cpp
Outdated
// result will actually be a linked list but for now we just get the first entry | ||
if (int status = getaddrinfo(NULL, std::to_string(m_unPort).c_str(), &hints, &result) != 0) | ||
{ | ||
LOG_ERROR(logging::g_qSharedLogger, "Failed to find IP! Error: {}", gai_strerror(status)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function returns a human-readable description of the error that corresponds to the status. I would recommend keeping it and potentially also printing the integer status.
src/RoveComm/RoveCommEthernetTcp.cpp
Outdated
close(m_nListeningSocket); | ||
continue; | ||
} | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This break means that the for loop will only execute a single iteration
src/RoveComm/RoveCommEthernetUdp.cpp
Outdated
// result will actually be a linked list but for now we just get the first entry | ||
if (int status = getaddrinfo(NULL, std::to_string(m_unPort).c_str(), &hints, &result) != 0) | ||
{ | ||
LOG_ERROR(logging::g_qSharedLogger, "Failed to find IP! Error: {}", gai_strerror(status)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function returns human readable description of error instead of just the integer status. I'd recommend keeping it.
src/RoveComm/RoveCommEthernetUdp.cpp
Outdated
|
||
if (int status = getaddrinfo(address.GetIp().ToString().c_str(), std::to_string(m_unPort).c_str(), &hints, &result) != 0) | ||
{ | ||
LOG_ERROR(logging::g_qSharedLogger, "Failed to find IP! Error: {}", gai_strerror(status)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Produces human-readable error message instead of integer status code.
Closing the PR for now, comments are still available. Reopen or recreate if you want to finish merging. |
No description provided.