Hi,
I'm having problems with making the RTT::Event class send/receive
commands over CAN.
I have a EventProxy derived from the signal<Signature> template
implementing a RTT::LocalCommand with a overridden operator()(). In this
operator I do:
void CLocalEventProxy<void(void)>::operator()()
{
if(m_El) m_El->sendEvent(m_Id); //--> send a CAN message. this->emit();
}
Where I receive the CAN message I just call emit() thus preventing an
other CAN message being sent.
Using this construction I can fire an event over the CAN network from a
proxy to a server. It is the other way around I can't get away with.
For Commands and DataPorts I change the implementation to a
server-implementation if they are in the interface of the TaskContex's I
want to export over CAN (using commands() and ports()). I was hoping I
could do the same thing with Events. The problem is that the objects
stored in the EventService, returned by events(), are already
implementations. So I can't just change them can I? Or are the shared
pointers smart enough to handle this?
Kind regards,
Sander Vandenbroucke

RTT::Events
On Monday 14 May 2007 11:50:06 Vandenbroucke Sander wrote:
> Hi,
>
> I'm having problems with making the RTT::Event class send/receive
> commands over CAN.
> I have a EventProxy derived from the signal<Signature> template
> implementing a RTT::LocalCommand with a overridden operator()(). In this
> operator I do:
>
> void CLocalEventProxy<void(void)>::operator()()
> {
> if(m_El)
> m_El->sendEvent(m_Id); //--> send a CAN message.
> this->emit();
> }
Interesting, using a commandi for emiting events.
>
> Where I receive the CAN message I just call emit() thus preventing an
> other CAN message being sent.
>
> Using this construction I can fire an event over the CAN network from a
> proxy to a server. It is the other way around I can't get away with.
>
> For Commands and DataPorts I change the implementation to a
> server-implementation if they are in the interface of the TaskContex's I
> want to export over CAN (using commands() and ports()). I was hoping I
> could do the same thing with Events. The problem is that the objects
> stored in the EventService, returned by events(), are already
> implementations. So I can't just change them can I? Or are the shared
> pointers smart enough to handle this?
I'll have to look into this. You can use Event<T>::operator= to assign a new
implementation before adding the event to the EventService (before
events()->addEvent( &e ) or after you get the Event (this completely removes
the old function then) and there is also an Event constructor which accepts
the implementation. You may change the implementation of an Event (about) at
any time. I don't fully understand your case yet though.
Do you need both local and remote delivery implementations of the Event ?
Peter