etisserant@203: #!/usr/bin/env python etisserant@203: # -*- coding: utf-8 -*- etisserant@203: etisserant@203: #This file is part of Beremiz, a Integrated Development Environment for etisserant@203: #programming IEC 61131-3 automates supporting plcopen standard and CanFestival. etisserant@203: # etisserant@203: #Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD etisserant@203: # etisserant@203: #See COPYING file for copyrights details. etisserant@203: # etisserant@203: #This library is free software; you can redistribute it and/or etisserant@203: #modify it under the terms of the GNU General Public etisserant@203: #License as published by the Free Software Foundation; either etisserant@203: #version 2.1 of the License, or (at your option) any later version. etisserant@203: # etisserant@203: #This library is distributed in the hope that it will be useful, etisserant@203: #but WITHOUT ANY WARRANTY; without even the implied warranty of etisserant@203: #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU etisserant@203: #General Public License for more details. etisserant@203: # etisserant@203: #You should have received a copy of the GNU General Public etisserant@203: #License along with this library; if not, write to the Free Software etisserant@203: #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA etisserant@203: etisserant@203: import Zeroconf etisserant@203: etisserant@203: class PublishService(): etisserant@203: def __init__(self): etisserant@203: self.server = Zeroconf.Zeroconf() etisserant@203: etisserant@203: def ConfigureService(self, type, name, address, port, description): etisserant@203: self.newservice = Zeroconf.ServiceInfo(type, etisserant@203: name, etisserant@203: address, etisserant@203: port, etisserant@203: weight = 0, # weight: weight of the service etisserant@203: priority= 0, # priority: priority of the service etisserant@203: properties = description) etisserant@203: etisserant@203: def PublishService(self): etisserant@203: self.server.registerService(self.newservice)