User Tools

Site Tools


xbee:xml

trying to find xbee info for usn xml-rpc to retrieve data from the connectport x4

http://docs.python.org/library/simplexmlrpcserver.html

here is thread from '08 someone was trying to set it up: http://forums.digi.com/support/forum/viewthread_thread,877#3322

Re: zb_tcp_serial.py Control Port 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):
import xmlrpclib
#
# Define the Host and port
HOST='192.168.1.54'
PORT='27000'
# Create the XML-RPC object instance
server = xmlrpclib.ServerProxy('http://' + HOST + ':' + PORT + '/RPC2')
#
# Obtain the result of the list method
list=server.list()
#
# Loop through the results and list relevant fields
for x in list:
# NOTE: Everything from here to the end is indented to part of the "for" list
# Get the 64-bit address and clean it up
ExtendedAddress=x['addr_extended']
ExtendedAddress=ExtendedAddress.replace('[','')
ExtendedAddress=ExtendedAddress.replace(']','')
ExtendedAddress=ExtendedAddress.replace('!','')
# Get the Node ID
NodeID=x['label']
# Get the TCP Port
TCPPort=x['port_number']
print '64-bit Address: ' + ExtendedAddress + ', NodeID: ' + NodeID + ', TCP Port: ' + str(TCPPort)
-----------

Here's the output from a program run from the command prompt:

-----------
D:\FILES\z. System\Power Monitor\Digi ConnectPort X2>xmlrpc
64-bit Address: 00:13:a2:00:40:0a:3e:ff, NodeID: E2, TCP Port: 27001

D:\FILES\z. System\Power Monitor\Digi ConnectPort X2>

controller

<?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);
	}
 
}

model

<?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 ;
		}
	}
 
 
}

view

<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>
xbee/xml.txt · Last modified: 2010/05/23 20:41 by rfile