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

Add Svc.Version component #2747

Merged
merged 44 commits into from
Jul 24, 2024
Merged

Add Svc.Version component #2747

merged 44 commits into from
Jul 24, 2024

Conversation

Shivaly-Reddy
Copy link
Collaborator

@Shivaly-Reddy Shivaly-Reddy commented May 24, 2024

Related Issue(s)
Has Unit Tests (y/n) Y
Documentation Included (y/n) Y (SDD requirements update)

Change Description

Implementation for ticket : #2604

Rationale

Migrating Versions into its own component

Testing/Review Recommendations

Ensure the functionality for the new versions component is as discussed.

Future Work

Once Versions component is approved, the remnants in SystemResources will be removed.

Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/test/ut/VersionTester.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.hpp Fixed Show fixed Hide fixed
Svc/Version/Version.hpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show resolved Hide resolved
break;
}

this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter opCode has not been checked.
break;
}

this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter cmdSeq has not been checked.
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
Svc/Version/Version.hpp Fixed Show fixed Hide fixed
Svc/Version/Version.hpp Fixed Show fixed Hide fixed
Svc/Version/Version.cpp Fixed Show fixed Hide fixed
@Shivaly-Reddy
Copy link
Collaborator Author

@LeStarch and @thomas-bc : I am not sure why I am seeing CI/Framework fail on Svc_Version_ut_exe. I've run it a few times and passes just fine on my local branch

Svc/Version/Version.cpp Fixed Show fixed Hide fixed

Version ::~Version() {}

void Version::config(bool enable) {

Check notice

Code scanning / CodeQL

Use of basic integral type Note

enable uses the basic integral type bool rather than a typedef with size and signedness.
// ----------------------------------------------------------------------

void Version ::ENABLE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::VersionEnabled enable) {
this->m_enable = (enable == VersionEnabled::ENABLED);

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter enable has not been checked.

void Version::config(bool enable) {
// Set Verbosity for custom versions
this->m_enable = enable;

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter enable has not been checked.
}
}

Version ::~Version() {}

Check notice

Code scanning / CodeQL

More than one statement per line Note

This line contains 2 statements; only one is allowed.
this->tlmWrite_ProjectVersion(proj_tlm);
}

void Version ::libraryVersion_tlm() {

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
Copy link
Collaborator

@thomas-bc thomas-bc left a comment

Choose a reason for hiding this comment

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

Looks good! This is a lot of code so I have a couple comments/questions, and some nits/formatting things

Autocoders/Python/src/fprime_ac/utils/version.py Outdated Show resolved Hide resolved
Svc/Version/Version.fpp Show resolved Hide resolved
cmake/target/version/generate_version_info.py Outdated Show resolved Hide resolved
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
}
// ----------------------------------------------------------------------
// implementations for internal functions
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: internal functions being named *_tlm() is a little confusing imo since they do both telemetry and event. Maybe _downlink() or sendAll() or something similar?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, I am so used to using telemetry as a generic term to describe data for users, which would mean both EVRs and EHAs.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually you're right - I've kind of overloaded the term telemetry in my head to mean telemetry channel...
Confusion is probably coming from the tlmWrite_*() name of the function to write to a channel. But our EVR/event scheme would indeed fall under the Telemetry umbrella in, say, the CCSDS standards.
Anyways, I'm ok with anything!

Svc/Version/Version.hpp Outdated Show resolved Hide resolved
struct CustomVersionDb {
version_enum: VersionCfg.VersionEnum @<enumeration/name of the custom version
version_value: string size 80 @< string containing custom version
version_status : Svc.VersionStatus @< status of the custom version
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the purpose of version_status in this struct?
This seems to be used-specified when setting a custom version so I don't quite understand the use case - is there a scenario where a user would set a value for a version but also set a FAILURE status?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If it carries meaning, should it be downlinked along with the version_value in customVersion_tlm() ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I debated about having this, in the end decided to leave it so it could be project specific. I figured this would carry more meaning for when "getVersion" is called rather than providing a downlink for the status

Svc/Version/Version.cpp Show resolved Hide resolved
Ref/Top/RefPackets.xml Show resolved Hide resolved
@@ -46,6 +46,7 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/StaticMemory/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/TlmChan/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/TlmPacketizer/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/SystemResources/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Ports/VersionPorts")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could be good to add a CMakeLists.txt under Svc/Ports/ so that we can only include

add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Ports")

here, and future ports can easily be added under the Svc/Ports module

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is this pointed to VersionPorts or are you saying in general?

}

void Version ::customVersion_tlm_all() {
for (U8 i = 0; (m_enable == true) && (m_num_custom_elements != 0) && (i < Svc::VersionCfg::VersionEnum::NUM_CONSTANTS);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Reading some parts of the docs/code I was under the impression that m_enable would control whether to send both telemtry and events, or only events.
Currently it looks like nothing will be downlinked unless m_enable is true.
Should there be a condition that still does a minimal amount of downlinking (maybe send an event only but no telemetry?) if the user sends a command VERSION(CUSTOM/ALL) when m_enable is false?

For example I can see that users would expect to get some amount of info back if they specifically send VERSION(CUSTOM), regardless of the verbose status.

Copy link
Collaborator Author

@Shivaly-Reddy Shivaly-Reddy Jul 9, 2024

Choose a reason for hiding this comment

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

That's a great point. One way the users can get custom version is to first send the enable command and then ask for VERSION(CUSTOM) but that seems like a cumbersome way of doing it. I think when a user sends a command to request custom version, it should be sent directly. @LeStarch: Thoughts?

The only way the telemetry is queued for downlink is during startup (all tlm downlinked except custom), port call and ground command. So essentially m_enable would only prevent verbosity during port calls.

// function to log custom version events and channels
void customVersion_tlm(VersionSlot custom_slot);
void customVersion_tlm_all();
bool m_enable; /*!<Send TLM when true>*/

Check notice

Code scanning / CodeQL

Use of basic integral type Note

m_enable uses the basic integral type bool rather than a typedef with size and signedness.
// Component construction and destruction
// ----------------------------------------------------------------------

Version ::Version(const char* const compName)

Check notice

Code scanning / CodeQL

Use of basic integral type Note

compName uses the basic integral type char rather than a typedef with size and signedness.
@thomas-bc thomas-bc changed the title FP-2604 Ticket Implementation Add Svc.Version component Jul 11, 2024
@LeStarch LeStarch merged commit 499aefd into nasa:devel Jul 24, 2024
35 checks passed
@Shivaly-Reddy Shivaly-Reddy deleted the FP-2604 branch September 18, 2024 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants