-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Differentiate sync/async ByteStreamDriver and update ComStub to work with both #3987
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
Conversation
| //! Construct object ComStubTester | ||
| //! | ||
| ComStubTester(); | ||
| ComStubTester(TestMode mode = TestMode::UNSPECIFIED); //!< Constructor with test mode |
Check warning
Code scanning / CppCheck
Constructors callable with one argument should be marked explicit. Warning test
| } | ||
|
|
||
| void LinuxUartDriver ::send_handler(const FwIndexType portNum, Fw::Buffer& serBuffer) { | ||
| Drv::ByteStreamStatus LinuxUartDriver ::send_handler(const FwIndexType portNum, Fw::Buffer& serBuffer) { |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| // ---------------------------------------------------------------------- | ||
|
|
||
| void TcpClientComponentImpl::send_handler(const FwIndexType portNum, Fw::Buffer& fwBuffer) { | ||
| Drv::ByteStreamStatus TcpClientComponentImpl::send_handler(const FwIndexType portNum, Fw::Buffer& fwBuffer) { |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| // ---------------------------------------------------------------------- | ||
|
|
||
| void TcpServerComponentImpl::send_handler(const FwIndexType portNum, Fw::Buffer& fwBuffer) { | ||
| Drv::ByteStreamStatus TcpServerComponentImpl::send_handler(const FwIndexType portNum, Fw::Buffer& fwBuffer) { |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| // ---------------------------------------------------------------------- | ||
|
|
||
| void UdpComponentImpl::send_handler(const FwIndexType portNum, Fw::Buffer& fwBuffer) { | ||
| Drv::ByteStreamStatus UdpComponentImpl::send_handler(const FwIndexType portNum, Fw::Buffer& fwBuffer) { |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| // A message should never get here if we need to reinitialize | ||
| FW_ASSERT(!this->m_reinitialize || !this->isConnected_comStatusOut_OutputPort(0)); | ||
| if (this->isConnected_drvSendOut_OutputPort(0)) { | ||
| this->handleSynchronousSend(sendBuffer, context); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
| // A message should never get here if we need to reinitialize | ||
| FW_ASSERT(!this->m_reinitialize || !this->isConnected_comStatusOut_OutputPort(0)); | ||
| if (this->isConnected_drvSendOut_OutputPort(0)) { | ||
| this->handleSynchronousSend(sendBuffer, context); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
| if (this->isConnected_drvSendOut_OutputPort(0)) { | ||
| this->handleSynchronousSend(sendBuffer, context); | ||
| } else if (this->isConnected_drvAsyncSendOut_OutputPort(0)) { | ||
| this->handleAsynchronousSend(sendBuffer, context); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
| if (this->isConnected_drvSendOut_OutputPort(0)) { | ||
| this->handleSynchronousSend(sendBuffer, context); | ||
| } else if (this->isConnected_drvAsyncSendOut_OutputPort(0)) { | ||
| this->handleAsynchronousSend(sendBuffer, context); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
| } else { | ||
| // Receive successful - forward data with empty context | ||
| ComCfg::FrameContext emptyContext; // ComStub knows nothing about the received bytes, empty context | ||
| this->dataOut_out(0, recvBuffer, emptyContext); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
| if (this->m_retry_count < this->RETRY_LIMIT) { | ||
| // Attempt retry if under the limit | ||
| this->m_retry_count++; | ||
| this->drvAsyncSendOut_out(0, fwBuffer); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
| this->drvAsyncSendOut_out(0, fwBuffer); | ||
| } else { | ||
| // Exceeded retry limit - return buffer and notify failure | ||
| this->dataReturnOut_out(0, fwBuffer, this->m_storedContext); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
| const Drv::ByteStreamStatus& sendStatus) { | ||
| if (sendStatus != Drv::ByteStreamStatus::SEND_RETRY) { | ||
| // Not retrying - return buffer ownership and send status | ||
| void ComStub::drvAsyncSendReturnIn_handler(FwIndexType portNum, //!< The port number |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| // Helper method implementations | ||
| // ---------------------------------------------------------------------- | ||
|
|
||
| void ComStub::handleSynchronousSend(Fw::Buffer& sendBuffer, const ComCfg::FrameContext& context) { |
Check notice
Code scanning / CodeQL
Long function without assertion Note
| this->comStatusOut_out(0, comSuccess); | ||
| } | ||
|
|
||
| void ComStub::handleAsyncRetry(Fw::Buffer& fwBuffer) { |
Check notice
Code scanning / CodeQL
Long function without assertion Note
|
|
||
| void ComStub::handleAsynchronousSend(Fw::Buffer& sendBuffer, const ComCfg::FrameContext& context) { | ||
| this->m_storedContext = context; // Store the context for async callback | ||
| this->drvAsyncSendOut_out(0, sendBuffer); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
…123) Remove async ComStub to ComDriver connection for nasa/fprime#3987
…3987) (#282) * remove async comdriver connection * remove packets include nasa/fprime#3987
…3987) (nasa#282) * remove async comdriver connection * remove packets include nasa/fprime#3987
Change Description
Fix #3770
This reverts the
Drv.ByteStreamDriverinterface to be synchronous, and adds in aDrv.AsyncByteStreamDriver.Svc.ComStubcan work with either, depending on which ports are connected.Testing/Review Recommendations
Svc.ComStubcode has a lot of branching and stuff - needs careful review.Future Work
Double check with Hub pattern