I got a hand-held scanner connected by the bluetooth and it is found
by the BuletoothClient.DiscoverDevices in application. The application
needs to get the data read by the scanner and save the database. But I
don't know how to invoke the event when the scanner is scan the barcode.
I
tried with ObexListener class to listen the event after the device has
been connected. But it doesn't work. I tried to use the Brecham.Obex
class by following code but it hangs the application. Am I in the right
direction to go? Can anyone of you help me out how to get scan event
from bluetooth scanner and which class should I use? Many thanks in
advance.
if (bc.Connected)
{
DateTime start = DateTime.UtcNow;
L_ThreadEvent = new ManualResetEvent(false);
Thread t = new Thread(new ThreadStart(Killer));
t.Start();
stream = p_BTClient.GetStream();
ObexGetServer handler = new ObexGetServer();
handler.CreateGetStream += new
EventHandler<CreateGetStreamEventArgs>(handler_CreateGetStream);
ObexHost = new AsyncObexServerHost(stream, 16 * 1024);
ObexHost.Start();
ObexHost.ExitWaitHandle.WaitOne();
strHistory.AppendLine("Connection lasted on " + (DateTime.UtcNow - start));