Skip to content

[csharp] add a callback-based ServiceClient API and a corresponding C# sample #2154

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

rex-schilasky
Copy link
Contributor

@rex-schilasky rex-schilasky commented May 7, 2025

Description

This PR introduces a new, callback-based variant of the service client call (CallWithCallback) alongside the existing CallWithResponse. It also adds or updates C# sample code to demonstrate the new API.

API Changes

  • Added a new constructor overload ServiceClient(String^ serviceName) allowing creation of a client without explicitly providing a ServiceMethodInformationList^.
  • Added ServiceClient::CallWithCallback(String^ methodName, array<Byte>^ request, ResponseCallback^ callback, int timeoutMs) to the C# wrapper.

Sample Added

  • mirror_client_callback_csharp.cs: Demonstrates registering a response-callback delegate instead of using CallWithResponse.

@rex-schilasky rex-schilasky added the cherry-pick-to-NONE Don't cherry-pick these changes label May 7, 2025
@@ -24,8 +24,9 @@ find_package(eCAL REQUIRED)
macro(ecal_add_csharp_core_sample sample_name)
ecal_add_sample(${sample_name} ${sample_name}.cs)
target_link_libraries(${sample_name} PRIVATE Eclipse.eCAL.Core)
set_property(TARGET ${sample_name} PROPERTY FOLDER samples/csharp/binary/service)
set_property(TARGET ${sample_name} PROPERTY FOLDER samples/csharp/core/service)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
set_property(TARGET ${sample_name} PROPERTY FOLDER samples/csharp/core/service)
set_property(TARGET ${sample_name} PROPERTY FOLDER samples/csharp/services/binary)

at least this is analog to C / C++ (Python is still a bit different).

Copy link
Contributor Author

@rex-schilasky rex-schilasky May 20, 2025

Choose a reason for hiding this comment

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

Unfortunately it's not that easy to align with the other languages. Currently the C# samples are aligned to the 3 C# modules (core, protobuf, string). So there are C# Core (binary) samples for pubsub and service. For C# Protobuf we have typed pubsub and monitoring. For C# String we have typed pubsub. I would keep it like it is, so the solution structure is reflecting the C# modules structure.

image

@Peguen Peguen added cherry-pick-to-support/v6.0 Cherry pick these changes to support/v6.0 and removed cherry-pick-to-NONE Don't cherry-pick these changes labels May 20, 2025
@Peguen Peguen force-pushed the csharp/add-client-callback-variant branch from 4022718 to 87984da Compare May 27, 2025 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-to-support/v6.0 Cherry pick these changes to support/v6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants