Author Topic: Stop RF Gun Wireless disconnects  (Read 8339 times)

Alex Copeland

  • Professional
  • ***
  • Posts: 23
  • Artist's rendering
Stop RF Gun Wireless disconnects
« on: March 19, 2010, 01:36:01 PM »
We had a problem with our RF barcode scanners that we use in our warehouse for inventory: every once in a while, they'd lose the connection to the host.  Sometimes when the connection got dropped, they'd be in the middle of picking an order, and the dropped connection left the order in a messy state.

In order to mitigate this problem, we use screen http://www.manpagez.com/man/1/screen/ (AIX RPMs here: http://www.oss4aix.org/download/RPMS/screen/) to abstract the session on the RF device -- if the connection drops, the same user can just log back in and resume the screen session.  One caveat -- screen is for all intents and purposes a VT100 terminal emulator, so you have to make sure that whatever you're connecting to (in our case Prelude) is expecting VT100, and the device you're using is expecting the same.

To automate this, part of the login script for our RF gun users is:

Code: [Select]
#!/bin/sh
export TERM=vt100

if screen -ls | grep "No Sockets found" > /dev/null 2>&1
  then
  screen -s /usr/local/bin/prelude.login
  exit 0
else
  SCREEN=`screen -ls | grep -v "screen" | awk '{print $1}'`
  echo "You are already logged on."
  echo "What do you want to do:"
  echo "1 - Resume Previous Session"
  echo "2 - Start a New Session"
  while [ ! "$yn" = "1" ] && [ ! "$yn" = "2" ]
    do
    echo "Please enter 1 or 2."
    read yn
  done
  if [ "$yn" = "1" ]
    then
    screen -D -R $SCREEN
  fi
  if [ "$yn" = "2" ]
    then
    screen -s /usr/local/bin/prelude.login
  fi
fi

exit 0

precisonline

  • President
  • Administrator
  • Rock Star
  • *****
  • Posts: 1612
    • Precision Solutions
Re: Stop RF Gun Wireless disconnects
« Reply #1 on: March 19, 2010, 03:13:14 PM »
Hey, THAT is cool.
-Kevin
Accidents "happen"; success, however, is planned and executed.

Alex Copeland

  • Professional
  • ***
  • Posts: 23
  • Artist's rendering
Re: Stop RF Gun Wireless disconnects
« Reply #2 on: March 19, 2010, 03:30:44 PM »
I've been wanting to roll screen out system wide, but there are few little hinky things about the VT100/VT220 terminal definition in Prelude and the way it works with xterm and Accuterm.  It mostly works, but little things like the down arrow doesn't work.  I haven't had the time to sit down and map out the right keys.

If anyone has done a comprehensive terminal definition in SB+ for xterm and/or Accuterm's VT100 emulation, I'd really like to see it.

precisonline

  • President
  • Administrator
  • Rock Star
  • *****
  • Posts: 1612
    • Precision Solutions
Re: Stop RF Gun Wireless disconnects
« Reply #3 on: March 19, 2010, 03:40:49 PM »
Check this: http://www.precisonline.com/forum/index.php/topic,238.0.html

I believe these AccuTerm definitions were created for SB+ by Pete S himself.
-Kevin
Accidents "happen"; success, however, is planned and executed.

Alex Copeland

  • Professional
  • ***
  • Posts: 23
  • Artist's rendering
Re: Stop RF Gun Wireless disconnects
« Reply #4 on: March 19, 2010, 03:46:57 PM »
Thanks, Kevin.  If this works out, say goodbye to dropped sessions.  I will post my results.