lots of changes
diff --git a/Makefile b/Makefile
index c9300cb..b303513 100644
--- a/Makefile
+++ b/Makefile
@@ -37,8 +37,8 @@
power_control: power_control_obj.o gpio.o
$(CC) -o bin/$@.exe obj/gpio.o obj/power_control_obj.o $(OFLAGS) $(CFLAGS)
-chassis_identify: chassis_identify_obj.o gpio.o
- $(CC) -o bin/$@.exe obj/gpio.o obj/chassis_identify_obj.o $(OFLAGS) $(CFLAGS)
+led_controller: led_controller.o gpio.o
+ $(CC) -o bin/$@.exe obj/gpio.o obj/led_controller.o $(OFLAGS) $(CFLAGS)
sensor_ambient: sensor_threshold.o sensor_temperature_ambient_obj.o
$(CC) -o bin/$@.exe obj/sensor_threshold.o obj/sensor_temperature_ambient_obj.o $(OFLAGS) $(CFLAGS)
@@ -46,9 +46,6 @@
button_power: button_power_obj.o gpio.o
$(CC) -o bin/$@.exe obj/button_power_obj.o obj/gpio.o $(OFLAGS) $(CFLAGS)
-sensor_host_status: sensor_host_status_obj.o
- $(CC) -o bin/$@.exe obj/sensor_host_status_obj.o $(OFLAGS) $(CFLAGS)
-
control_host: control_host_obj.o gpio.o
$(CC) -o bin/$@.exe obj/gpio.o obj/control_host_obj.o $(OFLAGS) $(CFLAGS)
@@ -76,5 +73,8 @@
flasher: $(OBJS2) flasher_obj.o
$(CC) -o bin/$@.exe obj/flasher_obj.o $(OFLAGS) $(OBJS3) $(CFLAGS)
+hwmon: hwmon_intf.o
+ $(CC) -o bin/$@.exe obj/hwmon_intf.o $(OFLAGS) $(CFLAGS)
-all: clean setup libopenbmc_intf power_control chassis_identify sensor_ambient button_power sensor_host_status control_host fan host_watchdog control_bmc sensor_occ board_vpd pcie_slot_present flash_bios flasher
+
+all: clean setup libopenbmc_intf power_control led_controller sensor_ambient button_power control_host fan host_watchdog control_bmc board_vpd pcie_slot_present flash_bios flasher
diff --git a/bin/Openbmc.py b/bin/Openbmc.py
index cb2746a..87c5ae6 100755
--- a/bin/Openbmc.py
+++ b/bin/Openbmc.py
@@ -103,8 +103,55 @@
parent = False
+class DbusProperties(dbus.service.Object):
+ def __init__(self):
+ dbus.service.Object.__init__(self)
+ self.properties = {}
-class DbusProperty:
+ @dbus.service.method(dbus.PROPERTIES_IFACE,
+ in_signature='ss', out_signature='v')
+ def Get(self, interface_name, property_name):
+ d = self.GetAll(interface_name)
+ try:
+ v = d[property_name]
+ return v
+ except:
+ raise dbus.exceptions.DBusException(
+ "org.freedesktop.UnknownPropery: "+property_name)
+
+ @dbus.service.method(dbus.PROPERTIES_IFACE,
+ in_signature='s', out_signature='a{sv}')
+ def GetAll(self, interface_name):
+ try:
+ d = self.properties[interface_name]
+ return d
+ except:
+ raise dbus.exceptions.DBusException(
+ "org.freedesktop.UnknownInterface: "+interface_name)
+
+ @dbus.service.method(dbus.PROPERTIES_IFACE,
+ in_signature='ssv')
+ def Set(self, interface_name, property_name, new_value):
+ if (self.properties.has_key(interface_name) == False):
+ self.properties[interface_name] = {}
+ try:
+ old_value = self.properties[interface_name][property_name]
+ if (old_value != new_value):
+ self.properties[interface_name][property_name] = new_value
+ self.PropertiesChanged(interface_name,{ property_name: new_value }, [])
+
+ except:
+ self.properties[interface_name][property_name] = new_value
+
+ @dbus.service.signal(dbus.PROPERTIES_IFACE,
+ signature='sa{sv}as')
+ def PropertiesChanged(self, interface_name, changed_properties,
+ invalidated_properties):
+ pass
+
+
+
+class DbusVariable:
def __init__(self,name,value):
self.name = str(name)
self.dbusType = str(type(value)).split("'")[1]
diff --git a/bin/Palmetto.py b/bin/Palmetto.py
index db940b7..e7425d4 100755
--- a/bin/Palmetto.py
+++ b/bin/Palmetto.py
@@ -10,30 +10,51 @@
SYSTEM_NAME = "Palmetto"
+
+## System states
+## state can change to next state in 2 ways:
+## - a process emits a GotoSystemState signal with state name to goto
+## - objects specified in EXIT_STATE_DEPEND have started
SYSTEM_STATES = [
- 'INIT',
- 'STANDBY',
- 'POWERING_ON',
- 'POWERED_ON',
- 'BOOTING',
+ 'BMC_INIT',
+ 'BMC_STARTING',
+ 'BMC_READY',
+ 'HOST_POWERING_ON',
+ 'HOST_POWERED_ON',
+ 'HOST_BOOTING',
'HOST_UP',
- 'SHUTTING_DOWN',
- 'POWERING_DOWN'
+ 'HOST_POWERED_DOWN',
]
+EXIT_STATE_DEPEND = {
+ 'BMC_STARTING' : {
+ '/org/openbmc/control/chassis0': 0,
+ '/org/openbmc/control/power0' : 0,
+ '/org/openbmc/control/led/BMC_READY' : 0,
+ '/org/openbmc/control/Host_0' : 0,
+ }
+}
+
+## method will be called when state is entered
ENTER_STATE_CALLBACK = {
- 'POWERED_ON' : {
+ 'HOST_POWERED_ON' : {
'bus_name' : 'org.openbmc.control.Host',
'obj_name' : '/org/openbmc/control/Host_0',
'interface_name' : 'org.openbmc.control.Host',
'method_name' : 'boot'
+ },
+ 'BMC_READY' : {
+ 'bus_name' : 'org.openbmc.control.led',
+ 'obj_name' : '/org/openbmc/control/led/BMC_READY',
+ 'interface_name' : 'org.openbmc.Led',
+ 'method_name' : 'setOn'
}
}
SYSTEM_CONFIG = {}
SYSTEM_CONFIG['org.openbmc.control.Bmc'] = {
- 'system_state' : 'INIT',
+ 'system_state' : 'BMC_INIT',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'control_bmc.exe',
@@ -42,7 +63,7 @@
}
SYSTEM_CONFIG['org.openbmc.managers.Inventory'] = {
- 'system_state' : 'STANDBY',
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'inventory_items.py',
@@ -50,7 +71,7 @@
'instances' : [ { 'name' : SYSTEM_NAME } ]
}
SYSTEM_CONFIG['org.openbmc.control.PciePresent'] = {
- 'system_state' : 'POWERED_ON',
+ 'system_state' : 'HOST_POWERED_ON',
'start_process' : True,
'monitor_process' : False,
'process_name' : 'pcie_slot_present.exe',
@@ -58,16 +79,16 @@
'instances' : [ { 'name' : 'Slots_0' } ]
}
SYSTEM_CONFIG['org.openbmc.sensor.Power8Virtual'] = {
- 'system_state' : 'STANDBY',
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'sensors_virtual_p8.py',
'heartbeat' : 'no',
- 'instances' : [ { 'name' : 'Dummy' } ]
+ 'instances' : [ { 'name' : 'virtual' } ]
}
SYSTEM_CONFIG['org.openbmc.managers.Sensors'] = {
- 'system_state' : 'STANDBY',
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'sensor_manager.py',
@@ -76,7 +97,7 @@
}
SYSTEM_CONFIG['org.openbmc.watchdog.Host'] = {
- 'system_state' : 'STANDBY',
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'host_watchdog.exe',
@@ -94,14 +115,14 @@
}
SYSTEM_CONFIG['org.openbmc.control.Power'] = {
- 'system_state' : 'STANDBY',
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'power_control.exe',
'heartbeat' : 'no',
'instances' : [
{
- 'name' : 'SystemPower_0',
+ 'name' : 'power0',
'user_label': 'Power control',
'properties' : {
'org.openbmc.Control': {
@@ -116,7 +137,7 @@
}
SYSTEM_CONFIG['org.openbmc.sensors.Temperature.Ambient'] = {
- 'system_state' : 'STANDBY',
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'sensor_ambient.exe',
@@ -144,31 +165,23 @@
]
}
SYSTEM_CONFIG['org.openbmc.buttons.Power'] = {
- 'system_state' : 'STANDBY',
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'button_power.exe',
'heartbeat' : 'no',
'instances' : [ { 'name' : 'PowerButton_0' } ]
}
-SYSTEM_CONFIG['org.openbmc.sensors.HostStatus'] = {
- 'system_state' : 'STANDBY',
- 'start_process' : False,
- 'monitor_process' : False,
- 'process_name' : 'sensor_host_status.exe',
- 'heartbeat' : "no",
- 'instances' : [ { 'name' : 'HostStatus_0' } ]
- }
-SYSTEM_CONFIG['org.openbmc.leds.ChassisIdentify'] = {
- 'system_state' : 'STANDBY',
+SYSTEM_CONFIG['org.openbmc.control.led'] = {
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
- 'process_name' : 'chassis_identify.exe',
+ 'process_name' : 'led_controller.exe',
'heartbeat' : 'no',
- 'instances' : [ { 'name' : 'ChassisIdentify_0' } ]
+ 'instances' : [ { 'name' : 'Dummy' } ]
}
SYSTEM_CONFIG['org.openbmc.flash.Bios'] = {
- 'system_state' : 'STANDBY',
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'flash_bios.exe',
@@ -177,7 +190,7 @@
}
SYSTEM_CONFIG['org.openbmc.manager.Download'] = {
- 'system_state' : 'STANDBY',
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'download_manager.py',
@@ -186,7 +199,7 @@
}
SYSTEM_CONFIG['org.openbmc.control.Host'] = {
- 'system_state' : 'STANDBY',
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'control_host.exe',
@@ -194,17 +207,17 @@
'instances' : [ { 'name' : 'Host_0' } ]
}
SYSTEM_CONFIG['org.openbmc.control.Chassis'] = {
- 'system_state' : 'STANDBY',
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'chassis_control.py',
'heartbeat' : 'no',
- 'instances' : [ { 'name' : 'Chassis' } ]
+ 'instances' : [ { 'name' : 'chassis0' } ]
}
SYSTEM_CONFIG['org.openbmc.vpd'] = {
- 'system_state' : 'POWERING_ON',
- 'start_process' : True,
+ 'system_state' : 'HOST_POWERED_ON',
+ 'start_process' : False,
'monitor_process' : False,
'process_name' : 'board_vpd.exe',
'heartbeat' : 'no',
@@ -212,9 +225,9 @@
}
SYSTEM_CONFIG['org.openbmc.sensors.Occ'] = {
- 'system_state' : 'BOOTED',
- 'start_process' : True,
- 'monitor_process' : True,
+ 'system_state' : 'BMC_STARTING',
+ 'start_process' : False,
+ 'monitor_process' : False,
'process_name' : 'sensor_occ.exe',
'heartbeat' : 'no',
'instances' : [
@@ -231,7 +244,7 @@
}
SYSTEM_CONFIG['org.openbmc.sensors.Fan'] = {
- 'system_state' : 'STANDBY',
+ 'system_state' : 'BMC_STARTING',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'fan.exe',
@@ -246,7 +259,7 @@
'state' : True,
'cache' : True
}
-INVENTORY_ROOT = '/org/openbmc/inventory/items'
+INVENTORY_ROOT = '/org/openbmc/inventory'
FRU_INSTANCES = {
'<inventory_root>/system' :
@@ -386,11 +399,14 @@
ID_LOOKUP = {
'FRU' : {
+ 0x0d : '<inventory_root>/system',
0x01 : '<inventory_root>/system/motherboard/cpu0',
+ 0x02 : '<inventory_root>/system/motherboard/centaur0',
0x03 : '<inventory_root>/system/motherboard/dimm0',
0x04 : '<inventory_root>/system/motherboard/dimm1',
0x05 : '<inventory_root>/system/motherboard/dimm2',
0x06 : '<inventory_root>/system/motherboard/dimm3',
+ 0xff : '<inventory_root>/system',
},
'SENSOR' : {
0x2f : '<inventory_root>/system/motherboard/cpu0',
@@ -420,7 +436,6 @@
'GPIO_PRESENT' : {
'SLOT0_PRESENT' : '<inventory_root>/system/io_board/pcie_slot0',
'SLOT1_PRESENT' : '<inventory_root>/system/io_board/pcie_slot1',
- 'SLOT2_PRESENT' : '<inventory_root>/system/io_board/pcie_slot2',
}
}
@@ -432,6 +447,7 @@
GPIO_CONFIG['CRONUS_SEL'] = { 'gpio_num': 486, 'direction': 'out' }
GPIO_CONFIG['PGOOD'] = { 'gpio_num': 503, 'direction': 'in' }
GPIO_CONFIG['IDENTIFY'] = { 'gpio_num': 365, 'direction': 'out' }
+GPIO_CONFIG['BMC_READY'] = { 'gpio_num': 365, 'direction': 'out' }
GPIO_CONFIG['POWER_BUTTON'] = { 'gpio_num': 448, 'direction': 'falling' }
GPIO_CONFIG['SLOT0_RISER_PRESENT'] = { 'gpio_num': 104, 'direction': 'in' }
GPIO_CONFIG['SLOT1_RISER_PRESENT'] = { 'gpio_num': 105, 'direction': 'in' }
diff --git a/bin/PropertyManager.py b/bin/PropertyManager.py
index b89ed12..1fa8d87 100755
--- a/bin/PropertyManager.py
+++ b/bin/PropertyManager.py
@@ -23,7 +23,7 @@
for prop_interface in properties.keys():
for prop in properties[prop_interface]:
tmp_val = dbus_properties.Get(prop_interface,prop)
- dbus_prop = Openbmc.DbusProperty(prop,tmp_val)
+ dbus_prop = Openbmc.DbusVariable(prop,tmp_val)
value = properties[prop_interface][prop]
dbus_prop.setValue(value)
dbus_properties.Set(prop_interface,prop,dbus_prop.getValue())
@@ -66,7 +66,7 @@
print "Caching: "+obj_path
all_properties = prop_intf.GetAll(interface_name)
for prop in all_properties.keys():
- dbus_prop = Openbmc.DbusProperty(prop,all_properties[prop])
+ dbus_prop = Openbmc.DbusVariable(prop,all_properties[prop])
dbus_props.append(dbus_prop)
try:
diff --git a/bin/chassis_control.py b/bin/chassis_control.py
index 2770507..bf84a13 100755
--- a/bin/chassis_control.py
+++ b/bin/chassis_control.py
@@ -10,6 +10,7 @@
DBUS_NAME = 'org.openbmc.control.Chassis'
OBJ_NAME = '/org/openbmc/control/'+sys.argv[1]
+CONTROL_INTF = 'org.openbmc.Control'
POWER_OFF = 0
POWER_ON = 1
@@ -25,12 +26,12 @@
self.dbus_objects = {
'power_control' : {
'bus_name' : 'org.openbmc.control.Power',
- 'object_name' : '/org/openbmc/control/SystemPower_0',
+ 'object_name' : '/org/openbmc/control/power0',
'interface_name' : 'org.openbmc.control.Power'
},
'identify_led' : {
- 'bus_name' : 'org.openbmc.leds.ChassisIdentify',
- 'object_name' : '/org/openbmc/leds/ChassisIdentify_0',
+ 'bus_name' : 'org.openbmc.control.led',
+ 'object_name' : '/org/openbmc/led/IDENTIFY',
'interface_name' : 'org.openbmc.Led'
}
}
diff --git a/bin/inventory_items.py b/bin/inventory_items.py
index d337d95..d27abd3 100755
--- a/bin/inventory_items.py
+++ b/bin/inventory_items.py
@@ -18,6 +18,7 @@
INTF_NAME = 'org.openbmc.InventoryItem'
DBUS_NAME = 'org.openbmc.managers.Inventory'
+ENUM_INTF = 'org.openbmc.Object.Enumerate'
FRUS = System.FRU_INSTANCES
FRU_PATH = System.FRU_PATH
@@ -35,74 +36,70 @@
def addItem(self,item):
self.objects.append(item)
- @dbus.service.method("org.openbmc.managers.Inventory",
+ @dbus.service.method(ENUM_INTF,
in_signature='', out_signature='a{sa{sv}}')
- def getItems(self):
+ def enumerate(self):
tmp_obj = {}
for item in self.objects:
- tmp_obj[str(item.item['name'])]=item.getItemDict()
+ tmp_obj[str(item.name)]=item.GetAll(INTF_NAME)
return tmp_obj
-class InventoryItem(dbus.service.Object):
- def __init__(self,bus,name):
+class InventoryItem(Openbmc.DbusProperties):
+ def __init__(self,bus,name):
+ Openbmc.DbusProperties.__init__(self)
dbus.service.Object.__init__(self,bus,name)
- ## store all properties in a dict so can easily
- ## send on dbus
- self.item = {
- 'name' : name,
- 'is_fru' : False,
- 'fru_type' : 0,
- 'state' : 0,
- 'manufacturer' : "",
- }
+ self.name = name
self.cache = True
-
- def getItemDict(self):
- return self.item
-
- @dbus.service.method('org.openbmc.InventoryItem',
+ self.Set(INTF_NAME,'is_fru',False)
+ self.Set(INTF_NAME,'fru_type',0)
+ self.Set(INTF_NAME,'present',"INACTIVE")
+ self.Set(INTF_NAME,'fault',"NONE")
+
+
+
+ @dbus.service.method(INTF_NAME,
in_signature='a{sv}', out_signature='')
def update(self,data):
## translate dbus data into basic data types
for k in data.keys():
- d = Openbmc.DbusProperty(k,data[k])
- self.item[str(k)] = d.getBaseValue()
+ self.setField(k,data[k])
+
self.saveToCache()
- @dbus.service.method("org.openbmc.InventoryItem",
+ @dbus.service.method(INTF_NAME,
in_signature='s', out_signature='')
def setPresent(self,present):
- self.item['present'] = present
- print "Set Present: "+str(present)
+ self.setField('present',present)
- @dbus.service.method("org.openbmc.InventoryItem",
+ @dbus.service.method(INTF_NAME,
in_signature='s', out_signature='')
def setFault(self,fault):
- self.item['fault_state'] = fault
- print "Set Fault: "+str(fault)
+ self.setField('fault',fault)
def setField(self,field,value):
- self.item[field] = value
+ f = str(field)
+ d = Openbmc.DbusVariable(f,value)
+ self.Set(INTF_NAME,f,d.getBaseValue())
def isCached(self):
return self.cache
def getCacheFilename(self):
global FRU_PATH
- name = self.item['name'].replace('/','.')
+ name = self.name.replace('/','.')
filename = FRU_PATH+name[1:]+".fru"
return filename
def saveToCache(self):
if (self.isCached() == False):
return
- print "Caching: "+self.item['name']
+ print "Caching: "+self.name
try:
output = open(self.getCacheFilename(), 'wb')
- ## just pickle dict not whole object
- cPickle.dump(self.item,output)
+ ## save properties
+ cPickle.dump(self.properties[INTF_NAME],output)
except Exception as e:
print "ERROR: "+str(e)
finally:
@@ -119,7 +116,7 @@
p = open(filename, 'rb')
data2 = cPickle.load(p)
for k in data2.keys():
- self.item[k] = data2[k]
+ self.setField(k,data2[k])
except Exception as e:
print "No cache file found: " +str(e)
finally:
@@ -131,7 +128,7 @@
bus = Openbmc.getDBus()
name = dbus.service.BusName(DBUS_NAME,bus)
mainloop = gobject.MainLoop()
- obj_parent = Inventory(bus, '/org/openbmc/managers/Inventory')
+ obj_parent = Inventory(bus, '/org/openbmc/inventory')
for f in FRUS.keys():
obj_path=f.replace("<inventory_root>",System.INVENTORY_ROOT)
diff --git a/bin/ipmi_example.py b/bin/ipmi_example.py
index bc506fa..b998ba5 100755
--- a/bin/ipmi_example.py
+++ b/bin/ipmi_example.py
@@ -25,7 +25,7 @@
def getChassisControl():
obj = bus.get_object('org.openbmc.control.Chassis',
- '/org/openbmc/control/Chassis')
+ '/org/openbmc/control/chassis0')
intf = dbus.Interface(obj, 'org.openbmc.control.Chassis' )
return intf
@@ -76,18 +76,25 @@
d = { 'manufacturer' : data }
intf_sys = Openbmc.getManagerInterface(bus,"System")
c = chr(int(ipmi_id))
- obj_info = intf_sys.getObjectFromByteId("FRU",chr(int(ipmi_id)))
+ print c
+ obj_info = intf_sys.getObjectFromByteId("FRU",c)
+ intf_name = obj_info[2]
obj_path = obj_info[1]
bus_name = obj_info[0]
if (obj_path != "" and bus_name != ""):
obj = bus.get_object(bus_name,obj_path)
- intf = dbus.Interface(obj,"org.openbmc.InventoryItem")
+ intf = dbus.Interface(obj,intf_name)
intf.update(d)
elif (cmd == "getfrus"):
- intf_fru = Openbmc.getManagerInterface(bus,"Inventory")
- data = intf_fru.getItems()
+ obj = bus.get_object('org.openbmc.managers.Inventory',
+ '/org/openbmc/inventory')
+ intf_fru = dbus.Interface(obj,'org.openbmc.Object.Enumerate')
+
+ data = intf_fru.enumerate()
for i in data:
+ print ">>>>>>>>"
+ print i
for k in data[i].keys():
print k+" = "+str(data[i][k])
elif (cmd == "updatefwftp"):
diff --git a/bin/ipmid.py b/bin/ipmid.py
deleted file mode 100755
index 4f01421..0000000
--- a/bin/ipmid.py
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-import subprocess
-import dbus
-import string
-import os
-import fcntl
-import glib
-import gobject
-import dbus.service
-import dbus.mainloop.glib
-
-DBUS_NAME = 'org.openbmc.HostIpmi'
-OBJ_NAME = '/org/openbmc/HostIpmi/1'
-
-def print_packet(seq, netfn, cmd, data):
-# print 'seq: 0x%02x\nnetfn: 0x%02x\ncmd: 0x%02x\ndata: [%s]' % (
-# seq, netfn, cmd,
-# ", ".join(['0x%02x' % x for x in data]))
- new_str = ""
- for x in data:
- new_str += "0x%s " % (x.encode('hex'))
- print new_str
-
-
-class Ipmid(dbus.service.Object):
- def __init__(self, bus, name):
- dbus.service.Object.__init__(self,bus,name)
-
- def setReader(self, reader):
- self.reader = reader
-
- @dbus.service.signal(DBUS_NAME, "yyyay")
- def ReceivedMessage(self, seq, netfn, cmd, data):
- print("IPMI packet from host. Seq = 0x%x Netfn = 0x%x Cmd = 0x%x" %
- (ord(seq), ord(netfn), ord(cmd)))
- print_packet(seq, netfn, cmd, data)
-
- @dbus.service.method(DBUS_NAME, "", "")
- def test(self):
- print("TEST")
-
- @dbus.service.method(DBUS_NAME, "yyyay", "x")
- def sendMessage(self, seq, netfn, cmd, data):
- print("IPMI packet sent to host. Seq = 0x%x Netfn = 0x%x Cmd = 0x%x" %
- (int(seq), int(netfn), int(cmd)))
- #print_packet(seq, netfn, cmd, data)
-
- self.reader.write(seq, netfn, cmd, data)
-
- return 0
-
-class BtReader(object):
- def __init__(self, ipmi_obj):
- self.ipmi_obj = ipmi_obj
- flags = os.O_NONBLOCK | os.O_RDWR
- self.bt = os.open("/dev/bt", flags)
- glib.io_add_watch(self.bt, glib.IO_IN, self.io_callback)
- ipmi_obj.setReader(self)
-
- def write(self, seq, netfn, cmd, data):
- # Untested
- val = chr(netfn) + chr(seq) + chr(cmd)
- val += reduce(lambda a, b: a + chr(b), data, "")
- val = chr(len(val)) + val
- os.write(self.bt, val)
-
- def io_callback(self, fd, condition):
- data = os.read(self.bt, 128)
- if (len(data) > 2):
- self.ipmi_obj.ReceivedMessage(data[2], data[1], data[3], data[4:])
- return True
-
-def main():
- dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
- bus = dbus.SystemBus()
- name = dbus.service.BusName(DBUS_NAME, bus)
- obj = Ipmid(bus, OBJ_NAME)
- r = BtReader(obj)
- mainloop = gobject.MainLoop()
- print("Started")
- mainloop.run()
-
-if __name__ == '__main__':
- sys.exit(main())
diff --git a/bin/sensor_manager.py b/bin/sensor_manager.py
index 9f3ab56..a91235e 100755
--- a/bin/sensor_manager.py
+++ b/bin/sensor_manager.py
@@ -14,7 +14,8 @@
import Openbmc
DBUS_NAME = 'org.openbmc.managers.Sensors'
-OBJ_NAME = '/org/openbmc/managers/Sensors'
+OBJ_NAME = '/org/openbmc/sensors'
+ENUM_INTF = 'org.openbmc.Object.Enumerate'
class SensorManager(dbus.service.Object):
def __init__(self,bus,name):
@@ -37,9 +38,9 @@
self.sensor_cache = {}
- @dbus.service.method(DBUS_NAME,
+ @dbus.service.method(ENUM_INTF,
in_signature='', out_signature='a{sa{sv}}')
- def getSensors(self):
+ def enumerate(self):
return self.sensor_cache;
diff --git a/bin/sensors_virtual_p8.py b/bin/sensors_virtual_p8.py
index d8bf1ef..1488256 100755
--- a/bin/sensors_virtual_p8.py
+++ b/bin/sensors_virtual_p8.py
@@ -8,151 +8,80 @@
import dbus.mainloop.glib
import Openbmc
-SENSOR_INTERFACE = 'org.openbmc.SensorValue'
DBUS_NAME = 'org.openbmc.sensor.Power8Virtual'
OBJ_NAME = '/org/openbmc/sensor/virtual/'
-class BootProgress(dbus.service.Object):
+class SensorValue(Openbmc.DbusProperties):
+ IFACE_NAME = 'org.openbmc.SensorValue'
+ def __init__(self):
+ Openbmc.DbusProperties.__init__(self)
+ self.Set(SensorValue.IFACE_NAME,'units',"")
+
+ @dbus.service.method(IFACE_NAME,
+ in_signature='v', out_signature='')
+ def setValue(self,value):
+ changed = False
+ try:
+ old_value = self.Get(SensorValue.IFACE_NAME,'value')
+ if (value != old_value):
+ changed = True
+ except:
+ changed = True
+
+ if (changed == True):
+ self.Set(SensorValue.IFACE_NAME,'value',value)
+ self.Changed(self.getValue(),self.getUnits())
+
+
+
+ @dbus.service.method(IFACE_NAME,
+ in_signature='', out_signature='v')
+ def getValue(self):
+ return self.Get(SensorValue.IFACE_NAME,'value')
+
+ @dbus.service.method(IFACE_NAME,
+ in_signature='', out_signature='s')
+ def getUnits(self):
+ return self.Get(SensorValue.IFACE_NAME,'units')
+
+ @dbus.service.signal(IFACE_NAME,signature='vs')
+ def Changed(self,value,units):
+ pass
+
+
+
+
+
+class BootProgress(SensorValue):
def __init__(self,bus,name):
+ SensorValue.__init__(self)
self.object_name = "BootProgress"
- self.value = 0
- self.units = ""
dbus.service.Object.__init__(self,bus,name+self.object_name)
-
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='v', out_signature='')
- def setValue(self,value):
- if (value != self.value):
- self.value=value
- self.Changed()
-
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='', out_signature='v')
- def getValue(self):
- return self.value;
-
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='', out_signature='s')
- def getUnits(self):
- return self.units;
-
- @dbus.service.signal(SENSOR_INTERFACE,signature='vs')
- def Changed(self,value,units):
- pass
-class HostStatus(dbus.service.Object):
+class HostStatus(SensorValue):
def __init__(self,bus,name):
+ SensorValue.__init__(self)
self.object_name = "HostStatus"
- self.value = 0
- self.units = ""
dbus.service.Object.__init__(self,bus,name+self.object_name)
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='v', out_signature='')
- def setValue(self,value):
- if (value != self.value):
- self.value=value
- self.Changed(self.value,self.units)
-
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='', out_signature='v')
- def getValue(self):
- return self.value;
-
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='', out_signature='s')
- def getUnits(self):
- return self.units;
-
- @dbus.service.signal(SENSOR_INTERFACE,signature='vs')
- def Changed(self,value,units):
- pass
-
-class OsStatus(dbus.service.Object):
+class OsStatus(SensorValue):
def __init__(self,bus,name):
+ SensorValue.__init__(self)
self.object_name = "OperatingSystemStatus"
- self.value = 0
- self.units = ""
dbus.service.Object.__init__(self,bus,name+self.object_name)
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='v', out_signature='')
- def setValue(self,value):
- if (value != self.value):
- self.value=value
- self.Changed(self.value,self.units)
-
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='', out_signature='v')
- def getValue(self):
- return self.value;
-
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='', out_signature='s')
- def getUnits(self):
- return self.units;
-
- @dbus.service.signal(SENSOR_INTERFACE,signature='vs')
- def Changed(self,value,units):
- pass
-
-class BootCount(dbus.service.Object):
+class BootCount(SensorValue):
def __init__(self,bus,name):
+ SensorValue.__init__(self)
self.object_name = "BootCount"
- self.value = 0
- self.units = ""
dbus.service.Object.__init__(self,bus,name+self.object_name)
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='v', out_signature='')
- def setValue(self,value):
- if (value != self.value):
- self.value=value
- self.Changed(self.value,self.units)
-
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='', out_signature='v')
- def getValue(self):
- return self.value;
-
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='', out_signature='s')
- def getUnits(self):
- return self.units;
-
- @dbus.service.signal(SENSOR_INTERFACE,signature='vs')
- def Changed(self,value,units):
- pass
-
-
-class OccStatus(dbus.service.Object):
+class OccStatus(SensorValue):
def __init__(self,bus,name):
+ SensorValue.__init__(self)
self.object_name = "OccStatus"
- self.value = 0
- self.units = ""
dbus.service.Object.__init__(self,bus,name+self.object_name)
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='v', out_signature='')
- def setValue(self,value):
- if (value != self.value):
- self.value=value
- self.Changed(self.value,self.units)
-
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='', out_signature='v')
- def getValue(self):
- return self.value;
-
- @dbus.service.method(SENSOR_INTERFACE,
- in_signature='', out_signature='s')
- def getUnits(self):
- return self.units;
-
- @dbus.service.signal(SENSOR_INTERFACE,signature='vs')
- def Changed(self,value,units):
- pass
-
if __name__ == '__main__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@@ -164,6 +93,12 @@
boot_count = BootCount(bus,OBJ_NAME)
occ_status = OccStatus(bus,OBJ_NAME)
mainloop = gobject.MainLoop()
+
+ boot_progress.setValue("INACTIVE")
+ host_status.setValue("OFF")
+ os_status.setValue("OFF")
+ boot_count.setValue(0)
+ occ_status.setValue(0)
print "Starting virtual sensors"
mainloop.run()
diff --git a/bin/system_manager.py b/bin/system_manager.py
index 17285b2..441e957 100755
--- a/bin/system_manager.py
+++ b/bin/system_manager.py
@@ -25,7 +25,7 @@
STATE_START_TIMEOUT = 10
INTF_SENSOR = 'org.openbmc.SensorValue'
INTF_ITEM = 'org.openbmc.InventoryItem'
-
+INTF_CONTROL = 'org.openbmc.Control'
class SystemManager(dbus.service.Object):
def __init__(self,bus,name):
@@ -41,7 +41,6 @@
self.current_state = ""
self.system_states = {}
self.bus_name_lookup = {}
-
self.bin_path = os.path.dirname(os.path.realpath(sys.argv[0]))
for bus_name in System.SYSTEM_CONFIG.keys():
@@ -57,7 +56,7 @@
new_val = val.replace("<inventory_root>",System.INVENTORY_ROOT)
System.ID_LOOKUP[category][key] = new_val
- self.SystemStateHandler("INIT")
+ self.SystemStateHandler("BMC_INIT")
print "SystemManager Init Done"
def SystemStateHandler(self,state_name):
@@ -72,21 +71,30 @@
if (i == STATE_START_TIMEOUT):
print "ERROR: Timeout waiting for state to finish: "+self.current_state
return
+
+ ## clearing object started flags
+ try:
+ for obj_path in System.EXIT_STATE_DEPEND[self.current_state]:
+ System.EXIT_STATE_DEPEND[self.current_state][obj_path] = 0
+ except:
+ pass
print "Running System State: "+state_name
if (self.system_states.has_key(state_name)):
for bus_name in self.system_states[state_name]:
self.start_process(bus_name)
- if (state_name == "INIT"):
+ if (state_name == "BMC_INIT"):
## Add poll for heartbeat
gobject.timeout_add(HEARTBEAT_CHECK_INTERVAL, self.heartbeat_check)
- if (System.ENTER_STATE_CALLBACK.has_key(state_name)):
+ try:
cb = System.ENTER_STATE_CALLBACK[state_name]
obj = bus.get_object(cb['bus_name'],cb['obj_name'])
method = obj.get_dbus_method(cb['method_name'],cb['interface_name'])
method()
+ except:
+ pass
self.current_state = state_name
@@ -119,7 +127,7 @@
obj_path = System.ID_LOOKUP[category][byte]
bus_name = self.bus_name_lookup[obj_path]
parts = obj_path.split('/')
- if (parts[2] == 'sensor'):
+ if (parts[3] == 'sensor'):
intf_name = INTF_SENSOR
except Exception as e:
print "ERROR SystemManager: "+str(e)+" not found in lookup"
@@ -175,10 +183,14 @@
try:
Openbmc.get_objs(bus,bus_name,"",objects)
for instance_name in objects.keys():
- self.bus_name_lookup[objects[instance_name]['PATH']] = bus_name
+ obj_path = objects[instance_name]['PATH']
+ self.bus_name_lookup[obj_path] = bus_name
+ if (System.EXIT_STATE_DEPEND[self.current_state].has_key(obj_path) == True):
+ System.EXIT_STATE_DEPEND[self.current_state][obj_path] = 1
+
except:
pass
-
+
if (System.SYSTEM_CONFIG.has_key(bus_name)):
System.SYSTEM_CONFIG[bus_name]['heartbeat_count'] = 0
for instance_name in objects.keys():
@@ -195,6 +207,28 @@
print "Calling init method: " +obj_path+" : "+init_intf
intf.init()
+ ## check if all objects are started to move to next state
+ try:
+ state = 1
+ for obj_path in System.EXIT_STATE_DEPEND[self.current_state]:
+ if (System.EXIT_STATE_DEPEND[self.current_state][obj_path] == 0):
+ state = 0
+ if (state == 1):
+ s = 0
+ for i in range(len(System.SYSTEM_STATES)):
+ if (System.SYSTEM_STATES[i] == self.current_state):
+ s = i+1
+
+ if (s == len(System.SYSTEM_STATES)):
+ print "ERROR SystemManager: No more system states"
+ else:
+ new_state_name = System.SYSTEM_STATES[s]
+ print "SystemManager Goto System State: "+new_state_name
+ self.SystemStateHandler(new_state_name)
+ except:
+ pass
+
+
@dbus.service.method(DBUS_NAME,
in_signature='s', out_signature='sis')
diff --git a/interfaces/openbmc_intf.c b/interfaces/openbmc_intf.c
index 6bd5d91..81ed6ea 100644
--- a/interfaces/openbmc_intf.c
+++ b/interfaces/openbmc_intf.c
@@ -149,1535 +149,6 @@
}
/* ------------------------------------------------------------------------
- * Code for interface org.openbmc.Occ
- * ------------------------------------------------------------------------
- */
-
-/**
- * SECTION:Occ
- * @title: Occ
- * @short_description: Generated C code for the org.openbmc.Occ D-Bus interface
- *
- * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> D-Bus interface in C.
- */
-
-/* ---- Introspection data for org.openbmc.Occ ---- */
-
-static const _ExtendedGDBusMethodInfo _occ_method_info_init =
-{
- {
- -1,
- (gchar *) "init",
- NULL,
- NULL,
- NULL
- },
- "handle-init",
- FALSE
-};
-
-static const _ExtendedGDBusMethodInfo _occ_method_info_collect =
-{
- {
- -1,
- (gchar *) "collect",
- NULL,
- NULL,
- NULL
- },
- "handle-collect",
- FALSE
-};
-
-static const _ExtendedGDBusMethodInfo * const _occ_method_info_pointers[] =
-{
- &_occ_method_info_init,
- &_occ_method_info_collect,
- NULL
-};
-
-static const _ExtendedGDBusPropertyInfo _occ_property_info_state =
-{
- {
- -1,
- (gchar *) "state",
- (gchar *) "s",
- G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
- NULL
- },
- "state",
- FALSE
-};
-
-static const _ExtendedGDBusPropertyInfo _occ_property_info_instance_name =
-{
- {
- -1,
- (gchar *) "instance_name",
- (gchar *) "s",
- G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
- NULL
- },
- "instance-name",
- FALSE
-};
-
-static const _ExtendedGDBusPropertyInfo _occ_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 _occ_property_info_pointers[] =
-{
- &_occ_property_info_state,
- &_occ_property_info_instance_name,
- &_occ_property_info_poll_interval,
- NULL
-};
-
-static const _ExtendedGDBusInterfaceInfo _occ_interface_info =
-{
- {
- -1,
- (gchar *) "org.openbmc.Occ",
- (GDBusMethodInfo **) &_occ_method_info_pointers,
- NULL,
- (GDBusPropertyInfo **) &_occ_property_info_pointers,
- NULL
- },
- "occ",
-};
-
-
-/**
- * occ_interface_info:
- *
- * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> D-Bus interface.
- *
- * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
- */
-GDBusInterfaceInfo *
-occ_interface_info (void)
-{
- return (GDBusInterfaceInfo *) &_occ_interface_info.parent_struct;
-}
-
-/**
- * occ_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 #Occ interface for a concrete class.
- * The properties are overridden in the order they are defined.
- *
- * Returns: The last property id.
- */
-guint
-occ_override_properties (GObjectClass *klass, guint property_id_begin)
-{
- g_object_class_override_property (klass, property_id_begin++, "state");
- g_object_class_override_property (klass, property_id_begin++, "instance-name");
- g_object_class_override_property (klass, property_id_begin++, "poll-interval");
- return property_id_begin - 1;
-}
-
-
-
-/**
- * Occ:
- *
- * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>.
- */
-
-/**
- * OccIface:
- * @parent_iface: The parent interface.
- * @handle_collect: Handler for the #Occ::handle-collect signal.
- * @handle_init: Handler for the #Occ::handle-init signal.
- * @get_instance_name: Getter for the #Occ:instance-name property.
- * @get_poll_interval: Getter for the #Occ:poll-interval property.
- * @get_state: Getter for the #Occ:state property.
- *
- * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>.
- */
-
-typedef OccIface OccInterface;
-G_DEFINE_INTERFACE (Occ, occ, G_TYPE_OBJECT);
-
-static void
-occ_default_init (OccIface *iface)
-{
- /* GObject signals for incoming D-Bus method calls: */
- /**
- * Occ::handle-init:
- * @object: A #Occ.
- * @invocation: A #GDBusMethodInvocation.
- *
- * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Occ.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 occ_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-init",
- G_TYPE_FROM_INTERFACE (iface),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (OccIface, handle_init),
- g_signal_accumulator_true_handled,
- NULL,
- g_cclosure_marshal_generic,
- G_TYPE_BOOLEAN,
- 1,
- G_TYPE_DBUS_METHOD_INVOCATION);
-
- /**
- * Occ::handle-collect:
- * @object: A #Occ.
- * @invocation: A #GDBusMethodInvocation.
- *
- * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Occ.collect">collect()</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 occ_complete_collect() 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-collect",
- G_TYPE_FROM_INTERFACE (iface),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (OccIface, handle_collect),
- g_signal_accumulator_true_handled,
- NULL,
- g_cclosure_marshal_generic,
- G_TYPE_BOOLEAN,
- 1,
- G_TYPE_DBUS_METHOD_INVOCATION);
-
- /* GObject properties for D-Bus properties: */
- /**
- * Occ:state:
- *
- * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</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_string ("state", "state", "state", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * Occ:instance-name:
- *
- * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Occ.instance_name">"instance_name"</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_string ("instance-name", "instance_name", "instance_name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * Occ:poll-interval:
- *
- * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Occ.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));
-}
-
-/**
- * occ_get_state: (skip)
- * @object: A #Occ.
- *
- * Gets the value of the <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</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.
- *
- * <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 occ_dup_state() 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.
- */
-const gchar *
-occ_get_state (Occ *object)
-{
- return OCC_GET_IFACE (object)->get_state (object);
-}
-
-/**
- * occ_dup_state: (skip)
- * @object: A #Occ.
- *
- * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</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: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
- */
-gchar *
-occ_dup_state (Occ *object)
-{
- gchar *value;
- g_object_get (G_OBJECT (object), "state", &value, NULL);
- return value;
-}
-
-/**
- * occ_set_state: (skip)
- * @object: A #Occ.
- * @value: The value to set.
- *
- * Sets the <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</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
-occ_set_state (Occ *object, const gchar *value)
-{
- g_object_set (G_OBJECT (object), "state", value, NULL);
-}
-
-/**
- * occ_get_instance_name: (skip)
- * @object: A #Occ.
- *
- * Gets the value of the <link linkend="gdbus-property-org-openbmc-Occ.instance_name">"instance_name"</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 occ_dup_instance_name() 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.
- */
-const gchar *
-occ_get_instance_name (Occ *object)
-{
- return OCC_GET_IFACE (object)->get_instance_name (object);
-}
-
-/**
- * occ_dup_instance_name: (skip)
- * @object: A #Occ.
- *
- * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Occ.instance_name">"instance_name"</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_free().
- */
-gchar *
-occ_dup_instance_name (Occ *object)
-{
- gchar *value;
- g_object_get (G_OBJECT (object), "instance-name", &value, NULL);
- return value;
-}
-
-/**
- * occ_set_instance_name: (skip)
- * @object: A #Occ.
- * @value: The value to set.
- *
- * Sets the <link linkend="gdbus-property-org-openbmc-Occ.instance_name">"instance_name"</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
-occ_set_instance_name (Occ *object, const gchar *value)
-{
- g_object_set (G_OBJECT (object), "instance-name", value, NULL);
-}
-
-/**
- * occ_get_poll_interval: (skip)
- * @object: A #Occ.
- *
- * Gets the value of the <link linkend="gdbus-property-org-openbmc-Occ.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
-occ_get_poll_interval (Occ *object)
-{
- return OCC_GET_IFACE (object)->get_poll_interval (object);
-}
-
-/**
- * occ_set_poll_interval: (skip)
- * @object: A #Occ.
- * @value: The value to set.
- *
- * Sets the <link linkend="gdbus-property-org-openbmc-Occ.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
-occ_set_poll_interval (Occ *object, gint value)
-{
- g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
-}
-
-/**
- * occ_call_init:
- * @proxy: A #OccProxy.
- * @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-Occ.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 occ_call_init_finish() to get the result of the operation.
- *
- * See occ_call_init_sync() for the synchronous, blocking version of this method.
- */
-void
-occ_call_init (
- Occ *proxy,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- g_dbus_proxy_call (G_DBUS_PROXY (proxy),
- "init",
- g_variant_new ("()"),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- cancellable,
- callback,
- user_data);
-}
-
-/**
- * occ_call_init_finish:
- * @proxy: A #OccProxy.
- * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_call_init().
- * @error: Return location for error or %NULL.
- *
- * Finishes an operation started with occ_call_init().
- *
- * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
- */
-gboolean
-occ_call_init_finish (
- Occ *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;
-}
-
-/**
- * occ_call_init_sync:
- * @proxy: A #OccProxy.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @error: Return location for error or %NULL.
- *
- * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Occ.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
- *
- * See occ_call_init() for the asynchronous version of this method.
- *
- * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
- */
-gboolean
-occ_call_init_sync (
- Occ *proxy,
- GCancellable *cancellable,
- GError **error)
-{
- GVariant *_ret;
- _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
- "init",
- 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;
-}
-
-/**
- * occ_call_collect:
- * @proxy: A #OccProxy.
- * @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-Occ.collect">collect()</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 occ_call_collect_finish() to get the result of the operation.
- *
- * See occ_call_collect_sync() for the synchronous, blocking version of this method.
- */
-void
-occ_call_collect (
- Occ *proxy,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- g_dbus_proxy_call (G_DBUS_PROXY (proxy),
- "collect",
- g_variant_new ("()"),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- cancellable,
- callback,
- user_data);
-}
-
-/**
- * occ_call_collect_finish:
- * @proxy: A #OccProxy.
- * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_call_collect().
- * @error: Return location for error or %NULL.
- *
- * Finishes an operation started with occ_call_collect().
- *
- * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
- */
-gboolean
-occ_call_collect_finish (
- Occ *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;
-}
-
-/**
- * occ_call_collect_sync:
- * @proxy: A #OccProxy.
- * @cancellable: (allow-none): A #GCancellable or %NULL.
- * @error: Return location for error or %NULL.
- *
- * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Occ.collect">collect()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
- *
- * See occ_call_collect() for the asynchronous version of this method.
- *
- * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
- */
-gboolean
-occ_call_collect_sync (
- Occ *proxy,
- GCancellable *cancellable,
- GError **error)
-{
- GVariant *_ret;
- _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
- "collect",
- 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;
-}
-
-/**
- * occ_complete_init:
- * @object: A #Occ.
- * @invocation: (transfer full): A #GDBusMethodInvocation.
- *
- * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Occ.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
-occ_complete_init (
- Occ *object,
- GDBusMethodInvocation *invocation)
-{
- g_dbus_method_invocation_return_value (invocation,
- g_variant_new ("()"));
-}
-
-/**
- * occ_complete_collect:
- * @object: A #Occ.
- * @invocation: (transfer full): A #GDBusMethodInvocation.
- *
- * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Occ.collect">collect()</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
-occ_complete_collect (
- Occ *object,
- GDBusMethodInvocation *invocation)
-{
- g_dbus_method_invocation_return_value (invocation,
- g_variant_new ("()"));
-}
-
-/* ------------------------------------------------------------------------ */
-
-/**
- * OccProxy:
- *
- * The #OccProxy structure contains only private data and should only be accessed using the provided API.
- */
-
-/**
- * OccProxyClass:
- * @parent_class: The parent class.
- *
- * Class structure for #OccProxy.
- */
-
-struct _OccProxyPrivate
-{
- GData *qdata;
-};
-
-static void occ_proxy_iface_init (OccIface *iface);
-
-#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
-G_DEFINE_TYPE_WITH_CODE (OccProxy, occ_proxy, G_TYPE_DBUS_PROXY,
- G_ADD_PRIVATE (OccProxy)
- G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_proxy_iface_init));
-
-#else
-G_DEFINE_TYPE_WITH_CODE (OccProxy, occ_proxy, G_TYPE_DBUS_PROXY,
- G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_proxy_iface_init));
-
-#endif
-static void
-occ_proxy_finalize (GObject *object)
-{
- OccProxy *proxy = OCC_PROXY (object);
- g_datalist_clear (&proxy->priv->qdata);
- G_OBJECT_CLASS (occ_proxy_parent_class)->finalize (object);
-}
-
-static void
-occ_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 < 3);
- info = _occ_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
-occ_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.Occ: %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
-occ_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 < 3);
- info = _occ_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.Occ", info->parent_struct.name, variant),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- NULL, (GAsyncReadyCallback) occ_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
- g_variant_unref (variant);
-}
-
-static void
-occ_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 *) &_occ_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_OCC);
- 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_OCC);
- 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
-occ_proxy_g_properties_changed (GDBusProxy *_proxy,
- GVariant *changed_properties,
- const gchar *const *invalidated_properties)
-{
- OccProxy *proxy = OCC_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 *) &_occ_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 *) &_occ_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 const gchar *
-occ_proxy_get_state (Occ *object)
-{
- OccProxy *proxy = OCC_PROXY (object);
- GVariant *variant;
- const gchar *value = NULL;
- variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
- if (variant != NULL)
- {
- value = g_variant_get_string (variant, NULL);
- g_variant_unref (variant);
- }
- return value;
-}
-
-static const gchar *
-occ_proxy_get_instance_name (Occ *object)
-{
- OccProxy *proxy = OCC_PROXY (object);
- GVariant *variant;
- const gchar *value = NULL;
- variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "instance_name");
- if (variant != NULL)
- {
- value = g_variant_get_string (variant, NULL);
- g_variant_unref (variant);
- }
- return value;
-}
-
-static gint
-occ_proxy_get_poll_interval (Occ *object)
-{
- OccProxy *proxy = OCC_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
-occ_proxy_init (OccProxy *proxy)
-{
-#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
- proxy->priv = occ_proxy_get_instance_private (proxy);
-#else
- proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_OCC_PROXY, OccProxyPrivate);
-#endif
-
- g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), occ_interface_info ());
-}
-
-static void
-occ_proxy_class_init (OccProxyClass *klass)
-{
- GObjectClass *gobject_class;
- GDBusProxyClass *proxy_class;
-
- gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->finalize = occ_proxy_finalize;
- gobject_class->get_property = occ_proxy_get_property;
- gobject_class->set_property = occ_proxy_set_property;
-
- proxy_class = G_DBUS_PROXY_CLASS (klass);
- proxy_class->g_signal = occ_proxy_g_signal;
- proxy_class->g_properties_changed = occ_proxy_g_properties_changed;
-
- occ_override_properties (gobject_class, 1);
-
-#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
- g_type_class_add_private (klass, sizeof (OccProxyPrivate));
-#endif
-}
-
-static void
-occ_proxy_iface_init (OccIface *iface)
-{
- iface->get_state = occ_proxy_get_state;
- iface->get_instance_name = occ_proxy_get_instance_name;
- iface->get_poll_interval = occ_proxy_get_poll_interval;
-}
-
-/**
- * occ_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-Occ.top_of_page">org.openbmc.Occ</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 occ_proxy_new_finish() to get the result of the operation.
- *
- * See occ_proxy_new_sync() for the synchronous, blocking version of this constructor.
- */
-void
-occ_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_OCC_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.Occ", NULL);
-}
-
-/**
- * occ_proxy_new_finish:
- * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_proxy_new().
- * @error: Return location for error or %NULL
- *
- * Finishes an operation started with occ_proxy_new().
- *
- * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
- */
-Occ *
-occ_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 OCC (ret);
- else
- return NULL;
-}
-
-/**
- * occ_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-Occ.top_of_page">org.openbmc.Occ</link>. See g_dbus_proxy_new_sync() for more details.
- *
- * The calling thread is blocked until a reply is received.
- *
- * See occ_proxy_new() for the asynchronous version of this constructor.
- *
- * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
- */
-Occ *
-occ_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_OCC_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Occ", NULL);
- if (ret != NULL)
- return OCC (ret);
- else
- return NULL;
-}
-
-
-/**
- * occ_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 occ_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 occ_proxy_new_for_bus_finish() to get the result of the operation.
- *
- * See occ_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
- */
-void
-occ_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_OCC_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.Occ", NULL);
-}
-
-/**
- * occ_proxy_new_for_bus_finish:
- * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_proxy_new_for_bus().
- * @error: Return location for error or %NULL
- *
- * Finishes an operation started with occ_proxy_new_for_bus().
- *
- * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
- */
-Occ *
-occ_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 OCC (ret);
- else
- return NULL;
-}
-
-/**
- * occ_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 occ_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
- *
- * The calling thread is blocked until a reply is received.
- *
- * See occ_proxy_new_for_bus() for the asynchronous version of this constructor.
- *
- * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
- */
-Occ *
-occ_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_OCC_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Occ", NULL);
- if (ret != NULL)
- return OCC (ret);
- else
- return NULL;
-}
-
-
-/* ------------------------------------------------------------------------ */
-
-/**
- * OccSkeleton:
- *
- * The #OccSkeleton structure contains only private data and should only be accessed using the provided API.
- */
-
-/**
- * OccSkeletonClass:
- * @parent_class: The parent class.
- *
- * Class structure for #OccSkeleton.
- */
-
-struct _OccSkeletonPrivate
-{
- GValue *properties;
- GList *changed_properties;
- GSource *changed_properties_idle_source;
- GMainContext *context;
- GMutex lock;
-};
-
-static void
-_occ_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)
-{
- OccSkeleton *skeleton = OCC_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_OCC);
- 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_OCC);
- 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 *
-_occ_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)
-{
- OccSkeleton *skeleton = OCC_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 *) &_occ_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
-_occ_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)
-{
- OccSkeleton *skeleton = OCC_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 *) &_occ_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 _occ_skeleton_vtable =
-{
- _occ_skeleton_handle_method_call,
- _occ_skeleton_handle_get_property,
- _occ_skeleton_handle_set_property,
- {NULL}
-};
-
-static GDBusInterfaceInfo *
-occ_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
-{
- return occ_interface_info ();
-}
-
-static GDBusInterfaceVTable *
-occ_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
-{
- return (GDBusInterfaceVTable *) &_occ_skeleton_vtable;
-}
-
-static GVariant *
-occ_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
-{
- OccSkeleton *skeleton = OCC_SKELETON (_skeleton);
-
- GVariantBuilder builder;
- guint n;
- g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
- if (_occ_interface_info.parent_struct.properties == NULL)
- goto out;
- for (n = 0; _occ_interface_info.parent_struct.properties[n] != NULL; n++)
- {
- GDBusPropertyInfo *info = _occ_interface_info.parent_struct.properties[n];
- if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
- {
- GVariant *value;
- value = _occ_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.Occ", 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 _occ_emit_changed (gpointer user_data);
-
-static void
-occ_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
-{
- OccSkeleton *skeleton = OCC_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)
- _occ_emit_changed (skeleton);
-}
-
-static void occ_skeleton_iface_init (OccIface *iface);
-#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
-G_DEFINE_TYPE_WITH_CODE (OccSkeleton, occ_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
- G_ADD_PRIVATE (OccSkeleton)
- G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_skeleton_iface_init));
-
-#else
-G_DEFINE_TYPE_WITH_CODE (OccSkeleton, occ_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
- G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_skeleton_iface_init));
-
-#endif
-static void
-occ_skeleton_finalize (GObject *object)
-{
- OccSkeleton *skeleton = OCC_SKELETON (object);
- guint n;
- for (n = 0; n < 3; 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 (occ_skeleton_parent_class)->finalize (object);
-}
-
-static void
-occ_skeleton_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec G_GNUC_UNUSED)
-{
- OccSkeleton *skeleton = OCC_SKELETON (object);
- g_assert (prop_id != 0 && prop_id - 1 < 3);
- g_mutex_lock (&skeleton->priv->lock);
- g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
- g_mutex_unlock (&skeleton->priv->lock);
-}
-
-static gboolean
-_occ_emit_changed (gpointer user_data)
-{
- OccSkeleton *skeleton = OCC_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.Occ",
- &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
-_occ_schedule_emit_changed (OccSkeleton *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
-occ_skeleton_notify (GObject *object,
- GParamSpec *pspec G_GNUC_UNUSED)
-{
- OccSkeleton *skeleton = OCC_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, _occ_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
-occ_skeleton_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- OccSkeleton *skeleton = OCC_SKELETON (object);
- g_assert (prop_id != 0 && prop_id - 1 < 3);
- 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)
- _occ_schedule_emit_changed (skeleton, _occ_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
-occ_skeleton_init (OccSkeleton *skeleton)
-{
-#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
- skeleton->priv = occ_skeleton_get_instance_private (skeleton);
-#else
- skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_OCC_SKELETON, OccSkeletonPrivate);
-#endif
-
- g_mutex_init (&skeleton->priv->lock);
- skeleton->priv->context = g_main_context_ref_thread_default ();
- skeleton->priv->properties = g_new0 (GValue, 3);
- g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
- g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
- g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
-}
-
-static const gchar *
-occ_skeleton_get_state (Occ *object)
-{
- OccSkeleton *skeleton = OCC_SKELETON (object);
- const gchar *value;
- g_mutex_lock (&skeleton->priv->lock);
- value = g_value_get_string (&(skeleton->priv->properties[0]));
- g_mutex_unlock (&skeleton->priv->lock);
- return value;
-}
-
-static const gchar *
-occ_skeleton_get_instance_name (Occ *object)
-{
- OccSkeleton *skeleton = OCC_SKELETON (object);
- const gchar *value;
- g_mutex_lock (&skeleton->priv->lock);
- value = g_value_get_string (&(skeleton->priv->properties[1]));
- g_mutex_unlock (&skeleton->priv->lock);
- return value;
-}
-
-static gint
-occ_skeleton_get_poll_interval (Occ *object)
-{
- OccSkeleton *skeleton = OCC_SKELETON (object);
- gint value;
- g_mutex_lock (&skeleton->priv->lock);
- value = g_value_get_int (&(skeleton->priv->properties[2]));
- g_mutex_unlock (&skeleton->priv->lock);
- return value;
-}
-
-static void
-occ_skeleton_class_init (OccSkeletonClass *klass)
-{
- GObjectClass *gobject_class;
- GDBusInterfaceSkeletonClass *skeleton_class;
-
- gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->finalize = occ_skeleton_finalize;
- gobject_class->get_property = occ_skeleton_get_property;
- gobject_class->set_property = occ_skeleton_set_property;
- gobject_class->notify = occ_skeleton_notify;
-
-
- occ_override_properties (gobject_class, 1);
-
- skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
- skeleton_class->get_info = occ_skeleton_dbus_interface_get_info;
- skeleton_class->get_properties = occ_skeleton_dbus_interface_get_properties;
- skeleton_class->flush = occ_skeleton_dbus_interface_flush;
- skeleton_class->get_vtable = occ_skeleton_dbus_interface_get_vtable;
-
-#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
- g_type_class_add_private (klass, sizeof (OccSkeletonPrivate));
-#endif
-}
-
-static void
-occ_skeleton_iface_init (OccIface *iface)
-{
- iface->get_state = occ_skeleton_get_state;
- iface->get_instance_name = occ_skeleton_get_instance_name;
- iface->get_poll_interval = occ_skeleton_get_poll_interval;
-}
-
-/**
- * occ_skeleton_new:
- *
- * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>.
- *
- * Returns: (transfer full) (type OccSkeleton): The skeleton object.
- */
-Occ *
-occ_skeleton_new (void)
-{
- return OCC (g_object_new (TYPE_OCC_SKELETON, NULL));
-}
-
-/* ------------------------------------------------------------------------
* Code for interface org.openbmc.Fan
* ------------------------------------------------------------------------
*/
@@ -12484,10 +10955,22 @@
"goto-system-state"
};
+static const _ExtendedGDBusSignalInfo _control_signal_info_started =
+{
+ {
+ -1,
+ (gchar *) "Started",
+ NULL,
+ NULL
+ },
+ "started"
+};
+
static const _ExtendedGDBusSignalInfo * const _control_signal_info_pointers[] =
{
&_control_signal_info_heartbeat,
&_control_signal_info_goto_system_state,
+ &_control_signal_info_started,
NULL
};
@@ -12585,6 +11068,7 @@
* @get_poll_interval: Getter for the #Control:poll-interval property.
* @goto_system_state: Handler for the #Control::goto-system-state signal.
* @heartbeat: Handler for the #Control::heartbeat signal.
+ * @started: Handler for the #Control::started signal.
*
* Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
*/
@@ -12657,6 +11141,24 @@
G_TYPE_NONE,
1, G_TYPE_STRING);
+ /**
+ * Control::started:
+ * @object: A #Control.
+ *
+ * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Control.Started">"Started"</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 ("started",
+ G_TYPE_FROM_INTERFACE (iface),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ControlIface, started),
+ NULL,
+ NULL,
+ g_cclosure_marshal_generic,
+ G_TYPE_NONE,
+ 0);
+
/* GObject properties for D-Bus properties: */
/**
* Control:poll-interval:
@@ -12771,6 +11273,19 @@
}
/**
+ * control_emit_started:
+ * @object: A #Control.
+ *
+ * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Started">"Started"</link> D-Bus signal.
+ */
+void
+control_emit_started (
+ Control *object)
+{
+ g_signal_emit_by_name (object, "started");
+}
+
+/**
* control_call_init:
* @proxy: A #ControlProxy.
* @cancellable: (allow-none): A #GCancellable or %NULL.
@@ -13584,6 +12099,28 @@
g_list_free_full (connections, g_object_unref);
}
+static void
+_control_on_signal_started (
+ Control *object)
+{
+ ControlSkeleton *skeleton = CONTROL_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.Control", "Started",
+ signal_variant, NULL);
+ }
+ g_variant_unref (signal_variant);
+ g_list_free_full (connections, g_object_unref);
+}
+
static void control_skeleton_iface_init (ControlIface *iface);
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
@@ -13818,6 +12355,7 @@
{
iface->heartbeat = _control_on_signal_heartbeat;
iface->goto_system_state = _control_on_signal_goto_system_state;
+ iface->started = _control_on_signal_started;
iface->get_poll_interval = control_skeleton_get_poll_interval;
iface->get_heatbeat = control_skeleton_get_heatbeat;
}
@@ -28492,15 +27030,6 @@
object_default_init (ObjectIface *iface)
{
/**
- * Object:occ:
- *
- * The #Occ instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</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 ("occ", "occ", "occ", TYPE_OCC, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
-
- /**
* Object:fan:
*
* The #Fan instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>, if any.
@@ -28665,23 +27194,6 @@
}
/**
- * object_get_occ:
- * @object: A #Object.
- *
- * Gets the #Occ instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> on @object, if any.
- *
- * Returns: (transfer full): A #Occ that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
- */
-Occ *object_get_occ (Object *object)
-{
- GDBusInterface *ret;
- ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
- if (ret == NULL)
- return NULL;
- return OCC (ret);
-}
-
-/**
* object_get_fan:
* @object: A #Object.
*
@@ -28989,26 +27501,6 @@
/**
- * object_peek_occ: (skip)
- * @object: A #Object.
- *
- * Like object_get_occ() 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 #Occ or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
- */
-Occ *object_peek_occ (Object *object)
-{
- GDBusInterface *ret;
- ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
- if (ret == NULL)
- return NULL;
- g_object_unref (ret);
- return OCC (ret);
-}
-
-/**
* object_peek_fan: (skip)
* @object: A #Object.
*
@@ -29436,96 +27928,91 @@
switch (prop_id)
{
case 1:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
- g_value_take_object (value, interface);
- break;
-
- case 2:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
g_value_take_object (value, interface);
break;
- case 3:
+ case 2:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
g_value_take_object (value, interface);
break;
- case 4:
+ case 3:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
g_value_take_object (value, interface);
break;
- case 5:
+ case 4:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
g_value_take_object (value, interface);
break;
- case 6:
+ case 5:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
g_value_take_object (value, interface);
break;
- case 7:
+ case 6:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
g_value_take_object (value, interface);
break;
- case 8:
+ case 7:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
g_value_take_object (value, interface);
break;
- case 9:
+ case 8:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
g_value_take_object (value, interface);
break;
- case 10:
+ case 9:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
g_value_take_object (value, interface);
break;
- case 11:
+ case 10:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
g_value_take_object (value, interface);
break;
- case 12:
+ case 11:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
g_value_take_object (value, interface);
break;
- case 13:
+ case 12:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
g_value_take_object (value, interface);
break;
- case 14:
+ case 13:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
g_value_take_object (value, interface);
break;
- case 15:
+ case 14:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
g_value_take_object (value, interface);
break;
- case 16:
+ case 15:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
g_value_take_object (value, interface);
break;
- case 17:
+ case 16:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
g_value_take_object (value, interface);
break;
- case 18:
+ case 17:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
g_value_take_object (value, interface);
break;
- case 19:
+ case 18:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
g_value_take_object (value, interface);
break;
@@ -29544,25 +28031,24 @@
gobject_class->set_property = object_proxy_set_property;
gobject_class->get_property = object_proxy_get_property;
- g_object_class_override_property (gobject_class, 1, "occ");
- g_object_class_override_property (gobject_class, 2, "fan");
- g_object_class_override_property (gobject_class, 3, "sensor-value");
- g_object_class_override_property (gobject_class, 4, "sensor-threshold");
- g_object_class_override_property (gobject_class, 5, "sensor-i2c");
- g_object_class_override_property (gobject_class, 6, "sensor-match");
- g_object_class_override_property (gobject_class, 7, "process");
- g_object_class_override_property (gobject_class, 8, "shared-resource");
- g_object_class_override_property (gobject_class, 9, "control");
- g_object_class_override_property (gobject_class, 10, "control-bmc");
- g_object_class_override_property (gobject_class, 11, "control-host");
- g_object_class_override_property (gobject_class, 12, "control-power");
- g_object_class_override_property (gobject_class, 13, "watchdog");
- g_object_class_override_property (gobject_class, 14, "event-log");
- g_object_class_override_property (gobject_class, 15, "flash");
- g_object_class_override_property (gobject_class, 16, "flash-control");
- g_object_class_override_property (gobject_class, 17, "button");
- g_object_class_override_property (gobject_class, 18, "led");
- g_object_class_override_property (gobject_class, 19, "host-ipmi");
+ g_object_class_override_property (gobject_class, 1, "fan");
+ g_object_class_override_property (gobject_class, 2, "sensor-value");
+ g_object_class_override_property (gobject_class, 3, "sensor-threshold");
+ g_object_class_override_property (gobject_class, 4, "sensor-i2c");
+ g_object_class_override_property (gobject_class, 5, "sensor-match");
+ g_object_class_override_property (gobject_class, 6, "process");
+ g_object_class_override_property (gobject_class, 7, "shared-resource");
+ g_object_class_override_property (gobject_class, 8, "control");
+ g_object_class_override_property (gobject_class, 9, "control-bmc");
+ g_object_class_override_property (gobject_class, 10, "control-host");
+ g_object_class_override_property (gobject_class, 11, "control-power");
+ g_object_class_override_property (gobject_class, 12, "watchdog");
+ g_object_class_override_property (gobject_class, 13, "event-log");
+ g_object_class_override_property (gobject_class, 14, "flash");
+ g_object_class_override_property (gobject_class, 15, "flash-control");
+ g_object_class_override_property (gobject_class, 16, "button");
+ g_object_class_override_property (gobject_class, 17, "led");
+ g_object_class_override_property (gobject_class, 18, "host-ipmi");
}
/**
@@ -29633,19 +28119,6 @@
interface = g_value_get_object (value);
if (interface != NULL)
{
- g_warn_if_fail (IS_OCC (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.Occ");
- }
- break;
-
- case 2:
- interface = g_value_get_object (value);
- if (interface != NULL)
- {
g_warn_if_fail (IS_FAN (interface));
g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
}
@@ -29655,7 +28128,7 @@
}
break;
- case 3:
+ case 2:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29668,7 +28141,7 @@
}
break;
- case 4:
+ case 3:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29681,7 +28154,7 @@
}
break;
- case 5:
+ case 4:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29694,7 +28167,7 @@
}
break;
- case 6:
+ case 5:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29707,7 +28180,7 @@
}
break;
- case 7:
+ case 6:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29720,7 +28193,7 @@
}
break;
- case 8:
+ case 7:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29733,7 +28206,7 @@
}
break;
- case 9:
+ case 8:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29746,7 +28219,7 @@
}
break;
- case 10:
+ case 9:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29759,7 +28232,7 @@
}
break;
- case 11:
+ case 10:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29772,7 +28245,7 @@
}
break;
- case 12:
+ case 11:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29785,7 +28258,7 @@
}
break;
- case 13:
+ case 12:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29798,7 +28271,7 @@
}
break;
- case 14:
+ case 13:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29811,7 +28284,7 @@
}
break;
- case 15:
+ case 14:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29824,7 +28297,7 @@
}
break;
- case 16:
+ case 15:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29837,7 +28310,7 @@
}
break;
- case 17:
+ case 16:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29850,7 +28323,7 @@
}
break;
- case 18:
+ case 17:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29863,7 +28336,7 @@
}
break;
- case 19:
+ case 18:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -29894,96 +28367,91 @@
switch (prop_id)
{
case 1:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
- g_value_take_object (value, interface);
- break;
-
- case 2:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
g_value_take_object (value, interface);
break;
- case 3:
+ case 2:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
g_value_take_object (value, interface);
break;
- case 4:
+ case 3:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
g_value_take_object (value, interface);
break;
- case 5:
+ case 4:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
g_value_take_object (value, interface);
break;
- case 6:
+ case 5:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
g_value_take_object (value, interface);
break;
- case 7:
+ case 6:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
g_value_take_object (value, interface);
break;
- case 8:
+ case 7:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
g_value_take_object (value, interface);
break;
- case 9:
+ case 8:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
g_value_take_object (value, interface);
break;
- case 10:
+ case 9:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
g_value_take_object (value, interface);
break;
- case 11:
+ case 10:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
g_value_take_object (value, interface);
break;
- case 12:
+ case 11:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
g_value_take_object (value, interface);
break;
- case 13:
+ case 12:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
g_value_take_object (value, interface);
break;
- case 14:
+ case 13:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
g_value_take_object (value, interface);
break;
- case 15:
+ case 14:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
g_value_take_object (value, interface);
break;
- case 16:
+ case 15:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
g_value_take_object (value, interface);
break;
- case 17:
+ case 16:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
g_value_take_object (value, interface);
break;
- case 18:
+ case 17:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
g_value_take_object (value, interface);
break;
- case 19:
+ case 18:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
g_value_take_object (value, interface);
break;
@@ -30002,25 +28470,24 @@
gobject_class->set_property = object_skeleton_set_property;
gobject_class->get_property = object_skeleton_get_property;
- g_object_class_override_property (gobject_class, 1, "occ");
- g_object_class_override_property (gobject_class, 2, "fan");
- g_object_class_override_property (gobject_class, 3, "sensor-value");
- g_object_class_override_property (gobject_class, 4, "sensor-threshold");
- g_object_class_override_property (gobject_class, 5, "sensor-i2c");
- g_object_class_override_property (gobject_class, 6, "sensor-match");
- g_object_class_override_property (gobject_class, 7, "process");
- g_object_class_override_property (gobject_class, 8, "shared-resource");
- g_object_class_override_property (gobject_class, 9, "control");
- g_object_class_override_property (gobject_class, 10, "control-bmc");
- g_object_class_override_property (gobject_class, 11, "control-host");
- g_object_class_override_property (gobject_class, 12, "control-power");
- g_object_class_override_property (gobject_class, 13, "watchdog");
- g_object_class_override_property (gobject_class, 14, "event-log");
- g_object_class_override_property (gobject_class, 15, "flash");
- g_object_class_override_property (gobject_class, 16, "flash-control");
- g_object_class_override_property (gobject_class, 17, "button");
- g_object_class_override_property (gobject_class, 18, "led");
- g_object_class_override_property (gobject_class, 19, "host-ipmi");
+ g_object_class_override_property (gobject_class, 1, "fan");
+ g_object_class_override_property (gobject_class, 2, "sensor-value");
+ g_object_class_override_property (gobject_class, 3, "sensor-threshold");
+ g_object_class_override_property (gobject_class, 4, "sensor-i2c");
+ g_object_class_override_property (gobject_class, 5, "sensor-match");
+ g_object_class_override_property (gobject_class, 6, "process");
+ g_object_class_override_property (gobject_class, 7, "shared-resource");
+ g_object_class_override_property (gobject_class, 8, "control");
+ g_object_class_override_property (gobject_class, 9, "control-bmc");
+ g_object_class_override_property (gobject_class, 10, "control-host");
+ g_object_class_override_property (gobject_class, 11, "control-power");
+ g_object_class_override_property (gobject_class, 12, "watchdog");
+ g_object_class_override_property (gobject_class, 13, "event-log");
+ g_object_class_override_property (gobject_class, 14, "flash");
+ g_object_class_override_property (gobject_class, 15, "flash-control");
+ g_object_class_override_property (gobject_class, 16, "button");
+ g_object_class_override_property (gobject_class, 17, "led");
+ g_object_class_override_property (gobject_class, 18, "host-ipmi");
}
/**
@@ -30039,18 +28506,6 @@
}
/**
- * object_skeleton_set_occ:
- * @object: A #ObjectSkeleton.
- * @interface_: (allow-none): A #Occ or %NULL to clear the interface.
- *
- * Sets the #Occ instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> on @object.
- */
-void object_skeleton_set_occ (ObjectSkeleton *object, Occ *interface_)
-{
- g_object_set (G_OBJECT (object), "occ", interface_, NULL);
-}
-
-/**
* object_skeleton_set_fan:
* @object: A #ObjectSkeleton.
* @interface_: (allow-none): A #Fan or %NULL to clear the interface.
@@ -30328,7 +28783,6 @@
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.Occ", GSIZE_TO_POINTER (TYPE_OCC_PROXY));
g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY));
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));
diff --git a/interfaces/openbmc_intf.h b/interfaces/openbmc_intf.h
index ae6ee88..204920b 100644
--- a/interfaces/openbmc_intf.h
+++ b/interfaces/openbmc_intf.h
@@ -13,200 +13,6 @@
/* ------------------------------------------------------------------------ */
-/* Declarations for org.openbmc.Occ */
-
-#define TYPE_OCC (occ_get_type ())
-#define OCC(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_OCC, Occ))
-#define IS_OCC(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_OCC))
-#define OCC_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_OCC, OccIface))
-
-struct _Occ;
-typedef struct _Occ Occ;
-typedef struct _OccIface OccIface;
-
-struct _OccIface
-{
- GTypeInterface parent_iface;
-
-
- gboolean (*handle_collect) (
- Occ *object,
- GDBusMethodInvocation *invocation);
-
- gboolean (*handle_init) (
- Occ *object,
- GDBusMethodInvocation *invocation);
-
- const gchar * (*get_instance_name) (Occ *object);
-
- gint (*get_poll_interval) (Occ *object);
-
- const gchar * (*get_state) (Occ *object);
-
-};
-
-GType occ_get_type (void) G_GNUC_CONST;
-
-GDBusInterfaceInfo *occ_interface_info (void);
-guint occ_override_properties (GObjectClass *klass, guint property_id_begin);
-
-
-/* D-Bus method call completion functions: */
-void occ_complete_init (
- Occ *object,
- GDBusMethodInvocation *invocation);
-
-void occ_complete_collect (
- Occ *object,
- GDBusMethodInvocation *invocation);
-
-
-
-/* D-Bus method calls: */
-void occ_call_init (
- Occ *proxy,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-
-gboolean occ_call_init_finish (
- Occ *proxy,
- GAsyncResult *res,
- GError **error);
-
-gboolean occ_call_init_sync (
- Occ *proxy,
- GCancellable *cancellable,
- GError **error);
-
-void occ_call_collect (
- Occ *proxy,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-
-gboolean occ_call_collect_finish (
- Occ *proxy,
- GAsyncResult *res,
- GError **error);
-
-gboolean occ_call_collect_sync (
- Occ *proxy,
- GCancellable *cancellable,
- GError **error);
-
-
-
-/* D-Bus property accessors: */
-const gchar *occ_get_state (Occ *object);
-gchar *occ_dup_state (Occ *object);
-void occ_set_state (Occ *object, const gchar *value);
-
-const gchar *occ_get_instance_name (Occ *object);
-gchar *occ_dup_instance_name (Occ *object);
-void occ_set_instance_name (Occ *object, const gchar *value);
-
-gint occ_get_poll_interval (Occ *object);
-void occ_set_poll_interval (Occ *object, gint value);
-
-
-/* ---- */
-
-#define TYPE_OCC_PROXY (occ_proxy_get_type ())
-#define OCC_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_OCC_PROXY, OccProxy))
-#define OCC_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_OCC_PROXY, OccProxyClass))
-#define OCC_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_OCC_PROXY, OccProxyClass))
-#define IS_OCC_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_OCC_PROXY))
-#define IS_OCC_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_OCC_PROXY))
-
-typedef struct _OccProxy OccProxy;
-typedef struct _OccProxyClass OccProxyClass;
-typedef struct _OccProxyPrivate OccProxyPrivate;
-
-struct _OccProxy
-{
- /*< private >*/
- GDBusProxy parent_instance;
- OccProxyPrivate *priv;
-};
-
-struct _OccProxyClass
-{
- GDBusProxyClass parent_class;
-};
-
-GType occ_proxy_get_type (void) G_GNUC_CONST;
-
-void occ_proxy_new (
- GDBusConnection *connection,
- GDBusProxyFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-Occ *occ_proxy_new_finish (
- GAsyncResult *res,
- GError **error);
-Occ *occ_proxy_new_sync (
- GDBusConnection *connection,
- GDBusProxyFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GError **error);
-
-void occ_proxy_new_for_bus (
- GBusType bus_type,
- GDBusProxyFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-Occ *occ_proxy_new_for_bus_finish (
- GAsyncResult *res,
- GError **error);
-Occ *occ_proxy_new_for_bus_sync (
- GBusType bus_type,
- GDBusProxyFlags flags,
- const gchar *name,
- const gchar *object_path,
- GCancellable *cancellable,
- GError **error);
-
-
-/* ---- */
-
-#define TYPE_OCC_SKELETON (occ_skeleton_get_type ())
-#define OCC_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_OCC_SKELETON, OccSkeleton))
-#define OCC_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_OCC_SKELETON, OccSkeletonClass))
-#define OCC_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_OCC_SKELETON, OccSkeletonClass))
-#define IS_OCC_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_OCC_SKELETON))
-#define IS_OCC_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_OCC_SKELETON))
-
-typedef struct _OccSkeleton OccSkeleton;
-typedef struct _OccSkeletonClass OccSkeletonClass;
-typedef struct _OccSkeletonPrivate OccSkeletonPrivate;
-
-struct _OccSkeleton
-{
- /*< private >*/
- GDBusInterfaceSkeleton parent_instance;
- OccSkeletonPrivate *priv;
-};
-
-struct _OccSkeletonClass
-{
- GDBusInterfaceSkeletonClass parent_class;
-};
-
-GType occ_skeleton_get_type (void) G_GNUC_CONST;
-
-Occ *occ_skeleton_new (void);
-
-
-/* ------------------------------------------------------------------------ */
/* Declarations for org.openbmc.Fan */
#define TYPE_FAN (fan_get_type ())
@@ -1602,6 +1408,9 @@
Control *object,
const gchar *arg_bus_name);
+ void (*started) (
+ Control *object);
+
};
GType control_get_type (void) G_GNUC_CONST;
@@ -1626,6 +1435,9 @@
Control *object,
const gchar *arg_state_name);
+void control_emit_started (
+ Control *object);
+
/* D-Bus method calls: */
@@ -3836,7 +3648,6 @@
GType object_get_type (void) G_GNUC_CONST;
-Occ *object_get_occ (Object *object);
Fan *object_get_fan (Object *object);
SensorValue *object_get_sensor_value (Object *object);
SensorThreshold *object_get_sensor_threshold (Object *object);
@@ -3855,7 +3666,6 @@
Button *object_get_button (Object *object);
Led *object_get_led (Object *object);
HostIpmi *object_get_host_ipmi (Object *object);
-Occ *object_peek_occ (Object *object);
Fan *object_peek_fan (Object *object);
SensorValue *object_peek_sensor_value (Object *object);
SensorThreshold *object_peek_sensor_threshold (Object *object);
@@ -3926,7 +3736,6 @@
GType object_skeleton_get_type (void) G_GNUC_CONST;
ObjectSkeleton *object_skeleton_new (const gchar *object_path);
-void object_skeleton_set_occ (ObjectSkeleton *object, Occ *interface_);
void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_);
void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_);
void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_);
diff --git a/objects/chassis_identify_obj.c b/objects/chassis_identify_obj.c
deleted file mode 100644
index 1206d17..0000000
--- a/objects/chassis_identify_obj.c
+++ /dev/null
@@ -1,151 +0,0 @@
-#include "interfaces/openbmc_intf.h"
-#include <stdio.h>
-#include "openbmc.h"
-#include "gpio.h"
-
-/* ---------------------------------------------------------------------------------------------------- */
-static const gchar* dbus_object_path = "/org/openbmc/leds";
-static const gchar* dbus_name = "org.openbmc.leds.ChassisIdentify";
-
-static GDBusObjectManagerServer *manager = NULL;
-
-GPIO led_gpio = (GPIO){"IDENTIFY"};
-
-static gboolean
-on_set_on (Led *led,
- GDBusMethodInvocation *invocation,
- gpointer user_data)
-{
- printf("Turn on chassis identify led\n");
- led_complete_set_on(led,invocation);
- int rc = GPIO_OK;
- do {
- rc = gpio_open(&led_gpio);
- if (rc != GPIO_OK) { break; }
- rc = gpio_write(&led_gpio,1);
- if (rc != GPIO_OK) { break; }
- } while(0);
- gpio_close(&led_gpio);
- if (rc != GPIO_OK)
- {
- printf("ERROR ChassisIdentify: GPIO error %s (rc=%d)\n",led_gpio.name,rc);
- }
-
- return TRUE;
-
-}
-
-static gboolean
-on_set_off (Led *led,
- GDBusMethodInvocation *invocation,
- gpointer user_data)
-{
- g_print("Turn off chassis identify led\n");
- led_complete_set_off(led,invocation);
- int rc = GPIO_OK;
- do {
- rc = gpio_open(&led_gpio);
- if (rc != GPIO_OK) { break; }
- rc = gpio_write(&led_gpio,0);
- if (rc != GPIO_OK) { break; }
- } while(0);
- gpio_close(&led_gpio);
- if (rc != GPIO_OK)
- {
- printf("ERROR ChassisIdentify: GPIO error %s (rc=%d)\n",led_gpio.name,rc);
- }
- return TRUE;
-}
-
-static void
-on_bus_acquired (GDBusConnection *connection,
- const gchar *name,
- gpointer user_data)
-{
- ObjectSkeleton *object;
-
- 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]);
- object = object_skeleton_new (s);
- g_free (s);
-
- Led *led = led_skeleton_new ();
- object_skeleton_set_led (object, led);
- g_object_unref (led);
-
- //define method callbacks
- g_signal_connect (led,
- "handle-set-on",
- G_CALLBACK (on_set_on),
- NULL); /* user_data */
- g_signal_connect (led,
- "handle-set-off",
- G_CALLBACK (on_set_off),
- NULL);
-
- led_set_color(led,0);
- led_set_function(led,"CHASSIS_IDENTIFY");
-
- /* 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);
- gpio_init(connection,&led_gpio);
-
-}
-
-static void
-on_name_acquired (GDBusConnection *connection,
- const gchar *name,
- gpointer user_data)
-{
-}
-
-static void
-on_name_lost (GDBusConnection *connection,
- const gchar *name,
- gpointer user_data)
-{
-}
-
-
-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 (DBUS_TYPE,
- 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/control_bmc_obj.c b/objects/control_bmc_obj.c
index 4355f63..caba185 100644
--- a/objects/control_bmc_obj.c
+++ b/objects/control_bmc_obj.c
@@ -108,7 +108,7 @@
reg_init();
#endif
control_complete_init(control,invocation);
- control_emit_goto_system_state(control,"STANDBY");
+ control_emit_goto_system_state(control,"BMC_STARTING");
return TRUE;
}
diff --git a/objects/flash_bios_obj.c b/objects/flash_bios_obj.c
index 928d11b..ebc71aa 100644
--- a/objects/flash_bios_obj.c
+++ b/objects/flash_bios_obj.c
@@ -24,10 +24,10 @@
const gchar* name = flash_get_flasher_name(flash);
const gchar* inst = flash_get_flasher_instance(flash);
const gchar* filename = flash_get_filename(flash);
-
status = execl(path, name, inst, filename, NULL);
+ return status;
}
- return status;
+ return 0;
}
static gboolean
@@ -53,9 +53,18 @@
gchar* name,
gpointer user_data)
{
- printf("Locking BIOS Flash: %s\n",name);
- shared_resource_set_lock(lock,true);
- shared_resource_set_name(lock,name);
+ gboolean locked = shared_resource_get_lock(lock);
+ if (locked)
+ {
+ const gchar* name = shared_resource_get_name(lock);
+ printf("ERROR: BIOS Flash is already locked: %s\n",name);
+ }
+ else
+ {
+ printf("Locking BIOS Flash: %s\n",name);
+ shared_resource_set_lock(lock,true);
+ shared_resource_set_name(lock,name);
+ }
shared_resource_complete_lock(lock,invocation);
return TRUE;
}
@@ -347,7 +356,7 @@
object,
NULL );
g_free(s);
- s = g_strdup_printf ("/org/openbmc/control/%s\0",cmd->argv[i]);
+ s = g_strdup_printf ("/org/openbmc/control/%s",cmd->argv[i]);
g_dbus_connection_signal_subscribe(connection,
NULL,
"org.openbmc.FlashControl",
diff --git a/objects/pcie_slot_present_obj.c b/objects/pcie_slot_present_obj.c
index cceb637..f1f882b 100644
--- a/objects/pcie_slot_present_obj.c
+++ b/objects/pcie_slot_present_obj.c
@@ -2,6 +2,7 @@
#include "openbmc.h"
#include <stdio.h>
#include <stdbool.h>
+#include <string.h>
#include "gpio.h"
#define NUM_SLOTS 4
@@ -48,7 +49,7 @@
g_variant_get(v_result,"(sss)",&obj_info->bus_name,&obj_info->path,&obj_info->intf_name);
int rc=0;
- if (strcmp(obj_info->bus_name,"") == 0) {
+ if (strlen(obj_info->bus_name) == 0) {
rc = 1;
}
g_variant_unref(v_result);
@@ -78,7 +79,7 @@
return rc;
}
-void update_fru_obj(GDBusConnection* connection, object_info* obj_info, bool present)
+void update_fru_obj(GDBusConnection* connection, object_info* obj_info, const char* present)
{
GDBusProxy *proxy;
GError *error;
@@ -97,7 +98,7 @@
g_assert_no_error (error);
error = NULL;
- parm = g_variant_new("(b)",present);
+ parm = g_variant_new("(s)",present);
result = g_dbus_proxy_call_sync (proxy,
"setPresent",
@@ -142,15 +143,18 @@
{
object_info obj_info;
uint8_t present;
- bool b_present=false;
+ char* chr_present;
do {
rc = get_object(sys_proxy,&slots[i],&obj_info);
if (rc) { break; }
rc = get_presence(c,&slots[i],&present);
- if (present==1) { b_present=true; }
//if (rc) { break; }
// TODO: send correct state
- update_fru_obj(c,&obj_info,b_present);
+ if (present == 1) {
+ update_fru_obj(c,&obj_info,"PRESENT");
+ } else {
+ update_fru_obj(c,&obj_info,"NOT PRESENT");
+ }
} while(0);
}
diff --git a/objects/power_control_obj.c b/objects/power_control_obj.c
index a943b5e..bdb7c9a 100644
--- a/objects/power_control_obj.c
+++ b/objects/power_control_obj.c
@@ -64,16 +64,18 @@
if (gpio==0)
{
control_power_emit_power_lost(control_power);
- control_emit_goto_system_state(control,"POWERED_OFF");
+ control_emit_goto_system_state(control,"HOST_POWERED_OFF");
}
else
{
control_power_emit_power_good(control_power);
- control_emit_goto_system_state(control,"POWERED_ON");
+ control_emit_goto_system_state(control,"HOST_POWERED_ON");
}
}
} else {
printf("ERROR PowerControl: GPIO read error (gpio=%s,rc=%d)\n",pgood.name,rc);
+ //return false so poll won't get called anymore
+ return FALSE;
}
//pgood is not at desired state yet
if (gpio != control_power_get_state(control_power) &&
@@ -118,9 +120,9 @@
int error = 0;
do {
if (state == 1) {
- control_emit_goto_system_state(control,"POWERING_ON");
+ control_emit_goto_system_state(control,"HOST_POWERING_ON");
} else {
- control_emit_goto_system_state(control,"POWERING_OFF");
+ control_emit_goto_system_state(control,"HOST_POWERING_OFF");
}
error = gpio_open(&power_pin);
if (error != GPIO_OK) { break; }
diff --git a/objects/sensor_host_status_obj.c b/objects/sensor_host_status_obj.c
deleted file mode 100644
index d631200..0000000
--- a/objects/sensor_host_status_obj.c
+++ /dev/null
@@ -1,181 +0,0 @@
-#include "interfaces/openbmc_intf.h"
-#include "openbmc.h"
-
-#define BOOTED 100
-/* ---------------------------------------------------------------------------------------------------- */
-
-static const gchar* dbus_object_path = "/org/openbmc/sensors";
-static const gchar* dbus_name = "org.openbmc.sensors.HostStatus";
-static guint heartbeat = 0;
-
-static GDBusObjectManagerServer *manager = NULL;
-
-static gboolean
-on_init (SensorValue *sen,
- GDBusMethodInvocation *invocation,
- gpointer user_data)
-{
- sensor_value_complete_init(sen,invocation);
- return TRUE;
-}
-
-static gboolean
-on_init_control (Control *control,
- GDBusMethodInvocation *invocation,
- gpointer user_data)
-{
- control_complete_init(control,invocation);
- return TRUE;
-}
-static gboolean
-on_set_value (SensorValue *sen,
- GDBusMethodInvocation *invocation,
- guchar host_status,
- gpointer user_data)
-{
- SensorValue *v = object_get_sensor_value((Object*)user_data);
- SensorMatch *match = object_get_sensor_match((Object*)user_data);
- Control* control = object_get_control((Object*)user_data);
-
- GVariant *old_value = sensor_value_get_value(sen);
- GVariant *value = NEW_VARIANT_B(host_status);
- if (VARIANT_COMPARE(old_value,value) != 0)
- {
- sensor_value_set_value(sen, value);
- sensor_value_emit_changed(sen, value, "");
- if (host_status == BOOTED)
- {
- sensor_match_set_state(match,host_status);
- sensor_match_emit_sensor_match(match,host_status);
- control_emit_goto_system_state(control,"BOOTED");
- }
- }
- sensor_value_complete_set_value(sen,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);
-
- 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);
-
- Control *control = control_skeleton_new ();
- object_skeleton_set_control (object, control);
- g_object_unref (control);
-
- //must init variant
- GVariant* v = NEW_VARIANT_B(0);
- sensor_value_set_value(sensor,v);
-
- // set units
- sensor_value_set_units(sensor,"");
- sensor_value_set_settable(sensor,TRUE);
- //must emit change so sensor manager sees initial value
- sensor_value_emit_changed(sensor,v,"");
-
- //signal handlers
- /*g_dbus_connection_signal_subscribe(connection,
- "org.openbmc.sensors.IpmiBt",
- "org.openbmc.sensors.IpmiBt",
- "SetSensor",
- "/org/openbmc/sensors/IpmiBt",
- NULL,
- G_DBUS_SIGNAL_FLAGS_NONE,
- (GDBusSignalCallback) on_set_ipmi,
- object,
- NULL );
- */
- //define method callbacks here
- g_signal_connect (sensor,
- "handle-init",
- G_CALLBACK (on_init),
- NULL); /* user_data */
-
- g_signal_connect (control,
- "handle-init",
- G_CALLBACK (on_init_control),
- 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));
- 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 (DBUS_TYPE,
- 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/xml/openbmc_intf.xml b/xml/openbmc_intf.xml
index 9f544ce..6fb726b 100644
--- a/xml/openbmc_intf.xml
+++ b/xml/openbmc_intf.xml
@@ -1,12 +1,4 @@
<node>
- <interface name="org.openbmc.Occ">
- <method name="init"/>
- <method name="collect"/>
- <property name="state" type="s" access="readwrite"/>
- <property name="instance_name" type="s" access="read"/>
- <property name="poll_interval" type="i" access="readwrite"/>
- </interface>
-
<interface name="org.openbmc.Fan">
<method name="setCoolingZone">
<arg name="cooling_zone" type="i" direction="in"/>
@@ -101,6 +93,7 @@
<signal name="GotoSystemState">
<arg name="state_name" type="s"/>
</signal>
+ <signal name="Started"/>
</interface>
<interface name="org.openbmc.control.Bmc">
<method name="place_holder"/>