2006-05-12 03:56:23 +02:00
|
|
|
import presence
|
|
|
|
|
2006-05-11 08:00:37 +02:00
|
|
|
class Service(object):
|
2006-05-12 03:56:23 +02:00
|
|
|
def __init__(self, name, stype, address, port, multicast=False):
|
2006-05-11 08:00:37 +02:00
|
|
|
self._name = name
|
2006-05-12 03:56:23 +02:00
|
|
|
self._stype = stype
|
2006-05-11 08:00:37 +02:00
|
|
|
self._address = str(address)
|
|
|
|
self._port = int(port)
|
2006-05-11 20:46:34 +02:00
|
|
|
self._multicast = multicast
|
2006-05-11 08:00:37 +02:00
|
|
|
|
|
|
|
def get_name(self):
|
|
|
|
return self._name
|
2006-05-12 03:56:23 +02:00
|
|
|
|
|
|
|
def get_type(self):
|
|
|
|
return self._stype
|
2006-05-11 08:00:37 +02:00
|
|
|
|
|
|
|
def get_address(self):
|
|
|
|
return self._address
|
|
|
|
|
|
|
|
def get_port(self):
|
|
|
|
return self._port
|
2006-05-12 04:31:02 +02:00
|
|
|
|
|
|
|
def set_port(self, port):
|
|
|
|
self._port = port
|
2006-05-11 20:46:34 +02:00
|
|
|
|
|
|
|
def is_multicast(self):
|
|
|
|
return self._multicast
|
2006-05-12 03:56:23 +02:00
|
|
|
|
|
|
|
def register(self, group):
|
|
|
|
pannounce = presence.PresenceAnnounce()
|
|
|
|
pannounce.register_service(self._name, self._port, self._stype)
|