Change Property ??
Posted: Mon Dec 06, 2004 6:05 pm
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 );
}
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 );
}