sugar-toolkit-gtk3/sugar/p2p/Service.py

45 lines
1009 B
Python
Raw Normal View History

import presence
class Service(object):
def __init__(self, name, stype, port, group_address = None):
self._name = name
self._stype = stype
self._port = int(port)
self._address = ''
self._group_address = group_address
def get_name(self):
return self._name
def get_type(self):
return self._stype
def get_port(self):
return self._port
def set_port(self, port):
self._port = port
def get_address(self):
return self._address
def get_group_address(self):
return self._group_address
def set_address(self, address):
self._address = address
2006-05-15 23:16:55 +02:00
def set_group_address(self, group_address):
self._group_address = group_address
def is_multicast(self):
return self._group_address != None
def register(self, group):
pannounce = presence.PresenceAnnounce()
if self._group_address:
2006-05-15 22:28:09 +02:00
pannounce.register_service(self._name, self._port, self._stype,
group_address = self._group_address)
2006-05-15 22:28:09 +02:00
else:
pannounce.register_service(self._name, self._port, self._stype)