.NET Components for Mobility

How to get data from bluetooth Scanner

Last post 09-23-2008 8:15 AM by amy myo. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 09-23-2008 8:15 AM

    How to get data from bluetooth Scanner

    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));

     

Page 1 of 1 (1 items)
Copyright © 2001-2008 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy.