1 | function 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 | |
---|
18 | if nargin < 3 |
---|
19 | error('Not enough arguments') |
---|
20 | end |
---|
21 | |
---|
22 | if isfamily(FamilyName) |
---|
23 | name = family2tango(FamilyName); |
---|
24 | [attr devlist] = getattribute(name); |
---|
25 | else %not a family name |
---|
26 | devlist = FamilyName; |
---|
27 | if ~iscell(devlist) |
---|
28 | devlist = {devlist}; |
---|
29 | end |
---|
30 | end |
---|
31 | |
---|
32 | nb = length(devlist); |
---|
33 | |
---|
34 | if size(strvalue,1) == 1 |
---|
35 | strlist = cellstr(repmat(strvalue,nb,1)); |
---|
36 | else |
---|
37 | strlist = strvalue; |
---|
38 | end |
---|
39 | |
---|
40 | % tango_put_property2('LT1/AE/cycleD.1','Delta',{'0.1'}) |
---|
41 | |
---|
42 | %%% |
---|
43 | for 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 |
---|
58 | end |
---|