203
|
1 |
#!/usr/bin/env python
|
|
2 |
# -*- coding: utf-8 -*-
|
|
3 |
|
|
4 |
#This file is part of Beremiz, a Integrated Development Environment for
|
|
5 |
#programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
|
|
6 |
#
|
|
7 |
#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
|
|
8 |
#
|
|
9 |
#See COPYING file for copyrights details.
|
|
10 |
#
|
|
11 |
#This library is free software; you can redistribute it and/or
|
|
12 |
#modify it under the terms of the GNU General Public
|
|
13 |
#License as published by the Free Software Foundation; either
|
|
14 |
#version 2.1 of the License, or (at your option) any later version.
|
|
15 |
#
|
|
16 |
#This library is distributed in the hope that it will be useful,
|
|
17 |
#but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18 |
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
19 |
#General Public License for more details.
|
|
20 |
#
|
|
21 |
#You should have received a copy of the GNU General Public
|
|
22 |
#License along with this library; if not, write to the Free Software
|
|
23 |
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
24 |
|
|
25 |
import Zeroconf
|
|
26 |
|
|
27 |
class PublishService():
|
|
28 |
def __init__(self):
|
|
29 |
self.server = Zeroconf.Zeroconf()
|
|
30 |
|
|
31 |
def ConfigureService(self, type, name, address, port, description):
|
|
32 |
self.newservice = Zeroconf.ServiceInfo(type,
|
|
33 |
name,
|
|
34 |
address,
|
|
35 |
port,
|
|
36 |
weight = 0, # weight: weight of the service
|
|
37 |
priority= 0, # priority: priority of the service
|
|
38 |
properties = description)
|
|
39 |
|
|
40 |
def PublishService(self):
|
|
41 |
self.server.registerService(self.newservice) |