OESF Portables Forum

General Forums => General Discussion => Topic started by: bam on December 28, 2006, 01:08:15 am

Title: Tree!explorer Obex Gui For Send-to Function
Post by: bam on December 28, 2006, 01:08:15 am
modified Meanies bluetooth-gui script to work for Tree!Exploreer Plus Send-To functionality

#!/bin/sh
#
######################################################################
APPNAME="OBEX GUI"
BNAME=`basename $0`
BLUECONTROL=/etc/pcmcia/bluetooth
BTLIST=/etc/bluetooth/devices
BTDEV=/etc/bluetooth/device
SUDO=`which sudo`

sFile=$1

init()
{
  export QSHDLG_APP=$BNAME$1
  INPUT=/var/spool/qshdlg/input_${QSHDLG_APP}
  OUTPUT=/var/spool/qshdlg/output_${QSHDLG_APP}
  CONTROL=/var/spool/qshdlg/control_${QSHDLG_APP}
}

get_device()
{
  if [ -f $BTDEV ] && [ "$DEVICE" = "" ]; then
    DEVICE=`cat $BTDEV`
  fi
 
}


  init dc
  qshdlg custom -C "message,reply"  -A -f lcfont -t "$APPNAME : control" -v "Scan,Start,Stop" &
  while [ ! -p $CONTROL ]
  do
    echo >/dev/null
  done
  if [ "`hciconfig`" = "" ]; then
    echo "Bluetooth service is not started" > $OUTPUT
  else
    echo "Bluetooth service is running" > $OUTPUT
    if [ -f $BTLIST ]; then
      for NODE in `grep ':' $BTLIST`
      do
        if [ "$NODE" != "Scanning" ] && [ "$NODE" != "..." ]; then
          if [ "`echo $NODE |grep ':'`" != "" ]; then
            NODEADDRESS=$NODE
          else
            echo 'item(QString)' "$NODEADDRESS---[$NODE]" > $CONTROL
            FOUND=1
          fi
        fi
      done
      if [ "$FOUND" = "1" ]; then
        echo 'showSelect()' > $CONTROL
        echo "Please select Bluetooth device" > $OUTPUT
      fi
    fi
  fi
  while read RET < $INPUT
  do
    case $RET in
      Start)
         if [ "`hciconfig`" != "" ]; then
           echo "stopping Bluetooth service..." > $OUTPUT
           $SUDO $BLUECONTROL stop
           CARDID=`cardctl ident 0 |grep manfid|cut -d: -f2 2>/dev/null`
           if [ "$CARDID" != "" ] && [ "`grep $CARDID /etc/pcmcia/bluetooth.conf 2>/dev/null`" != "" ]; then
             $SUDO cardctl eject 0
           fi
         fi
         if [ "`cardctl status 0|grep 'no card'`" != "" ]; then
           echo "inserting card..." > $OUTPUT
           $SUDO cardctl insert 0
         fi
         if [ "`cardctl status 0|grep suspended`" != "" ]; then
           echo "resuming card..." > $OUTPUT
           $SUDO cardctl resume 0
         fi
         echo "starting Bluetooth service..." > $OUTPUT
         if [ "`hciconfig`" = "" ]; then
           echo "Bluetooth started" > $OUTPUT
           $SUDO $BLUECONTROL start
         else
           echo "Bluetooth failed to start" > $OUTPUT
         fi
         ;;
      Stop)
         echo "stopping Bluetooth service..." > $OUTPUT
         $SUDO $BLUECONTROL stop
         CARDID=`cardctl ident 0 |grep manfid|cut -d: -f2 2>/dev/null`
         if [ "$CARDID" != "" ] && [ "`grep $CARDID /etc/pcmcia/bluetooth.conf 2>/dev/null`" != "" ]; then
           $SUDO cardctl eject 0
         fi
         if [ "`hciconfig`" = "" ]; then
           echo "Bluetooth stopped" > $OUTPUT
         else
           echo "Bluetooth failed to stop" > $OUTPUT
         fi
         ;;
      Scan)
         if [ "`hciconfig`" = "" ]; then
           echo "Cannot scan. Bluetooth is not enabled." > $OUTPUT
         else
           echo "Scanning for Bluetooth devices..." > $OUTPUT
           FOUND=0
           for NODE in `hcitool scan | $SUDO tee $BTLIST`
           do
             if [ "$NODE" != "Scanning" ] && [ "$NODE" != "..." ]; then
               if [ "`echo $NODE |grep ':'`" != "" ]; then
                 NODEADDRESS=$NODE
               else
                 echo 'item(QString)' "$NODEADDRESS---[$NODE]" > $CONTROL
                 FOUND=1
               fi
             fi
           done
           if [ "$FOUND" = "1" ]; then
             echo 'showSelect()' > $CONTROL
             echo "Please select Bluetooth device" > $OUTPUT
           else
             echo "No Bluetooth device found" > $OUTPUT
           fi
         fi
         ;;
      *)
   if [ "`echo $RET|grep ':'`" != "" ]; then
      DEVICE=`echo $RET|cut -d- -f1`
              echo "selected device is $DEVICE" |tee $OUTPUT
           
              get_device
      echo "Connecting to Device..." > $OUTPUT
 
           if [ -f /etc/bluetooth/obex ]; then
                OFTP=`cat /etc/bluetooth/obex`
           else
                OFTP=`sdptool search FTP|grep Channel|cut -d: -f2`
           fi

        echo 'Connected' > $OUTPUT
          echo "transferring $sFile ..." > $OUTPUT
          obextool push $sFile $DEVICE $OFTP
          echo "Transfer Complete" > $OUTPUT          
              $SUDO touch $BTDEV
              $SUDO chown zaurus:qpe $BTDEV
              echo $DEVICE > $BTDEV
   else
           echo "nothing selected" |tee $OUTPUT
   fi
         
         echo 'reject()' > $CONTROL
         ;;
    esac
  done


make sure to add a command in Tree!Explorer Plus Send-to
select command, then the name of this script "obex-gui %1 &", no quotes. Then you should be able to liong tap->send to->obex-gui. The dialog box pops-up select the device and press ok. thanks to Meanie for the original bluetooth-gui script.
Title: Tree!explorer Obex Gui For Send-to Function
Post by: Jon_J on December 28, 2006, 02:50:19 am
I sure wish I could get my hands on Tree!Explorer+
Anywhere I can send a money order?
I would drop my other filemanagers if I could click and launch documents from Tree!Explorer.
Title: Tree!explorer Obex Gui For Send-to Function
Post by: bam on December 28, 2006, 02:47:24 pm
I thinki I got it at handango
Title: Tree!explorer Obex Gui For Send-to Function
Post by: dougeeebear on December 28, 2006, 03:30:30 pm
Jon,
Maybe   this (https://www.oesf.org/forums/index.php?showtopic=22427&view=findpost&p=148989) will help.

Or you could send me a money order for $50,000,000,000.00  
Title: Tree!explorer Obex Gui For Send-to Function
Post by: Jon_J on December 28, 2006, 03:39:26 pm
handango link is dead
" Error
The product you were looking for is not available."

I don't think handango will take money orders.
I'll ask Stephen at StreamlineCPUs if he can get it for me when I order my new C3200 next month.