Skip to content
Snippets Groups Projects
Commit 1b688aba authored by jkerdreu's avatar jkerdreu
Browse files

Remove busAddr,busPort...

git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/trunk@1962 b32b6428-25c9-4566-ad07-03861ab6144f
parent 1958870a
No related branches found
No related tags found
No related merge requests found
# Load main class & modules. If you need something more feel
# free to do ie :
# from xaal.lib.network import NetworkConnector
# Load main class & modules.
from . import tools
from . import config
from .core import Engine
from .devices import Device
from .devices import Attribute
from .core import Engine,Timer
from .network import NetworkConnector
from .devices import Device, Attribute, Attributes
from .exceptions import *
......@@ -77,9 +77,9 @@ class Attributes(list):
class Device(object):
def __init__(self,devtype,addr=None,engine=None):
# xAAL internal attributes for a device
self.devtype = devtype # xaal devtype
self.address = addr # xaal addr
self.vendor_id = None # vendor ID ie : ACME
self.product_id = None # product ID
self.version = None # product release
......@@ -87,20 +87,19 @@ class Device(object):
self.info = None # additionnal info
self.hw_id = None # hardware info
self.group_id = None # group devices
# Some useless attributes, only for compatibility
self.bus_addr = config.address
self.bus_port = config.port
self.hops = config.hops
# Unsupported stuffs
self.unsupported_attributes = []
self.unsupported_methods = []
self.unsupported_notifications = []
# Alive management
self.alive_period = config.alive_timer # time in sec between two alive
self.next_alive = 0
# Default attributes & methods
self.__attributes = Attributes()
self.new_attribute('busAddr',config.address)
self.new_attribute('busPort',config.port)
self.new_attribute('hops',config.hops)
self.methods = {'getAttributes' : self._get_attributes,
'getDescription': self._get_description }
self.engine = engine
......@@ -124,8 +123,6 @@ class Device(object):
# version must be a string
if value:
self.__version = "%s" % value
else:
self.__version = value
@property
def address(self):
......
......@@ -4,8 +4,6 @@ import time,random
import logging
logger = logging.getLogger(__name__)
HIDDEN_ATTRIBUTES = ['busAddr','busPort','hops']
class Device:
def __init__(self, addr, devtype, version):
self.address = addr
......@@ -26,9 +24,6 @@ class Device:
""" rude update attributes. Return true if updated"""
keys = list(data.keys())
change = False
for k in keys:
if k in HIDDEN_ATTRIBUTES:
data.pop(k)
# really no the best comparaison, but we just need a flag
if self.attributes == data:
return False
......@@ -51,20 +46,6 @@ class Device:
except KeyError:
return None
"""
def __cmp__(self,other):
if (self.devtype == other.devtype):
if self.address > other.address:
return 1
else:
return -1
if (self.devtype > other.devtype):
return 1
if (self.devtype < other.devtype):
return -1
return 0
"""
def dump(self):
print("*** %s %s **" % (self.address,self.devtype))
print(" Description : %s" % self.description)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment