1

I have created a script where I want to send file over bluetooth. For that I took "obexctl" utility. I can transfer file using obexctl utility over terminal. But when I'm trying to incorporate the same in a script using expect, it says "Client proxy not available".

Can somebody help me with the code. Thanks in advance.

Commands over terminal:

$ obexctl

[NEW] Client /org/bluez/obex 

[obex]# connect xx:xx:xx:xx:xx:xx

Attempting to connect to xx:xx:xx:xx:xx:xx

[NEW] Session /org/bluez/obex/client/session11 [default]

[NEW] ObjectPush /org/bluez/obex/client/session11 

Connection successful

[xx:xx:xx:xx:xx:xx]# send abc.txt

Attempting to send abc.txt to /org/bluez/obex/client/session3

[NEW] Transfer /org/bluez/obex/client/session3/transfer1

Transfer /org/bluez/obex/client/session3/transfer1

        Status: queued
        Name: filename.sh
        size: 0
        Filename: abc.txt
        Session: org/bluez/obex/client/session3

[CHG] Transfer /org/bluez/obex/client/session3/transfer1 Status: complete

[DEL] Transfer /org/bluez/obex/client/session3/transfer1

[xx:xx:xx:xx:xx:xx]#

Shell Script

#!/bin/bash
....
/usr/bin/expect << EOF
      set prompt "#"
      spawn sudo obexctl
      #expect -re \$prompt
      expect "Client"
      send "connect $hw_addr\r"
      sleep 4
      expect "Connection"
      send "send $bluetooth_log_file\r"
      send "quit\r"

EOF
....

On executing this script, it provides output as:

spawn sudo obexctl

[obex]# connect xx:xx:xx:xx:xx:xx

Client proxy not available

[obex]#

The result should be same either executed manually on terminal or automated using a script.

Can somebody provide some suggestion where I'm doing wrong.

Aaron
  • 24,009
  • 2
  • 33
  • 57
Nikita
  • 425
  • 1
  • 7
  • 19

0 Answers0