Esempio n. 1
0
	def init(self):
		AuthenticatedTransport.init(self)
		if isinstance(self['address'], six.string_types):
			self['address'] = [self['address']]
		if len(self['address']) < 0:
			raise KozoError('Must provide at least one address.')
		self._serverSocket = None
Esempio n. 2
0
	def bind(self):
		AuthenticatedTransport.bind(self)
		self._adapter.SetProperty('Discoverable', self._address is None, signature='sv')
		self._serverSocket = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
		self._serverSocket.bind(('', bluetooth.PORT_ANY))
		self._serverSocket.listen(self['socketConnectionBacklog'])
		bluetooth.advertise_service(self._serverSocket, 'kozo', service_id=self._uuid, service_classes=[self._uuid, bluetooth.SERIAL_PORT_CLASS], profiles=[bluetooth.SERIAL_PORT_PROFILE])
		infoTransport(self, 'Bound on port', self._serverSocket.getsockname()[1], 'with UUID', self._uuid)
Esempio n. 3
0
	def bind(self):
		AuthenticatedTransport.bind(self)
		self._serverSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
		self._serverSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
		self._serverSocket.bind((self['bindAddress'], self['port']))
		self._serverSocket.listen(self['socketConnectionBacklog'])
Esempio n. 4
0
	def localInit(self):
		AuthenticatedTransport.localInit(self)
		bus = dbus.SystemBus()
		manager = dbus.Interface(bus.get_object('org.bluez', '/'), 'org.bluez.Manager')
		self._adapter = dbus.Interface(bus.get_object('org.bluez', manager.DefaultAdapter()), 'org.bluez.Adapter')