User Tools

Site Tools


xbee:xml

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
xbee:xml [2010/05/23 17:25] rfilexbee:xml [2010/05/23 20:41] (current) rfile
Line 7: Line 7:
  
 <box 95%> <box 95%>
-<code>+
 Re: zb_tcp_serial.py Control Port Re: zb_tcp_serial.py Control Port
-Got it working! Here's the python code that runs on my PC to  +Got it working! Here's the python code that runs on my PC to obtain the Zigbee address to TCP port mapping (I used the list method as the discover output was identical - I presume that if I've discovered new devices through the Web interface, they'll show up in list):
-obtain the Zigbee address to TCP port mapping  +
-(I used the list method as the discover output was identical +
- - I presume that if I've discovered new devices through the Web interface,  +
-they'll show up in list):+
  
 --------- ---------
 +<code>
 import xmlrpclib import xmlrpclib
 # #
Line 51: Line 48:
 </code> </code>
 </box> </box>
 +
 +controller
 +<code php>
 +<?php
 +
 +class Latlon extends Controller {
 +   function __construct()
 +       {
 +            parent::Controller();
 +       }
 +
 +
 + function index() {
 + $this->load->model('lat_lon');
 + $posdata['rows'] = $this->lat_lon->getAll();
 +
 +        $this->load->view('coords' , $posdata);
 + }
 +
 +}
 +
 +</code>
 +
 +model
 +<code php>
 +<?php
 +
 +
 +class Lat_lon extends Model {
 +
 + function getAll() {
 + $q = $this->db->get('latlon');
 +
 + if($q->num_rows() > 0) {
 + foreach ($q->result() as $row) {
 +     $lldata[] = $row;
 + }
 + return $lldata ;
 + }
 + }
 +
 +
 +}
 +
 +
 +</code>
 +view
 +<code php>
 +<html>
 +  <head>
 +    <title></title>
 +    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 +  </head>
 +
 +  <body>
 +    <div id="container">
 +    <p>My view has been loaded</p>
 +
 +        <?php
 +        foreach($rows as $r){
 +        echo "<h1>" . $r->name . "</h1>";
 +        echo "<div>Lattitude: " . $r->lat . "</div>";
 +        echo "<div>Longitude: " . $r->lon . "</div>";
 +        echo "<div>ID: " . $r->id . "</div>" ;
 +          }
 +
 +         ?>
 +    </div>
 +  </body>
 +</html>
 +
 +</code>
xbee/xml.1274653506.txt.gz · Last modified: 2010/05/23 17:25 by rfile