vsomeip icon indicating copy to clipboard operation
vsomeip copied to clipboard

how to send notification message

Open fengmao31 opened this issue 10 months ago • 8 comments

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 avatar Apr 10 '24 03:04 fengmao31

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

nidheesh-ss avatar May 28 '24 12:05 nidheesh-ss

@fengmao31 have you tried the suggestion?

duartenfonseca avatar Sep 06 '24 09:09 duartenfonseca

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.

fengmao31 avatar Sep 12 '24 03:09 fengmao31

@fengmao31 https://github.com/COVESA/vsomeip/blob/master/examples/request-sample.cpp take a look at this example

duartenfonseca avatar Sep 12 '24 08:09 duartenfonseca

@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.

fengmao31 avatar Sep 12 '24 08:09 fengmao31

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

duartenfonseca avatar Sep 25 '24 14:09 duartenfonseca

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 avatar Sep 25 '24 14:09 fengmao31

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);

fengmao31 avatar Sep 25 '24 15:09 fengmao31

the behaviour you describe is not intended, can you explain better in which setting would you use this like so? maybe we can help with another way of achieving what you want

duartenfonseca avatar Oct 28 '24 18:10 duartenfonseca