Beispiel #1
0
import configuration as config
import Pyro4

G = Pyro4.Proxy("PYRONAME:0")
# G.temp()
# print G.ID_Book
# G.register("sensor", "temperature")
addr_book = G.addr_book()
temperature = config.Sensors(addr_book[-1], "temperature")
# print addr_book
G.register("temperature")

Pyro4.Daemon.serveSimple({temperature: str(addr_book[-1])}, ns=True)
Beispiel #2
0
import configuration as config
import Pyro4

G = Pyro4.Proxy("PYRONAME:gateway1")
# G.temp()
# print G.ID_Book
# G.register("sensor", "temperature")
addr_book = G.addr_book()
beacon = config.Sensors(addr_book[-1], "beacon")
# print addr_book
G.register("beacon")

Pyro4.Daemon.serveSimple({beacon: str(addr_book[-1])}, ns=True)
Beispiel #3
0
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 28 16:59:11 2017

@author: dxy
"""

# leader election
# Bully Algorithm

# For pyro4: python -m Pyro4.naming
import configuration as config
import Pyro4

G = Pyro4.Proxy("PYRONAME:0")
addr_book = G.addr_book()
motion = config.Sensors(addr_book[-1], "motion")
# G.temp()
# print G.ID_Book
# G.register("sensor", "temperature")

# print addr_book
G.register("motion")

Pyro4.Daemon.serveSimple({motion: str(addr_book[-1])}, ns=True)
import configuration as config
import Pyro4

G = Pyro4.Proxy("PYRONAME:0")
# G.temp()
# print G.ID_Book
# G.register("sensor", "temperature")
addr_book = G.addr_book()
door = config.Sensors(addr_book[-1], "door")
# print addr_book
G.register("door")

Pyro4.Daemon.serveSimple({door: str(addr_book[-1])}, ns=True)