Change Property ??

HouseBot Plugin Development Discussions.
Post Reply
maze42
Member
Posts: 28
Joined: Sat Aug 07, 2004 11:30 am
Location: Sweden

Change Property ??

Post by maze42 »

Is this the right way to change a property without user input(no button puched)? My local property is m_pValue and I want to change it from my digital Interface. The digital Interface sends a NotifySubscribedDevices() every time a digital input has change its status. This code works but it feels a bit odd to use the ChangeRequestCompleted() method this way. :roll:





BOOL CInputDevice::SubscriptionNotification( LPCTSTR szListName, LPCTSTR szFilter, CDataPack* pDataPack )

{

CPropertyValue* pNoValue = NULL;



if (strcmp(pDataPack->GetData( "ChannelName" ),m_pChannelName->GetPropertyValueAsString())==0)

{

pNoValue = m_pValue->CreatePropertyValue( pDataPack->GetData( "Value" ) );

}

if (pNoValue)

{

pNoValue->ChangeRequestCompleted();

delete pNoValue;

}

return( TRUE );

}
ScottBot
Site Admin
Posts: 2787
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Post by ScottBot »

That's the way. When creating the property internally like this, it may seem a little odd. It makes more sense in when you think of being able to optionally call ChangeRequestFailed() when the changes are coming from the user.
Scott
Post Reply