afflux / pysomeip

basic python implementation of SOME/IP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use notify_once

iznogoud-zz opened this issue · comments

Hi,

I am using notify_once to notify all the subscribed clients something has changed.

I register the eventgroup:
self.register_eventgroup(evg(self))

and then in the method that receives the message have

def method_a(self, someip_message: SOMEIPHeader, addr: _T_SOCKNAME) -> typing.Optional[bytes]:
        self.eventgroups[1].values[0x8010] = someip_message.payload
        self.eventgroups[1].notify_once([0x8010])

my problem is that when the notify_once is called the event groups keeps sending the message to the subscribed clients forever.

Am I doing something wrong?

Hi,

you should only see continuous notifications if you created a task containing cyclic_notify or if you passed an interval to the SimpleEventgroup constructor:

def __init__(
self, service: SimpleService, id: int, interval: typing.Optional[float] = None
):

Thanks for the tip. It's probably that. I started form the SimpleService example and in that example the SimpleEventgroup is initialized with 1 second interval, I missed it.

Thanks it worked.