Changeset 584bc7


Ignore:
Timestamp:
08/16/09 16:03:18 (4 years ago)
Author:
Micke Prag <micke.prag@…>
Branches:
('master', 'a231b56d57a69513303d0061f5fa3e3cd51c85c1')('controller-upgrade', '72b31cc86eeeef18f1371a3067b6e8a5ca21abfc')('windows_service_fixes', 'df6bd2788365991d36d5af2a75833b8de2a5860f')
Children:
528598e862013bc08845c43f10f0e9908711cce4
Parents:
c41e5de4f761799a4d41bb05ea8a84d14d0ef9d7
git-author:
Micke Prag <micke.prag@telldus.se>2009-08-16 14:03:18+00:00
git-committer:
Micke Prag <micke.prag@telldus.se>2009-08-16 14:03:18+00:00
Message:

Made telldus-core report back when the state of a device changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • telldus-core/driver/libtelldus-core/Manager.cpp

    r31d7bb r584bc7  
    3636#define strcasecmp _stricmp 
    3737#endif 
     38 
     39//Defined in telldus-core.cpp 
     40extern char *wrapStdString( const std::string &string); 
     41 
    3842 
    3943using namespace TelldusCore; 
     
    179183bool Manager::setDeviceState( int intDeviceId, int intDeviceState, const std::string &strDeviceStateValue ) { 
    180184        if (intDeviceState != TELLSTICK_BELL) { 
    181                 return settings.setDeviceState(intDeviceId, intDeviceState, strDeviceStateValue); 
     185                bool retval = settings.setDeviceState(intDeviceId, intDeviceState, strDeviceStateValue); 
     186                for(CallbackList::const_iterator callback_it = callbacks.begin(); callback_it != callbacks.end(); ++callback_it) { 
     187                        (*callback_it).event(intDeviceId, intDeviceState, wrapStdString(strDeviceStateValue), (*callback_it).id, (*callback_it).context); 
     188                } 
     189                 
     190                return retval; 
    182191        } 
    183192        return true; 
     
    240249                } 
    241250                if (found) { 
    242                         //First save the last sent command 
     251                        //First save the last sent command, this also triggers the callback to the client 
    243252                        setDeviceState(it->first, method, ""); 
    244                         for(CallbackList::const_iterator callback_it = callbacks.begin(); callback_it != callbacks.end(); ++callback_it) { 
    245                                 (*callback_it).event(it->first, method, message.c_str(), (*callback_it).id, (*callback_it).context); 
    246                         } 
    247253                } 
    248254        } 
Note: See TracChangeset for help on using the changeset viewer.