1 | function wl_config_read |
---|
2 | configFile = which('wl_config.ini'); |
---|
3 | if(isempty(configFile)) |
---|
4 | error('cannot find wl_config.ini. please run wl_setup.m'); |
---|
5 | end |
---|
6 | |
---|
7 | readKeys = {'network', '', 'host_address', ''}; |
---|
8 | IP = inifile(configFile, 'read', readKeys); |
---|
9 | IP = IP{1}; |
---|
10 | |
---|
11 | readKeys = {'network', '', 'host_ID', ''}; |
---|
12 | host = inifile(configFile, 'read', readKeys); |
---|
13 | host = host{1}; |
---|
14 | |
---|
15 | readKeys = {'network', '', 'unicast_starting_port', ''}; |
---|
16 | port_unicast = inifile(configFile, 'read', readKeys); |
---|
17 | port_unicast = port_unicast{1}; |
---|
18 | |
---|
19 | readKeys = {'network', '', 'bcast_port', ''}; |
---|
20 | port_bcast = inifile(configFile, 'read', readKeys); |
---|
21 | port_bcast = port_bcast{1}; |
---|
22 | |
---|
23 | readKeys = {'network', '', 'transport', ''}; |
---|
24 | transport = inifile(configFile, 'read', readKeys); |
---|
25 | transport = transport{1}; |
---|
26 | |
---|
27 | readKeys = {'network', '', 'max_transport_payload_size', ''}; |
---|
28 | max_transport_payload_size = inifile(configFile, 'read', readKeys); |
---|
29 | max_transport_payload_size = max_transport_payload_size{1}; |
---|
30 | |
---|
31 | fprintf('\n\nContents of wl_config.ini:\n'); |
---|
32 | fprintf('(located at %s)\n', configFile') |
---|
33 | |
---|
34 | fprintf('--------------------------------------\n') |
---|
35 | fprintf('| Host IP Address |%12s|\n',IP); |
---|
36 | |
---|
37 | if(ispc) |
---|
38 | [status, tempret] = system('ipconfig /all'); |
---|
39 | elseif(ismac||isunix) |
---|
40 | [status, tempret] = system('ifconfig -a'); |
---|
41 | end |
---|
42 | tempret = strfind(tempret,IP); |
---|
43 | |
---|
44 | if(isempty(tempret)) |
---|
45 | fprintf('\b *No interface found. Please ensure that your network interface is connected and configured with static IP %s\n',IP); |
---|
46 | end |
---|
47 | |
---|
48 | fprintf('-----------------------------------------\n') |
---|
49 | fprintf('| WARPLab Host ID |%12s|\n', host); |
---|
50 | fprintf('-----------------------------------------\n') |
---|
51 | fprintf('| Unicast Starting Port |%12s|\n', port_unicast); |
---|
52 | fprintf('-----------------------------------------\n') |
---|
53 | fprintf('| Broadcast Port |%12s|\n', port_bcast); |
---|
54 | fprintf('-----------------------------------------\n') |
---|
55 | fprintf('| Transport |%12s|\n', transport); |
---|
56 | fprintf('-----------------------------------------\n') |
---|
57 | fprintf('| Max Payload Size (bytes) |%12s|\n', max_transport_payload_size); |
---|
58 | fprintf('-----------------------------------------\n') |
---|
59 | |
---|
60 | end |
---|