public PropertyItem[] getProperties() { StrVector propNamesVect; Vector<PropertyItem> props = new Vector<PropertyItem>(); try { core_.setAutoFocusDevice(devName_); propNamesVect = core_.getDevicePropertyNames(devName_); for (int i = 0; i < propNamesVect.size(); i++) { PropertyItem p = new PropertyItem(); p.device = devName_; p.name = propNamesVect.get(i); p.value = core_.getProperty(devName_, p.name); p.readOnly = core_.isPropertyReadOnly(devName_, p.name); if (core_.hasPropertyLimits(devName_, p.name)) { p.lowerLimit = core_.getPropertyLowerLimit(devName_, p.name); p.upperLimit = core_.getPropertyUpperLimit(devName_, p.name); } StrVector vals = core_.getAllowedPropertyValues(devName_, p.name); p.allowed = new String[(int) vals.size()]; for (int j = 0; j < vals.size(); j++) p.allowed[j] = vals.get(j); props.add(p); } } catch (Exception e) { ReportingUtils.logError(e); } return props.toArray(new PropertyItem[0]); }
protected void createProperty(String name, String value) { PropertyItem p = new PropertyItem(); p.name = name; p.value = value; p.device = getDeviceName(); properties_.add(p); }
public PropertyItem getProperty(String name) throws MMException { try { if (core_.hasProperty(devName_, name)) { PropertyItem p = new PropertyItem(); p.device = devName_; p.name = name; p.value = core_.getProperty(devName_, p.name); p.readOnly = core_.isPropertyReadOnly(devName_, p.name); if (core_.hasPropertyLimits(devName_, p.name)) { p.lowerLimit = core_.getPropertyLowerLimit(devName_, p.name); p.upperLimit = core_.getPropertyUpperLimit(devName_, p.name); } StrVector vals = core_.getAllowedPropertyValues(devName_, p.name); p.allowed = new String[(int) vals.size()]; for (int j = 0; j < vals.size(); j++) p.allowed[j] = vals.get(j); return p; } else { throw new MMException("Unknown property: " + name); } } catch (Exception e) { throw new MMException(e.getMessage()); } }