Exemplo n.º 1
0
    async def read_raw_history(self,
                               starttime=None,
                               endtime=None,
                               numvalues=0,
                               return_bounds=True):
        """
        Read raw history of a node
        result code from server is checked and an exception is raised in case of error
        If numvalues is > 0 and number of events in period is > numvalues
        then result will be truncated
        """
        details = ua.ReadRawModifiedDetails()
        details.IsReadModified = False
        if starttime:
            details.StartTime = starttime
        else:
            details.StartTime = ua.get_win_epoch()
        if endtime:
            details.EndTime = endtime
        else:
            details.EndTime = ua.get_win_epoch()
        details.NumValuesPerNode = numvalues
        details.ReturnBounds = return_bounds
        history = []
        continuation_point = None
        while True:
            result = await self.history_read(details, continuation_point)
            result.StatusCode.check()
            continuation_point = result.ContinuationPoint
            history.extend(result.HistoryData.DataValues)
            # No more data available
            if continuation_point is None:
                break

        return history
Exemplo n.º 2
0
 async def read_raw_history(self,
                            starttime=None,
                            endtime=None,
                            numvalues=0):
     """
     Read raw history of a node
     result code from server is checked and an exception is raised in case of error
     If numvalues is > 0 and number of events in period is > numvalues
     then result will be truncated
     """
     details = ua.ReadRawModifiedDetails()
     details.IsReadModified = False
     if starttime:
         details.StartTime = starttime
     else:
         details.StartTime = ua.get_win_epoch()
     if endtime:
         details.EndTime = endtime
     else:
         details.EndTime = ua.get_win_epoch()
     details.NumValuesPerNode = numvalues
     details.ReturnBounds = True
     result = await self.history_read(details)
     result.StatusCode.check()
     return result.HistoryData.DataValues