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

Merge of Issue #346 "CAN sessions" #360

Merged
merged 17 commits into from
May 15, 2024
Merged

Merge of Issue #346 "CAN sessions" #360

merged 17 commits into from
May 15, 2024

Conversation

serges147
Copy link
Collaborator

No description provided.

serges147 and others added 16 commits April 5, 2024 11:04
Added:
- `transport::ISession`
- `transport::IMessage[Rx|Ts]Session`
- `transport::I[Request|Response][Rx|Ts]Session`

Also:
- add "std: [14, 17, 20]" to the build matrix
- add hash tag triggering by #verification #docs tags
- strip repo absolute path prefix from doxygen file paths #docs

---------

Co-authored-by: Sergei Shirokov <sergei@Sergeis-Mac-mini.local>
- Added `ITransport::makeMessage[Rx|Tx]Session` methods
- Added `ITransport::make[Request|Response][Rx|Tx]Session` methods
- Added `Priority`, `[Service]TransferMetadata`, `PayloadFragments`,
`MessageRxTransfre` and `ServiceRxTransfer` types.
- Added`transport::AnyError`
- Added implementation of `DynamicBuffer`.

Also:
- fixed "Coverage" build flavor, and artifacts upload
- added `libcyphal::UniquePtr` & `libcyphal::Expected`
- fixed "rule of five" deficiency
- Added `ITransport`, `ICanTransport` & `IUpdTransport`
- `PayloadFragment` now immutable; `FragmentBuffer` is mutable span.
- `canardInit` is in use.
- CAN transport memory resource is connected to the canard
allocate/free.
- Implemented `getLocalNodeId`

Also:
- Get rid of extra `Factory` entities.
- `cetl::VariableLengthArray` is now in use to store CAN transport media
interfaces.
- min MTU from all media is reported by the
`ICanTransport::getProtocolParams`.
- added corresponding unit tests (to cover `getProtocolParams`).

Also:
- a bit reworked (simplified) canard memory alloc/free
1. Less `auto` according AUTOSAR A7-1-5
2. Less `struct` according AUTOSAR A11-0-2
3. C.35: A base class destructor should be either public and virtual, or protected and non-virtual.
4. `IMedia::setFilters` now fallible.
- Implemented `MessageRxSession`
- Added intermediate `can::TransportDelegate` entity:
  - needed for all sessions to be able reference their parent transport
- contains canard related (kinda) mixin logic (like "canard" memory
management or errors translation)

Also:
- switch to toolshed 22.4.7
- disable asserts from "Coverage" build flavor - to not pollute branch
coverage

---------

Co-authored-by: Sergei Shirokov <sshirokov@malwarebytes.com>
- Implemented TX behavior:
- building contiguous payload from TX fragments (see internal
`ContiguousPayload`)
  - pushing the payload to each media canard TX queue
- `can::TransportImpl::run` now peeks, pushes to media, and finally pops
TX queue items (see `runMediaTransmit`)
  - implemented dropping of expired transfers
- implemented flushing of TX queues on transport destruction - no memory
leaks now in case there were not transmitted queue items
  - extended `ITransport` with new `setLocalNodeId` method
- A bit simplified creation of RX session (b/c it turns out that there
is no failure path; but assert is there just in case)
- Addressed issue #349 
- More documentation
- Previous PR fixes:
  - `memcpy` → `memmove`
  - removed not needed `inline`-s
  - `std::` prefixes before std integrals

Also:
- better coverage stats for branches
- no doxygen warnings
- fixed some places where `noexcept` were lost
- `override` → `final` where applicable (for Scott ;) )

Coverage:
<img width="1680" alt="image"
src="https://github.com/OpenCyphal-Garage/libcyphal/assets/2915466/ebc795a9-72a4-4da8-a049-adb899d09480">

---------

Co-authored-by: Sergei Shirokov <sshirokov@malwarebytes.com>
- Added Svc RX & TX sessions (both for Request & Response).
- Now that we have more sessions, `ContiguousPayload` building moved to
transport impl:
  - less code duplication
  - less to verify by unit tests
- sessions now more like facade for RX/TX - they do necessary params
validation/conversion, but ultimately delegate to the transport
- switch to `cetl::unbounded_variant` (instead of former `cetl::any`)

Also:
- minor changes for previous PR requests
- more docs for stable api; excluding `*::detail::*` from generated docs

Codo coverage:
<img width="1723" alt="Screenshot 2024-05-02 at 09 53 11"
src="https://github.com/OpenCyphal-Garage/libcyphal/assets/2915466/56c4ab26-177c-4cd8-806e-173cf38eb84c">

---------

Co-authored-by: Sergei Shirokov <sshirokov@malwarebytes.com>
- Implemented CAN media filters reconfiguration on subscribe/unsubscribe
- Reference official `libcanard` v3.2.0 #verification

---------

Co-authored-by: Sergei Shirokov <sshirokov@malwarebytes.com>
GitHub's "Hide whitespace" is recommended during review.

<img width="1311" alt="image"
src="https://github.com/OpenCyphal-Garage/libcyphal/assets/2915466/0fb7a41c-06be-4e8d-b528-d3ac168629c1">

<img width="1708" alt="image"
src="https://github.com/OpenCyphal-Garage/libcyphal/assets/2915466/6bd03515-5607-44b8-ab11-5bf8b2695ef8">

---------

Co-authored-by: Sergei Shirokov <sshirokov@malwarebytes.com>
No `CETL_NODISCARD` for the most of public api (issue #350), but private
(aka `detail`) stuff stays under strict `[[nodiscard]]` policy for all
non-`void` returning functions.

Also:
- Less `NOSONAR`-s by switching some internal `void*`-s →
`cetl::byte*`-s.
- Eliminated `IMultiplexer` at CAN - no use of it; but will be at UDP.
- More docs for public api.
- Fixed Build Status and Sonar Cloud badges at `README.md`.

---------

Co-authored-by: Sergei Shirokov <sshirokov@malwarebytes.com>
Co-authored-by: Pavel Kirienko <pavel.kirienko@gmail.com>
@serges147 serges147 self-assigned this May 14, 2024
pavel-kirienko
pavel-kirienko previously approved these changes May 14, 2024
cmake/compiler_flag_sets/default.cmake Outdated Show resolved Hide resolved
Co-authored-by: Pavel Kirienko <pavel.kirienko@gmail.com>
Copy link

sonarcloud bot commented May 15, 2024

@serges147 serges147 added this pull request to the merge queue May 15, 2024
Merged via the queue into main with commit 5e652de May 15, 2024
33 checks passed
@serges147 serges147 deleted the issue/346_can_sessions branch May 15, 2024 13:32
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.

None yet

3 participants