1 | function tango_starter(starter, command) |
---|
2 | % TANGO_STARTER - Interact with a tangostarter, Full interface implemented |
---|
3 | % |
---|
4 | % INPUTS |
---|
5 | % 1. command - command name among possibilities |
---|
6 | % |
---|
7 | % 'DevGetRunningServers' |
---|
8 | % 'DevGetStopServers' |
---|
9 | % 'DevReadLog' |
---|
10 | % 'DevStart' |
---|
11 | % 'DevStartAll' |
---|
12 | % 'DevStop' |
---|
13 | % 'DevStopAll' |
---|
14 | % 'Init' |
---|
15 | % 'NotifyDaemonState' |
---|
16 | % 'StartPollingThread' |
---|
17 | % 'State' |
---|
18 | % 'Status' |
---|
19 | % 'UpdateServersInfo' |
---|
20 | % |
---|
21 | % OUTPUTS |
---|
22 | % None |
---|
23 | % |
---|
24 | % EXAMPLES |
---|
25 | % 1. tango_starter('tango/admin/escaut','DevGetRunningServers') |
---|
26 | |
---|
27 | % |
---|
28 | % Written by Laurent S. Nadolski |
---|
29 | |
---|
30 | if nargin ~= 2 |
---|
31 | disp(['Wrong syntax! Try help on ' mfilename]) |
---|
32 | return, |
---|
33 | end |
---|
34 | |
---|
35 | %% Verify starter responds |
---|
36 | % list of command |
---|
37 | cmdDescList = tango_command_list_query(starter); |
---|
38 | if (tango_error == -1) |
---|
39 | %- handle error |
---|
40 | tango_print_error_stack; |
---|
41 | return; |
---|
42 | end |
---|
43 | |
---|
44 | cmdList = [{cmdDescList.cmd_name}]; |
---|
45 | |
---|
46 | % look whether the command exists or not |
---|
47 | if all(strcmp(command,cmdList) == 0) |
---|
48 | disp('Command unknown') |
---|
49 | disp(['try help ' mfilename]) |
---|
50 | return; |
---|
51 | else |
---|
52 | icmd = find(strcmp(command,cmdList) == 1); |
---|
53 | end |
---|
54 | |
---|
55 | %% |
---|
56 | cmdDescList(icmd).in_type |
---|
57 | switch cmdDescList(icmd).in_type |
---|
58 | case '-' % DEV_VOID |
---|
59 | % Init, State, Status,UpdateServersInfo,NotifyDaemonState |
---|
60 | tango_command_inout2(starter,command); |
---|
61 | case '1-by-1 int16' % DEV_SHORT |
---|
62 | % DevStartAll, DevStopAll |
---|
63 | answer = input('Which level? [1-n] \n'); |
---|
64 | tango_command_inout2(starter,command,int16(answer)); |
---|
65 | case '1-by-1 uint16' % DEV_BOOLEAN |
---|
66 | % DevGetRunnningServers, DevGetStopServers |
---|
67 | answer = input('All ? [1/0] \n'); |
---|
68 | rep = tango_command_inout2(starter,command,uint8(answer)); |
---|
69 | rep' |
---|
70 | case '1-by-n char' %DEV_STRING |
---|
71 | % DevStart, DevStop, DevReadLog |
---|
72 | disp('If you do not know, try: tango_starter(''DevGetRunningServers'')'); |
---|
73 | answer = input('Which dserver? [servername/instance] \n','s'); |
---|
74 | tango_command_inout2(starter,command,answer); |
---|
75 | otherwise |
---|
76 | disp('Do Nothing') |
---|
77 | end |
---|