|
Boost Users : |
Subject: Re: [Boost-users] Statechart problem
From: Iwan Sanders (iwan.sanders_at_[hidden])
Date: 2009-03-25 10:24:52
Hi thanks for looking into the issue (which is driving me nuts)
I've defines the following Receiving state:
namespace sc = boost::statechart;
namespace mpl = boost::mpl;
struct EvNewFrame : sc::event< EvNewFrame > {};
struct EvNeedFlowControl : sc::event< EvNeedFlowControl > {};
struct EvDoneReceiving : sc::event<EvDoneReceiving> {};
struct Idle_Receiving;
struct ParseFrame;
struct Receiving : ICANMonitorClient, sc::state< Receiving, USDTTransmitter,
Idle_Receiving >
{
typedef mpl::list<
sc::custom_reaction< EvAbort >,
//sc::deferral< EvNewFrame >,
sc::transition< EvNewFrame, ParseFrame >,
sc::transition< EvDoneReceiving , Finished> > reactions;
Receiving( my_context ctx );
~Receiving();
sc::result react( const EvAbort& );
*virtual void UpdateNewCANMessage(CANMessageId pMsgFilter, TT_CANMsg*
pMsg);*
TT_CANMsg* newCANMessage;
std::vector<_u8> wb;
bool DoneReceiving;
};
The UpdateNewCANMessage is a callback function defined in the
ICANMonitorClient interface. This method is being called when new data
frames arrive (that works) but then I want to notify the state machine to
proceed to its next state effectively by sending an EvNewFrame event but
nothing happens.
I tried this->post_event( EvNewFrame() ); // no effect
and this->post_event( boost::intrusive_ptr<EvNewFrame>( new EvNewFrame( ) )
); // no effect
(this->terminate() still works in this method on the other hand)
Regards
On Wed, Mar 25, 2009 at 15:15, Igor R <boost.lists_at_[hidden]> wrote:
> > But then when I want to notify the state that the machine is currently in
> > with a post_event this event seems to be discarded even though it should
> > react on it (the machine state has transitions defined for this event and
> > the current state is that state). I also tried using the transit call but
> > that doesn't do anything either.
>
> Do you try to post_event from a state constructor? How is this state
> defined exaclty?
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net