diff options
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | bin/Barreleye.py | 32 | ||||
-rw-r--r-- | bin/Openbmc.py | 14 | ||||
-rw-r--r-- | bin/PropertyManager.py | 1 | ||||
-rw-r--r-- | bin/chassis_control.py | 57 | ||||
-rw-r--r-- | bin/ipmi_bt.py | 36 | ||||
-rw-r--r-- | bin/ipmi_translator.py | 32 | ||||
-rw-r--r-- | bin/sensor_manager.py | 17 | ||||
-rw-r--r-- | bin/system_manager.py | 28 | ||||
-rw-r--r-- | includes/openbmc.h | 2 | ||||
-rw-r--r-- | interfaces/control.c | 98 | ||||
-rw-r--r-- | interfaces/control.h | 15 | ||||
-rw-r--r-- | interfaces/sensor.c | 1416 | ||||
-rw-r--r-- | interfaces/sensor.h | 153 | ||||
-rw-r--r-- | interfaces/watchdog.c | 2338 | ||||
-rw-r--r-- | interfaces/watchdog.h | 380 | ||||
-rw-r--r-- | objects/host_watchdog_obj.c | 146 | ||||
-rw-r--r-- | objects/power_control_obj.c | 58 | ||||
-rw-r--r-- | objects/sensor_host_status_obj.c | 73 | ||||
-rw-r--r-- | objects/sensor_temperature_ambient_obj.c | 32 | ||||
-rw-r--r-- | xml/control.xml | 6 | ||||
-rw-r--r-- | xml/sensor.xml | 12 | ||||
-rw-r--r-- | xml/watchdog.xml | 5 |
23 files changed, 4729 insertions, 227 deletions
@@ -33,6 +33,9 @@ button_power: button.o button_power_obj.o gpio.o sensor_host_status: sensor.o sensor_host_status_obj.o $(CC) -o bin/$@.exe obj/sensor.o obj/sensor_host_status_obj.o $(CFLAGS) +sensor_occ: sensor.o sensor_occ_obj.o + $(CC) -o bin/$@.exe obj/sensor.o obj/sensor_occ_obj.o $(CFLAGS) + control_host: control.o control_host_obj.o gpio.o $(CC) -o bin/$@.exe obj/gpio.o obj/control.o obj/control_host_obj.o $(CFLAGS) @@ -49,3 +52,5 @@ fru_board: fru.o fru_board_obj.o $(CC) -o bin/$@.exe obj/fru.o obj/fru_board_obj.o $(CFLAGS) +host_watchdog: watchdog.o host_watchdog_obj.o + $(CC) -o bin/$@.exe obj/watchdog.o obj/host_watchdog_obj.o $(CFLAGS) diff --git a/bin/Barreleye.py b/bin/Barreleye.py index 65d8683..50a3492 100644 --- a/bin/Barreleye.py +++ b/bin/Barreleye.py @@ -1,4 +1,6 @@ #! /usr/bin/python + +## todos: event logger, import dbus import Openbmc @@ -12,6 +14,24 @@ CACHED_INTERFACES = { SYSTEM_CONFIG = {} +SYSTEM_CONFIG['org.openbmc.watchdog.HostWatchdog'] = { + 'start_process' : True, + 'process_name' : 'host_watchdog.exe', + 'heartbeat' : 'no', + 'rest_name' : 'watchdog', + 'instances' : [ + { + 'name' : 'Watchdog1', + 'user_label': 'Host Watchdog', + 'properties' : { + 'org.openbmc.Watchdog' : { + 'poll_interval': 300000, + } + } + } + ] + } + SYSTEM_CONFIG['org.openbmc.managers.Sensors'] = { 'start_process' : True, 'process_name' : 'sensor_manager.py', @@ -59,6 +79,11 @@ SYSTEM_CONFIG['org.openbmc.control.Power'] = { { 'name' : 'PowerControl1', 'user_label': 'Power control', + 'properties' : { + 'org.openbmc.Control': { + 'poll_interval' : 3000 + } + } } ] } @@ -68,13 +93,15 @@ SYSTEM_CONFIG['org.openbmc.sensors.Temperature.Ambient'] = { 'process_name' : 'sensor_ambient.exe', 'heartbeat' : 'yes', 'init_methods' : ['org.openbmc.SensorValue'], - 'poll_interval': 5000, 'instances' : [ { 'name' : 'AmbientTemperature1', 'user_label': 'Ambient Temperature 1', 'sensor_id' : 41, 'properties' : { + 'org.openbmc.SensorValue': { + 'poll_interval' : 5000 + }, 'org.openbmc.SensorThreshold' : { 'lower_critical': 5, 'lower_warning' : 10, @@ -91,6 +118,9 @@ SYSTEM_CONFIG['org.openbmc.sensors.Temperature.Ambient'] = { 'name' : 'AmbientTemperature2', 'user_label': 'Ambient Temperature 2', 'properties' : { + 'org.openbmc.SensorValue': { + 'poll_interval' : 5000 + }, 'org.openbmc.SensorThreshold' : { 'lower_critical': 5, 'lower_warning' : 10, diff --git a/bin/Openbmc.py b/bin/Openbmc.py index 4b10739..12f93c7 100644 --- a/bin/Openbmc.py +++ b/bin/Openbmc.py @@ -1,4 +1,5 @@ import dbus +import xml.etree.ElementTree as ET BUS_PREFIX = 'org.openbmc' GPIO_DEV = '/sys/class/gpio' @@ -28,6 +29,19 @@ def object_to_bus_name(obj): def bus_to_object_name(bus_name): return "/"+bus_name.replace('.','/') +def get_methods(obj): + methods = {} + introspect_iface = dbus.Interface(obj,"org.freedesktop.DBus.Introspectable") + tree = ET.ElementTree(ET.fromstring(introspect_iface.Introspect())) + root = tree.getroot() + for intf in root.iter('interface'): + intf_name = intf.attrib['name'] + if (intf_name.find(BUS_PREFIX)==0): + methods[intf_name] = {} + for method in intf.iter('method'): + methods[intf_name][method.attrib['name']] = True + + return methods class DbusProperty: def __init__(self,name,value): diff --git a/bin/PropertyManager.py b/bin/PropertyManager.py index ff0e200..6af3af7 100644 --- a/bin/PropertyManager.py +++ b/bin/PropertyManager.py @@ -57,7 +57,6 @@ class PropertyManager(): for prop in properties.keys(): print "Saving properties: "+prop ## convert property to correct dbus type - print type(properties[prop]) prop_intf.Set(interface_name,prop,properties[prop]) dbus_props = [] diff --git a/bin/chassis_control.py b/bin/chassis_control.py index 15a8feb..4be1afc 100644 --- a/bin/chassis_control.py +++ b/bin/chassis_control.py @@ -12,10 +12,13 @@ OBJ_NAME = '/org/openbmc/control/Chassis/'+sys.argv[1] POWER_OFF = 0 POWER_ON = 1 +BOOTED = 100 + class ChassisControlObject(dbus.service.Object): def __init__(self,bus,name): self.dbus_objects = { } + dbus.service.Object.__init__(self,bus,name) ## load utilized objects self.dbus_busses = { 'org.openbmc.control.Power' : @@ -26,16 +29,10 @@ class ChassisControlObject(dbus.service.Object): [ { 'name' : 'HostControl1', 'intf' : 'org.openbmc.control.Host' } ] } self.power_sequence = 0 - dbus.service.Object.__init__(self,bus,name) - bus = dbus.SessionBus() - try: - for bus_name in self.dbus_busses.keys(): - self.request_name(bus_name,"",bus_name) + self.reboot = 0 + self.last_power_state = 0 - except: - ## its ok if this fails. hotplug will detect too - print "Warning: One of processes not started yet." - pass + bus = dbus.SessionBus() ## add signal handler to detect when new objects show up on dbus bus.add_signal_receiver(self.request_name, @@ -46,9 +43,23 @@ class ChassisControlObject(dbus.service.Object): dbus_interface = "org.openbmc.Button", signal_name = "ButtonPressed", path="/org/openbmc/buttons/ButtonPower/PowerButton1" ) bus.add_signal_receiver(self.power_good_signal_handler, - dbus_interface = "org.openbmc.control.Power", signal_name = "PowerGood", - path="/org/openbmc/control/Power/PowerControl1") + dbus_interface = "org.openbmc.control.Power", signal_name = "PowerGood") + bus.add_signal_receiver(self.power_lost_signal_handler, + dbus_interface = "org.openbmc.control.Power", signal_name = "PowerLost") + bus.add_signal_receiver(self.host_watchdog_signal_handler, + dbus_interface = "org.openbmc.Watchdog", signal_name = "WatchdogError") + bus.add_signal_receiver(self.host_status_signal_handler, + dbus_interface = "org.openbmc.SensorMatch", signal_name = "SensorMatch", + path="/org/openbmc/sensors/HostStatus/HostStatus1") + + try: + for bus_name in self.dbus_busses.keys(): + self.request_name(bus_name,"",bus_name) + except: + ## its ok if this fails. hotplug will detect too + print "Warning: One of processes not started yet." + pass def request_name(self, bus_name, a, b): @@ -60,6 +71,7 @@ class ChassisControlObject(dbus.service.Object): obj_path = "/"+bus_name.replace('.','/') for objs in self.dbus_busses[bus_name]: inst_name = objs['name'] + print "Chassis control: "+inst_name obj = bus.get_object(bus_name,obj_path+"/"+inst_name) self.dbus_objects[inst_name] = dbus.Interface(obj, objs['intf']) @@ -69,7 +81,6 @@ class ChassisControlObject(dbus.service.Object): def getID(self): return id - @dbus.service.method(DBUS_NAME, in_signature='', out_signature='') def setIdentify(self): @@ -77,7 +88,6 @@ class ChassisControlObject(dbus.service.Object): self.dbus_objects['ChassisIdentify1'].setOn() return None - @dbus.service.method(DBUS_NAME, in_signature='', out_signature='') def clearIdentify(self): @@ -90,6 +100,7 @@ class ChassisControlObject(dbus.service.Object): def setPowerOn(self): print "Turn on power and boot" self.power_sequence = 0 + self.reboot = 0 if (self.getPowerState()==0): self.dbus_objects['PowerControl1'].setPowerState(POWER_ON) self.power_sequence = 1 @@ -98,6 +109,7 @@ class ChassisControlObject(dbus.service.Object): @dbus.service.method(DBUS_NAME, in_signature='', out_signature='') def setPowerOff(self): + self.power_sequence = 0 print "Turn off power" self.dbus_objects['PowerControl1'].setPowerState(POWER_OFF); return None @@ -118,9 +130,10 @@ class ChassisControlObject(dbus.service.Object): def setPowerPolicy(self,policy): return None + ## Signal handler def power_button_signal_handler(self): - # only power on if not currently powered on + # toggle power state = self.getPowerState() if state == POWER_OFF: self.setPowerOn() @@ -129,13 +142,27 @@ class ChassisControlObject(dbus.service.Object): # TODO: handle long press and reset - ## Signal handler + ## Signal handlers def power_good_signal_handler(self): if (self.power_sequence==1): self.dbus_objects['HostControl1'].boot() self.power_sequence = 2 + def host_status_signal_handler(self,value): + if (value == BOOTED and self.power_sequence==2): + self.power_sequence=0 + print "Host booted" + def power_lost_signal_handler(self): + ## Reboot if power is lost but reboot requested + if (self.reboot == 1): + self.setPowerOn() + + def host_watchdog_signal_handler(self): + print "Watchdog Error, Rebooting" + self.reboot = 1 + self.setPowerOff() + if __name__ == '__main__': dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) diff --git a/bin/ipmi_bt.py b/bin/ipmi_bt.py index 375eb2a..d3e79cd 100644 --- a/bin/ipmi_bt.py +++ b/bin/ipmi_bt.py @@ -39,7 +39,7 @@ class IpmiBt(dbus.service.Object): @dbus.service.method(DBUS_NAME) def emitUpdateSensor(self,ipmi_id,data): - self.UpdateSensor(ipmi_id,int(data)) + self.UpdateSensor(ipmi_id,dbus.Byte(int(data))) print "update sensor emitted" return 'Signal emitted' @@ -49,11 +49,31 @@ class IpmiBt(dbus.service.Object): intf = dbus.Interface(obj, 'org.openbmc.managers.IpmiTranslator' ) return intf.getSensor(ipmi_id) + def pokeHostWatchdog(self): + obj = bus.get_object('org.openbmc.managers.IpmiTranslator', + '/org/openbmc/managers/IpmiTranslator/Barreleye') + intf = dbus.Interface(obj, 'org.openbmc.managers.IpmiTranslator' ) + intf.pokeHostWatchdog() -if __name__ == '__main__': + def startHostWatchdog(self): + obj = bus.get_object('org.openbmc.managers.IpmiTranslator', + '/org/openbmc/managers/IpmiTranslator/Barreleye') + intf = dbus.Interface(obj, 'org.openbmc.managers.IpmiTranslator' ) + intf.startHostWatchdog() - cmd = sys.argv[2] - ipmi_id = int(sys.argv[3]) + + + + +if __name__ == '__main__': + + cmd = "" + data = None + ipmi_id = 0 + if (len(sys.argv) > 2): + cmd = sys.argv[2] + if (len(sys.argv) > 3): + ipmi_id = int(sys.argv[3]) if (len(sys.argv)>4): data = sys.argv[4] @@ -69,7 +89,13 @@ if __name__ == '__main__': obj.emitUpdateSensor(ipmi_id,data) elif (cmd == 'getsensor'): print obj.getSensor(ipmi_id) - + elif (cmd == 'pokewatchdog'): + print obj.pokeHostWatchdog() + elif (cmd == 'startwatchdog'): + print obj.startHostWatchdog() + else: + print "ERROR: Invalid command" + print "Valid commands: updatefru, setsensor, getsensor, startwatchdog, pokewatchdog" #mainloop.run() diff --git a/bin/ipmi_translator.py b/bin/ipmi_translator.py index f7a7aab..2f3d0bb 100644 --- a/bin/ipmi_translator.py +++ b/bin/ipmi_translator.py @@ -73,15 +73,13 @@ class IpmiTranslator(dbus.service.Object): ## change to variant data type ## comes in off dbus from ipmi_bt as a basic data type dvalue = Openbmc.DbusProperty('value',value) - dvalue.setVariant(2) - data = { 'value' : dvalue.getValue() } + dvalue.setVariant(1) ## save sensor value - ## TODO: need to accomodate any sensor interface interface_name = 'org.openbmc.SensorValue' cache = System.CACHED_INTERFACES.has_key(interface_name) obj = bus.get_object(bus_name,obj_path) intf = dbus.Interface(obj, interface_name) - self.property_manager.saveProperties(bus_name,obj_path,interface_name,cache,data) + intf.setValue(dvalue.getValue()) else: ## TODO: error handling pass @@ -99,10 +97,34 @@ class IpmiTranslator(dbus.service.Object): '/org/openbmc/managers/Sensors/Barreleye') intf = dbus.Interface(obj, 'org.openbmc.managers.Sensors' ) val = intf.getSensor(obj_path) - print "value = "+str(val) return val + @dbus.service.method(DBUS_NAME, + in_signature='', out_signature='') + def pokeHostWatchdog(self): + ## TODO don't do hardcoding + obj = bus.get_object('org.openbmc.watchdog.HostWatchdog', + '/org/openbmc/watchdog/HostWatchdog/Watchdog1') + intf = dbus.Interface(obj, 'org.openbmc.Watchdog' ) + intf.poke() + + return None + + @dbus.service.method(DBUS_NAME, + in_signature='', out_signature='') + def startHostWatchdog(self): + ## TODO don't do hardcoding + obj = bus.get_object('org.openbmc.watchdog.HostWatchdog', + '/org/openbmc/watchdog/HostWatchdog/Watchdog1') + intf = dbus.Interface(obj, 'org.openbmc.Watchdog' ) + intf.start() + + return None + + + + if __name__ == '__main__': dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) diff --git a/bin/sensor_manager.py b/bin/sensor_manager.py index 2314a7f..cb0904e 100644 --- a/bin/sensor_manager.py +++ b/bin/sensor_manager.py @@ -19,8 +19,8 @@ class SensorManager(dbus.service.Object): def __init__(self,bus,name): dbus.service.Object.__init__(self,bus,name) bus.add_signal_receiver(self.UpdateSensor, - dbus_interface = 'org.freedesktop.DBus.Properties', - signal_name = 'PropertiesChanged', path_keyword='path') + dbus_interface = 'org.openbmc.SensorValue', + signal_name = 'Changed', path_keyword='path') bus.add_signal_receiver(self.NormalThreshold, dbus_interface = 'org.openbmc.SensorThreshold', signal_name = 'Normal', path_keyword='path') @@ -41,11 +41,10 @@ class SensorManager(dbus.service.Object): val = self.sensor_cache[path]['value'] return val - def UpdateSensor(self,interface,prop_dict,props, path = None): - if (interface == "org.openbmc.SensorValue"): - self.initSensorEntry(path) - for p in prop_dict.keys(): - self.sensor_cache[path][p] = prop_dict[p] + def UpdateSensor(self,value,units,path = None): + self.initSensorEntry(path) + self.sensor_cache[path]['value'] = value + self.sensor_cache[path]['units'] = units @dbus.service.signal(DBUS_NAME) def CriticalThreshold(self, path = None): @@ -68,10 +67,6 @@ class SensorManager(dbus.service.Object): def initSensorEntry(self,path): if (self.sensor_cache.has_key(path) == False): self.sensor_cache[path] = {} - obj = bus.get_object(Openbmc.object_to_bus_name(path),path) - intf = dbus.Interface(obj,'org.freedesktop.DBus.Properties') - self.sensor_cache[path]['units'] = intf.Get('org.openbmc.SensorValue','units') - if __name__ == '__main__': diff --git a/bin/system_manager.py b/bin/system_manager.py index e96e547..cb37c41 100644 --- a/bin/system_manager.py +++ b/bin/system_manager.py @@ -3,13 +3,14 @@ import sys import subprocess from gi.repository import GObject - import dbus import dbus.service import dbus.mainloop.glib import os import PropertyManager +import Openbmc + if (len(sys.argv) < 2): print "Usage: system_manager.py [system name]" exit(1) @@ -25,15 +26,15 @@ HEARTBEAT_CHECK_INTERVAL = 20000 class SystemManager(dbus.service.Object): def __init__(self,bus,name): dbus.service.Object.__init__(self,bus,name) - self.property_manager = PropertyManager.PropertyManager(bus,System.CACHE_PATH) + ## Signal handlers bus.add_signal_receiver(self.NewBusHandler, dbus_interface = 'org.freedesktop.DBus', signal_name = "NameOwnerChanged") bus.add_signal_receiver(self.CacheMeHandler, signal_name = 'CacheMe', path_keyword='path',interface_keyword='interface') - + bus.add_signal_receiver(self.HeartbeatHandler, signal_name = "Heartbeat") try: # launch dbus object processes @@ -43,8 +44,9 @@ class SystemManager(dbus.service.Object): ## TODO: error handling pass - bus.add_signal_receiver(self.HeartbeatHandler, signal_name = "Heartbeat") + ## Add poll for heartbeat GObject.timeout_add(HEARTBEAT_CHECK_INTERVAL, self.heartbeat_check) + def CacheMeHandler(self,busname,path=None,interface=None): #interface_name = 'org.openbmc.Fru' @@ -115,15 +117,21 @@ class SystemManager(dbus.service.Object): obj_path = obj_root+'/'+instance['name'] obj_paths.append(obj_path) if (instance.has_key('properties')): + print "load props: "+obj_path self.property_manager.loadProperties(bus_name,obj_path, instance['properties']) + ## scan all used interfaces and get interfaces with init method + + ## After object properties are setup, call init method if requested - if (System.SYSTEM_CONFIG[bus_name].has_key('init_methods')): - for obj_path in obj_paths: - for init_interface in System.SYSTEM_CONFIG[bus_name]['init_methods']: - obj = bus.get_object(bus_name,obj_path) - intf = dbus.Interface(obj,init_interface) - print "calling init:" +init_interface + #if (System.SYSTEM_CONFIG[bus_name].has_key('init_methods')): + for obj_path in obj_paths: + obj = bus.get_object(bus_name,obj_path) + methods = Openbmc.get_methods(obj) + for intf_name in methods.keys(): + if (methods[intf_name].has_key('init')): + intf = dbus.Interface(obj,intf_name) + print "Calling init: " +intf_name intf.init() diff --git a/includes/openbmc.h b/includes/openbmc.h index e9d17b8..fa65e0e 100644 --- a/includes/openbmc.h +++ b/includes/openbmc.h @@ -7,8 +7,10 @@ #define GET_VARIANT(v) g_variant_get_variant(v) #define GET_VARIANT_D(v) g_variant_get_double(g_variant_get_variant(v)) #define GET_VARIANT_U(v) g_variant_get_uint32(g_variant_get_variant(v)) +#define GET_VARIANT_B(v) g_variant_get_byte(g_variant_get_variant(v)) #define NEW_VARIANT_D(v) g_variant_new_variant(g_variant_new_double(v)) #define NEW_VARIANT_U(v) g_variant_new_variant(g_variant_new_uint32(v)) +#define NEW_VARIANT_B(v) g_variant_new_variant(g_variant_new_byte(v)) #define VARIANT_COMPARE(x,y) g_variant_compare(GET_VARIANT(x),GET_VARIANT(y)) diff --git a/interfaces/control.c b/interfaces/control.c index 3eab9e1..b7eba40 100644 --- a/interfaces/control.c +++ b/interfaces/control.c @@ -163,39 +163,22 @@ _g_value_equal (const GValue *a, const GValue *b) /* ---- Introspection data for org.openbmc.Control ---- */ -static const _ExtendedGDBusArgInfo _control_method_info_set_poll_interval_IN_ARG_poll_interval = +static const _ExtendedGDBusMethodInfo _control_method_info_init = { { -1, - (gchar *) "poll_interval", - (gchar *) "i", - NULL - }, - FALSE -}; - -static const _ExtendedGDBusArgInfo * const _control_method_info_set_poll_interval_IN_ARG_pointers[] = -{ - &_control_method_info_set_poll_interval_IN_ARG_poll_interval, - NULL -}; - -static const _ExtendedGDBusMethodInfo _control_method_info_set_poll_interval = -{ - { - -1, - (gchar *) "setPollInterval", - (GDBusArgInfo **) &_control_method_info_set_poll_interval_IN_ARG_pointers, + (gchar *) "init", + NULL, NULL, NULL }, - "handle-set-poll-interval", + "handle-init", FALSE }; static const _ExtendedGDBusMethodInfo * const _control_method_info_pointers[] = { - &_control_method_info_set_poll_interval, + &_control_method_info_init, NULL }; @@ -239,7 +222,7 @@ static const _ExtendedGDBusPropertyInfo _control_property_info_poll_interval = -1, (gchar *) "poll_interval", (gchar *) "i", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL }, "poll-interval", @@ -322,7 +305,7 @@ control_override_properties (GObjectClass *klass, guint property_id_begin) /** * ControlIface: * @parent_iface: The parent interface. - * @handle_set_poll_interval: Handler for the #Control::handle-set-poll-interval signal. + * @handle_init: Handler for the #Control::handle-init signal. * @get_heatbeat: Getter for the #Control:heatbeat property. * @get_poll_interval: Getter for the #Control:poll-interval property. * @heartbeat: Handler for the #Control::heartbeat signal. @@ -338,27 +321,26 @@ control_default_init (ControlIface *iface) { /* GObject signals for incoming D-Bus method calls: */ /** - * Control::handle-set-poll-interval: + * Control::handle-init: * @object: A #Control. * @invocation: A #GDBusMethodInvocation. - * @arg_poll_interval: Argument passed by remote caller. * - * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Control.setPollInterval">setPollInterval()</link> D-Bus method. + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method. * - * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call control_complete_set_poll_interval() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call control_complete_init() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. * * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. */ - g_signal_new ("handle-set-poll-interval", + g_signal_new ("handle-init", G_TYPE_FROM_INTERFACE (iface), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ControlIface, handle_set_poll_interval), + G_STRUCT_OFFSET (ControlIface, handle_init), g_signal_accumulator_true_handled, NULL, g_cclosure_marshal_generic, G_TYPE_BOOLEAN, - 2, - G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT); + 1, + G_TYPE_DBUS_METHOD_INVOCATION); /* GObject signals for received D-Bus signals: */ /** @@ -386,7 +368,7 @@ control_default_init (ControlIface *iface) * * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link>. * - * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. */ g_object_interface_install_property (iface, g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); @@ -407,7 +389,7 @@ control_default_init (ControlIface *iface) * * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property. * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. * * Returns: The property value. */ @@ -424,7 +406,7 @@ control_get_poll_interval (Control *object) * * Sets the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property to @value. * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. */ void control_set_poll_interval (Control *object, gint value) @@ -479,31 +461,28 @@ control_emit_heartbeat ( } /** - * control_call_set_poll_interval: + * control_call_init: * @proxy: A #ControlProxy. - * @arg_poll_interval: Argument to pass with the method invocation. * @cancellable: (allow-none): A #GCancellable or %NULL. * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. * @user_data: User data to pass to @callback. * - * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.setPollInterval">setPollInterval()</link> D-Bus method on @proxy. + * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy. * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. - * You can then call control_call_set_poll_interval_finish() to get the result of the operation. + * You can then call control_call_init_finish() to get the result of the operation. * - * See control_call_set_poll_interval_sync() for the synchronous, blocking version of this method. + * See control_call_init_sync() for the synchronous, blocking version of this method. */ void -control_call_set_poll_interval ( +control_call_init ( Control *proxy, - gint arg_poll_interval, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_dbus_proxy_call (G_DBUS_PROXY (proxy), - "setPollInterval", - g_variant_new ("(i)", - arg_poll_interval), + "init", + g_variant_new ("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, @@ -512,17 +491,17 @@ control_call_set_poll_interval ( } /** - * control_call_set_poll_interval_finish: + * control_call_init_finish: * @proxy: A #ControlProxy. - * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_call_set_poll_interval(). + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_call_init(). * @error: Return location for error or %NULL. * - * Finishes an operation started with control_call_set_poll_interval(). + * Finishes an operation started with control_call_init(). * * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. */ gboolean -control_call_set_poll_interval_finish ( +control_call_init_finish ( Control *proxy, GAsyncResult *res, GError **error) @@ -539,30 +518,27 @@ _out: } /** - * control_call_set_poll_interval_sync: + * control_call_init_sync: * @proxy: A #ControlProxy. - * @arg_poll_interval: Argument to pass with the method invocation. * @cancellable: (allow-none): A #GCancellable or %NULL. * @error: Return location for error or %NULL. * - * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.setPollInterval">setPollInterval()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. * - * See control_call_set_poll_interval() for the asynchronous version of this method. + * See control_call_init() for the asynchronous version of this method. * * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. */ gboolean -control_call_set_poll_interval_sync ( +control_call_init_sync ( Control *proxy, - gint arg_poll_interval, GCancellable *cancellable, GError **error) { GVariant *_ret; _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), - "setPollInterval", - g_variant_new ("(i)", - arg_poll_interval), + "init", + g_variant_new ("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, @@ -577,16 +553,16 @@ _out: } /** - * control_complete_set_poll_interval: + * control_complete_init: * @object: A #Control. * @invocation: (transfer full): A #GDBusMethodInvocation. * - * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Control.setPollInterval">setPollInterval()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. * * This method will free @invocation, you cannot use it afterwards. */ void -control_complete_set_poll_interval ( +control_complete_init ( Control *object, GDBusMethodInvocation *invocation) { diff --git a/interfaces/control.h b/interfaces/control.h index aaed8cb..78c7bd5 100644 --- a/interfaces/control.h +++ b/interfaces/control.h @@ -30,10 +30,9 @@ struct _ControlIface - gboolean (*handle_set_poll_interval) ( + gboolean (*handle_init) ( Control *object, - GDBusMethodInvocation *invocation, - gint arg_poll_interval); + GDBusMethodInvocation *invocation); gint (*get_heatbeat) (Control *object); @@ -52,7 +51,7 @@ guint control_override_properties (GObjectClass *klass, guint property_id_begin) /* D-Bus method call completion functions: */ -void control_complete_set_poll_interval ( +void control_complete_init ( Control *object, GDBusMethodInvocation *invocation); @@ -66,21 +65,19 @@ void control_emit_heartbeat ( /* D-Bus method calls: */ -void control_call_set_poll_interval ( +void control_call_init ( Control *proxy, - gint arg_poll_interval, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); -gboolean control_call_set_poll_interval_finish ( +gboolean control_call_init_finish ( Control *proxy, GAsyncResult *res, GError **error); -gboolean control_call_set_poll_interval_sync ( +gboolean control_call_init_sync ( Control *proxy, - gint arg_poll_interval, GCancellable *cancellable, GError **error); diff --git a/interfaces/sensor.c b/interfaces/sensor.c index bb80fd0..94ab510 100644 --- a/interfaces/sensor.c +++ b/interfaces/sensor.c @@ -325,7 +325,7 @@ static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_value = -1, (gchar *) "value", (gchar *) "v", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "value", @@ -351,7 +351,7 @@ static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_poll_interva -1, (gchar *) "poll_interval", (gchar *) "i", - G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL }, "poll-interval", @@ -371,12 +371,26 @@ static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_heatbeat = FALSE }; +static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_settable = +{ + { + -1, + (gchar *) "settable", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "settable", + FALSE +}; + static const _ExtendedGDBusPropertyInfo * const _sensor_value_property_info_pointers[] = { &_sensor_value_property_info_value, &_sensor_value_property_info_units, &_sensor_value_property_info_poll_interval, &_sensor_value_property_info_heatbeat, + &_sensor_value_property_info_settable, NULL }; @@ -424,6 +438,7 @@ sensor_value_override_properties (GObjectClass *klass, guint property_id_begin) g_object_class_override_property (klass, property_id_begin++, "units"); g_object_class_override_property (klass, property_id_begin++, "poll-interval"); g_object_class_override_property (klass, property_id_begin++, "heatbeat"); + g_object_class_override_property (klass, property_id_begin++, "settable"); return property_id_begin - 1; } @@ -443,6 +458,7 @@ sensor_value_override_properties (GObjectClass *klass, guint property_id_begin) * @handle_set_value: Handler for the #SensorValue::handle-set-value signal. * @get_heatbeat: Getter for the #SensorValue:heatbeat property. * @get_poll_interval: Getter for the #SensorValue:poll-interval property. + * @get_settable: Getter for the #SensorValue:settable property. * @get_units: Getter for the #SensorValue:units property. * @get_value: Getter for the #SensorValue:value property. * @changed: Handler for the #SensorValue::changed signal. @@ -571,7 +587,7 @@ sensor_value_default_init (SensorValueIface *iface) * * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link>. * - * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. */ g_object_interface_install_property (iface, g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); @@ -589,7 +605,7 @@ sensor_value_default_init (SensorValueIface *iface) * * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link>. * - * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. */ g_object_interface_install_property (iface, g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); @@ -602,6 +618,15 @@ sensor_value_default_init (SensorValueIface *iface) */ g_object_interface_install_property (iface, g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * SensorValue:settable: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("settable", "settable", "settable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); } /** @@ -610,7 +635,7 @@ sensor_value_default_init (SensorValueIface *iface) * * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property. * - * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_value_dup_value() if on another thread.</warning> * @@ -628,7 +653,7 @@ sensor_value_get_value (SensorValue *object) * * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property. * - * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. * * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). */ @@ -647,7 +672,7 @@ sensor_value_dup_value (SensorValue *object) * * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property to @value. * - * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. */ void sensor_value_set_value (SensorValue *object, GVariant *value) @@ -712,7 +737,7 @@ sensor_value_set_units (SensorValue *object, const gchar *value) * * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property. * - * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. * * Returns: The property value. */ @@ -729,7 +754,7 @@ sensor_value_get_poll_interval (SensorValue *object) * * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property to @value. * - * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. */ void sensor_value_set_poll_interval (SensorValue *object, gint value) @@ -769,6 +794,37 @@ sensor_value_set_heatbeat (SensorValue *object, gint value) } /** + * sensor_value_get_settable: (skip) + * @object: A #SensorValue. + * + * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +sensor_value_get_settable (SensorValue *object) +{ + return SENSOR_VALUE_GET_IFACE (object)->get_settable (object); +} + +/** + * sensor_value_set_settable: (skip) + * @object: A #SensorValue. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +sensor_value_set_settable (SensorValue *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "settable", value, NULL); +} + +/** * sensor_value_emit_changed: * @object: A #SensorValue. * @arg_value: Argument to pass with the signal. @@ -1193,7 +1249,7 @@ sensor_value_proxy_get_property (GObject *object, { const _ExtendedGDBusPropertyInfo *info; GVariant *variant; - g_assert (prop_id != 0 && prop_id - 1 < 4); + g_assert (prop_id != 0 && prop_id - 1 < 5); info = _sensor_value_property_info_pointers[prop_id - 1]; variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); if (info->use_gvariant) @@ -1240,7 +1296,7 @@ sensor_value_proxy_set_property (GObject *object, { const _ExtendedGDBusPropertyInfo *info; GVariant *variant; - g_assert (prop_id != 0 && prop_id - 1 < 4); + g_assert (prop_id != 0 && prop_id - 1 < 5); info = _sensor_value_property_info_pointers[prop_id - 1]; variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); g_dbus_proxy_call (G_DBUS_PROXY (object), @@ -1380,6 +1436,21 @@ sensor_value_proxy_get_heatbeat (SensorValue *object) return value; } +static gboolean +sensor_value_proxy_get_settable (SensorValue *object) +{ + SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "settable"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + static void sensor_value_proxy_init (SensorValueProxy *proxy) { @@ -1421,6 +1492,7 @@ sensor_value_proxy_iface_init (SensorValueIface *iface) iface->get_units = sensor_value_proxy_get_units; iface->get_poll_interval = sensor_value_proxy_get_poll_interval; iface->get_heatbeat = sensor_value_proxy_get_heatbeat; + iface->get_settable = sensor_value_proxy_get_settable; } /** @@ -1897,7 +1969,7 @@ sensor_value_skeleton_finalize (GObject *object) { SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); guint n; - for (n = 0; n < 4; n++) + for (n = 0; n < 5; n++) g_value_unset (&skeleton->priv->properties[n]); g_free (skeleton->priv->properties); g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); @@ -1915,7 +1987,7 @@ sensor_value_skeleton_get_property (GObject *object, GParamSpec *pspec G_GNUC_UNUSED) { SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); - g_assert (prop_id != 0 && prop_id - 1 < 4); + g_assert (prop_id != 0 && prop_id - 1 < 5); g_mutex_lock (&skeleton->priv->lock); g_value_copy (&skeleton->priv->properties[prop_id - 1], value); g_mutex_unlock (&skeleton->priv->lock); @@ -2032,7 +2104,7 @@ sensor_value_skeleton_set_property (GObject *object, GParamSpec *pspec) { SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); - g_assert (prop_id != 0 && prop_id - 1 < 4); + g_assert (prop_id != 0 && prop_id - 1 < 5); g_mutex_lock (&skeleton->priv->lock); g_object_freeze_notify (object); if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) @@ -2057,11 +2129,12 @@ sensor_value_skeleton_init (SensorValueSkeleton *skeleton) g_mutex_init (&skeleton->priv->lock); skeleton->priv->context = g_main_context_ref_thread_default (); - skeleton->priv->properties = g_new0 (GValue, 4); + skeleton->priv->properties = g_new0 (GValue, 5); g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT); g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); g_value_init (&skeleton->priv->properties[2], G_TYPE_INT); g_value_init (&skeleton->priv->properties[3], G_TYPE_INT); + g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN); } static GVariant * @@ -2108,6 +2181,17 @@ sensor_value_skeleton_get_heatbeat (SensorValue *object) return value; } +static gboolean +sensor_value_skeleton_get_settable (SensorValue *object) +{ + SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[4])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + static void sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass) { @@ -2143,6 +2227,7 @@ sensor_value_skeleton_iface_init (SensorValueIface *iface) iface->get_units = sensor_value_skeleton_get_units; iface->get_poll_interval = sensor_value_skeleton_get_poll_interval; iface->get_heatbeat = sensor_value_skeleton_get_heatbeat; + iface->get_settable = sensor_value_skeleton_get_settable; } /** @@ -5120,6 +5205,1223 @@ sensor_i2c_skeleton_new (void) } /* ------------------------------------------------------------------------ + * Code for interface org.openbmc.SensorMatch + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:SensorMatch + * @title: SensorMatch + * @short_description: Generated C code for the org.openbmc.SensorMatch D-Bus interface + * + * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface in C. + */ + +/* ---- Introspection data for org.openbmc.SensorMatch ---- */ + +static const _ExtendedGDBusArgInfo _sensor_match_signal_info_sensor_match_ARG_state = +{ + { + -1, + (gchar *) "state", + (gchar *) "y", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _sensor_match_signal_info_sensor_match_ARG_pointers[] = +{ + &_sensor_match_signal_info_sensor_match_ARG_state, + NULL +}; + +static const _ExtendedGDBusSignalInfo _sensor_match_signal_info_sensor_match = +{ + { + -1, + (gchar *) "SensorMatch", + (GDBusArgInfo **) &_sensor_match_signal_info_sensor_match_ARG_pointers, + NULL + }, + "sensor-match" +}; + +static const _ExtendedGDBusSignalInfo * const _sensor_match_signal_info_pointers[] = +{ + &_sensor_match_signal_info_sensor_match, + NULL +}; + +static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_match_value = +{ + { + -1, + (gchar *) "match_value", + (gchar *) "v", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "match-value", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_state = +{ + { + -1, + (gchar *) "state", + (gchar *) "y", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "state", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo * const _sensor_match_property_info_pointers[] = +{ + &_sensor_match_property_info_match_value, + &_sensor_match_property_info_state, + NULL +}; + +static const _ExtendedGDBusInterfaceInfo _sensor_match_interface_info = +{ + { + -1, + (gchar *) "org.openbmc.SensorMatch", + NULL, + (GDBusSignalInfo **) &_sensor_match_signal_info_pointers, + (GDBusPropertyInfo **) &_sensor_match_property_info_pointers, + NULL + }, + "sensor-match", +}; + + +/** + * sensor_match_interface_info: + * + * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * +sensor_match_interface_info (void) +{ + return (GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct; +} + +/** + * sensor_match_override_properties: + * @klass: The class structure for a #GObject<!-- -->-derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #SensorMatch interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint +sensor_match_override_properties (GObjectClass *klass, guint property_id_begin) +{ + g_object_class_override_property (klass, property_id_begin++, "match-value"); + g_object_class_override_property (klass, property_id_begin++, "state"); + return property_id_begin - 1; +} + + + +/** + * SensorMatch: + * + * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. + */ + +/** + * SensorMatchIface: + * @parent_iface: The parent interface. + * @get_match_value: Getter for the #SensorMatch:match-value property. + * @get_state: Getter for the #SensorMatch:state property. + * @sensor_match: Handler for the #SensorMatch::sensor-match signal. + * + * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. + */ + +typedef SensorMatchIface SensorMatchInterface; +G_DEFINE_INTERFACE (SensorMatch, sensor_match, G_TYPE_OBJECT); + +static void +sensor_match_default_init (SensorMatchIface *iface) +{ + /* GObject signals for received D-Bus signals: */ + /** + * SensorMatch::sensor-match: + * @object: A #SensorMatch. + * @arg_state: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("sensor-match", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (SensorMatchIface, sensor_match), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 1, G_TYPE_UCHAR); + + /* GObject properties for D-Bus properties: */ + /** + * SensorMatch:match-value: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_variant ("match-value", "match_value", "match_value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * SensorMatch:state: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +/** + * sensor_match_get_match_value: (skip) + * @object: A #SensorMatch. + * + * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_match_dup_match_value() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +GVariant * +sensor_match_get_match_value (SensorMatch *object) +{ + return SENSOR_MATCH_GET_IFACE (object)->get_match_value (object); +} + +/** + * sensor_match_dup_match_value: (skip) + * @object: A #SensorMatch. + * + * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref(). + */ +GVariant * +sensor_match_dup_match_value (SensorMatch *object) +{ + GVariant *value; + g_object_get (G_OBJECT (object), "match-value", &value, NULL); + return value; +} + +/** + * sensor_match_set_match_value: (skip) + * @object: A #SensorMatch. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +sensor_match_set_match_value (SensorMatch *object, GVariant *value) +{ + g_object_set (G_OBJECT (object), "match-value", value, NULL); +} + +/** + * sensor_match_get_state: (skip) + * @object: A #SensorMatch. + * + * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +guchar +sensor_match_get_state (SensorMatch *object) +{ + return SENSOR_MATCH_GET_IFACE (object)->get_state (object); +} + +/** + * sensor_match_set_state: (skip) + * @object: A #SensorMatch. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +sensor_match_set_state (SensorMatch *object, guchar value) +{ + g_object_set (G_OBJECT (object), "state", value, NULL); +} + +/** + * sensor_match_emit_sensor_match: + * @object: A #SensorMatch. + * @arg_state: Argument to pass with the signal. + * + * Emits the <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> D-Bus signal. + */ +void +sensor_match_emit_sensor_match ( + SensorMatch *object, + guchar arg_state) +{ + g_signal_emit_by_name (object, "sensor-match", arg_state); +} + +/* ------------------------------------------------------------------------ */ + +/** + * SensorMatchProxy: + * + * The #SensorMatchProxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * SensorMatchProxyClass: + * @parent_class: The parent class. + * + * Class structure for #SensorMatchProxy. + */ + +struct _SensorMatchProxyPrivate +{ + GData *qdata; +}; + +static void sensor_match_proxy_iface_init (SensorMatchIface *iface); + +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY, + G_ADD_PRIVATE (SensorMatchProxy) + G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init)); + +#else +G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init)); + +#endif +static void +sensor_match_proxy_finalize (GObject *object) +{ + SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object); + g_datalist_clear (&proxy->priv->qdata); + G_OBJECT_CLASS (sensor_match_proxy_parent_class)->finalize (object); +} + +static void +sensor_match_proxy_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 2); + info = _sensor_match_property_info_pointers[prop_id - 1]; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); + if (info->use_gvariant) + { + g_value_set_variant (value, variant); + } + else + { + if (variant != NULL) + g_dbus_gvariant_to_gvalue (variant, value); + } + if (variant != NULL) + g_variant_unref (variant); +} + +static void +sensor_match_proxy_set_property_cb (GDBusProxy *proxy, + GAsyncResult *res, + gpointer user_data) +{ + const _ExtendedGDBusPropertyInfo *info = user_data; + GError *error; + GVariant *_ret; + error = NULL; + _ret = g_dbus_proxy_call_finish (proxy, res, &error); + if (!_ret) + { + g_warning ("Error setting property '%s' on interface org.openbmc.SensorMatch: %s (%s, %d)", + info->parent_struct.name, + error->message, g_quark_to_string (error->domain), error->code); + g_error_free (error); + } + else + { + g_variant_unref (_ret); + } +} + +static void +sensor_match_proxy_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 2); + info = _sensor_match_property_info_pointers[prop_id - 1]; + variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_dbus_proxy_call (G_DBUS_PROXY (object), + "org.freedesktop.DBus.Properties.Set", + g_variant_new ("(ssv)", "org.openbmc.SensorMatch", info->parent_struct.name, variant), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, (GAsyncReadyCallback) sensor_match_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); + g_variant_unref (variant); +} + +static void +sensor_match_proxy_g_signal (GDBusProxy *proxy, + const gchar *sender_name G_GNUC_UNUSED, + const gchar *signal_name, + GVariant *parameters) +{ + _ExtendedGDBusSignalInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children (parameters); + paramv = g_new0 (GValue, num_params + 1); + g_value_init (¶mv[0], TYPE_SENSOR_MATCH); + g_value_set_object (¶mv[0], proxy); + g_variant_iter_init (&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH); + g_signal_emitv (paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static void +sensor_match_proxy_g_properties_changed (GDBusProxy *_proxy, + GVariant *changed_properties, + const gchar *const *invalidated_properties) +{ + SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (_proxy); + guint n; + const gchar *key; + GVariantIter *iter; + _ExtendedGDBusPropertyInfo *info; + g_variant_get (changed_properties, "a{sv}", &iter); + while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, key); + g_datalist_remove_data (&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } + g_variant_iter_free (iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, invalidated_properties[n]); + g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } +} + +static GVariant * +sensor_match_proxy_get_match_value (SensorMatch *object) +{ + SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object); + GVariant *variant; + GVariant *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "match_value"); + value = variant; + if (variant != NULL) + g_variant_unref (variant); + return value; +} + +static guchar +sensor_match_proxy_get_state (SensorMatch *object) +{ + SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object); + GVariant *variant; + guchar value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state"); + if (variant != NULL) + { + value = g_variant_get_byte (variant); + g_variant_unref (variant); + } + return value; +} + +static void +sensor_match_proxy_init (SensorMatchProxy *proxy) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + proxy->priv = sensor_match_proxy_get_instance_private (proxy); +#else + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyPrivate); +#endif + + g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_match_interface_info ()); +} + +static void +sensor_match_proxy_class_init (SensorMatchProxyClass *klass) +{ + GObjectClass *gobject_class; + GDBusProxyClass *proxy_class; + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = sensor_match_proxy_finalize; + gobject_class->get_property = sensor_match_proxy_get_property; + gobject_class->set_property = sensor_match_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS (klass); + proxy_class->g_signal = sensor_match_proxy_g_signal; + proxy_class->g_properties_changed = sensor_match_proxy_g_properties_changed; + + sensor_match_override_properties (gobject_class, 1); + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private (klass, sizeof (SensorMatchProxyPrivate)); +#endif +} + +static void +sensor_match_proxy_iface_init (SensorMatchIface *iface) +{ + iface->get_match_value = sensor_match_proxy_get_match_value; + iface->get_state = sensor_match_proxy_get_state; +} + +/** + * sensor_match_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. See g_dbus_proxy_new() for more details. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call sensor_match_proxy_new_finish() to get the result of the operation. + * + * See sensor_match_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void +sensor_match_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_SENSOR_MATCH_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL); +} + +/** + * sensor_match_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with sensor_match_proxy_new(). + * + * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. + */ +SensorMatch * +sensor_match_proxy_new_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return SENSOR_MATCH (ret); + else + return NULL; +} + +/** + * sensor_match_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. See g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See sensor_match_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. + */ +SensorMatch * +sensor_match_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_SENSOR_MATCH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL); + if (ret != NULL) + return SENSOR_MATCH (ret); + else + return NULL; +} + + +/** + * sensor_match_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like sensor_match_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call sensor_match_proxy_new_for_bus_finish() to get the result of the operation. + * + * See sensor_match_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void +sensor_match_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_SENSOR_MATCH_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL); +} + +/** + * sensor_match_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with sensor_match_proxy_new_for_bus(). + * + * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. + */ +SensorMatch * +sensor_match_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return SENSOR_MATCH (ret); + else + return NULL; +} + +/** + * sensor_match_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like sensor_match_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See sensor_match_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set. + */ +SensorMatch * +sensor_match_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_SENSOR_MATCH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL); + if (ret != NULL) + return SENSOR_MATCH (ret); + else + return NULL; +} + + +/* ------------------------------------------------------------------------ */ + +/** + * SensorMatchSkeleton: + * + * The #SensorMatchSkeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * SensorMatchSkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #SensorMatchSkeleton. + */ + +struct _SensorMatchSkeletonPrivate +{ + GValue *properties; + GList *changed_properties; + GSource *changed_properties_idle_source; + GMainContext *context; + GMutex lock; +}; + +static void +_sensor_match_skeleton_handle_method_call ( + GDBusConnection *connection G_GNUC_UNUSED, + const gchar *sender G_GNUC_UNUSED, + const gchar *object_path G_GNUC_UNUSED, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); + _ExtendedGDBusMethodInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint num_extra; + guint n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); + g_assert (info != NULL); + num_params = g_variant_n_children (parameters); + num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); + n = 0; + g_value_init (¶mv[n], TYPE_SENSOR_MATCH); + g_value_set_object (¶mv[n++], skeleton); + g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object (¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); +#else + g_assert_not_reached (); +#endif + } + g_variant_iter_init (&iter, parameters); + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH); + g_value_init (&return_value, G_TYPE_BOOLEAN); + g_signal_emitv (paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean (&return_value)) + g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name); + g_value_unset (&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static GVariant * +_sensor_match_skeleton_handle_get_property ( + GDBusConnection *connection G_GNUC_UNUSED, + const gchar *sender G_GNUC_UNUSED, + const gchar *object_path G_GNUC_UNUSED, + const gchar *interface_name G_GNUC_UNUSED, + const gchar *property_name, + GError **error, + gpointer user_data) +{ + SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + GVariant *ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init (&value, pspec->value_type); + g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_value_unset (&value); + } + return ret; +} + +static gboolean +_sensor_match_skeleton_handle_set_property ( + GDBusConnection *connection G_GNUC_UNUSED, + const gchar *sender G_GNUC_UNUSED, + const gchar *object_path G_GNUC_UNUSED, + const gchar *interface_name G_GNUC_UNUSED, + const gchar *property_name, + GVariant *variant, + GError **error, + gpointer user_data) +{ + SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant (&value, variant); + else + g_dbus_gvariant_to_gvalue (variant, &value); + g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); + g_value_unset (&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _sensor_match_skeleton_vtable = +{ + _sensor_match_skeleton_handle_method_call, + _sensor_match_skeleton_handle_get_property, + _sensor_match_skeleton_handle_set_property, + {NULL} +}; + +static GDBusInterfaceInfo * +sensor_match_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) +{ + return sensor_match_interface_info (); +} + +static GDBusInterfaceVTable * +sensor_match_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) +{ + return (GDBusInterfaceVTable *) &_sensor_match_skeleton_vtable; +} + +static GVariant * +sensor_match_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) +{ + SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + if (_sensor_match_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _sensor_match_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo *info = _sensor_match_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant *value; + value = _sensor_match_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", info->name, NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref (value); + g_variant_builder_add (&builder, "{sv}", info->name, value); + g_variant_unref (value); + } + } + } +out: + return g_variant_builder_end (&builder); +} + +static gboolean _sensor_match_emit_changed (gpointer user_data); + +static void +sensor_match_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) +{ + SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton); + gboolean emit_changed = FALSE; + + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties_idle_source != NULL) + { + g_source_destroy (skeleton->priv->changed_properties_idle_source); + skeleton->priv->changed_properties_idle_source = NULL; + emit_changed = TRUE; + } + g_mutex_unlock (&skeleton->priv->lock); + + if (emit_changed) + _sensor_match_emit_changed (skeleton); +} + +static void +_sensor_match_on_signal_sensor_match ( + SensorMatch *object, + guchar arg_state) +{ + SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("(y)", + arg_state)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", "SensorMatch", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void sensor_match_skeleton_iface_init (SensorMatchIface *iface); +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_ADD_PRIVATE (SensorMatchSkeleton) + G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init)); + +#else +G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init)); + +#endif +static void +sensor_match_skeleton_finalize (GObject *object) +{ + SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); + guint n; + for (n = 0; n < 2; n++) + g_value_unset (&skeleton->priv->properties[n]); + g_free (skeleton->priv->properties); + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy (skeleton->priv->changed_properties_idle_source); + g_main_context_unref (skeleton->priv->context); + g_mutex_clear (&skeleton->priv->lock); + G_OBJECT_CLASS (sensor_match_skeleton_parent_class)->finalize (object); +} + +static void +sensor_match_skeleton_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ + SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 2); + g_mutex_lock (&skeleton->priv->lock); + g_value_copy (&skeleton->priv->properties[prop_id - 1], value); + g_mutex_unlock (&skeleton->priv->lock); +} + +static gboolean +_sensor_match_emit_changed (gpointer user_data) +{ + SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data); + GList *l; + GVariantBuilder builder; + GVariantBuilder invalidated_builder; + guint num_changes; + + g_mutex_lock (&skeleton->priv->lock); + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); + for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) + { + ChangedProperty *cp = l->data; + GVariant *variant; + const GValue *cur_value; + + cur_value = &skeleton->priv->properties[cp->prop_id - 1]; + if (!_g_value_equal (cur_value, &cp->orig_value)) + { + variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); + g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); + g_variant_unref (variant); + num_changes++; + } + } + if (num_changes > 0) + { + GList *connections, *ll; + GVariant *signal_variant; + signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorMatch", + &builder, &invalidated_builder)); + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + for (ll = connections; ll != NULL; ll = ll->next) + { + GDBusConnection *connection = ll->data; + + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + signal_variant, + NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); + } + else + { + g_variant_builder_clear (&builder); + g_variant_builder_clear (&invalidated_builder); + } + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + skeleton->priv->changed_properties = NULL; + skeleton->priv->changed_properties_idle_source = NULL; + g_mutex_unlock (&skeleton->priv->lock); + return FALSE; +} + +static void +_sensor_match_schedule_emit_changed (SensorMatchSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) +{ + ChangedProperty *cp; + GList *l; + cp = NULL; + for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) + { + ChangedProperty *i_cp = l->data; + if (i_cp->info == info) + { + cp = i_cp; + break; + } + } + if (cp == NULL) + { + cp = g_new0 (ChangedProperty, 1); + cp->prop_id = prop_id; + cp->info = info; + skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); + g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); + g_value_copy (orig_value, &cp->orig_value); + } +} + +static void +sensor_match_skeleton_notify (GObject *object, + GParamSpec *pspec G_GNUC_UNUSED) +{ + SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties != NULL && + skeleton->priv->changed_properties_idle_source == NULL) + { + skeleton->priv->changed_properties_idle_source = g_idle_source_new (); + g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); + g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_match_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); + g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); + g_source_unref (skeleton->priv->changed_properties_idle_source); + } + g_mutex_unlock (&skeleton->priv->lock); +} + +static void +sensor_match_skeleton_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 2); + g_mutex_lock (&skeleton->priv->lock); + g_object_freeze_notify (object); + if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) + { + if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) + _sensor_match_schedule_emit_changed (skeleton, _sensor_match_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); + g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); + g_object_notify_by_pspec (object, pspec); + } + g_mutex_unlock (&skeleton->priv->lock); + g_object_thaw_notify (object); +} + +static void +sensor_match_skeleton_init (SensorMatchSkeleton *skeleton) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + skeleton->priv = sensor_match_skeleton_get_instance_private (skeleton); +#else + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonPrivate); +#endif + + g_mutex_init (&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default (); + skeleton->priv->properties = g_new0 (GValue, 2); + g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT); + g_value_init (&skeleton->priv->properties[1], G_TYPE_UCHAR); +} + +static GVariant * +sensor_match_skeleton_get_match_value (SensorMatch *object) +{ + SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); + GVariant *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_variant (&(skeleton->priv->properties[0])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static guchar +sensor_match_skeleton_get_state (SensorMatch *object) +{ + SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object); + guchar value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_uchar (&(skeleton->priv->properties[1])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static void +sensor_match_skeleton_class_init (SensorMatchSkeletonClass *klass) +{ + GObjectClass *gobject_class; + GDBusInterfaceSkeletonClass *skeleton_class; + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = sensor_match_skeleton_finalize; + gobject_class->get_property = sensor_match_skeleton_get_property; + gobject_class->set_property = sensor_match_skeleton_set_property; + gobject_class->notify = sensor_match_skeleton_notify; + + + sensor_match_override_properties (gobject_class, 1); + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); + skeleton_class->get_info = sensor_match_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = sensor_match_skeleton_dbus_interface_get_properties; + skeleton_class->flush = sensor_match_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = sensor_match_skeleton_dbus_interface_get_vtable; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private (klass, sizeof (SensorMatchSkeletonPrivate)); +#endif +} + +static void +sensor_match_skeleton_iface_init (SensorMatchIface *iface) +{ + iface->sensor_match = _sensor_match_on_signal_sensor_match; + iface->get_match_value = sensor_match_skeleton_get_match_value; + iface->get_state = sensor_match_skeleton_get_state; +} + +/** + * sensor_match_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. + * + * Returns: (transfer full) (type SensorMatchSkeleton): The skeleton object. + */ +SensorMatch * +sensor_match_skeleton_new (void) +{ + return SENSOR_MATCH (g_object_new (TYPE_SENSOR_MATCH_SKELETON, NULL)); +} + +/* ------------------------------------------------------------------------ * Code for Object, ObjectProxy and ObjectSkeleton * ------------------------------------------------------------------------ */ @@ -5178,6 +6480,15 @@ object_default_init (ObjectIface *iface) */ g_object_interface_install_property (iface, g_param_spec_object ("sensor-i2c", "sensor-i2c", "sensor-i2c", TYPE_SENSOR_I2C, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); + /** + * Object:sensor-match: + * + * The #SensorMatch instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>, if any. + * + * Connect to the #GObject::notify signal to get informed of property changes. + */ + g_object_interface_install_property (iface, g_param_spec_object ("sensor-match", "sensor-match", "sensor-match", TYPE_SENSOR_MATCH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); + } /** @@ -5231,6 +6542,23 @@ SensorI2c *object_get_sensor_i2c (Object *object) return SENSOR_I2C (ret); } +/** + * object_get_sensor_match: + * @object: A #Object. + * + * Gets the #SensorMatch instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> on @object, if any. + * + * Returns: (transfer full): A #SensorMatch that must be freed with g_object_unref() or %NULL if @object does not implement the interface. + */ +SensorMatch *object_get_sensor_match (Object *object) +{ + GDBusInterface *ret; + ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); + if (ret == NULL) + return NULL; + return SENSOR_MATCH (ret); +} + /** * object_peek_sensor_value: (skip) @@ -5292,6 +6620,26 @@ SensorI2c *object_peek_sensor_i2c (Object *object) return SENSOR_I2C (ret); } +/** + * object_peek_sensor_match: (skip) + * @object: A #Object. + * + * Like object_get_sensor_match() but doesn't increase the reference count on the returned object. + * + * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning> + * + * Returns: (transfer none): A #SensorMatch or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. + */ +SensorMatch *object_peek_sensor_match (Object *object) +{ + GDBusInterface *ret; + ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); + if (ret == NULL) + return NULL; + g_object_unref (ret); + return SENSOR_MATCH (ret); +} + static void object_notify (GDBusObject *object, GDBusInterface *interface) @@ -5374,6 +6722,11 @@ object_proxy_get_property (GObject *gobject, g_value_take_object (value, interface); break; + case 4: + interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); + g_value_take_object (value, interface); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); break; @@ -5391,6 +6744,7 @@ object_proxy_class_init (ObjectProxyClass *klass) g_object_class_override_property (gobject_class, 1, "sensor-value"); g_object_class_override_property (gobject_class, 2, "sensor-threshold"); g_object_class_override_property (gobject_class, 3, "sensor-i2c"); + g_object_class_override_property (gobject_class, 4, "sensor-match"); } /** @@ -5496,6 +6850,19 @@ object_skeleton_set_property (GObject *gobject, } break; + case 4: + interface = g_value_get_object (value); + if (interface != NULL) + { + g_warn_if_fail (IS_SENSOR_MATCH (interface)); + g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); + } + else + { + g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch"); + } + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); break; @@ -5528,6 +6895,11 @@ object_skeleton_get_property (GObject *gobject, g_value_take_object (value, interface); break; + case 4: + interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch"); + g_value_take_object (value, interface); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); break; @@ -5545,6 +6917,7 @@ object_skeleton_class_init (ObjectSkeletonClass *klass) g_object_class_override_property (gobject_class, 1, "sensor-value"); g_object_class_override_property (gobject_class, 2, "sensor-threshold"); g_object_class_override_property (gobject_class, 3, "sensor-i2c"); + g_object_class_override_property (gobject_class, 4, "sensor-match"); } /** @@ -5598,6 +6971,18 @@ void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interfac g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL); } +/** + * object_skeleton_set_sensor_match: + * @object: A #ObjectSkeleton. + * @interface_: (allow-none): A #SensorMatch or %NULL to clear the interface. + * + * Sets the #SensorMatch instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> on @object. + */ +void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_) +{ + g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL); +} + /* ------------------------------------------------------------------------ * Code for ObjectManager client @@ -5663,6 +7048,7 @@ object_manager_client_get_proxy_type (GDBusObjectManagerClient *manager G_GNUC_U g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY)); g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY)); g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY)); + g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY)); g_once_init_leave (&once_init_value, 1); } ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name)); diff --git a/interfaces/sensor.h b/interfaces/sensor.h index 9b3e15f..551a9a8 100644 --- a/interfaces/sensor.h +++ b/interfaces/sensor.h @@ -47,6 +47,8 @@ struct _SensorValueIface gint (*get_poll_interval) (SensorValue *object); + gboolean (*get_settable) (SensorValue *object); + const gchar * (*get_units) (SensorValue *object); GVariant * (*get_value) (SensorValue *object); @@ -166,6 +168,9 @@ void sensor_value_set_poll_interval (SensorValue *object, gint value); gint sensor_value_get_heatbeat (SensorValue *object); void sensor_value_set_heatbeat (SensorValue *object, gint value); +gboolean sensor_value_get_settable (SensorValue *object); +void sensor_value_set_settable (SensorValue *object, gboolean value); + /* ---- */ @@ -604,6 +609,151 @@ GType sensor_i2c_skeleton_get_type (void) G_GNUC_CONST; SensorI2c *sensor_i2c_skeleton_new (void); +/* ------------------------------------------------------------------------ */ +/* Declarations for org.openbmc.SensorMatch */ + +#define TYPE_SENSOR_MATCH (sensor_match_get_type ()) +#define SENSOR_MATCH(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_SENSOR_MATCH, SensorMatch)) +#define IS_SENSOR_MATCH(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_SENSOR_MATCH)) +#define SENSOR_MATCH_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_SENSOR_MATCH, SensorMatchIface)) + +struct _SensorMatch; +typedef struct _SensorMatch SensorMatch; +typedef struct _SensorMatchIface SensorMatchIface; + +struct _SensorMatchIface +{ + GTypeInterface parent_iface; + + + GVariant * (*get_match_value) (SensorMatch *object); + + guchar (*get_state) (SensorMatch *object); + + void (*sensor_match) ( + SensorMatch *object, + guchar arg_state); + +}; + +GType sensor_match_get_type (void) G_GNUC_CONST; + +GDBusInterfaceInfo *sensor_match_interface_info (void); +guint sensor_match_override_properties (GObjectClass *klass, guint property_id_begin); + + +/* D-Bus signal emissions functions: */ +void sensor_match_emit_sensor_match ( + SensorMatch *object, + guchar arg_state); + + + +/* D-Bus property accessors: */ +GVariant *sensor_match_get_match_value (SensorMatch *object); +GVariant *sensor_match_dup_match_value (SensorMatch *object); +void sensor_match_set_match_value (SensorMatch *object, GVariant *value); + +guchar sensor_match_get_state (SensorMatch *object); +void sensor_match_set_state (SensorMatch *object, guchar value); + + +/* ---- */ + +#define TYPE_SENSOR_MATCH_PROXY (sensor_match_proxy_get_type ()) +#define SENSOR_MATCH_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_SENSOR_MATCH_PROXY, SensorMatchProxy)) +#define SENSOR_MATCH_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyClass)) +#define SENSOR_MATCH_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyClass)) +#define IS_SENSOR_MATCH_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_SENSOR_MATCH_PROXY)) +#define IS_SENSOR_MATCH_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_SENSOR_MATCH_PROXY)) + +typedef struct _SensorMatchProxy SensorMatchProxy; +typedef struct _SensorMatchProxyClass SensorMatchProxyClass; +typedef struct _SensorMatchProxyPrivate SensorMatchProxyPrivate; + +struct _SensorMatchProxy +{ + /*< private >*/ + GDBusProxy parent_instance; + SensorMatchProxyPrivate *priv; +}; + +struct _SensorMatchProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType sensor_match_proxy_get_type (void) G_GNUC_CONST; + +void sensor_match_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +SensorMatch *sensor_match_proxy_new_finish ( + GAsyncResult *res, + GError **error); +SensorMatch *sensor_match_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + +void sensor_match_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +SensorMatch *sensor_match_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error); +SensorMatch *sensor_match_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + + +/* ---- */ + +#define TYPE_SENSOR_MATCH_SKELETON (sensor_match_skeleton_get_type ()) +#define SENSOR_MATCH_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeleton)) +#define SENSOR_MATCH_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonClass)) +#define SENSOR_MATCH_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonClass)) +#define IS_SENSOR_MATCH_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_SENSOR_MATCH_SKELETON)) +#define IS_SENSOR_MATCH_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_SENSOR_MATCH_SKELETON)) + +typedef struct _SensorMatchSkeleton SensorMatchSkeleton; +typedef struct _SensorMatchSkeletonClass SensorMatchSkeletonClass; +typedef struct _SensorMatchSkeletonPrivate SensorMatchSkeletonPrivate; + +struct _SensorMatchSkeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + SensorMatchSkeletonPrivate *priv; +}; + +struct _SensorMatchSkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType sensor_match_skeleton_get_type (void) G_GNUC_CONST; + +SensorMatch *sensor_match_skeleton_new (void); + + /* ---- */ #define TYPE_OBJECT (object_get_type ()) @@ -625,9 +775,11 @@ GType object_get_type (void) G_GNUC_CONST; SensorValue *object_get_sensor_value (Object *object); SensorThreshold *object_get_sensor_threshold (Object *object); SensorI2c *object_get_sensor_i2c (Object *object); +SensorMatch *object_get_sensor_match (Object *object); SensorValue *object_peek_sensor_value (Object *object); SensorThreshold *object_peek_sensor_threshold (Object *object); SensorI2c *object_peek_sensor_i2c (Object *object); +SensorMatch *object_peek_sensor_match (Object *object); #define TYPE_OBJECT_PROXY (object_proxy_get_type ()) #define OBJECT_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_OBJECT_PROXY, ObjectProxy)) @@ -683,6 +835,7 @@ ObjectSkeleton *object_skeleton_new (const gchar *object_path); void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_); void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_); void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_); +void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_); /* ---- */ diff --git a/interfaces/watchdog.c b/interfaces/watchdog.c new file mode 100644 index 0000000..3adc476 --- /dev/null +++ b/interfaces/watchdog.c @@ -0,0 +1,2338 @@ +/* + * Generated by gdbus-codegen 2.40.2. DO NOT EDIT. + * + * The license of this code is the same as for the source it was derived from. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "interfaces/watchdog.h" + +#include <string.h> +#ifdef G_OS_UNIX +# include <gio/gunixfdlist.h> +#endif + +typedef struct +{ + GDBusArgInfo parent_struct; + gboolean use_gvariant; +} _ExtendedGDBusArgInfo; + +typedef struct +{ + GDBusMethodInfo parent_struct; + const gchar *signal_name; + gboolean pass_fdlist; +} _ExtendedGDBusMethodInfo; + +typedef struct +{ + GDBusSignalInfo parent_struct; + const gchar *signal_name; +} _ExtendedGDBusSignalInfo; + +typedef struct +{ + GDBusPropertyInfo parent_struct; + const gchar *hyphen_name; + gboolean use_gvariant; +} _ExtendedGDBusPropertyInfo; + +typedef struct +{ + GDBusInterfaceInfo parent_struct; + const gchar *hyphen_name; +} _ExtendedGDBusInterfaceInfo; + +typedef struct +{ + const _ExtendedGDBusPropertyInfo *info; + guint prop_id; + GValue orig_value; /* the value before the change */ +} ChangedProperty; + +static void +_changed_property_free (ChangedProperty *data) +{ + g_value_unset (&data->orig_value); + g_free (data); +} + +static gboolean +_g_strv_equal0 (gchar **a, gchar **b) +{ + gboolean ret = FALSE; + guint n; + if (a == NULL && b == NULL) + { + ret = TRUE; + goto out; + } + if (a == NULL || b == NULL) + goto out; + if (g_strv_length (a) != g_strv_length (b)) + goto out; + for (n = 0; a[n] != NULL; n++) + if (g_strcmp0 (a[n], b[n]) != 0) + goto out; + ret = TRUE; +out: + return ret; +} + +static gboolean +_g_variant_equal0 (GVariant *a, GVariant *b) +{ + gboolean ret = FALSE; + if (a == NULL && b == NULL) + { + ret = TRUE; + goto out; + } + if (a == NULL || b == NULL) + goto out; + ret = g_variant_equal (a, b); +out: + return ret; +} + +G_GNUC_UNUSED static gboolean +_g_value_equal (const GValue *a, const GValue *b) +{ + gboolean ret = FALSE; + g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b)); + switch (G_VALUE_TYPE (a)) + { + case G_TYPE_BOOLEAN: + ret = (g_value_get_boolean (a) == g_value_get_boolean (b)); + break; + case G_TYPE_UCHAR: + ret = (g_value_get_uchar (a) == g_value_get_uchar (b)); + break; + case G_TYPE_INT: + ret = (g_value_get_int (a) == g_value_get_int (b)); + break; + case G_TYPE_UINT: + ret = (g_value_get_uint (a) == g_value_get_uint (b)); + break; + case G_TYPE_INT64: + ret = (g_value_get_int64 (a) == g_value_get_int64 (b)); + break; + case G_TYPE_UINT64: + ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b)); + break; + case G_TYPE_DOUBLE: + { + /* Avoid -Wfloat-equal warnings by doing a direct bit compare */ + gdouble da = g_value_get_double (a); + gdouble db = g_value_get_double (b); + ret = memcmp (&da, &db, sizeof (gdouble)) == 0; + } + break; + case G_TYPE_STRING: + ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0); + break; + case G_TYPE_VARIANT: + ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b)); + break; + default: + if (G_VALUE_TYPE (a) == G_TYPE_STRV) + ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b)); + else + g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a))); + break; + } + return ret; +} + +/* ------------------------------------------------------------------------ + * Code for interface org.openbmc.Watchdog + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:Watchdog + * @title: Watchdog + * @short_description: Generated C code for the org.openbmc.Watchdog D-Bus interface + * + * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface in C. + */ + +/* ---- Introspection data for org.openbmc.Watchdog ---- */ + +static const _ExtendedGDBusMethodInfo _watchdog_method_info_start = +{ + { + -1, + (gchar *) "start", + NULL, + NULL, + NULL + }, + "handle-start", + FALSE +}; + +static const _ExtendedGDBusMethodInfo _watchdog_method_info_poke = +{ + { + -1, + (gchar *) "poke", + NULL, + NULL, + NULL + }, + "handle-poke", + FALSE +}; + +static const _ExtendedGDBusMethodInfo _watchdog_method_info_stop = +{ + { + -1, + (gchar *) "stop", + NULL, + NULL, + NULL + }, + "handle-stop", + FALSE +}; + +static const _ExtendedGDBusMethodInfo * const _watchdog_method_info_pointers[] = +{ + &_watchdog_method_info_start, + &_watchdog_method_info_poke, + &_watchdog_method_info_stop, + NULL +}; + +static const _ExtendedGDBusSignalInfo _watchdog_signal_info_watchdog_error = +{ + { + -1, + (gchar *) "WatchdogError", + NULL, + NULL + }, + "watchdog-error" +}; + +static const _ExtendedGDBusSignalInfo * const _watchdog_signal_info_pointers[] = +{ + &_watchdog_signal_info_watchdog_error, + NULL +}; + +static const _ExtendedGDBusPropertyInfo _watchdog_property_info_watchdog = +{ + { + -1, + (gchar *) "watchdog", + (gchar *) "i", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL + }, + "watchdog", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _watchdog_property_info_poll_interval = +{ + { + -1, + (gchar *) "poll_interval", + (gchar *) "i", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL + }, + "poll-interval", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo * const _watchdog_property_info_pointers[] = +{ + &_watchdog_property_info_watchdog, + &_watchdog_property_info_poll_interval, + NULL +}; + +static const _ExtendedGDBusInterfaceInfo _watchdog_interface_info = +{ + { + -1, + (gchar *) "org.openbmc.Watchdog", + (GDBusMethodInfo **) &_watchdog_method_info_pointers, + (GDBusSignalInfo **) &_watchdog_signal_info_pointers, + (GDBusPropertyInfo **) &_watchdog_property_info_pointers, + NULL + }, + "watchdog", +}; + + +/** + * watchdog_interface_info: + * + * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * +watchdog_interface_info (void) +{ + return (GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct; +} + +/** + * watchdog_override_properties: + * @klass: The class structure for a #GObject<!-- -->-derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #Watchdog interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint +watchdog_override_properties (GObjectClass *klass, guint property_id_begin) +{ + g_object_class_override_property (klass, property_id_begin++, "watchdog"); + g_object_class_override_property (klass, property_id_begin++, "poll-interval"); + return property_id_begin - 1; +} + + + +/** + * Watchdog: + * + * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. + */ + +/** + * WatchdogIface: + * @parent_iface: The parent interface. + * @handle_poke: Handler for the #Watchdog::handle-poke signal. + * @handle_start: Handler for the #Watchdog::handle-start signal. + * @handle_stop: Handler for the #Watchdog::handle-stop signal. + * @get_poll_interval: Getter for the #Watchdog:poll-interval property. + * @get_watchdog: Getter for the #Watchdog:watchdog property. + * @watchdog_error: Handler for the #Watchdog::watchdog-error signal. + * + * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. + */ + +typedef WatchdogIface WatchdogInterface; +G_DEFINE_INTERFACE (Watchdog, watchdog, G_TYPE_OBJECT); + +static void +watchdog_default_init (WatchdogIface *iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * Watchdog::handle-start: + * @object: A #Watchdog. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call watchdog_complete_start() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-start", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (WatchdogIface, handle_start), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * Watchdog::handle-poke: + * @object: A #Watchdog. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call watchdog_complete_poke() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-poke", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (WatchdogIface, handle_poke), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * Watchdog::handle-stop: + * @object: A #Watchdog. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call watchdog_complete_stop() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-stop", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (WatchdogIface, handle_stop), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /* GObject signals for received D-Bus signals: */ + /** + * Watchdog::watchdog-error: + * @object: A #Watchdog. + * + * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new ("watchdog-error", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (WatchdogIface, watchdog_error), + NULL, + NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 0); + + /* GObject properties for D-Bus properties: */ + /** + * Watchdog:watchdog: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link>. + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. + */ + g_object_interface_install_property (iface, + g_param_spec_int ("watchdog", "watchdog", "watchdog", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Watchdog:poll-interval: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link>. + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. + */ + g_object_interface_install_property (iface, + g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +/** + * watchdog_get_watchdog: (skip) + * @object: A #Watchdog. + * + * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gint +watchdog_get_watchdog (Watchdog *object) +{ + return WATCHDOG_GET_IFACE (object)->get_watchdog (object); +} + +/** + * watchdog_set_watchdog: (skip) + * @object: A #Watchdog. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + */ +void +watchdog_set_watchdog (Watchdog *object, gint value) +{ + g_object_set (G_OBJECT (object), "watchdog", value, NULL); +} + +/** + * watchdog_get_poll_interval: (skip) + * @object: A #Watchdog. + * + * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gint +watchdog_get_poll_interval (Watchdog *object) +{ + return WATCHDOG_GET_IFACE (object)->get_poll_interval (object); +} + +/** + * watchdog_set_poll_interval: (skip) + * @object: A #Watchdog. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + */ +void +watchdog_set_poll_interval (Watchdog *object, gint value) +{ + g_object_set (G_OBJECT (object), "poll-interval", value, NULL); +} + +/** + * watchdog_emit_watchdog_error: + * @object: A #Watchdog. + * + * Emits the <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> D-Bus signal. + */ +void +watchdog_emit_watchdog_error ( + Watchdog *object) +{ + g_signal_emit_by_name (object, "watchdog-error"); +} + +/** + * watchdog_call_start: + * @proxy: A #WatchdogProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call watchdog_call_start_finish() to get the result of the operation. + * + * See watchdog_call_start_sync() for the synchronous, blocking version of this method. + */ +void +watchdog_call_start ( + Watchdog *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "start", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * watchdog_call_start_finish: + * @proxy: A #WatchdogProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_start(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with watchdog_call_start(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +watchdog_call_start_finish ( + Watchdog *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * watchdog_call_start_sync: + * @proxy: A #WatchdogProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See watchdog_call_start() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +watchdog_call_start_sync ( + Watchdog *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "start", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * watchdog_call_poke: + * @proxy: A #WatchdogProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call watchdog_call_poke_finish() to get the result of the operation. + * + * See watchdog_call_poke_sync() for the synchronous, blocking version of this method. + */ +void +watchdog_call_poke ( + Watchdog *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "poke", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * watchdog_call_poke_finish: + * @proxy: A #WatchdogProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_poke(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with watchdog_call_poke(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +watchdog_call_poke_finish ( + Watchdog *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * watchdog_call_poke_sync: + * @proxy: A #WatchdogProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See watchdog_call_poke() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +watchdog_call_poke_sync ( + Watchdog *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "poke", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * watchdog_call_stop: + * @proxy: A #WatchdogProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call watchdog_call_stop_finish() to get the result of the operation. + * + * See watchdog_call_stop_sync() for the synchronous, blocking version of this method. + */ +void +watchdog_call_stop ( + Watchdog *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "stop", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * watchdog_call_stop_finish: + * @proxy: A #WatchdogProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_stop(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with watchdog_call_stop(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +watchdog_call_stop_finish ( + Watchdog *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * watchdog_call_stop_sync: + * @proxy: A #WatchdogProxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See watchdog_call_stop() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +watchdog_call_stop_sync ( + Watchdog *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "stop", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * watchdog_complete_start: + * @object: A #Watchdog. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +watchdog_complete_start ( + Watchdog *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * watchdog_complete_poke: + * @object: A #Watchdog. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +watchdog_complete_poke ( + Watchdog *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * watchdog_complete_stop: + * @object: A #Watchdog. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +watchdog_complete_stop ( + Watchdog *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/* ------------------------------------------------------------------------ */ + +/** + * WatchdogProxy: + * + * The #WatchdogProxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * WatchdogProxyClass: + * @parent_class: The parent class. + * + * Class structure for #WatchdogProxy. + */ + +struct _WatchdogProxyPrivate +{ + GData *qdata; +}; + +static void watchdog_proxy_iface_init (WatchdogIface *iface); + +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY, + G_ADD_PRIVATE (WatchdogProxy) + G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init)); + +#else +G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init)); + +#endif +static void +watchdog_proxy_finalize (GObject *object) +{ + WatchdogProxy *proxy = WATCHDOG_PROXY (object); + g_datalist_clear (&proxy->priv->qdata); + G_OBJECT_CLASS (watchdog_proxy_parent_class)->finalize (object); +} + +static void +watchdog_proxy_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 2); + info = _watchdog_property_info_pointers[prop_id - 1]; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); + if (info->use_gvariant) + { + g_value_set_variant (value, variant); + } + else + { + if (variant != NULL) + g_dbus_gvariant_to_gvalue (variant, value); + } + if (variant != NULL) + g_variant_unref (variant); +} + +static void +watchdog_proxy_set_property_cb (GDBusProxy *proxy, + GAsyncResult *res, + gpointer user_data) +{ + const _ExtendedGDBusPropertyInfo *info = user_data; + GError *error; + GVariant *_ret; + error = NULL; + _ret = g_dbus_proxy_call_finish (proxy, res, &error); + if (!_ret) + { + g_warning ("Error setting property '%s' on interface org.openbmc.Watchdog: %s (%s, %d)", + info->parent_struct.name, + error->message, g_quark_to_string (error->domain), error->code); + g_error_free (error); + } + else + { + g_variant_unref (_ret); + } +} + +static void +watchdog_proxy_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 2); + info = _watchdog_property_info_pointers[prop_id - 1]; + variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_dbus_proxy_call (G_DBUS_PROXY (object), + "org.freedesktop.DBus.Properties.Set", + g_variant_new ("(ssv)", "org.openbmc.Watchdog", info->parent_struct.name, variant), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, (GAsyncReadyCallback) watchdog_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); + g_variant_unref (variant); +} + +static void +watchdog_proxy_g_signal (GDBusProxy *proxy, + const gchar *sender_name G_GNUC_UNUSED, + const gchar *signal_name, + GVariant *parameters) +{ + _ExtendedGDBusSignalInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children (parameters); + paramv = g_new0 (GValue, num_params + 1); + g_value_init (¶mv[0], TYPE_WATCHDOG); + g_value_set_object (¶mv[0], proxy); + g_variant_iter_init (&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG); + g_signal_emitv (paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static void +watchdog_proxy_g_properties_changed (GDBusProxy *_proxy, + GVariant *changed_properties, + const gchar *const *invalidated_properties) +{ + WatchdogProxy *proxy = WATCHDOG_PROXY (_proxy); + guint n; + const gchar *key; + GVariantIter *iter; + _ExtendedGDBusPropertyInfo *info; + g_variant_get (changed_properties, "a{sv}", &iter); + while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, key); + g_datalist_remove_data (&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } + g_variant_iter_free (iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, invalidated_properties[n]); + g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } +} + +static gint +watchdog_proxy_get_watchdog (Watchdog *object) +{ + WatchdogProxy *proxy = WATCHDOG_PROXY (object); + GVariant *variant; + gint value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "watchdog"); + if (variant != NULL) + { + value = g_variant_get_int32 (variant); + g_variant_unref (variant); + } + return value; +} + +static gint +watchdog_proxy_get_poll_interval (Watchdog *object) +{ + WatchdogProxy *proxy = WATCHDOG_PROXY (object); + GVariant *variant; + gint value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval"); + if (variant != NULL) + { + value = g_variant_get_int32 (variant); + g_variant_unref (variant); + } + return value; +} + +static void +watchdog_proxy_init (WatchdogProxy *proxy) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + proxy->priv = watchdog_proxy_get_instance_private (proxy); +#else + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_WATCHDOG_PROXY, WatchdogProxyPrivate); +#endif + + g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), watchdog_interface_info ()); +} + +static void +watchdog_proxy_class_init (WatchdogProxyClass *klass) +{ + GObjectClass *gobject_class; + GDBusProxyClass *proxy_class; + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = watchdog_proxy_finalize; + gobject_class->get_property = watchdog_proxy_get_property; + gobject_class->set_property = watchdog_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS (klass); + proxy_class->g_signal = watchdog_proxy_g_signal; + proxy_class->g_properties_changed = watchdog_proxy_g_properties_changed; + + watchdog_override_properties (gobject_class, 1); + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private (klass, sizeof (WatchdogProxyPrivate)); +#endif +} + +static void +watchdog_proxy_iface_init (WatchdogIface *iface) +{ + iface->get_watchdog = watchdog_proxy_get_watchdog; + iface->get_poll_interval = watchdog_proxy_get_poll_interval; +} + +/** + * watchdog_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. See g_dbus_proxy_new() for more details. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call watchdog_proxy_new_finish() to get the result of the operation. + * + * See watchdog_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void +watchdog_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_WATCHDOG_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Watchdog", NULL); +} + +/** + * watchdog_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with watchdog_proxy_new(). + * + * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. + */ +Watchdog * +watchdog_proxy_new_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return WATCHDOG (ret); + else + return NULL; +} + +/** + * watchdog_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. See g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See watchdog_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. + */ +Watchdog * +watchdog_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_WATCHDOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Watchdog", NULL); + if (ret != NULL) + return WATCHDOG (ret); + else + return NULL; +} + + +/** + * watchdog_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like watchdog_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call watchdog_proxy_new_for_bus_finish() to get the result of the operation. + * + * See watchdog_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void +watchdog_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_WATCHDOG_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Watchdog", NULL); +} + +/** + * watchdog_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with watchdog_proxy_new_for_bus(). + * + * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. + */ +Watchdog * +watchdog_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return WATCHDOG (ret); + else + return NULL; +} + +/** + * watchdog_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like watchdog_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See watchdog_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set. + */ +Watchdog * +watchdog_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_WATCHDOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Watchdog", NULL); + if (ret != NULL) + return WATCHDOG (ret); + else + return NULL; +} + + +/* ------------------------------------------------------------------------ */ + +/** + * WatchdogSkeleton: + * + * The #WatchdogSkeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * WatchdogSkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #WatchdogSkeleton. + */ + +struct _WatchdogSkeletonPrivate +{ + GValue *properties; + GList *changed_properties; + GSource *changed_properties_idle_source; + GMainContext *context; + GMutex lock; +}; + +static void +_watchdog_skeleton_handle_method_call ( + GDBusConnection *connection G_GNUC_UNUSED, + const gchar *sender G_GNUC_UNUSED, + const gchar *object_path G_GNUC_UNUSED, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); + _ExtendedGDBusMethodInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint num_extra; + guint n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); + g_assert (info != NULL); + num_params = g_variant_n_children (parameters); + num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); + n = 0; + g_value_init (¶mv[n], TYPE_WATCHDOG); + g_value_set_object (¶mv[n++], skeleton); + g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object (¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); +#else + g_assert_not_reached (); +#endif + } + g_variant_iter_init (&iter, parameters); + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG); + g_value_init (&return_value, G_TYPE_BOOLEAN); + g_signal_emitv (paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean (&return_value)) + g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name); + g_value_unset (&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static GVariant * +_watchdog_skeleton_handle_get_property ( + GDBusConnection *connection G_GNUC_UNUSED, + const gchar *sender G_GNUC_UNUSED, + const gchar *object_path G_GNUC_UNUSED, + const gchar *interface_name G_GNUC_UNUSED, + const gchar *property_name, + GError **error, + gpointer user_data) +{ + WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + GVariant *ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init (&value, pspec->value_type); + g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_value_unset (&value); + } + return ret; +} + +static gboolean +_watchdog_skeleton_handle_set_property ( + GDBusConnection *connection G_GNUC_UNUSED, + const gchar *sender G_GNUC_UNUSED, + const gchar *object_path G_GNUC_UNUSED, + const gchar *interface_name G_GNUC_UNUSED, + const gchar *property_name, + GVariant *variant, + GError **error, + gpointer user_data) +{ + WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant (&value, variant); + else + g_dbus_gvariant_to_gvalue (variant, &value); + g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); + g_value_unset (&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _watchdog_skeleton_vtable = +{ + _watchdog_skeleton_handle_method_call, + _watchdog_skeleton_handle_get_property, + _watchdog_skeleton_handle_set_property, + {NULL} +}; + +static GDBusInterfaceInfo * +watchdog_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) +{ + return watchdog_interface_info (); +} + +static GDBusInterfaceVTable * +watchdog_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) +{ + return (GDBusInterfaceVTable *) &_watchdog_skeleton_vtable; +} + +static GVariant * +watchdog_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) +{ + WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + if (_watchdog_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _watchdog_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo *info = _watchdog_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant *value; + value = _watchdog_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", info->name, NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref (value); + g_variant_builder_add (&builder, "{sv}", info->name, value); + g_variant_unref (value); + } + } + } +out: + return g_variant_builder_end (&builder); +} + +static gboolean _watchdog_emit_changed (gpointer user_data); + +static void +watchdog_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) +{ + WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton); + gboolean emit_changed = FALSE; + + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties_idle_source != NULL) + { + g_source_destroy (skeleton->priv->changed_properties_idle_source); + skeleton->priv->changed_properties_idle_source = NULL; + emit_changed = TRUE; + } + g_mutex_unlock (&skeleton->priv->lock); + + if (emit_changed) + _watchdog_emit_changed (skeleton); +} + +static void +_watchdog_on_signal_watchdog_error ( + Watchdog *object) +{ + WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); + + GList *connections, *l; + GVariant *signal_variant; + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + + signal_variant = g_variant_ref_sink (g_variant_new ("()")); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection *connection = l->data; + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", "WatchdogError", + signal_variant, NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); +} + +static void watchdog_skeleton_iface_init (WatchdogIface *iface); +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_ADD_PRIVATE (WatchdogSkeleton) + G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init)); + +#else +G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init)); + +#endif +static void +watchdog_skeleton_finalize (GObject *object) +{ + WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); + guint n; + for (n = 0; n < 2; n++) + g_value_unset (&skeleton->priv->properties[n]); + g_free (skeleton->priv->properties); + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy (skeleton->priv->changed_properties_idle_source); + g_main_context_unref (skeleton->priv->context); + g_mutex_clear (&skeleton->priv->lock); + G_OBJECT_CLASS (watchdog_skeleton_parent_class)->finalize (object); +} + +static void +watchdog_skeleton_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ + WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 2); + g_mutex_lock (&skeleton->priv->lock); + g_value_copy (&skeleton->priv->properties[prop_id - 1], value); + g_mutex_unlock (&skeleton->priv->lock); +} + +static gboolean +_watchdog_emit_changed (gpointer user_data) +{ + WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data); + GList *l; + GVariantBuilder builder; + GVariantBuilder invalidated_builder; + guint num_changes; + + g_mutex_lock (&skeleton->priv->lock); + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); + for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) + { + ChangedProperty *cp = l->data; + GVariant *variant; + const GValue *cur_value; + + cur_value = &skeleton->priv->properties[cp->prop_id - 1]; + if (!_g_value_equal (cur_value, &cp->orig_value)) + { + variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); + g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); + g_variant_unref (variant); + num_changes++; + } + } + if (num_changes > 0) + { + GList *connections, *ll; + GVariant *signal_variant; + signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Watchdog", + &builder, &invalidated_builder)); + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + for (ll = connections; ll != NULL; ll = ll->next) + { + GDBusConnection *connection = ll->data; + + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + signal_variant, + NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); + } + else + { + g_variant_builder_clear (&builder); + g_variant_builder_clear (&invalidated_builder); + } + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + skeleton->priv->changed_properties = NULL; + skeleton->priv->changed_properties_idle_source = NULL; + g_mutex_unlock (&skeleton->priv->lock); + return FALSE; +} + +static void +_watchdog_schedule_emit_changed (WatchdogSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) +{ + ChangedProperty *cp; + GList *l; + cp = NULL; + for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) + { + ChangedProperty *i_cp = l->data; + if (i_cp->info == info) + { + cp = i_cp; + break; + } + } + if (cp == NULL) + { + cp = g_new0 (ChangedProperty, 1); + cp->prop_id = prop_id; + cp->info = info; + skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); + g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); + g_value_copy (orig_value, &cp->orig_value); + } +} + +static void +watchdog_skeleton_notify (GObject *object, + GParamSpec *pspec G_GNUC_UNUSED) +{ + WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties != NULL && + skeleton->priv->changed_properties_idle_source == NULL) + { + skeleton->priv->changed_properties_idle_source = g_idle_source_new (); + g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); + g_source_set_callback (skeleton->priv->changed_properties_idle_source, _watchdog_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); + g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); + g_source_unref (skeleton->priv->changed_properties_idle_source); + } + g_mutex_unlock (&skeleton->priv->lock); +} + +static void +watchdog_skeleton_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 2); + g_mutex_lock (&skeleton->priv->lock); + g_object_freeze_notify (object); + if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) + { + if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) + _watchdog_schedule_emit_changed (skeleton, _watchdog_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); + g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); + g_object_notify_by_pspec (object, pspec); + } + g_mutex_unlock (&skeleton->priv->lock); + g_object_thaw_notify (object); +} + +static void +watchdog_skeleton_init (WatchdogSkeleton *skeleton) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + skeleton->priv = watchdog_skeleton_get_instance_private (skeleton); +#else + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_WATCHDOG_SKELETON, WatchdogSkeletonPrivate); +#endif + + g_mutex_init (&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default (); + skeleton->priv->properties = g_new0 (GValue, 2); + g_value_init (&skeleton->priv->properties[0], G_TYPE_INT); + g_value_init (&skeleton->priv->properties[1], G_TYPE_INT); +} + +static gint +watchdog_skeleton_get_watchdog (Watchdog *object) +{ + WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); + gint value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_int (&(skeleton->priv->properties[0])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gint +watchdog_skeleton_get_poll_interval (Watchdog *object) +{ + WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object); + gint value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_int (&(skeleton->priv->properties[1])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static void +watchdog_skeleton_class_init (WatchdogSkeletonClass *klass) +{ + GObjectClass *gobject_class; + GDBusInterfaceSkeletonClass *skeleton_class; + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = watchdog_skeleton_finalize; + gobject_class->get_property = watchdog_skeleton_get_property; + gobject_class->set_property = watchdog_skeleton_set_property; + gobject_class->notify = watchdog_skeleton_notify; + + + watchdog_override_properties (gobject_class, 1); + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); + skeleton_class->get_info = watchdog_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = watchdog_skeleton_dbus_interface_get_properties; + skeleton_class->flush = watchdog_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = watchdog_skeleton_dbus_interface_get_vtable; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private (klass, sizeof (WatchdogSkeletonPrivate)); +#endif +} + +static void +watchdog_skeleton_iface_init (WatchdogIface *iface) +{ + iface->watchdog_error = _watchdog_on_signal_watchdog_error; + iface->get_watchdog = watchdog_skeleton_get_watchdog; + iface->get_poll_interval = watchdog_skeleton_get_poll_interval; +} + +/** + * watchdog_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. + * + * Returns: (transfer full) (type WatchdogSkeleton): The skeleton object. + */ +Watchdog * +watchdog_skeleton_new (void) +{ + return WATCHDOG (g_object_new (TYPE_WATCHDOG_SKELETON, NULL)); +} + +/* ------------------------------------------------------------------------ + * Code for Object, ObjectProxy and ObjectSkeleton + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:Object + * @title: Object + * @short_description: Specialized GDBusObject types + * + * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces. + */ + +/** + * Object: + * + * The #Object type is a specialized container of interfaces. + */ + +/** + * ObjectIface: + * @parent_iface: The parent interface. + * + * Virtual table for the #Object interface. + */ + +typedef ObjectIface ObjectInterface; +G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT)); + +static void +object_default_init (ObjectIface *iface) +{ + /** + * Object:watchdog: + * + * The #Watchdog instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>, if any. + * + * Connect to the #GObject::notify signal to get informed of property changes. + */ + g_object_interface_install_property (iface, g_param_spec_object ("watchdog", "watchdog", "watchdog", TYPE_WATCHDOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); + +} + +/** + * object_get_watchdog: + * @object: A #Object. + * + * Gets the #Watchdog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> on @object, if any. + * + * Returns: (transfer full): A #Watchdog that must be freed with g_object_unref() or %NULL if @object does not implement the interface. + */ +Watchdog *object_get_watchdog (Object *object) +{ + GDBusInterface *ret; + ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); + if (ret == NULL) + return NULL; + return WATCHDOG (ret); +} + + +/** + * object_peek_watchdog: (skip) + * @object: A #Object. + * + * Like object_get_watchdog() but doesn't increase the reference count on the returned object. + * + * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning> + * + * Returns: (transfer none): A #Watchdog or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. + */ +Watchdog *object_peek_watchdog (Object *object) +{ + GDBusInterface *ret; + ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); + if (ret == NULL) + return NULL; + g_object_unref (ret); + return WATCHDOG (ret); +} + + +static void +object_notify (GDBusObject *object, GDBusInterface *interface) +{ + _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface); + /* info can be NULL if the other end is using a D-Bus interface we don't know + * anything about, for example old generated code in this process talking to + * newer generated code in the other process. */ + if (info != NULL) + g_object_notify (G_OBJECT (object), info->hyphen_name); +} + +/** + * ObjectProxy: + * + * The #ObjectProxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * ObjectProxyClass: + * @parent_class: The parent class. + * + * Class structure for #ObjectProxy. + */ + +static void +object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) +{ +} + +static void +object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface) +{ + iface->interface_added = object_notify; + iface->interface_removed = object_notify; +} + + +G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY, + G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init) + G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init)); + +static void +object_proxy_init (ObjectProxy *object G_GNUC_UNUSED) +{ +} + +static void +object_proxy_set_property (GObject *gobject, + guint prop_id, + const GValue *value G_GNUC_UNUSED, + GParamSpec *pspec) +{ + G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); +} + +static void +object_proxy_get_property (GObject *gobject, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + ObjectProxy *object = OBJECT_PROXY (gobject); + GDBusInterface *interface; + + switch (prop_id) + { + case 1: + interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); + g_value_take_object (value, interface); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); + break; + } +} + +static void +object_proxy_class_init (ObjectProxyClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gobject_class->set_property = object_proxy_set_property; + gobject_class->get_property = object_proxy_get_property; + + g_object_class_override_property (gobject_class, 1, "watchdog"); +} + +/** + * object_proxy_new: + * @connection: A #GDBusConnection. + * @object_path: An object path. + * + * Creates a new proxy object. + * + * Returns: (transfer full): The proxy object. + */ +ObjectProxy * +object_proxy_new (GDBusConnection *connection, + const gchar *object_path) +{ + g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL); + g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); + return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL)); +} + +/** + * ObjectSkeleton: + * + * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * ObjectSkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #ObjectSkeleton. + */ + +static void +object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) +{ +} + + +static void +object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface) +{ + iface->interface_added = object_notify; + iface->interface_removed = object_notify; +} + +G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON, + G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init) + G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init)); + +static void +object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED) +{ +} + +static void +object_skeleton_set_property (GObject *gobject, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + ObjectSkeleton *object = OBJECT_SKELETON (gobject); + GDBusInterfaceSkeleton *interface; + + switch (prop_id) + { + case 1: + interface = g_value_get_object (value); + if (interface != NULL) + { + g_warn_if_fail (IS_WATCHDOG (interface)); + g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); + } + else + { + g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Watchdog"); + } + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); + break; + } +} + +static void +object_skeleton_get_property (GObject *gobject, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + ObjectSkeleton *object = OBJECT_SKELETON (gobject); + GDBusInterface *interface; + + switch (prop_id) + { + case 1: + interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog"); + g_value_take_object (value, interface); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); + break; + } +} + +static void +object_skeleton_class_init (ObjectSkeletonClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gobject_class->set_property = object_skeleton_set_property; + gobject_class->get_property = object_skeleton_get_property; + + g_object_class_override_property (gobject_class, 1, "watchdog"); +} + +/** + * object_skeleton_new: + * @object_path: An object path. + * + * Creates a new skeleton object. + * + * Returns: (transfer full): The skeleton object. + */ +ObjectSkeleton * +object_skeleton_new (const gchar *object_path) +{ + g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); + return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL)); +} + +/** + * object_skeleton_set_watchdog: + * @object: A #ObjectSkeleton. + * @interface_: (allow-none): A #Watchdog or %NULL to clear the interface. + * + * Sets the #Watchdog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> on @object. + */ +void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_) +{ + g_object_set (G_OBJECT (object), "watchdog", interface_, NULL); +} + + +/* ------------------------------------------------------------------------ + * Code for ObjectManager client + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:ObjectManagerClient + * @title: ObjectManagerClient + * @short_description: Generated GDBusObjectManagerClient type + * + * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. + */ + +/** + * ObjectManagerClient: + * + * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API. + */ + +/** + * ObjectManagerClientClass: + * @parent_class: The parent class. + * + * Class structure for #ObjectManagerClient. + */ + +G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT); + +static void +object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED) +{ +} + +static void +object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED) +{ +} + +/** + * object_manager_client_get_proxy_type: + * @manager: A #GDBusObjectManagerClient. + * @object_path: The object path of the remote object (unused). + * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType. + * @user_data: User data (unused). + * + * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types. + * + * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy. + */ +GType +object_manager_client_get_proxy_type (GDBusObjectManagerClient *manager G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name, gpointer user_data G_GNUC_UNUSED) +{ + static gsize once_init_value = 0; + static GHashTable *lookup_hash; + GType ret; + + if (interface_name == NULL) + return TYPE_OBJECT_PROXY; + if (g_once_init_enter (&once_init_value)) + { + lookup_hash = g_hash_table_new (g_str_hash, g_str_equal); + g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Watchdog", GSIZE_TO_POINTER (TYPE_WATCHDOG_PROXY)); + g_once_init_leave (&once_init_value, 1); + } + ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name)); + if (ret == (GType) 0) + ret = G_TYPE_DBUS_PROXY; + return ret; +} + +/** + * object_manager_client_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call object_manager_client_new_finish() to get the result of the operation. + * + * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor. + */ +void +object_manager_client_new ( + GDBusConnection *connection, + GDBusObjectManagerClientFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL); +} + +/** + * object_manager_client_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with object_manager_client_new(). + * + * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. + */ +GDBusObjectManager * +object_manager_client_new_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return G_DBUS_OBJECT_MANAGER (ret); + else + return NULL; +} + +/** + * object_manager_client_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See object_manager_client_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. + */ +GDBusObjectManager * +object_manager_client_new_sync ( + GDBusConnection *connection, + GDBusObjectManagerClientFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL); + if (ret != NULL) + return G_DBUS_OBJECT_MANAGER (ret); + else + return NULL; +} + + +/** + * object_manager_client_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation. + * + * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void +object_manager_client_new_for_bus ( + GBusType bus_type, + GDBusObjectManagerClientFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL); +} + +/** + * object_manager_client_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with object_manager_client_new_for_bus(). + * + * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. + */ +GDBusObjectManager * +object_manager_client_new_for_bus_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return G_DBUS_OBJECT_MANAGER (ret); + else + return NULL; +} + +/** + * object_manager_client_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See object_manager_client_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. + */ +GDBusObjectManager * +object_manager_client_new_for_bus_sync ( + GBusType bus_type, + GDBusObjectManagerClientFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL); + if (ret != NULL) + return G_DBUS_OBJECT_MANAGER (ret); + else + return NULL; +} + + diff --git a/interfaces/watchdog.h b/interfaces/watchdog.h new file mode 100644 index 0000000..2736f4b --- /dev/null +++ b/interfaces/watchdog.h @@ -0,0 +1,380 @@ +/* + * Generated by gdbus-codegen 2.40.2. DO NOT EDIT. + * + * The license of this code is the same as for the source it was derived from. + */ + +#ifndef __INTERFACES_WATCHDOG_H__ +#define __INTERFACES_WATCHDOG_H__ + +#include <gio/gio.h> + +G_BEGIN_DECLS + + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.openbmc.Watchdog */ + +#define TYPE_WATCHDOG (watchdog_get_type ()) +#define WATCHDOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_WATCHDOG, Watchdog)) +#define IS_WATCHDOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_WATCHDOG)) +#define WATCHDOG_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_WATCHDOG, WatchdogIface)) + +struct _Watchdog; +typedef struct _Watchdog Watchdog; +typedef struct _WatchdogIface WatchdogIface; + +struct _WatchdogIface +{ + GTypeInterface parent_iface; + + + + gboolean (*handle_poke) ( + Watchdog *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_start) ( + Watchdog *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_stop) ( + Watchdog *object, + GDBusMethodInvocation *invocation); + + gint (*get_poll_interval) (Watchdog *object); + + gint (*get_watchdog) (Watchdog *object); + + void (*watchdog_error) ( + Watchdog *object); + +}; + +GType watchdog_get_type (void) G_GNUC_CONST; + +GDBusInterfaceInfo *watchdog_interface_info (void); +guint watchdog_override_properties (GObjectClass *klass, guint property_id_begin); + + +/* D-Bus method call completion functions: */ +void watchdog_complete_start ( + Watchdog *object, + GDBusMethodInvocation *invocation); + +void watchdog_complete_poke ( + Watchdog *object, + GDBusMethodInvocation *invocation); + +void watchdog_complete_stop ( + Watchdog *object, + GDBusMethodInvocation *invocation); + + + +/* D-Bus signal emissions functions: */ +void watchdog_emit_watchdog_error ( + Watchdog *object); + + + +/* D-Bus method calls: */ +void watchdog_call_start ( + Watchdog *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean watchdog_call_start_finish ( + Watchdog *proxy, + GAsyncResult *res, + GError **error); + +gboolean watchdog_call_start_sync ( + Watchdog *proxy, + GCancellable *cancellable, + GError **error); + +void watchdog_call_poke ( + Watchdog *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean watchdog_call_poke_finish ( + Watchdog *proxy, + GAsyncResult *res, + GError **error); + +gboolean watchdog_call_poke_sync ( + Watchdog *proxy, + GCancellable *cancellable, + GError **error); + +void watchdog_call_stop ( + Watchdog *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean watchdog_call_stop_finish ( + Watchdog *proxy, + GAsyncResult *res, + GError **error); + +gboolean watchdog_call_stop_sync ( + Watchdog *proxy, + GCancellable *cancellable, + GError **error); + + + +/* D-Bus property accessors: */ +gint watchdog_get_watchdog (Watchdog *object); +void watchdog_set_watchdog (Watchdog *object, gint value); + +gint watchdog_get_poll_interval (Watchdog *object); +void watchdog_set_poll_interval (Watchdog *object, gint value); + + +/* ---- */ + +#define TYPE_WATCHDOG_PROXY (watchdog_proxy_get_type ()) +#define WATCHDOG_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_WATCHDOG_PROXY, WatchdogProxy)) +#define WATCHDOG_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_WATCHDOG_PROXY, WatchdogProxyClass)) +#define WATCHDOG_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_WATCHDOG_PROXY, WatchdogProxyClass)) +#define IS_WATCHDOG_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_WATCHDOG_PROXY)) +#define IS_WATCHDOG_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_WATCHDOG_PROXY)) + +typedef struct _WatchdogProxy WatchdogProxy; +typedef struct _WatchdogProxyClass WatchdogProxyClass; +typedef struct _WatchdogProxyPrivate WatchdogProxyPrivate; + +struct _WatchdogProxy +{ + /*< private >*/ + GDBusProxy parent_instance; + WatchdogProxyPrivate *priv; +}; + +struct _WatchdogProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType watchdog_proxy_get_type (void) G_GNUC_CONST; + +void watchdog_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +Watchdog *watchdog_proxy_new_finish ( + GAsyncResult *res, + GError **error); +Watchdog *watchdog_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + +void watchdog_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +Watchdog *watchdog_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error); +Watchdog *watchdog_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + + +/* ---- */ + +#define TYPE_WATCHDOG_SKELETON (watchdog_skeleton_get_type ()) +#define WATCHDOG_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_WATCHDOG_SKELETON, WatchdogSkeleton)) +#define WATCHDOG_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_WATCHDOG_SKELETON, WatchdogSkeletonClass)) +#define WATCHDOG_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_WATCHDOG_SKELETON, WatchdogSkeletonClass)) +#define IS_WATCHDOG_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_WATCHDOG_SKELETON)) +#define IS_WATCHDOG_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_WATCHDOG_SKELETON)) + +typedef struct _WatchdogSkeleton WatchdogSkeleton; +typedef struct _WatchdogSkeletonClass WatchdogSkeletonClass; +typedef struct _WatchdogSkeletonPrivate WatchdogSkeletonPrivate; + +struct _WatchdogSkeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + WatchdogSkeletonPrivate *priv; +}; + +struct _WatchdogSkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType watchdog_skeleton_get_type (void) G_GNUC_CONST; + +Watchdog *watchdog_skeleton_new (void); + + +/* ---- */ + +#define TYPE_OBJECT (object_get_type ()) +#define OBJECT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_OBJECT, Object)) +#define IS_OBJECT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_OBJECT)) +#define OBJECT_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_OBJECT, Object)) + +struct _Object; +typedef struct _Object Object; +typedef struct _ObjectIface ObjectIface; + +struct _ObjectIface +{ + GTypeInterface parent_iface; +}; + +GType object_get_type (void) G_GNUC_CONST; + +Watchdog *object_get_watchdog (Object *object); +Watchdog *object_peek_watchdog (Object *object); + +#define TYPE_OBJECT_PROXY (object_proxy_get_type ()) +#define OBJECT_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_OBJECT_PROXY, ObjectProxy)) +#define OBJECT_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_OBJECT_PROXY, ObjectProxyClass)) +#define OBJECT_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_OBJECT_PROXY, ObjectProxyClass)) +#define IS_OBJECT_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_OBJECT_PROXY)) +#define IS_OBJECT_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_OBJECT_PROXY)) + +typedef struct _ObjectProxy ObjectProxy; +typedef struct _ObjectProxyClass ObjectProxyClass; +typedef struct _ObjectProxyPrivate ObjectProxyPrivate; + +struct _ObjectProxy +{ + /*< private >*/ + GDBusObjectProxy parent_instance; + ObjectProxyPrivate *priv; +}; + +struct _ObjectProxyClass +{ + GDBusObjectProxyClass parent_class; +}; + +GType object_proxy_get_type (void) G_GNUC_CONST; +ObjectProxy *object_proxy_new (GDBusConnection *connection, const gchar *object_path); + +#define TYPE_OBJECT_SKELETON (object_skeleton_get_type ()) +#define OBJECT_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_OBJECT_SKELETON, ObjectSkeleton)) +#define OBJECT_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_OBJECT_SKELETON, ObjectSkeletonClass)) +#define OBJECT_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_OBJECT_SKELETON, ObjectSkeletonClass)) +#define IS_OBJECT_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_OBJECT_SKELETON)) +#define IS_OBJECT_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_OBJECT_SKELETON)) + +typedef struct _ObjectSkeleton ObjectSkeleton; +typedef struct _ObjectSkeletonClass ObjectSkeletonClass; +typedef struct _ObjectSkeletonPrivate ObjectSkeletonPrivate; + +struct _ObjectSkeleton +{ + /*< private >*/ + GDBusObjectSkeleton parent_instance; + ObjectSkeletonPrivate *priv; +}; + +struct _ObjectSkeletonClass +{ + GDBusObjectSkeletonClass parent_class; +}; + +GType object_skeleton_get_type (void) G_GNUC_CONST; +ObjectSkeleton *object_skeleton_new (const gchar *object_path); +void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_); + +/* ---- */ + +#define TYPE_OBJECT_MANAGER_CLIENT (object_manager_client_get_type ()) +#define OBJECT_MANAGER_CLIENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_OBJECT_MANAGER_CLIENT, ObjectManagerClient)) +#define OBJECT_MANAGER_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_OBJECT_MANAGER_CLIENT, ObjectManagerClientClass)) +#define OBJECT_MANAGER_CLIENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_OBJECT_MANAGER_CLIENT, ObjectManagerClientClass)) +#define IS_OBJECT_MANAGER_CLIENT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_OBJECT_MANAGER_CLIENT)) +#define IS_OBJECT_MANAGER_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_OBJECT_MANAGER_CLIENT)) + +typedef struct _ObjectManagerClient ObjectManagerClient; +typedef struct _ObjectManagerClientClass ObjectManagerClientClass; +typedef struct _ObjectManagerClientPrivate ObjectManagerClientPrivate; + +struct _ObjectManagerClient +{ + /*< private >*/ + GDBusObjectManagerClient parent_instance; + ObjectManagerClientPrivate *priv; +}; + +struct _ObjectManagerClientClass +{ + GDBusObjectManagerClientClass parent_class; +}; + +GType object_manager_client_get_type (void) G_GNUC_CONST; + +GType object_manager_client_get_proxy_type (GDBusObjectManagerClient *manager, const gchar *object_path, const gchar *interface_name, gpointer user_data); + +void object_manager_client_new ( + GDBusConnection *connection, + GDBusObjectManagerClientFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GDBusObjectManager *object_manager_client_new_finish ( + GAsyncResult *res, + GError **error); +GDBusObjectManager *object_manager_client_new_sync ( + GDBusConnection *connection, + GDBusObjectManagerClientFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + +void object_manager_client_new_for_bus ( + GBusType bus_type, + GDBusObjectManagerClientFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GDBusObjectManager *object_manager_client_new_for_bus_finish ( + GAsyncResult *res, + GError **error); +GDBusObjectManager *object_manager_client_new_for_bus_sync ( + GBusType bus_type, + GDBusObjectManagerClientFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + + +G_END_DECLS + +#endif /* __INTERFACES_WATCHDOG_H__ */ diff --git a/objects/host_watchdog_obj.c b/objects/host_watchdog_obj.c new file mode 100644 index 0000000..6396658 --- /dev/null +++ b/objects/host_watchdog_obj.c @@ -0,0 +1,146 @@ +#include "interfaces/watchdog.h"
+#include "openbmc.h"
+
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static const gchar* dbus_object_path = "/org/openbmc/watchdog/HostWatchdog";
+static const gchar* dbus_name = "org.openbmc.watchdog.HostWatchdog";
+
+static GDBusObjectManagerServer *manager = NULL;
+
+
+static gboolean
+poll_watchdog(gpointer user_data)
+{
+ Watchdog *watchdog = object_get_watchdog((Object*)user_data);
+
+ guint count = watchdog_get_watchdog(watchdog);
+ g_print("Polling watchdog: %d\n",count);
+
+ if (count == 0)
+ {
+ watchdog_emit_watchdog_error(watchdog);
+ }
+
+ //reset watchdog
+ watchdog_set_watchdog(watchdog,0);
+ return TRUE;
+}
+
+static gboolean
+on_start (Watchdog *wd,
+ GDBusMethodInvocation *invocation,
+ gpointer user_data)
+{
+ guint poll_interval = watchdog_get_poll_interval(wd);
+ g_timeout_add(poll_interval, poll_watchdog, user_data);
+ watchdog_complete_start(wd,invocation);
+ return TRUE;
+}
+
+static gboolean
+on_poke (Watchdog *wd,
+ GDBusMethodInvocation *invocation,
+ gpointer user_data)
+{
+ watchdog_set_watchdog(wd,1);
+ watchdog_complete_poke(wd,invocation);
+ return TRUE;
+}
+
+
+
+static void
+on_bus_acquired (GDBusConnection *connection,
+ const gchar *name,
+ gpointer user_data)
+{
+ g_print ("Acquired a message bus connection: %s\n",name);
+
+ cmdline *cmd = user_data;
+ if (cmd->argc < 2)
+ {
+ g_print("No objects created. Put object name(s) on command line\n");
+ return;
+ }
+ manager = g_dbus_object_manager_server_new (dbus_object_path);
+ int i=0;
+ for (i=1;i<cmd->argc;i++)
+ {
+ gchar *s;
+ s = g_strdup_printf ("%s/%s",dbus_object_path,cmd->argv[i]);
+ ObjectSkeleton *object = object_skeleton_new (s);
+ g_free (s);
+
+ Watchdog *wd = watchdog_skeleton_new ();
+ object_skeleton_set_watchdog (object, wd);
+ g_object_unref (wd);
+
+ // set properties
+ watchdog_set_watchdog(wd,1);
+
+ //define method callbacks here
+ g_signal_connect (wd,
+ "handle-start",
+ G_CALLBACK (on_start),
+ object); /* user_data */
+
+ g_signal_connect (wd,
+ "handle-poke",
+ G_CALLBACK (on_poke),
+ object); /* user_data */
+
+
+ /* Export the object (@manager takes its own reference to @object) */
+ g_dbus_object_manager_server_export (manager, G_DBUS_OBJECT_SKELETON (object));
+ g_object_unref (object);
+ }
+
+ /* Export all objects */
+ g_dbus_object_manager_server_set_connection (manager, connection);
+}
+
+static void
+on_name_acquired (GDBusConnection *connection,
+ const gchar *name,
+ gpointer user_data)
+{
+ g_print ("Acquired the name %s\n", name);
+}
+
+static void
+on_name_lost (GDBusConnection *connection,
+ const gchar *name,
+ gpointer user_data)
+{
+ g_print ("Lost the name %s\n", name);
+}
+
+
+gint
+main (gint argc, gchar *argv[])
+{
+ GMainLoop *loop;
+ cmdline cmd;
+ cmd.argc = argc;
+ cmd.argv = argv;
+ guint id;
+ loop = g_main_loop_new (NULL, FALSE);
+
+ id = g_bus_own_name (G_BUS_TYPE_SESSION,
+ dbus_name,
+ G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT |
+ G_BUS_NAME_OWNER_FLAGS_REPLACE,
+ on_bus_acquired,
+ on_name_acquired,
+ on_name_lost,
+ &cmd,
+ NULL);
+
+ g_main_loop_run (loop);
+
+ g_bus_unown_name (id);
+ g_main_loop_unref (loop);
+ return 0;
+}
diff --git a/objects/power_control_obj.c b/objects/power_control_obj.c index c0047bd..ce9144b 100644 --- a/objects/power_control_obj.c +++ b/objects/power_control_obj.c @@ -42,23 +42,6 @@ static gboolean poll_pgood(gpointer user_data) control_power_emit_power_good(control_power);
}
}
- //}
- //else
- //{
- //TODO: error handling
- /* GVariantBuilder *b;
- GVariant *dict;
- b = g_variant_builder_new (G_VARIANT_TYPE ("a{ss}"));
- g_variant_builder_add (b, "{ss}", "object",dbus_object_path);
- g_variant_builder_add (b, "{ss}", "message", "Unable to read pgood gpio");
- char buf[254];
- sprintf(buf,"%s/gpio%d",pgood.dev,pgood.num);
- g_variant_builder_add (b, "{ss}", "gpio",buf);
-
- dict = g_variant_builder_end (b);
- event_log_emit_event_log(event_log,dict);
-
- }*/
return TRUE;
}
@@ -77,23 +60,31 @@ on_set_power_state (ControlPower *pwr, "Invalid power state");
return TRUE;
}
+ // return from method call
+ control_power_complete_set_power_state(pwr,invocation);
if (state == control_power_get_state(pwr))
{
- g_dbus_method_invocation_return_dbus_error (invocation,
- "org.openbmc.ControlPower.Error.Failed",
- "Power Control is already at requested state");
- return TRUE;
+ g_print("Power already at requested state: %d\n",state);
}
+ else
+ {
+ g_print("Set power state: %d\n",state);
+ gpio_open(&power_pin);
+ gpio_write(&power_pin,!state);
+ gpio_close(&power_pin);
+ control_power_set_state(pwr,state);
+ }
+ return TRUE;
+}
- //go ahead and return from method call
- control_power_complete_set_power_state(pwr,invocation);
-
- g_print("Set power state: %d\n",state);
- gpio_open(&power_pin);
- gpio_write(&power_pin,!state);
- gpio_close(&power_pin);
-
- control_power_set_state(pwr,state);
+static gboolean
+on_init (Control *control,
+ GDBusMethodInvocation *invocation,
+ gpointer user_data)
+{
+ guint poll_interval = control_get_poll_interval(control);
+ g_timeout_add(poll_interval, poll_pgood, user_data);
+ control_complete_init(control,invocation);
return TRUE;
}
@@ -152,7 +143,12 @@ on_bus_acquired (GDBusConnection *connection, G_CALLBACK (on_get_power_state),
NULL); /* user_data */
- g_timeout_add(5000, poll_pgood, object);
+ g_signal_connect (control,
+ "handle-init",
+ G_CALLBACK (on_init),
+ object); /* user_data */
+
+
/* Export the object (@manager takes its own reference to @object) */
g_dbus_object_manager_server_export (manager, G_DBUS_OBJECT_SKELETON (object));
diff --git a/objects/sensor_host_status_obj.c b/objects/sensor_host_status_obj.c index a085220..bd16935 100644 --- a/objects/sensor_host_status_obj.c +++ b/objects/sensor_host_status_obj.c @@ -1,48 +1,45 @@ #include "interfaces/sensor.h"
#include "openbmc.h"
-
+#define BOOTED 100
/* ---------------------------------------------------------------------------------------------------- */
static const gchar* dbus_object_path = "/org/openbmc/sensors/HostStatus";
static const gchar* dbus_name = "org.openbmc.sensors.HostStatus";
-static const guint poll_interval = 3000;
static guint heartbeat = 0;
static GDBusObjectManagerServer *manager = NULL;
-/*
-static gboolean
-on_get_units (SensorValue *sen,
- GDBusMethodInvocation *invocation,
- gpointer user_data)
-{
- const gchar* val = sensor_value_get_units(sen);
- sensor_value_complete_get_units(sen,invocation,val);
- return TRUE;
-}
static gboolean
-on_get (SensorValue *sen,
+on_set_value (SensorValue *sen,
GDBusMethodInvocation *invocation,
+ GVariant* value,
gpointer user_data)
{
- guint reading = sensor_value_get_value(sen);
- sensor_value_complete_get_value(sen,invocation,reading);
- return TRUE;
+ SensorMatch *match = object_get_sensor_match((Object*)user_data);
+ sensor_value_set_value(sen,value);
+ sensor_value_emit_changed(sen,value,"");
+ // Important host status values
+ guchar host_status = g_variant_get_byte(g_variant_get_variant(value));
+
+ if (host_status == BOOTED)
+ {
+ sensor_match_set_state(match,host_status);
+ sensor_match_emit_sensor_match(match,host_status);
+ }
+ sensor_value_complete_set_value(sen,invocation);
+ return TRUE;
}
+
static gboolean
-on_set (SensorValue *sen,
+on_init (SensorValue *sen,
GDBusMethodInvocation *invocation,
- guint value,
gpointer user_data)
{
- GVariant* v = NEW_VARIANT_U(value);
- sensor_value_set_value(sen,v);
- sensor_value_emit_changed(sen,v,sensor_value_get_units(sen));
- sensor_value_complete_set_value(sen,invocation);
+ sensor_value_complete_init(sen,invocation);
return TRUE;
}
-*/
+
static void
on_bus_acquired (GDBusConnection *connection,
const gchar *name,
@@ -68,26 +65,28 @@ on_bus_acquired (GDBusConnection *connection, SensorValue *sensor = sensor_value_skeleton_new ();
object_skeleton_set_sensor_value (object, sensor);
g_object_unref (sensor);
+
+ SensorMatch *match = sensor_match_skeleton_new ();
+ object_skeleton_set_sensor_match (object, match);
+ g_object_unref (match);
//must init variant
- GVariant* v = NEW_VARIANT_U(0);
+ GVariant* v = NEW_VARIANT_B(0);
sensor_value_set_value(sensor,v);
- // set units
+ // set units
sensor_value_set_units(sensor,"");
+ sensor_value_set_settable(sensor,TRUE);
+
//define method callbacks here
- //g_signal_connect (sensor,
- // "handle-get-value",
- // G_CALLBACK (on_get),
- // NULL); /* user_data */
- //g_signal_connect (sensor,
- // "handle-get-units",
- // G_CALLBACK (on_get_units),
- // NULL); /* user_data */
- //g_signal_connect (sensor,
- // "handle-set-value",
- // G_CALLBACK (on_set),
- // NULL); /* user_data */
+ g_signal_connect (sensor,
+ "handle-init",
+ G_CALLBACK (on_init),
+ NULL); /* user_data */
+ g_signal_connect (sensor,
+ "handle-set-value",
+ G_CALLBACK (on_set_value),
+ object); /* user_data */
/* Export the object (@manager takes its own reference to @object) */
g_dbus_object_manager_server_export (manager, G_DBUS_OBJECT_SKELETON (object));
diff --git a/objects/sensor_temperature_ambient_obj.c b/objects/sensor_temperature_ambient_obj.c index 70787dd..4f1b32a 100644 --- a/objects/sensor_temperature_ambient_obj.c +++ b/objects/sensor_temperature_ambient_obj.c @@ -7,25 +7,20 @@ static const gchar* dbus_object_path = "/org/openbmc/sensors/Temperature/Ambient";
static const gchar* dbus_name = "org.openbmc.sensors.Temperature.Ambient";
-static const guint poll_interval = 3000;
static guint heartbeat = 0;
static GDBusObjectManagerServer *manager = NULL;
-static gboolean inited = FALSE;
-
static gboolean
poll_sensor(gpointer user_data)
{
- if (!inited)
- {
- return TRUE;
- }
SensorValue *sensor = object_get_sensor_value((Object*)user_data);
SensorThreshold *threshold = object_get_sensor_threshold((Object*)user_data);
SensorI2c *i2c = object_get_sensor_i2c((Object*)user_data);
GVariant* v_value = sensor_value_get_value(sensor);
+ guint poll_interval = sensor_value_get_poll_interval(sensor);
+
//TODO: Change to actually read sensor
double value = GET_VARIANT_D(v_value);
g_print("Reading I2C = %s; Address = %s; %f\n",
@@ -46,17 +41,13 @@ poll_sensor(gpointer user_data) // End actually reading sensor
//if changed, set property and emit signal
- // if (value != sensor_value_get_value(sensor)
if (value != GET_VARIANT_D(v_value))
{
- // they don't appear to provide a function to modify float value in varait
- // so it seems I have to create a new one
GVariant* v_new_value = NEW_VARIANT_D(value);
sensor_value_set_value(sensor,v_new_value);
-
- sensor_value_set_value(sensor,v_new_value);
- //sensor_value_emit_changed(sensor,v_new_value,sensor_value_get_units(sensor));
- check_thresholds(threshold,v_new_value);
+ const gchar* units = sensor_value_get_units(sensor);
+ sensor_value_emit_changed(sensor,v_new_value,units);
+ check_thresholds(threshold,v_new_value);
}
return TRUE;
}
@@ -66,9 +57,11 @@ on_init (SensorValue *sen, GDBusMethodInvocation *invocation,
gpointer user_data)
{
- inited = TRUE;
- sensor_value_complete_init(sen,invocation);
- return TRUE;
+
+ guint poll_interval = sensor_value_get_poll_interval(sen);
+ g_timeout_add(poll_interval, poll_sensor, user_data);
+ sensor_value_complete_init(sen,invocation);
+ return TRUE;
}
@@ -112,6 +105,7 @@ on_bus_acquired (GDBusConnection *connection, GVariant* value = g_variant_new_variant(g_variant_new_double(1.0));
sensor_value_set_value(sensor,value);
sensor_value_set_units(sensor,"C");
+ sensor_value_set_settable(sensor,FALSE);
sensor_threshold_set_state(threshold,NOT_SET);
sensor_threshold_set_upper_critical(threshold,
@@ -128,14 +122,14 @@ on_bus_acquired (GDBusConnection *connection, g_signal_connect (sensor,
"handle-init",
G_CALLBACK (on_init),
- NULL); /* user_data */
+ object); /* user_data */
g_signal_connect (threshold,
"handle-get-state",
G_CALLBACK (get_threshold_state),
NULL); /* user_data */
- g_timeout_add(poll_interval, poll_sensor, object);
+
/* Export the object (@manager takes its own reference to @object) */
g_dbus_object_manager_server_export (manager, G_DBUS_OBJECT_SKELETON (object));
diff --git a/xml/control.xml b/xml/control.xml index 844cf5f..b23cf1c 100644 --- a/xml/control.xml +++ b/xml/control.xml @@ -1,9 +1,7 @@ <node> <interface name="org.openbmc.Control"> - <method name="setPollInterval"> - <arg name="poll_interval" type="i" direction="in"/> - </method> - <property name="poll_interval" type="i" access="read"/> + <method name="init"/> + <property name="poll_interval" type="i" access="readwrite"/> <property name="heatbeat" type="i" access="read"/> <signal name="Heartbeat"> <arg name="bus_name" type="s"/> diff --git a/xml/sensor.xml b/xml/sensor.xml index 2d6ccdb..463264c 100644 --- a/xml/sensor.xml +++ b/xml/sensor.xml @@ -8,10 +8,11 @@ <arg name="value" type="v" direction="in"/>
</method>
- <property name="value" type="v" access="readwrite"/>
+ <property name="value" type="v" access="read"/>
<property name="units" type="s" access="read"/>
- <property name="poll_interval" type="i" access="read"/>
+ <property name="poll_interval" type="i" access="readwrite"/>
<property name="heatbeat" type="i" access="read"/>
+ <property name="settable" type="b" access="read"/>
<signal name="Changed">
<arg name="value" type="v"/>
@@ -40,5 +41,12 @@ <property name="dev_path" type="s" access="readwrite"/>
<property name="address" type="s" access="readwrite"/>
</interface>
+ <interface name="org.openbmc.SensorMatch">
+ <property name="match_value" type="v" access="read"/>
+ <property name="state" type="y" access="read"/>
+ <signal name="SensorMatch">
+ <arg name="state" type="y"/>
+ </signal>
+ </interface>
</node>
diff --git a/xml/watchdog.xml b/xml/watchdog.xml index 90138ba..7889b43 100644 --- a/xml/watchdog.xml +++ b/xml/watchdog.xml @@ -4,9 +4,12 @@ @short_description:
-->
<interface name="org.openbmc.Watchdog">
- <method name="update"/>
<method name="start"/>
+ <method name="poke"/>
<method name="stop"/>
+ <property name="watchdog" type="i" access="readwrite"/>
+ <property name="poll_interval" type="i" access="readwrite"/>
+ <signal name="WatchdogError"/>
</interface>
</node>
|