Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions nodes/SonarArrayDriverNode/node/SonarArrayDriverNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,8 @@ void SonarArrayDriverNode::system_commandAction_Callback(
}
void SonarArrayDriverNode::command_Callback(const eros::command::ConstPtr &t_msg) {
eros::command cmd = eros::eros_utility::ConvertUtility::convert_fromptr(t_msg);
eros::eros_diagnostic::Diagnostic diag = process->get_root_diagnostic();
diag = process->update_diagnostic(
eros::eros_diagnostic::DiagnosticType::COMMUNICATIONS,
eros::Level::Type::WARN,
eros::eros_diagnostic::Message::DROPPING_PACKETS,
"Received unsupported Command: " +
eros::Command::CommandString((eros::Command::Type)cmd.Command));
logger->log_diagnostic(diag);
auto diag_list = process->new_commandmsg(cmd);
for (auto diag : diag_list) { logger->log_diagnostic(diag); }
}
bool SonarArrayDriverNode::changenodestate_service(eros::srv_change_nodestate::Request &req,
eros::srv_change_nodestate::Response &res) {
Expand Down
4 changes: 2 additions & 2 deletions nodes/SonarArrayDriverNode/node/SonarArrayDriverNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ class SonarArrayDriverNode : public eros::BaseNode
const uint16_t MINOR_RELEASE_VERSION = 0;

/*! \brief The Build Number of the Node.*/
const uint16_t BUILD_NUMBER = 3;
const uint16_t BUILD_NUMBER = 4;

/*! \brief A Description of the Firmware.*/
const std::string FIRMWARE_DESCRIPTION = "Latest Rev: 19-Mar-2025";
const std::string FIRMWARE_DESCRIPTION = "Latest Rev: 31-Mar-2025";

/*! \brief What System this Node falls under.*/
const eros::System::MainSystem DIAGNOSTIC_SYSTEM = eros::System::MainSystem::ROVER;
Expand Down
14 changes: 11 additions & 3 deletions nodes/SonarArrayDriverNode/node/SonarArrayDriverNodeProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,17 @@ eros::eros_diagnostic::Diagnostic SonarArrayDriverNodeProcess::update(double t_d
}
std::vector<eros::eros_diagnostic::Diagnostic> SonarArrayDriverNodeProcess::new_commandmsg(
eros::command msg) {
(void)msg;
std::vector<eros::eros_diagnostic::Diagnostic> diag_list;
logger->log_warn("No Command Messages Supported at this time.");
std::vector<eros::eros_diagnostic::Diagnostic> diag_list = base_new_commandmsg(msg);
if (diag_list.size() == 0) {
// No currently supported commands.
}
else {
for (auto diag : diag_list) {
if (diag.level >= eros::Level::Type::INFO) {
diagnostic_manager.update_diagnostic(diag);
}
}
}
return diag_list;
}
std::vector<eros::eros_diagnostic::Diagnostic>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ TEST(BasicTest, TestOperation) {
Logger::LoggerStatus::LOG_WRITTEN);

eros_diagnostic::Diagnostic diag = tester->finish_initialization();
logger->log_diagnostic(diag);
EXPECT_TRUE(diag.level <= Level::Type::NOTICE);

tester->reset();
Expand All @@ -59,12 +58,6 @@ TEST(BasicTest, TestOperation) {
timer += dt;
}

logger->log_warn("Testing Unsupported Command Message");
{
eros::command cmd;
std::vector<eros::eros_diagnostic::Diagnostic> diag_list = tester->new_commandmsg(cmd);
EXPECT_EQ(diag_list.size(), 0);
}
logger->log_warn("Testing Unsupported Program Variables Check");
{
std::vector<eros::eros_diagnostic::Diagnostic> diag_list = tester->check_programvariables();
Expand All @@ -75,6 +68,39 @@ TEST(BasicTest, TestOperation) {
// delete logger;
delete tester;
}

TEST(TestCommands, TestAllCommands) {
Logger* logger = new Logger("DEBUG", "UnitTestSonarArrayDriverNodeProcess");
SonarArrayDriverNodeProcessTester* tester = new SonarArrayDriverNodeProcessTester;
tester->initialize("UnitTestSonarArrayDriverNodeProcess",
"UnitTestSonarArrayDriverNodeProcess",
"MyHost",
System::MainSystem::SIMROVER,
System::SubSystem::ENTIRE_SYSTEM,
System::Component::ENTIRE_SUBSYSTEM,
logger);
std::vector<eros_diagnostic::DiagnosticType> diagnostic_types;
diagnostic_types.push_back(eros_diagnostic::DiagnosticType::SOFTWARE);
diagnostic_types.push_back(eros_diagnostic::DiagnosticType::DATA_STORAGE);
diagnostic_types.push_back(eros_diagnostic::DiagnosticType::SYSTEM_RESOURCE);
diagnostic_types.push_back(eros_diagnostic::DiagnosticType::COMMUNICATIONS);
tester->enable_diagnostics(diagnostic_types);
EXPECT_TRUE(tester->get_logger()->log_warn("A Log to Write") ==
Logger::LoggerStatus::LOG_WRITTEN);

eros_diagnostic::Diagnostic diag = tester->finish_initialization();
EXPECT_TRUE(diag.level <= Level::Type::NOTICE);
for (uint8_t i = (uint16_t)Command::Type::UNKNOWN; i < (uint16_t)Command::Type::END_OF_LIST;
++i) {
eros::command new_cmd;
new_cmd.Command = i;
std::vector<eros_diagnostic::Diagnostic> diag_list = tester->new_commandmsg(new_cmd);
EXPECT_GT(diag_list.size(), 0);
for (auto diag : diag_list) { EXPECT_TRUE(diag.level < Level::Type::WARN); }
}

delete tester;
}
int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
Expand Down