Exemplo n.º 1
0
def getSubDevice(filter):
    exportedDevices = dict()
    db = Database()
    eDevices = db.get_device_exported(filter).value_string
    for eDevice in eDevices:
        sd = db.get_device_property(eDevice, "__SubDevices")["__SubDevices"]
        for s in sd:
            exportedDevices[s] = eDevice
    return exportedDevices
Exemplo n.º 2
0
 def __init__(self, connector=None, uri=None):
     Camera.__init__(self)
     self.uri = uri
     attributes = [ \
             {"attr": "ExposureAuto", "name": "exposure_time_auto"},
             {"attr": "ExposureAutoMin", "name": "exposure_time_min"},
             {"attr": "ExposureAutoMax", "name": "exposure_time_max"},
             {"attr": "ExposureTimeAbs", "name": "exposure_time"},
             {"attr": "GainAuto", "name": "gain_auto"},
             {"attr": "GainAutoMin", "name": "gain_min"},
             {"attr": "GainAutoMax", "name": "gain_max"},
             {"attr": "Gain", "name": "gain"},
             {"attr": "TriggerSource", "name": "trigger_source"},
             {"attr": "AcquisitionFrameRateAbs", "name": "frame_rate"},
             {"attr": "Width"},
             {"attr": "Height"},
             {"attr": "OffsetX", "name": "offset_x"},
             {"attr": "OffsetY", "name": "offset_y"},
             {"attr": "WidthMax", "name": "width_max"},
             {"attr": "HeightMax", "name": "height_max"},
             {"attr": "Image8", "name": "image_8"},
     ]
     if connector == "simulation":
         attributes.append({"attr": "Image8", "name": "image_8"})
         self.connector = VimbaCameraSimulationConnector(uri, attributes)
         self.connector.write("width", 640)
         self.connector.write("height", 480)
         self.connector.write("width_max", 640)
         self.connector.write("height_max", 480)
         self.connector.image_changed.connect(self.on_image_changed)
     elif connector == "tango":
         #determine gain attribute name
         if -1 < uri.find(":") < uri.find("/"):
             host, port = uri.partition("/")[0].split(":")
             db = Database(host, port)
             gain_prop = db.get_device_property(
                     uri.partition("/")[2], "GainFeatureName")
         else:
             db = Database()
             gain_prop = db.get_device_property(uri, "GainFeatureName")
         if len(gain_prop["GainFeatureName"]) > 0:
             gain_attr = gain_prop["GainFeatureName"][0]
             for attr in attributes:
                 if "name" in attr and attr["name"] == "gain":
                     attr["attr"] = gain_attr
         #setup connector
         self.connector = TangoConnector(uri, attributes)
         #start acquisition in right viewing mode and connect changed signal
         try:
             self.connector.proxy.write_attribute("ViewingMode", 1)
             if self.state(refresh=True) != State.RUNNING:
                 self.connector.proxy.command_inout("StartAcquisition")
             sleep(0.2)
             self.connector.proxy.subscribe_event("image_8", \
                     EventType.DATA_READY_EVENT, \
                     self.on_image_changed, [], False)
         except:
             self.janus.utils["logger"].error(
                     "VimbaCamera(" + self.uri + ").__init__() " +
                     "failed to set viewing mode")
             self.janus.utils["logger"].debug("", exc_info=True)
     self.connector.write("trigger_source", "FixedRate")
     self.connector.write("frame_rate", 10.)
     self.connector.value_changed.connect(self.value_changed.emit)
     self.buffer = None