source: MML/trunk/mml/links/tango/tango_get_attribute_property.m @ 4

Last change on this file since 4 was 4, checked in by zhangj, 10 years ago

Initial import--MML version from SOLEIL@2013

File size: 1.7 KB
Line 
1function attr_prop = tango_get_attribute_property(varargin)
2%TANGO_GET_ATTRIBUTE_PROPERTY - Get properties for an attribute property
3%  attr_prop = tango_get_attribute_property(FamilyName, property)
4%
5%  INPUTS
6%  1. FamilyName or cell array of devicenames
7%  2. property of the attribute
8%  3. Optional - 'Double' return a double array instead of a cell array
9%                'Setpoint' {Default}, 'Monitor'   
10
11%  OUTPUTS
12%  1.  attr_prop - property value
13%
14%  EXAMPLES
15%  1. tango_get_attribute_property('BEND','max_value')
16%
17%  See also tango_set_attribute_property, tango_set_device_property
18
19%
20% Written by Laurent S. Nadolski
21
22DoubleFlag = 0;
23Mode = 'Setpoint';
24
25% Input parser
26for i = length(varargin):-1:1
27    if strcmpi(varargin{i},'Double')
28        DoubleFlag = 1;
29        varargin(i) = [];
30    elseif strcmpi(varargin{i},'Setpoint')
31        Mode = 'Setpoint';
32        varargin(i) = [];
33    elseif strcmpi(varargin{i},'Monitor')
34        Mode = 'Monitor';
35        varargin(i) = [];
36    end
37end
38
39if length(varargin) < 2
40    error('Not enough arguments')
41else
42    FamilyName = varargin{1};
43    property = varargin{2};
44
45    if isfamily(FamilyName)
46        name = family2tango(FamilyName, Mode);
47    else %not a family name
48        name = FamilyName;
49    end
50    [attr devlist] = getattribute(name);
51end
52
53attr_prop = cell('');
54for k = 1:length(devlist)
55    attr_config = tango_get_attribute_config(devlist{k,:},attr{k,:});   
56    if (tango_error == -1)
57        %- handle error
58        tango_print_error_stack;
59        fprintf(1,'TracyServer Error %s\n',devlist{k,:})
60        return;
61    end
62    attr_prop(k) = {attr_config.(property)};
63end
64
65attr_prop = attr_prop(:);
66
67if DoubleFlag
68    attr_prop = str2num(char(attr_prop));
69end
Note: See TracBrowser for help on using the repository browser.