I try to build computer program that trasfer files use Bluetooth and OBEX technology between Windows and RPI. I use BLuetooth RFCOMM Server @ Windows Side. RPI is @ client side. I use pybluez and PyObex for both side. Now I sent file from RPI side. However I can't catch the file @ Windows side. Code elements figured at below.
Server Side:
class BlueDev(object):
def __init__(self):
self.socket = BluetoothSocket(RFCOMM)
self.server = BrowserServer()
self.port = None
def startService(self):
""" Starts Socket and Advertising Service """
self.socket.bind(("",PORT_ANY))
self.port = self.socket.getsocketname()[1]
self.socket.listen(1)
self.server.start_service(self.socket) ## advertise server
self.server.serve(self.socket) ## accepts connection
if __name__ == "__main__"
blueDevServ = BlueDev()
blueDevServ.startService()
Client Side:
class BluetoothDev(object): def __init__(self): self.client = None self.socket = Bluetooth(RFCOMM) self.port = None self.address = "" def startService(self): if sys.version < '3': input = raw_input if len(sys.argv) < 2: print("No device") services = bluetooth.find_service(uuid=OBEX_FILETRANS_CLASS, address=self.address) servicesMatch = services[0] port = servicesMatch["port"] self.address = servicesMatch["host"] print(port , self.address) self.client = client.BrowserClient(self.address,port) print("Client is ready") def connect(self): self.client.connect() print "Connected from client Side" if __name__ == "__main__": blueClient = BluetoothDev() devices = blueClient.discover() blueClient.startService() print("Waiting for server service") blueClient.connect() client.put('test.txt', 'HelloWorld!') print("File Sent:")
I couldn't find missing elements on architecture.How can i catch sent files on Server Side?