def set_value(self, newvalue): r = self._proxy.SetValue(wrap_dbus_value(newvalue)) # instead of just saving the value, go to the dbus and get it. So we have the right type etc. if r == 0: self._refreshcachedvalue() return r
def set_value(self, newvalue): r = self._proxy.SetValue(wrap_dbus_value(newvalue)) # instead of just saving the value, go to the dbus and get it. So we have the right type etc. if r == 0: self._refreshcachedvalue() return r
def local_set_value(self, newvalue): if self._value == newvalue: return self._value = newvalue changes = {} changes['Value'] = wrap_dbus_value(newvalue) changes['Text'] = self.GetText() self.PropertiesChanged(changes)
def local_set_value(self, newvalue): if self._value == newvalue: return self._value = newvalue changes = {} changes['Value'] = wrap_dbus_value(newvalue) changes['Text'] = self.GetText() self.PropertiesChanged(changes)
def _get_tree_dict(self, path, get_text=False): logging.debug("_get_tree_dict called for %s" % path) r = {} px = path if not px.endswith('/'): px += '/' for p, item in self._dbusobjects.items(): if p.startswith(px): v = item.GetText() if get_text else wrap_dbus_value(item.local_get_value()) r[p[len(px):]] = v logging.debug(r) return r
def _get_tree_dict(self, path, get_text=False): logging.debug("_get_tree_dict called for %s" % path) r = {} px = path if not px.endswith('/'): px += '/' for p, item in self._dbusobjects.items(): if p.startswith(px): v = item.GetText() if get_text else wrap_dbus_value(item.local_get_value()) r[p[len(px):]] = v logging.debug(r) return r
def set_value(self, serviceName, objectPath, value): # Check if the D-Bus object referenced by serviceName and objectPath is registered. There is no # necessity to do this, but it is in line with previous implementations which kept VeDbusItemImport # objects for registers items only. service = self.servicesByName.get(serviceName, None) if service is None: return -1 if objectPath not in service['paths']: return -1 # We do not catch D-Bus exceptions here, because the previous implementation did not do that either. return self.dbusConn.call_blocking(serviceName, objectPath, dbus_interface='com.victronenergy.BusItem', method='SetValue', signature=None, args=[wrap_dbus_value(value)])
def set_value(self, serviceName, objectPath, value): # Check if the D-Bus object referenced by serviceName and objectPath is registered. There is no # necessity to do this, but it is in line with previous implementations which kept VeDbusItemImport # objects for registers items only. service = self.servicesByName.get(serviceName, None) if service is None: return -1 if objectPath not in service['paths']: return -1 # We do not catch D-Bus exceptions here, because the previous implementation did not do that either. return self.dbusConn.call_blocking(serviceName, objectPath, dbus_interface='com.victronenergy.BusItem', method='SetValue', signature=None, args=[wrap_dbus_value(value)])
def set_value_async(self, serviceName, objectPath, value, reply_handler=None, error_handler=None): service = self.servicesByName.get(serviceName, None) if service is not None: if objectPath in service['paths']: self.dbusConn.call_async(serviceName, objectPath, dbus_interface='com.victronenergy.BusItem', method='SetValue', signature=None, args=[wrap_dbus_value(value)], reply_handler=reply_handler, error_handler=error_handler) return if error_handler is not None: error_handler(TypeError('Service or path not found, ' 'service=%s, path=%s' % (serviceName, objectPath)))
def set_value_async(self, serviceName, objectPath, value, reply_handler=None, error_handler=None): service = self.servicesByName.get(serviceName, None) if service is not None: if objectPath in service.paths: self.dbusConn.call_async( serviceName, objectPath, dbus_interface='com.victronenergy.BusItem', method='SetValue', signature=None, args=[wrap_dbus_value(value)], reply_handler=reply_handler, error_handler=error_handler) return if error_handler is not None: error_handler( TypeError('Service or path not found, ' 'service=%s, path=%s' % (serviceName, objectPath)))
def _set_dbus_value(self, service, path, value): value = wrap_dbus_value(value) return self._dbus_conn.call_blocking(service, path, None, 'SetValue', 'v', [value])
def GetValue(self): return wrap_dbus_value(self._value)
def GetValue(self): return wrap_dbus_value(self._value)