Changeset 1724
- Timestamp:
- 11/22/09 12:55:51 (14 years ago)
- Files:
-
- trunk/libffado/src/libcontrol/BasicElements.h (modified) (1 diff)
- trunk/libffado/support/dbus/control-interface.xml (modified) (1 diff)
- trunk/libffado/support/dbus/controlserver.cpp (modified) (2 diffs)
- trunk/libffado/support/dbus/controlserver.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/src/libcontrol/BasicElements.h
r1158 r1724 154 154 virtual std::string getAttributeName(int attridx) = 0; 155 155 }; 156 /*! 157 @brief Base class for basic boolean control elements 158 */ 159 class Boolean 160 : public Element 161 { 162 public: 163 Boolean(Element *p) : Element(p) {}; 164 Boolean(Element *p, std::string n) : Element(p, n) {}; 165 virtual ~Boolean() {}; 166 167 virtual bool select(bool) = 0; 168 virtual bool selected() = 0; 169 virtual std::string getBooleanLabel(bool n) { 170 if (n) return "True"; 171 return "False"; 172 } 173 }; 156 174 157 175 }; // namespace Control trunk/libffado/support/dbus/control-interface.xml
r1655 r1724 303 303 </interface> 304 304 305 <interface name="org.ffado.Control.Element.Boolean"> 306 <method name="select"> 307 <arg type="b" name="value" direction="in"/> 308 <arg type="b" name="success" direction="out"/> 309 </method> 310 <method name="selected"> 311 <arg type="b" name="value" direction="out"/> 312 </method> 313 <method name="getBooleanLabel"> 314 <arg type="b" name="value" direction="in"/> 315 <arg type="s" name="label" direction="out"/> 316 </method> 317 </interface> 305 318 </node> trunk/libffado/support/dbus/controlserver.cpp
r1655 r1724 410 410 } 411 411 412 if (dynamic_cast<Control::Boolean *>(&e) != NULL) { 413 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::Boolean\n"); 414 415 return new Boolean(conn(), std::string(path()+"/"+e.getName()), 416 parent, *dynamic_cast<Control::Boolean *>(&e)); 417 } 418 412 419 if (dynamic_cast<ConfigRom *>(&e) != NULL) { 413 420 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a ConfigRom\n"); … … 1009 1016 } 1010 1017 1018 // --- Boolean 1019 1020 Boolean::Boolean( DBus::Connection& connection, std::string p, Element* parent, Control::Boolean &slave) 1021 : Element(connection, p, parent, slave) 1022 , m_Slave(slave) 1023 { 1024 debugOutput( DEBUG_LEVEL_VERBOSE, "Created Boolean on '%s'\n", 1025 path().c_str() ); 1026 } 1027 1028 DBus::Bool 1029 Boolean::select( const DBus::Bool& value ) 1030 { 1031 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "select(%d)\n", value ); 1032 return m_Slave.select(value); 1033 } 1034 1035 DBus::Bool 1036 Boolean::selected() 1037 { 1038 bool retval = m_Slave.selected(); 1039 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "selected() => %d\n", retval ); 1040 return retval; 1041 } 1042 1043 DBus::String 1044 Boolean::getBooleanLabel( const DBus::Bool& value ) 1045 { 1046 std::string retval = m_Slave.getBooleanLabel(value); 1047 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "getBooleanLabel(%d) => %s\n", value, retval.c_str() ); 1048 return retval; 1049 } 1050 1011 1051 1012 1052 } // end of namespace Control trunk/libffado/support/dbus/controlserver.h
r1655 r1724 367 367 }; 368 368 369 class Boolean 370 : public org::ffado::Control::Element::Boolean 371 , public Element 372 { 373 public: 374 Boolean( DBus::Connection& connection, 375 std::string p, Element *, 376 Control::Boolean &slave ); 377 378 DBus::Bool select( const DBus::Bool& value ); 379 DBus::Bool selected(); 380 DBus::String getBooleanLabel( const DBus::Bool& value ); 381 382 private: 383 Control::Boolean &m_Slave; 384 }; 369 385 } 370 386