Esempio n. 1
0
    def summary(self):
        ''' Returns a summary of the counters current status

        :returns: A byte with each bit representing each counter
        '''
        count, result = 0x01, 0x00
        for i in itervalues(self.__data):
            if i != 0x00: result |= count
            count <<= 1
        return result
Esempio n. 2
0
    def summary(self):
        ''' Returns a summary of the counters current status

        :returns: A byte with each bit representing each counter
        '''
        count, result = 0x01, 0x00
        for i in itervalues(self.__data):
            if i != 0x00: result |= count
            count <<= 1
        return result
Esempio n. 3
0
    def __init__(self, values):
        ''' Initializes the datastore

        Using the input values we create the default
        datastore value and the starting address

        :param values: Either a list or a dictionary of values
        '''
        if isinstance(values, dict):
            self.values = values
        elif hasattr(values, '__iter__'):
            self.values = dict(enumerate(values))
        else: raise ParameterException(
            "Values for datastore must be a list or dictionary")
        self.default_value = get_next(itervalues(self.values)).__class__()
        self.address = get_next(iterkeys(self.values))
Esempio n. 4
0
    def __init__(self, values):
        ''' Initializes the datastore

        Using the input values we create the default
        datastore value and the starting address

        :param values: Either a list or a dictionary of values
        '''
        if isinstance(values, dict):
            self.values = values
        elif hasattr(values, '__iter__'):
            self.values = dict(enumerate(values))
        else: raise ParameterException(
            "Values for datastore must be a list or dictionary")
        self.default_value = get_next(itervalues(self.values)).__class__()
        self.address = get_next(iterkeys(self.values))
Esempio n. 5
0
 def reset(self):
     ''' Resets all the datastores to their default values '''
     for datastore in itervalues(self.store):
         datastore.reset()
Esempio n. 6
0
 def reset(self):
     ''' Resets all the datastores to their default values '''
     for datastore in itervalues(self.store):
         datastore.reset()
Esempio n. 7
0
    def __iter__(self):
        ''' Iterater over the device counters

        :returns: An iterator of the device counters
        '''
        return izip(self.__names, itervalues(self.__data))
Esempio n. 8
0
    def summary(self):
        ''' Return a summary of the main items

        :returns: An dictionary of the main items
        '''
        return dict(zip(self.__names, itervalues(self.__data)))
Esempio n. 9
0
    def summary(self):
        ''' Returns a summary of the modbus plus statistics

        :returns: 54 16-bit words representing the status
        '''
        return itervalues(self.__data)
Esempio n. 10
0
    def __iter__(self):
        ''' Iterater over the device counters

        :returns: An iterator of the device counters
        '''
        return izip(self.__names, itervalues(self.__data))
Esempio n. 11
0
    def summary(self):
        ''' Return a summary of the main items

        :returns: An dictionary of the main items
        '''
        return dict(zip(self.__names, itervalues(self.__data)))
Esempio n. 12
0
    def summary(self):
        ''' Returns a summary of the modbus plus statistics

        :returns: 54 16-bit words representing the status
        '''
        return itervalues(self.__data)