22 lines
		
	
	
	
		
			612 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
	
		
			612 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include "devices.hpp"
 | |
| #include "events.hpp"
 | |
| #include "dbc.hpp"
 | |
| 
 | |
| namespace components {
 | |
| 
 | |
|   /*
 | |
|    * Note: This should go away or at least the event names to
 | |
|    * numbers should probably be automatically created.
 | |
|    */
 | |
|   void Device::configure_events(json &event_names) {
 | |
|     for(string name : event_names) {
 | |
|       if(name == "Events::GUI::STAIRS_DOWN") {
 | |
|         events.push_back(Events::GUI::STAIRS_DOWN);
 | |
|       } else if(name == "Events::GUI::STAIRS_UP") {
 | |
|         events.push_back(Events::GUI::STAIRS_UP);
 | |
|       } else {
 | |
|         dbc::sentinel(fmt::format("Unknown device event {}", name));
 | |
|       }
 | |
|     }
 | |
|   }
 | |
| }
 | 
