Project

General

Profile

Statistics
| Revision:

root / trunk / docs / _build / html / uporaba.html @ 11

History | View | Annotate | Download (7.5 KB)

1

    
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4

    
5
<html xmlns="http://www.w3.org/1999/xhtml">
6
  <head>
7
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
    
9
    <title>Uporaba &mdash; LIDAR dokumentacija</title>
10
    <link rel="stylesheet" href="_static/nature.css" type="text/css" />
11
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
12
    <script type="text/javascript">
13
      var DOCUMENTATION_OPTIONS = {
14
        URL_ROOT:    '',
15
        VERSION:     '1.0.0',
16
        COLLAPSE_INDEX: false,
17
        FILE_SUFFIX: '.html',
18
        HAS_SOURCE:  true
19
      };
20
    </script>
21
    <script type="text/javascript" src="_static/jquery.js"></script>
22
    <script type="text/javascript" src="_static/underscore.js"></script>
23
    <script type="text/javascript" src="_static/doctools.js"></script>
24
    <script type="text/javascript" src="_static/translations.js"></script>
25
    <link rel="top" title="LIDAR dokumentacija" href="index.html" />
26
    <link rel="prev" title="API" href="api.html" /> 
27
  </head>
28
  <body>
29
    <div class="related">
30
      <h3>Navigacija</h3>
31
      <ul>
32
        <li class="right" style="margin-right: 10px">
33
          <a href="api.html" title="API"
34
             accesskey="P">nazaj</a></li>
35
        <li><a href="index.html">LIDAR dokumentacija</a> &raquo;</li> 
36
      </ul>
37
    </div>  
38

    
39
    <div class="document">
40
      <div class="documentwrapper">
41
        <div class="bodywrapper">
42
          <div class="body">
43
            
44
  <div class="section" id="uporaba">
45
<h1>Uporaba<a class="headerlink" href="#uporaba" title="Povezava na naslov"></a></h1>
46
<p>Primeri uporabe web servisa na Ubuntu 10.04 za Python in SOAP knjižico <a class="reference external" href="https://fedorahosted.org/suds/">SUDS</a>, ki jo namestimo z:</p>
47
<div class="highlight-python"><pre>sudo easy_install suds</pre>
48
</div>
49
<div class="section" id="nadzorni-modul">
50
<h2>Nadzorni modul<a class="headerlink" href="#nadzorni-modul" title="Povezava na naslov"></a></h2>
51
<p>Nadozrni modul skrbi za dostop do naprave.</p>
52
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">suds.client</span> <span class="kn">import</span> <span class="n">Client</span>
53
<span class="n">management</span> <span class="o">=</span> <span class="n">Client</span><span class="p">(</span><span class="n">url</span><span class="p">)</span>
54

    
55
<span class="n">url</span> <span class="o">=</span> <span class="s">&#39;http://&lt;webservice_host&gt;/lidar/Management?wsdl&#39;</span>
56
<span class="n">api_key</span> <span class="o">=</span> <span class="s">&#39;api_key&#39;</span>
57
<span class="n">username</span> <span class="o">=</span> <span class="s">&#39;username&#39;</span>
58
<span class="n">password</span> <span class="o">=</span> <span class="s">&#39;password&#39;</span>
59
</pre></div>
60
</div>
61
<div class="section" id="avtentikacija">
62
<h3>Avtentikacija<a class="headerlink" href="#avtentikacija" title="Povezava na naslov"></a></h3>
63
<div class="highlight-python"><div class="highlight"><pre><span class="n">auth_token</span> <span class="o">=</span> <span class="n">management</span><span class="o">.</span><span class="n">service</span><span class="o">.</span><span class="n">getAuthenticationToken</span><span class="p">(</span><span class="n">api_key</span><span class="p">,</span> <span class="n">username</span><span class="p">,</span> <span class="n">password</span><span class="p">)</span>
64
<span class="k">if</span> <span class="n">auth_token</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
65
    <span class="k">print</span> <span class="s">&#39;Prijavljen! Auth token: </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">auth_token</span>
66
</pre></div>
67
</div>
68
</div>
69
<div class="section" id="zaklep">
70
<h3>Zaklep<a class="headerlink" href="#zaklep" title="Povezava na naslov"></a></h3>
71
<div class="highlight-python"><div class="highlight"><pre><span class="n">status</span> <span class="o">=</span> <span class="n">management</span><span class="o">.</span><span class="n">service</span><span class="o">.</span><span class="n">getStatus</span><span class="p">(</span><span class="n">auth_token</span><span class="p">)</span>
72
<span class="k">if</span> <span class="n">status</span> <span class="o">==</span> <span class="s">&#39;unlocked&#39;</span><span class="p">:</span>
73
    <span class="n">lock_token</span> <span class="o">=</span> <span class="n">management</span><span class="o">.</span><span class="n">service</span><span class="o">.</span><span class="n">getLockToken</span><span class="p">(</span><span class="n">auth_token</span><span class="p">)</span>
74
    <span class="k">if</span> <span class="n">lock_token</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
75
        <span class="k">print</span> <span class="s">&#39;Naprava zaklenjena! Lock token: </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">lock_token</span>
76

    
77
        <span class="c"># TODO: Uporaba zaklenjene naprave z uporabo lock_token</span>
78
</pre></div>
79
</div>
80
</div>
81
<div class="section" id="odklep">
82
<h3>Odklep<a class="headerlink" href="#odklep" title="Povezava na naslov"></a></h3>
83
<div class="highlight-python"><div class="highlight"><pre><span class="n">unlock</span> <span class="o">=</span> <span class="n">management</span><span class="o">.</span><span class="n">service</span><span class="o">.</span><span class="n">unlock</span><span class="p">(</span><span class="n">lock_token</span><span class="p">)</span>
84
<span class="k">if</span> <span class="n">unlock</span><span class="p">:</span>
85
    <span class="k">print</span> <span class="s">&#39;Naprava odklenjena!&#39;</span>
86
</pre></div>
87
</div>
88
</div>
89
</div>
90
</div>
91

    
92

    
93
          </div>
94
        </div>
95
      </div>
96
      <div class="sphinxsidebar">
97
        <div class="sphinxsidebarwrapper">
98
  <h3><a href="index.html">Seznam Vsebine</a></h3>
99
  <ul>
100
<li><a class="reference internal" href="#">Uporaba</a><ul>
101
<li><a class="reference internal" href="#nadzorni-modul">Nadzorni modul</a><ul>
102
<li><a class="reference internal" href="#avtentikacija">Avtentikacija</a></li>
103
<li><a class="reference internal" href="#zaklep">Zaklep</a></li>
104
<li><a class="reference internal" href="#odklep">Odklep</a></li>
105
</ul>
106
</li>
107
</ul>
108
</li>
109
</ul>
110

    
111
  <h4>Prejšnja tema</h4>
112
  <p class="topless"><a href="api.html"
113
                        title="prejšnje poglavje">API</a></p>
114
<div id="searchbox" style="display: none">
115
  <h3>Hitro iskanje</h3>
116
    <form class="search" action="search.html" method="get">
117
      <input type="text" name="q" size="18" />
118
      <input type="submit" value="Potrdi" />
119
      <input type="hidden" name="check_keywords" value="yes" />
120
      <input type="hidden" name="area" value="default" />
121
    </form>
122
    <p class="searchtip" style="font-size: 90%">
123
    Vnesi ime modula, razreda ali funkcije.
124
    </p>
125
</div>
126
<script type="text/javascript">$('#searchbox').show(0);</script>
127
        </div>
128
      </div>
129
      <div class="clearer"></div>
130
    </div>
131
    <div class="related">
132
      <h3>Navigacija</h3>
133
      <ul>
134
        <li class="right" style="margin-right: 10px">
135
          <a href="api.html" title="API"
136
             >nazaj</a></li>
137
        <li><a href="index.html">LIDAR dokumentacija</a> &raquo;</li> 
138
      </ul>
139
    </div>
140
    <div class="footer">
141
        &copy; Vse pravice pridržane 2010, Andrej Cimperšek.
142
      Narejeno s <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0b2.
143
    </div>
144
  </body>
145
</html>