runtime/ServicePublisher.py
author etisserant
Wed, 20 Aug 2008 00:11:40 +0200
changeset 203 cb9901076a21
child 217 f3eb35df4d87
permissions -rwxr-xr-x
Added concepts :
- connector class (for PLC control, debug and flashing abstraction).
- builder class (C toolchain abstraction)

Added features :
- Pyro based connector.
- ctypes loader, load PLC shared object and run it
- ctypes based debugger embryo (not tested)
- gcc builder

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