participant "scanner\n(serverXR/scanner.py)" as S
participant "rpc\n(django-web/rpc.py)" as R
participant "uploader\n(serverXR/uploader.py)" as U
participant "worker\nThread 1" as W
participant "worker\nThread 2" as W2
participant "ObexFTP" as O
participant "BlueZ" as B

U-->R: uploader_register\n(known_dongles)

loop for each uploader dongle
R->U: add_dongle(address, max_connection)
end

activate U
R-->U: doUpload(target, address, files)

U-->W: doWork(target, address, files)
activate W

W-->B: searchService(address, uuid)
activate B
B-->W: foundService(port)
W->R: foundService(address, port)
R->R: logToDB
deactivate B

loop for each file in files

W->O: Upload File file
activate O
B-->U: hcl connected\n(this signal is not taked into account yet!)
O->W: Return Value
W->R: UploadCompletedFile(file, target)
R->R: logToDB
deactivate O
end

W-->R: UploadCompleted(address)
R->R: logToDB

deactivate W

R-->U: doUpload(target, address, files)
U-->W2: doWork(target, address, files)
activate W2
W2->W2: ....
deactivate W2

deactivate U