コード例 #1
0
ファイル: device.py プロジェクト: bashwork/pymodbus
    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
コード例 #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
コード例 #3
0
ファイル: store.py プロジェクト: bashwork/pymodbus
    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))
コード例 #4
0
ファイル: store.py プロジェクト: ibaranov-cp/jhu05
    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))
コード例 #5
0
ファイル: context.py プロジェクト: Biondoap/pymodbus
 def reset(self):
     ''' Resets all the datastores to their default values '''
     for datastore in itervalues(self.store):
         datastore.reset()
コード例 #6
0
ファイル: context.py プロジェクト: ccatterina/pymodbus
 def reset(self):
     ''' Resets all the datastores to their default values '''
     for datastore in itervalues(self.store):
         datastore.reset()
コード例 #7
0
ファイル: device.py プロジェクト: bashwork/pymodbus
    def __iter__(self):
        ''' Iterater over the device counters

        :returns: An iterator of the device counters
        '''
        return izip(self.__names, itervalues(self.__data))
コード例 #8
0
ファイル: device.py プロジェクト: bashwork/pymodbus
    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)))
コード例 #9
0
ファイル: device.py プロジェクト: bashwork/pymodbus
    def summary(self):
        ''' Returns a summary of the modbus plus statistics

        :returns: 54 16-bit words representing the status
        '''
        return itervalues(self.__data)
コード例 #10
0
    def __iter__(self):
        ''' Iterater over the device counters

        :returns: An iterator of the device counters
        '''
        return izip(self.__names, itervalues(self.__data))
コード例 #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)))
コード例 #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)