2008-09-16 6 views
4

PropertyNotifiedシグナルの間に私のハンドラからorg.freedesktop.Hal.DeviceでGetPropertyを呼び出しています。私は追加または変更されたプロパティでのみGetPropertyを呼び出しています。いつプロパティが更新されるか

プロパティの追加中にGetPropertyを呼び出すと、org.freedesktop.Hal.NoSuchProperty例外が発生します。私はまた、変更の間、私は古い値を得ていることを心配しています。

いつGetPropertyを呼び出す必要がありますか?関連する競合条件

答えて

1

どの程度DeviceExists方法(hereなど):

# 
# _CBHalDeviceConnected 
# 
# INTERNAL 
# 
# Callback triggered when a device is connected through Hal. 
# 

def _CBHalDeviceConnected(self, obj_path): 
... 
self.device.connect_to_signal("PropertyModified", 
    self._CBHalDeviceAuthStateChanged) 
... 

# 
# _CBHalDeviceAuthStateChanged 
# 
# INTERNAL 
# 
# Callback triggered when a Hal device property is changed, 
# for checking authorization state changes 
# 

def _CBHalDeviceAuthStateChanged(self,num_changes,properties): 
for property in properties: 
property_name, added, removed = property 
if property_name == "pda.pocketpc.password": 
self.logger.info("_CBHalDeviceAuthStateChanged: 
    device authorization state changed: reauthorizing") 
self._ProcessAuth() 

HAL 0.5.10 Specification
D-Bus Specification

if device.PropertyExists('info.product'): 
     return device.GetProperty('info.product') 
    return "unknown" 

そして信号、(ex from real world)をPropertyModified 10

関連する問題