summaryrefslogtreecommitdiff
path: root/roles/ws/minet/templates/connections/a1Mobile.j2
blob: 205ca791a3800670204bb5702dd0bf9f6faeac50 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh

SHORT_NAME="a1Mobile"
DESC_NAME="A1 Mobiles Schmalband"
USB_DEV="/dev/mobile"
RFCOMM_DEV="/dev/rfcomm1"
BT_ADDR="38:EC:E4:86:8F:D3"
RFCOMM_CHANNEL=3

case "$1" in
  start|"")
    echo "Connecting with $DESC_NAME"
    if [ -e "$USB_DEV" ]; then
      DEV=$USB_DEV
    else
      /usr/bin/rfcomm -A -E -S bind $RFCOMM_DEV $BT_ADDR $RFCOMM_CHANNEL
      DEV=$RFCOMM_DEV
    fi
    /usr/bin/pon a1.net $DEV
    ;;
  stop)
    echo "Disconnecting from $DESC_NAME"
    /usr/bin/poff a1.net
    if [ ! -e "$USB_DEV" ]; then
      /usr/bin/rfcomm release $RFCOMM_DEV
    fi
    ;;
  *)
    exit 1
    ;;
esac