#!/bin/bash

export PEBBLE_ID=`bt-device -l | grep "Pebble Time" | cut -d ' ' -f4 | cut -c2-18`

if [ -z "$PEBBLE_ID" ];
then

  export PEBBLE_ID=`bt-device -l | grep "Pebble" | cut -d ' ' -f3 | cut -c2-18`

fi

export PARAMETERS=--lightblue
export SUBCOMMAND=remote
export APP_NAME=soffice

if [ "$1" == "-h" ] || [ "$1" == "--help" ];
then

  echo "Usage: `basename $0` [path_to_odp_file]"
  exit 0

elif [ "$1" == "-v" ] || [ "$1" == "--version" ];
then

  echo "2.2"
  exit 0

else

  p.py --pebble_id $PEBBLE_ID $PARAMETERS $SUBCOMMAND $APP_NAME $1

fi

