mirror of
https://github.com/nasa/fprime.git
synced 2025-12-10 16:29:04 -06:00
lestarch: minor fixes (#1760)
* lestarch: minor oversight in communication adapter description * lestarch: prevent inappropriate deallocation in Tcp driver in the event of a RETRY * lestarch: adding clang-format file * lestarch: improved MemAllocator comments and documentation * lestarch: adding communication adapter how-to guide * lestarch: sp * removing tutorial from this PR
This commit is contained in:
parent
5832d630d7
commit
2c981a34ff
5
.clang-format
Normal file
5
.clang-format
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
BasedOnStyle: Chromium
|
||||
IndentWidth: 4
|
||||
ColumnLimit: 120
|
||||
AccessModifierOffset: -2
|
||||
2
.github/actions/spelling/expect.txt
vendored
2
.github/actions/spelling/expect.txt
vendored
@ -211,6 +211,7 @@ COMQUEUE
|
||||
COMQUEUEIN
|
||||
COMSPLITTER
|
||||
COMSTUB
|
||||
COMXBEE
|
||||
Concat
|
||||
config
|
||||
configparser
|
||||
@ -1597,6 +1598,7 @@ wxgui
|
||||
Xabcdefx
|
||||
xapian
|
||||
xargs
|
||||
XBee
|
||||
xcode
|
||||
xdf
|
||||
xdffe
|
||||
|
||||
@ -68,13 +68,14 @@ void TcpClientComponentImpl::connected() {
|
||||
|
||||
Drv::SendStatus TcpClientComponentImpl::send_handler(const NATIVE_INT_TYPE portNum, Fw::Buffer& fwBuffer) {
|
||||
Drv::SocketIpStatus status = m_socket.send(fwBuffer.getData(), fwBuffer.getSize());
|
||||
// Always return the buffer
|
||||
deallocate_out(0, fwBuffer);
|
||||
if ((status == SOCK_DISCONNECTED) || (status == SOCK_INTERRUPTED_TRY_AGAIN)) {
|
||||
// Only deallocate buffer when the caller is not asked to retry
|
||||
if (status == SOCK_INTERRUPTED_TRY_AGAIN) {
|
||||
return SendStatus::SEND_RETRY;
|
||||
} else if (status != SOCK_SUCCESS) {
|
||||
deallocate_out(0, fwBuffer);
|
||||
return SendStatus::SEND_ERROR;
|
||||
}
|
||||
deallocate_out(0, fwBuffer);
|
||||
return SendStatus::SEND_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -75,13 +75,14 @@ void TcpServerComponentImpl::connected() {
|
||||
|
||||
Drv::SendStatus TcpServerComponentImpl::send_handler(const NATIVE_INT_TYPE portNum, Fw::Buffer& fwBuffer) {
|
||||
Drv::SocketIpStatus status = m_socket.send(fwBuffer.getData(), fwBuffer.getSize());
|
||||
// Always return the buffer
|
||||
deallocate_out(0, fwBuffer);
|
||||
if ((status == SOCK_DISCONNECTED) || (status == SOCK_INTERRUPTED_TRY_AGAIN)) {
|
||||
// Only deallocate buffer when the caller is not asked to retry
|
||||
if (status == SOCK_INTERRUPTED_TRY_AGAIN) {
|
||||
return SendStatus::SEND_RETRY;
|
||||
} else if (status != SOCK_SUCCESS) {
|
||||
deallocate_out(0, fwBuffer);
|
||||
return SendStatus::SEND_ERROR;
|
||||
}
|
||||
deallocate_out(0, fwBuffer);
|
||||
return SendStatus::SEND_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -27,7 +27,9 @@
|
||||
* appropriate.
|
||||
*
|
||||
* The identifier can be used to look up a pre-allocated buffer by ID in an
|
||||
* embedded system.
|
||||
* embedded system. Identifiers may be used only in a single call to an invocation.
|
||||
* Some implementations of MemAllocator discard the identifier but components using
|
||||
* the MemAllocator interface should not depend on the identifier to be discarded.
|
||||
*
|
||||
* The size is the requested size of the memory. If the allocator cannot return the
|
||||
* requested amount, it should return the actual amount and users should check.
|
||||
@ -45,7 +47,7 @@ namespace Fw {
|
||||
public:
|
||||
//! Allocate memory
|
||||
/*!
|
||||
* \param identifier the memory segment identifier (if needed)
|
||||
* \param identifier the memory segment identifier, each identifier is to be used in once single allocation
|
||||
* \param size the requested size - changed to actual if different
|
||||
* \param recoverable - flag to indicate the memory could be recoverable
|
||||
* \return the pointer to memory. Zero if unable to allocate
|
||||
@ -56,7 +58,7 @@ namespace Fw {
|
||||
bool& recoverable)=0;
|
||||
//! Deallocate memory
|
||||
/*!
|
||||
* \param identifier the memory segment identifier (if needed)
|
||||
* \param identifier the memory segment identifier, each identifier is to be used in once single allocation
|
||||
* \param ptr the pointer to memory returned by allocate()
|
||||
*/
|
||||
virtual void deallocate(
|
||||
|
||||
@ -85,7 +85,7 @@ transmissions. This is done with the `comStatus` port. A communication status is
|
||||
| Fw::Success::SUCCESS | *Communication adapter* transmission succeeded and is ready for more data. |
|
||||
| Fw::Success::FAILURE | Last transmission failed; *communication adapter* is unable to receive more data. |
|
||||
|
||||
> * Fw::Success::SUCCESS may also indicate a connection/reconnection success when data flow must be initiated.
|
||||
* Fw::Success::SUCCESS may also indicate a connection/reconnection success when data flow must be initiated.
|
||||
|
||||
A *Communication Adapter* shall emit either Fw::Success::SUCCESS or Fw::Success::FAILURE via the `comStatus` port once
|
||||
for each call received on `comDataIn`. Additionally, a *Communication Adapter* shall emit Fw::Success::SUCCESS once at
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user