Skip to content

Commit

Permalink
Added remote variable handler methods
Browse files Browse the repository at this point in the history
  • Loading branch information
grodansparadis committed Jan 2, 2024
1 parent 39a2e78 commit d078c8c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/vscp/common/mdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7730,7 +7730,7 @@ CMDF::getRemoteVariable(uint32_t offset, uint16_t page)
std::deque<CMDF_RemoteVariable *>::iterator iter;
for (iter = m_list_remotevar.begin(); iter != m_list_remotevar.end(); ++iter) {
CMDF_RemoteVariable *pvar = *iter;
if ((nullptr == pvar) && (page == pvar->getPage()) && (offset == pvar->getOffset()) ) {
if ((nullptr != pvar) && (page == pvar->getPage()) && (offset == pvar->getOffset()) ) {
return pvar;
}
}
Expand Down Expand Up @@ -7785,6 +7785,28 @@ CMDF::deleteRegister(CMDF_Register *preg)
return false;
}

///////////////////////////////////////////////////////////////////////////////
// deleteRemoteVariable
//

bool
CMDF::deleteRemoteVariable(CMDF_RemoteVariable *pvar)
{
// Check pointer
if (nullptr == pvar) {
return false;
}

for (auto it = m_list_remotevar.cbegin(); it != m_list_remotevar.cend(); ++it) {
if (pvar == *it) {
m_list_remotevar.erase(it);
return true;
}
}

return false;
}

///////////////////////////////////////////////////////////////////////////////
// createRegisterStortedSet
//
Expand Down
7 changes: 7 additions & 0 deletions src/vscp/common/mdf.h
Original file line number Diff line number Diff line change
Expand Up @@ -3840,6 +3840,13 @@ class CMDF : public CMDF_Object {
*/
std::deque<CMDF_RemoteVariable *> *getRemoteVariableList(void) { return &m_list_remotevar; };

/*!
Delete a defined remote variable
@param pvar Pointer to remote variable
@return True on success, false otherwise
*/
bool deleteRemoteVariable(CMDF_RemoteVariable *pvar);

//-----------------------------------------------------------------------------

/*!
Expand Down

0 comments on commit d078c8c

Please sign in to comment.