예제 #1
0
    def _run(self):
        QTools.assert_arg_count(self.args, 'eq', 0)

        target_address = None
        if self.options.address:
            target_address = self.options.address

        target_host = '255.255.255.255'
        if self.options.target_host:
            target_host = self.options.target_host
        port = 5330
        if self.options.port:
            port = self.options.port
        self.comm.set_address(target_host)
        self.comm.set_port(port)
        action = QPoll.QPoll()
        self.comm.execute(action)


        for response in action.get_result_data():
            (ip, port) = response.getSourceIPAddressInfo()
            if not target_address or (target_address == ip):
                print "Q330 [%s]:" % str(response.getKMIPropertyTag())
                print "    S/N:  %X" % response.getSerialNumber()
                print "    IP:   %s" % ip
                print "    Port: %s" % port
                print
예제 #2
0
def formatARP(values):
    if not values: return None
    values = Quasar.Status.StatusDict(values, prefix="ARP_")
    idx = QTools.Counter()
    dict = {}

    num_entries = values['NumberOfEntries']
    dict['NumberOfEntries'] = (idx.inc(), "Number of Entries", num_entries)
    dict['LengthOfThisBlock'] = (idx.inc(), "Length of this Block", "%d bytes" % values['LengthOfThisBlock'])

    for i in range(0, num_entries):
        key_ip = "IPAddress_%d" % i
        key_mac_high_32 = "MACAddressHigh32_%d" % i
        key_mac_low_16 = "MACAddressLow16_%d" % i
        key_mac = "MACAddress_%d" % i
        key_timeout = "TimeoutInSeconds_%d" % i
        value_ip = values[key_ip]
        value_mac_high_32 = int(values[key_mac_high_32])
        value_mac_low_16 = int(values[key_mac_low_16])
        value_timeout = int(values[key_timeout])
        dict[key_ip] = (idx.inc(), "IP Address", QTools.format_ip(value_ip))
        dict[key_mac] = (idx.inc(), "MAC Address", QTools.format_mac((value_mac_high_32, value_mac_low_16)))
        dict[key_timeout] = (idx.inc(), "Timeout", "%d seconds" % values[key_timeout])
        #dict[key_mac_high_32] = (idx.inc(), "MAC Address High 32", value_mac_high)
        #dict[key_mac_low_16] = (idx.inc(), "MAC Address Low 16", value_mac_low)

    return dict
예제 #3
0
 def _generate_private(self):
     if self.__dict__.has_key('private'):
         QTools.qassert(type(self.__dict__['private']) == list)
         self.__dict__['data'] = {}
         for key in self.private:
             QTools.qassert(type(key) == str)
             self.__dict__['data'][key] = None
예제 #4
0
def formatDataPort(values, index):
    if not values: return None
    values = Quasar.Status.StatusDict(values, prefix="DataPort%s_" % index)
    idx = QTools.Counter()
    dict = {}

    dict['TotalDataPacketsSent'] = (idx.inc(), "Total Data Packets Sent", QTools.fancy_integer(int(values['TotalDataPacketsSent'])))
    dict['TotalPacketsResent'] = (idx.inc(), "Total Packets Resent", QTools.fancy_integer(int(values['TotalPacketsResent'])))
    dict['TotalFillPacketsSent'] = (idx.inc(), "Total Fill Packets Sent", QTools.fancy_integer(int(values['TotalFillPacketsSent'])))
    dict['ReceiveSequenceErrors'] = (idx.inc(), "Receive Sequence Errors", QTools.fancy_integer(int(values['ReceiveSequenceErrors'])))
    dict['BytesOfPacketCurrentlyUsed'] = (idx.inc(), "Bytes of Packet Buffer Currently Used", values['BytesOfPacketCurrentlyUsed'])
    dict['TimeOfLastDataPacketAcked'] = (idx.inc(), "Time of Last Data Packet Acknowledged", values['TimeOfLastDataPacketAcked'])
    value = values['PhysicalInterfaceNumber']
    if_str = "Unrecognized"
    if value in range(0,3):
        if_str = "Serial Port %d" % (value+1,)
    elif value == 3:
        if_str = "Ethernet Port"
    result_str = "%d (%s)" % (value, if_str)
    dict['PhysicalInterfaceNumber'] = (idx.inc(), "Physical Interface Number", result_str)
    dict['DataPortNumber'] = (idx.inc(), "Data Port Number", values['DataPortNumber'] + 1)
    dict['RetransmissionTimeout'] = (idx.inc(), "Retransmission Timeout", "%d milliseconds" % (values['RetransmissionTimeout'] * 10,))
    value = values['DataPortFlags']
    result_str = ""
    if value & 0x0001: 
        result_str += "Baler should disconnect and prepare to reconnect to a data vacuum. "
    if value & 0x0002: 
        result_str += "Baler should stay powered on. "
    if value & 0x0004: 
        result_str += "Baler should shut down immediately. "
    if value & 0x8000: 
        result_str += "Packet memory reduced due to bad packet memory RAM. "
    dict['DataPortFlags'] = (idx.inc(), "Data Port Flags", values['DataPortFlags'])

    return dict
예제 #5
0
    def _run(self):
        QTools.assert_arg_count(self.args, 'gte', 1)

        arg_device_id = self.args[0]
        self.comm.set_from_file(arg_device_id, self.options.reg_file)

        if self.options.address:
            self.comm.set_address(self.options.address)
        if self.options.port:
            self.comm.set_port(self.options.port)

        
        action = QPing.QPing(self.comm.get_device_type(), self.options.show_restricted, self.options.show_unavailable)
        try:
            if self.options.detect:
                action.action = 'detect'
            elif self.options.info:
                action.action = 'info'
            elif len(self.args) > 1:
                action.action = 'status'
                action.status = self.args[1:]
            else:
                action.action = 'monitor'
        except TypeError, msg:
            raise QTools.QExArgs("invalid type for argument '%s'" % msg.__str__())
 def val_ip(self, value):
     if type(value) != str:
         raise TypeError('ip')
     try: 
         QTools.parse_ip(value)
     except ValueError:
         raise ValueError('ip')
     return value
예제 #7
0
    def _run_start(self):
        QTools.assert_arg_count(self.args, "gte", 9)
        QTools.assert_arg_count(self.args, "lte", 10)

        try:
            int(self.args[0])
            arg_device_id = self.args[0]
        except:
            raise QTools.QExArgs("invalid type for argument 'device'")
        if not self.comm.set_from_file(arg_device_id, self.options.reg_file):
            raise QTools.QExArgs("invalid entry for Q330 #%d in configuration" % int(arg_device_id))

        e300_type = None
        if self.options.e300_raw:
            if e300_type:
                raise QTools.QExArgs("You may only specify one of: --e300-raw | --e300-velocity | --e300-acceleration")
            e300_type = E300.E300_RAW

        if self.options.e300_velocity:
            if e300_type:
                raise QTools.QExArgs("You may only specify one of: --e300-raw | --e300-velocity | --e300-acceleration")
            e300_type = E300.E300_VELOCITY

        if self.options.e300_acceleration:
            if e300_type:
                raise QTools.QExArgs("You may only specify one of: --e300-raw | --e300-velocity | --e300-acceleration")
            e300_type = E300.E300_ACCELERATION

        e300_remind_interval = None
        if self.options.e300_remind_interval:
            e300_remind_interval = self.options.e300_remind_interval

        try:
            arg_wave_form = self.args[7]
            action = QCal.QCal(arg_wave_form)
            action.channels = self.args[1]
            action.cal_monitor = self.args[2]
            action.amplitude = self.args[3]
            action.settle = self.args[4]
            action.duration = self.args[5]
            action.trailer = self.args[6]
            # self.args[10] <-- wave_form; set on QCal class instantiation
            if action.wave_form == "sine":
                QTools.assert_arg_count(self.args, "eq", 9)
                action.frequency = self.args[8]
            elif action.wave_form == "step":
                QTools.assert_arg_count(self.args, "eq", 9)
                action.polarity = self.args[8]
            elif action.wave_form == "random":
                QTools.assert_arg_count(self.args, "eq", 10)
                action.frequency = self.args[8]
                action.noise = self.args[9]
            action.coupling = "R"
            if self.options.capacitive:
                action.coupling = "C"
        except TypeError, msg:
            raise QTools.QExArgs("invalid type for argument '%s'" % msg.__str__())
예제 #8
0
    def _run(self):
        QTools.assert_arg_count(self.args, 'gt', 1)

        arg_device_id = self.args[0]
        self.comm.set_from_file(arg_device_id, self.options.reg_file)

        arg_sections = self.args[1:]
        action = QView.QView()
        try:
            action.sections = arg_sections
        except TypeError, msg:
            raise QTools.QExArgs("invalid type for argument '%s'" % msg.__str__())
예제 #9
0
    def _run(self):
        QTools.assert_arg_count(self.args, 'eq', 1)

        arg_device_id = self.args[0]
        self.comm.set_from_file(arg_device_id, self.options.reg_file)

        action = QAuth.QAuth()
        try:
            if self.options.file:
                action.file = self.options.file
        except TypeError, msg:
            raise QTools.QExArgs("invalid type for argument '%s'" % msg.__str__())
예제 #10
0
    def _run(self):
        QTools.assert_arg_count(self.args, 'eq', 1)

        try:
            arg_device_id = self.args[0]
        except:
            raise QTools.QExArgs("invalid type for argument 'device'")
        if not self.comm.set_from_file(arg_device_id, self.options.reg_file):
            raise QTools.QExArgs("invalid entry for Q330 #%d in configuration" % int(arg_device_id))

        action = QReboot.QReboot()

        self.comm.register()
        self.comm.execute(action)
예제 #11
0
    def _run(self):
        QTools.assert_arg_count(self.args, 'eq', 2)

        arg_device_id = self.args[0]
        self.comm.set_from_file(arg_device_id, self.options.reg_file)

        arg_channels = self.args[1]
        action = QQuickView.QQuickView()

        if self.options.verbosity:
            action.verbosity = self.options.verbosity
        try:
            action.channels = arg_channels
        except TypeError, msg:
            raise QTools.QExArgs("invalid type for argument '%s'" % msg.__str__())
예제 #12
0
    def _run(self):
        QTools.assert_arg_count(self.args, 'eq', 2)

        try:
            arg_device_id = self.args[0]
        except:
            raise QTools.QExArgs("invalid type for argument 'device'")
        if not self.comm.set_from_file(arg_device_id, self.options.reg_file):
            raise QTools.QExArgs("invalid entry for Q330 #%d in configuration" % int(arg_device_id))

        action = QGps.QGps()
        try:
            action.action = self.args[1]
        except TypeError, msg:
            raise QTools.QExArgs("invalid type for argument '%s'" % msg.__str__())
예제 #13
0
    def __init__(self, print_method, remind_interval=None):
        threading.Thread.__init__(self)
        self.lock = QLock.QLock()
        self.lock.set_name('e300')
        self.lock.set_pid()

        QTools.qassert(callable(print_method))

        self.set_remind_interval(remind_interval)

        self.request_queue  = Queue.Queue(256)
        self.response_queue = Queue.Queue(256)
        self.input = E300_RAW
        self.daemon  = True
        self.state   = 'init'
        self._print  = print_method
예제 #14
0
def formatGps(values):
    if not values: return None
    values = Quasar.Status.StatusDict(values, prefix="Gps_")
    idx = QTools.Counter()
    dict = {}

    value = values['GPSOnIfNotZero']
    seconds = values['GPSPowerOnOffTime']
    if not value:
        dict['GPSOnIfNotZero'] = (idx.inc(), "GPS enabled", "No")
        dict['GPSPowerOnOffTime'] = (idx.inc(), "GPS has been off", "%d seconds" % seconds)
    else:
        dict['GPSOnIfNotZero'] = (idx.inc(), "GPS enabled", "Yes")
        dict['GPSPowerOnOffTime'] = (idx.inc(), "GPS has been on", "%d seconds" % seconds)

    dict['NumberOfSatellitesUsed'] = (idx.inc(), "Number of Satellites in Use", values['NumberOfSatellitesUsed'])
    dict['NumberOfSatellitesInView'] = (idx.inc(), "Number of Satellites in View", values['NumberOfSatellitesInView'])
    dict['GPSTimeString'] = (idx.inc(), "GPS Time String", values['GPSTimeString'])
    dict['GPSDateString'] = (idx.inc(), "GPS Date String", values['GPSDateString'])
    dict['GPSFixString'] = (idx.inc(), "GPS Fix String", values['GPSFixString'])
    dict['GPSHeightString'] = (idx.inc(), "GPS Height String", values['GPSHeightString'])
    dict['GPSLatitudeString'] = (idx.inc(), "GPS Latitude String", values['GPSLatitudeString'])
    dict['GPSLongitudeString'] = (idx.inc(), "GPS Longitude String", values['GPSLongitudeString'])

    value = values['TimeOfLastGood1PPS']
    value_string = "Never"
    if value:
        value_string = "%s" % time.strftime("%Y/%m/%d %H:%M:%S", time.gmtime(QTools.q330_to_unix_time(value)))
    dict['TimeOfLastGood1PPS'] = (idx.inc(), "Last good 1PPS", value_string)

    dict['TotalChecksumErrors'] = (idx.inc(), "Total Checksum Errors", "%d checksum errors" % values['TotalChecksumErrors'])

    return dict
예제 #15
0
def formatDynamicIP(values):
    if not values: return None
    values = Quasar.Status.StatusDict(values, prefix="DynamicIP_")
    idx = QTools.Counter()
    dict = {}

    value_ip = int(values['Serial1IPAddress'])
    dict['Serial1IPAddress'] = (idx.inc(), "Serial 1 IP Address", QTools.format_ip(value_ip))

    value_ip = int(values['Serial2IPAddress'])
    dict['Serial2IPAddress'] = (idx.inc(), "Serial 2 IP Address", QTools.format_ip(value_ip))
    dict['Reserved'] = (idx.inc(), "Reserved", "N/A")

    value_ip = int(values['EthernetIPAddress'])
    dict['EthernetIPAddress'] = (idx.inc(), "Ethernet IP Address", QTools.format_ip(value_ip))

    return dict
예제 #16
0
    def _run(self):
        QTools.assert_arg_count(self.args, 'eq', 3)

        try:
            arg_device_id = self.args[0]
        except:
            raise QTools.QExArgs("invalid type for argument 'device'")
        if not self.comm.set_from_file(arg_device_id, self.options.reg_file):
            raise QTools.QExArgs("invalid entry for Q330 #%d in configuration" % int(arg_device_id))

        try:
            action = QConfig.QConfig()
            action.action = self.args[1]
            action.type   = self.args[2]
            if self.options.offset:
                action.offset = self.options.offset
            if self.options.bytes:
                action.bytes  = self.options.bytes
        except TypeError, msg:
            raise QTools.QExArgs("invalid type for argument '%s'" % msg.__str__())
예제 #17
0
    def _run(self):
        QTools.assert_arg_count(self.args, 'gt', 2)
        arg_device_id = self.args[0]
        try:
            int(arg_device_id)
        except:
            raise QTools.QExArgs("invalid type for argument 'device'")
        if not self.comm.set_from_file(arg_device_id, self.options.reg_file):
            raise QTools.QExArgs("invalid entry for Q330 #%d in configuration" % int(arg_device_id))

        arg_interface = self.args[1]
        arg_action    = self.args[2]
        arg_timeout   = 1

        if self.args[2] == 'off':
            QTools.assert_arg_count(self.args, 'eq', 3)
        else:
            QTools.assert_arg_count(self.args, 'eq', 4)
            arg_timeout = self.args[3]

        try:
            action = QBaler.QBaler()
            action.interface = arg_interface
            action.action    = arg_action
            action.timeout   = arg_timeout
            action.verbosity = self.options.verbosity
        except TypeError, msg:
            raise QTools.QExArgs("invalid type for argument '%s'" % msg.__str__())
예제 #18
0
    def __init__(self, print_method, server):
        threading.Thread.__init__(self)
        QTools.qassert(callable(print_method))

        self.request_queue  = Queue.Queue(256)
        self.response_queue = Queue.Queue(256)
        self.clean_complete = threading.Condition()
        self.cleaning = False
        self.daemon  = True
        self.running = False
        self.halting = False

        self._print = print_method

        self.server = server
        self.socket = None
        self.notifier = Notifier()

        self.id_counter = QTools.Counter(negatives=False, wrap=99999999)
        self.outstanding = {}
        self.applied = {}
        self.clean_requests = {}
예제 #19
0
 def val_channels(self, value):
     if type(value) != str:
         raise TypeError('channels')
     try:
         values = sorted(QTools.expand_int_list_set(value))
     except ValueError:
         raise ValueError('channels')
     value = []
     for v in values:
         if 1 > v > 6:
             raise ValueError('channels')
         value.append(v)
     return value
예제 #20
0
    def _run(self):
        QTools.assert_arg_count(self.args, 'gte', 1)

        arg_device_id = self.args[0]
        self.comm.set_from_file(arg_device_id, self.options.reg_file)

        arg_status = ['Detect']
        if self.options.address:
            self.comm.set_address(self.options.address)
        if self.options.port:
            self.comm.set_port(self.options.port)
        if self.options.info:
            arg_status = ['info']

        if len(self.args) > 1:
            arg_status = self.args[1:]

        arg_delay = 3 # 3 second default delay
        if self.options.delay:
            QTools.qassert(type(arg_delay) in (int, long))
            arg_delay = self.options.delay

        action = QPing.QPing(self.comm.get_device_type(), self.options.show_restricted, self.options.show_unavailable)
        try:
            if 'all' in arg_status:
                raise ValueError('status')
            if arg_status is not None:
                if 'Detect' in arg_status:
                    action.action = 'detect'
                elif 'info' in map(lambda a: a.lower(), arg_status):
                    action.action = 'info'
                else:
                    action.action = 'status'
                    action.status = arg_status
            else:
                action.action = 'monitor'
        except TypeError, msg:
            raise QTools.QExArgs("invalid type for argument '%s'" % msg.__str__())
예제 #21
0
 def val_cal_monitor(self, value):
     if type(value) != str:
         raise TypeError('cal_monitor')
     try:
         values = sorted(QTools.expand_int_list_set(value))
     except:
         raise ValueError('cal_monitor')
     value = []
     for v in values:
         if 0 > v > 6:
             raise ValueError('cal_monitor')
         if v != 0:
             value.append(v)
     return value
예제 #22
0
    def _run(self):
        QTools.assert_arg_count(self.args, 'eq', 2)

        try:
            arg_device_id = self.args[0]
        except:
            raise QTools.QExArgs("invalid type for argument 'device'")
        if not self.comm.set_from_file(arg_device_id, self.options.reg_file):
            raise QTools.QExArgs("invalid entry for Q330 #%d in configuration" % int(arg_device_id))

        try:
            action = QModule.QModule()
            action.action = self.args[1]

            if self.options.module_file:
                action.module_file = self.options.module_file
            elif action.action == 'install':
                module_file = ""
                while not os.path.isfile(module_file):
                    module_file = raw_input("core module file: ")
                action.module_file = module_file

        except TypeError, msg:
            raise QTools.QExArgs("invalid type for argument '%s'" % msg.__str__())
예제 #23
0
 def val_channels(self, value):
     if type(value) != str:
         raise TypeError('channels')
     try:
         channels = QTools.expand_int_list_set(value)
     except ValueError:
         raise ValueError('channels')
     value = int(0)
     for channel in channels:
         if 1 > channel > 6:
             raise ValueError('channels')
         value |= 1 << (channel - 1)
     if 1 > value > 63:
         raise ValueError('channels')
     return value
예제 #24
0
def formatPingStatus(values):
    if not values: return None
    idx = QTools.Counter()
    dict = {}

    dict['Type'] = (idx.inc(), "Ping Type", values['Type'])
    dict['UserMessageNumber'] = (idx.inc(), "User Message Number", values['UserMessageNumber'])
    dict['UserMessageCount'] = (idx.inc(), "User Message Count", values['UserMessageCount'])
    dict['DriftTolerance'] = (idx.inc(), "Drift Tolerance", values['DriftTolerance'])

    time_reboot = QTools.q330_to_unix_time(values['TimeOfLastReboot'])
    time_now = float(calendar.timegm(time.gmtime()))
    uptime = (time_now - time_reboot) / 86400.0
    time_string = "%s UTC" % time.strftime("%Y/%m/%d %H:%M", time.gmtime(time_reboot))
    dict['TimeOfLastReboot'] = (idx.inc(), "Boot Time", time_string)
    dict['Uptime'] = (idx.inc(), "Uptime", "%.02f days" % uptime)
    #dict['Spare1'] = (idx.inc(), "Spare 1", values['Spare1'])
    #dict['Spare2'] = (idx.inc(), "Spare 2", values['Spare2'])
    dict['StatusBitmap'] = (idx.inc(), "Status Bitmap", values['StatusBitmap'])

    return dict
예제 #25
0
 def val_status(self, value):
     n_value = []
     if type(value) != list:
         raise TypeError('status')
     for status in value:
         type_list = Quasar.Status.StatusBits[self._device_type].keys()
         if status == "all":
             n_value = type_list
             if not self._show_restricted:
                 n_value = self.remove_restricted(n_value)
             break;
         else:
             restrictions = self._restricted_status
             if self._show_restricted:
                 restrictions = []
             r_status = QTools.verify_status_type(status, type_list, exclusions=restrictions)
             if (r_status is None) and (status != 'all'):
                 raise ValueError('status')
             #if self.is_restricted(r_status):
             #    raise ValueError('status')
         n_value.extend(r_status)
     value = n_value
     return value
예제 #26
0
def formatGlobal(values):
    if not values: return None
    values = Quasar.Status.StatusDict(values, prefix="Global_")
    idx = QTools.Counter()
    dict = {}

    dict['AcquisitionControl'] = (idx.inc(), "Acquisition Control", values['AcquisitionControl'])
    
    value = values['ClockQuality']
    result_str = ""
    if ((value & 0xc0) >> 6) == 1:
        result_str += "PLL Hold"
    elif ((value & 0xc0) >> 6) == 2:
        result_str += "PLL Tracking"
    elif ((value & 0xc0) >> 6) == 3:
        result_str += "PLL Locked"
    else:
        result_str += "PLL not enabled"
    if not (value & 0x01):
        result_str += " (Clock has never been locked)"
    elif value & 0x20:
        result_str += " (Speculative Lock based on internal clock)"
    elif value & 0x10:
        result_str += " (Timemarks currently frozen due to filtering)"
    elif value & 0x04:
        result_str += " (Clock has 3-D lock)"
    elif value & 0x02:
        result_str += " (Clock has 2-D lock)"
    elif value & 0x08:
        result_str += " (Clock has 1-D lock)"
    else:
        result_str += " (Clock has been locked)"
    dict['ClockQuality'] = (idx.inc(), "Clock Quality", result_str)

    dict['MinutesSinceLoss'] = (idx.inc(), "Last Locked", "Clock last locked %d minutes ago" % values['MinutesSinceLoss'])
    dict['AnalogVoltageControlValue'] = (idx.inc(), "Analog Voltage Control Value", values['AnalogVoltageControlValue'])
    dict['SecondsOffset'] = (idx.inc(), "Seconds Offset", values['SecondsOffset'])
    dict['USecOffset'] = (idx.inc(), "Microseconds Offset", values['USecOffset'])
    dict['TotalTimeInSeconds'] = (idx.inc(), "Total Time in Seconds", values['TotalTimeInSeconds'])
    dict['PowerOnTimeInSeconds'] = (idx.inc(), "Power on Time in Seconds", values['PowerOnTimeInSeconds'])

    seconds = values['TimeOfLastResync']
    time_station = QTools.q330_to_unix_time(seconds)
    dict['TimeOfLastResync'] = (idx.inc(), "Time of Last Resync", time.strftime("%Y/%m/%d %H:%M:%S", time.gmtime(time_station)))
    dict['TotalNumberOfResyncs'] = (idx.inc(), "Total Number of Resyncs", values['TotalNumberOfResyncs'])
    dict['GPSStatus'] = (idx.inc(), "GPS Status", values['GPSStatus'])

    value = values['CalibratorStatus']
    result_str = ""
    if value & 0x01:
        result_str += "Enabled"
        if value & 0x02:
            result_str += " [Signal On]"
        else:
            result_str += " [Signal Off]"
        if value & 0x04:
            result_str += " (Calibrator should be generating a signal, but isn't)"
    else:
        result_str += "Disabled"
    dict['CalibratorStatus'] = (idx.inc(), "Calibrator Status", result_str)
    dict['SensorControlBitmap'] = (idx.inc(), "Sensor Control Bitmap", hex(values['SensorControlBitmap']))
    dict['CurrentVCO'] = (idx.inc(), "Current VCO", values['CurrentVCO'])
    dict['DataSequenceNumber'] = (idx.inc(), "Data Sequence Number", values['DataSequenceNumber'])
    value = "No"
    if values['PLLRunningIfSet']:
        value = "Yes"
    dict['PLLRunningIfSet'] = (idx.inc(), "PLL Running", value)
    dict['StatusInputs'] = (idx.inc(), "Status Inputs", values['StatusInputs'])
    dict['MiscInputs'] = (idx.inc(), "Miscellaneous Inputs", values['MiscInputs'])
    dict['CurrentDataSequenceNumber'] = (idx.inc(), "Current Data Sequence Number", values['CurrentDataSequenceNumber'])

    seconds = values['SecondsOffset'] + values['CurrentDataSequenceNumber']
    usecs = values['USecOffset']
    time_station = QTools.q330_to_unix_time(seconds)
    dict['StationTime'] = (idx.inc(), "Station Time", "%s.%06d" % (time.strftime("%Y/%m/%d %H:%M:%S", time.gmtime(time_station)), usecs))

    return dict
예제 #27
0
 def set_directory(self, dir):
     if QTools.test_dir(dir, 'w'):
         self.lock_dir = dir
         return True
     return False
예제 #28
0
 def set_verbosity(self, verbosity):
     QTools.qassert(type(verbosity) == type(int(1)))
     self.verbosity = verbosity
예제 #29
0
 def execute(self, action):
     QTools.qassert(isinstance(action, QAction.QAction))
     try:
         action.execute(self.q330)
     except Quasar.QDPDevice.TimeoutException, ex:
         raise QTools.QExMessage(str(ex))
예제 #30
0
 def set_forced(self, forced=True):
     QTools.qassert(forced in (True, False))
     self.forced = forced