How to detect if Topaz device is connected(through USB) in JavaScript code using SigWeb?

1.4k views Asked by At

How to detect if Topaz device is connected?

My Topaz is: T-LBK462-HSB-R (USB) I am using: SigWeb SDK (SigWebTablet.js)

Which method of SigWebTablet.js library should I call to check if device is connected?

As it says on their officail DEMO: http://www.sigplusweb.com/sigwebtablet_demo.htm

if I want to use Topaz I need to call this code:

   var ctx = document.getElementById('cnv').getContext('2d');         
   SetDisplayXSize( 500 );
   SetDisplayYSize( 100 );
   SetTabletState(0, tmr);
   SetJustifyMode(0);
   ClearTablet();
   if(tmr == null)
   {
      tmr = SetTabletState(1, ctx, 50);
   }
   else
   {
      SetTabletState(0, tmr);
      tmr = null;
      tmr = SetTabletState(1, ctx, 50);
   }

But this code is successfully executed even if Topaz device is not connected, which basically means it just requires Topaz local Server to be running. But it is not enough for me, I need to know it device is connected.

1

There are 1 answers

1
Renat Gatin On BEST ANSWER

Found solution by my-self: GetTabletState() method returns either '1' or '0'

May be useful for somebody..