source: MML/trunk/mml/links/tango/tango_set_device_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.4 KB
Line 
1function tango_set_device_property(FamilyName, property, strvalue)
2%TANGO_SET_DEVICE_PROPERTY - Set a device property to a given value
3% tango_set_device_property(DeviceName, value)
4%
5% INPUTS
6% 1. Family name or Device name
7% 2. property to set
8% 3. strvalue - values to set
9%
10% EXAMPLES
11% 1. tango_set_device_property('CycleBEND','Delta','1')
12%
13% See also tango_get_attribute_property, tango_get_device_property
14
15%
16% Written by Laurent S. Nadolski
17
18if nargin < 3
19    error('Not enough arguments')
20end
21
22if isfamily(FamilyName)
23    name = family2tango(FamilyName);
24    [attr devlist] = getattribute(name);
25else %not a family name
26    devlist = FamilyName;
27    if ~iscell(devlist)
28        devlist = {devlist};
29    end
30end
31   
32nb = length(devlist);
33
34if size(strvalue,1) == 1
35    strlist = cellstr(repmat(strvalue,nb,1));
36else
37    strlist = strvalue;
38end
39
40% tango_put_property2('LT1/AE/cycleD.1','Delta',{'0.1'})
41
42%%%
43for k = 1:nb
44    prop_config = tango_get_property2(devlist{k,:},property);
45    %% check if property defined. If not do nothing
46    if ~isempty(prop_config.value)
47        prop_config.value = strlist{k};
48        tango_put_property(devlist{k,:}, property, strlist(k));
49        if (tango_error == -1)
50            %- handle error
51            tango_print_error_stack;
52            fprintf(1,'TracyServer Error %s\n',devlist{k,:})
53            return;
54        end
55    else
56        warning('Property %s is not defined\n Action canceled',property)
57    end
58end
Note: See TracBrowser for help on using the repository browser.