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

how to send notification message #665

Open
fengmao31 opened this issue Apr 10, 2024 · 8 comments
Open

how to send notification message #665

fengmao31 opened this issue Apr 10, 2024 · 8 comments
Labels

Comments

@fengmao31
Copy link

vSomeip Version

v3.4.9.1

Boost Version

1.84

Environment

ubuntu20

Describe the bug

   std::shared_ptr<vsomeip::message> notification = vsomeip::runtime::get()->create_notification();
        notification->set_service(SAMPLE_SERVICE_ID);
        notification->set_instance(SAMPLE_INSTANCE_ID);
        notification->set_method(SAMPLE_EVENT_ID);
        app->send(notification);
        //app->notify(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_EVENT_ID, payload);

I want to send the notification by message interface. However, I cannot find the way to setup event_id. I try to send message, but the client cannot get the notification.
//app->notify(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_EVENT_ID, payload);can work.

Reproduction Steps

No response

Expected behaviour

No response

Logs and Screenshots

No response

@fengmao31 fengmao31 added the bug label Apr 10, 2024
@nidheesh-ss
Copy link

You can send the notification by creating and offering event id in service side and subscribe to this event on client side and you can simple use the app->notify (service_id,instance_id,event_id)
it will work

@duartenfonseca
Copy link
Collaborator

@fengmao31 have you tried the suggestion?

@fengmao31
Copy link
Author

I've tried it before and it worked, but why doesn't the standard interface function properly? It lacks organization when I'm packaging the library.

@duartenfonseca
Copy link
Collaborator

@fengmao31
Copy link
Author

@fengmao31 https://github.com/COVESA/vsomeip/blob/master/examples/request-sample.cpp看一下这个例子

I know the example. But you can't send notification message by interface as request interface.

@duartenfonseca
Copy link
Collaborator

have you taken a look at the notify-sample / subscribe-sample?

On the notify sample side (the app that offers) will do:
app_->offer_event
app_->offer_service
app_->notify

on the subscribe sample side (the client that consumes the offer):

app_->register_message_handler (to read the response from the service)

app_->request_event
app_->subscribe
app_->request_service

this is how it works on that example.

please take a look at the vsomeip in 10 minutes

@fengmao31
Copy link
Author

have you taken a look at the notify-sample / subscribe-sample?

On the notify sample side (the app that offers) will do: app_->offer_event app_->offer_service app_->notify

on the subscribe sample side (the client that consumes the offer):

app_->register_message_handler (to read the response from the service)

app_->request_event app_->subscribe app_->request_service

this is how it works on that example.

please take a look at the vsomeip in 10 minutes

I know the example. and I can use app_->notify to send the message well. But I can't send notification message by interface as request interface though the message have the notification attribute。

@fengmao31
Copy link
Author

have you taken a look at the notify-sample / subscribe-sample?

On the notify sample side (the app that offers) will do: app_->offer_event app_->offer_service app_->notify

on the subscribe sample side (the client that consumes the offer):

app_->register_message_handler (to read the response from the service)

app_->request_event app_->subscribe app_->request_service

this is how it works on that example.

please take a look at the vsomeip in 10 minutes

   std::shared_ptr<vsomeip::message> notification = vsomeip::runtime::get()->create_notification();
        notification->set_service(SAMPLE_SERVICE_ID);
        notification->set_instance(SAMPLE_INSTANCE_ID);
        notification->set_method(SAMPLE_EVENT_ID);
        app->send(notification);
        //app->notify(SAMPLE_SERVICE_ID, SAMPLE_INSTANCE_ID, SAMPLE_EVENT_ID, payload);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants