Project

General

Profile

Statistics
| Revision:

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

History | View | Annotate | Download (7.78 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="genindex.html" title="Splošni abecedni seznam"
34
             accesskey="I">abecedni seznam</a></li>
35
        <li class="right" >
36
          <a href="api.html" title="API"
37
             accesskey="P">nazaj</a> |</li>
38
        <li><a href="index.html">LIDAR dokumentacija</a> &raquo;</li> 
39
      </ul>
40
    </div>  
41

    
42
    <div class="document">
43
      <div class="documentwrapper">
44
        <div class="bodywrapper">
45
          <div class="body">
46
            
47
  <div class="section" id="uporaba">
48
<h1>Uporaba<a class="headerlink" href="#uporaba" title="Povezava na naslov"></a></h1>
49
<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>
50
<div class="highlight-python"><pre>sudo easy_install suds</pre>
51
</div>
52
<div class="section" id="nadzorni-modul">
53
<h2>Nadzorni modul<a class="headerlink" href="#nadzorni-modul" title="Povezava na naslov"></a></h2>
54
<p>Nadozrni modul skrbi za dostop do naprave.</p>
55
<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>
56
<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>
57

    
58
<span class="n">url</span> <span class="o">=</span> <span class="s">&#39;http://&lt;webservice_host&gt;/lidar/Management?wsdl&#39;</span>
59
<span class="n">api_key</span> <span class="o">=</span> <span class="s">&#39;api_key&#39;</span>
60
<span class="n">username</span> <span class="o">=</span> <span class="s">&#39;username&#39;</span>
61
<span class="n">password</span> <span class="o">=</span> <span class="s">&#39;password&#39;</span>
62
</pre></div>
63
</div>
64
<div class="section" id="avtentikacija">
65
<h3>Avtentikacija<a class="headerlink" href="#avtentikacija" title="Povezava na naslov"></a></h3>
66
<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>
67
<span class="k">if</span> <span class="n">auth_token</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
68
    <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>
69
</pre></div>
70
</div>
71
</div>
72
<div class="section" id="zaklep">
73
<h3>Zaklep<a class="headerlink" href="#zaklep" title="Povezava na naslov"></a></h3>
74
<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>
75
<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>
76
    <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>
77
    <span class="k">if</span> <span class="n">lock_token</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
78
        <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>
79

    
80
        <span class="c"># TODO: Uporaba zaklenjene naprave z uporabo lock_token</span>
81
</pre></div>
82
</div>
83
</div>
84
<div class="section" id="odklep">
85
<h3>Odklep<a class="headerlink" href="#odklep" title="Povezava na naslov"></a></h3>
86
<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>
87
<span class="k">if</span> <span class="n">unlock</span><span class="p">:</span>
88
    <span class="k">print</span> <span class="s">&#39;Naprava odklenjena!&#39;</span>
89
</pre></div>
90
</div>
91
</div>
92
</div>
93
</div>
94

    
95

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

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