Personal tools
You are here: Home HowTos CPP: Manage state machine on a READ_WRITE attribute

CPP: Manage state machine on a READ_WRITE attribute

This HowTo explains how you have to code your READ_WRITE attributes is_allowed() method in case you want to manage the type of action done on the attribute (READ or WRITE)

To manage state machine on a READ_WRITE attribute, you need to modify theĀ is_<attribute>_allowed method in the MyTangoClassStateMachine.cpp file like this:

bool MyTangoClass::is_Encoder_present_allowed(Tango::AttReqType type)
{
if (get_state() == Tango::MOVING ||
get_state() == Tango::FAULT)
{
// End of Generated Code

if ( get_state()==Tango::MOVING && type==Tango::READ_REQ )
{
return true;
}

// Re-Start of Generated Code
return false;
}
return true;
}

This code checks if it is a read or write request and allow or disallow it.

Document Actions