.NET Components for Mobility

How to use InTheHand.Net.Ports.BluetoothSerialPort.CreateServer

Last post 01-30-2008 10:18 AM by alanjmcf. 10 replies.
Page 1 of 1 (11 items)
Sort Posts: Previous Next
  • 03-01-2007 12:06 AM

    • kebbs
    • Not Ranked
    • Joined on 02-28-2007
    • Posts 0

    How to use InTheHand.Net.Ports.BluetoothSerialPort.CreateServer

    I have a WinCE device which I'm trying to use as the endpoint of a bluetooth serial connection (e.g. so that I can initiate a connection from my PC). I am doing the following:

     _BluetoothSerialPort port = BluetoothSerialPort.CreateServer(InTheHand.Net.Bluetooth.BluetoothService.SerialPort);
     Console.Out.WriteLine("BTSerialConnnection virtual com port is " +
        port.PortName + " " + " " + port.Service + " " + port.Local);           

    This code succeeds as desired, and I see that the portName is "COM0". I then try to open a SerialPort as follows:
     
    SerialPort serialPort = new SerialPort(port.PortName, 38400);
    serialPort.Open();

     
    The Open() call fails with the following eror, "The port 'COM0:' does not exist". Any ideas what I am doing wrong?

        

  • 03-10-2007 11:45 AM In reply to

    Re: How to use InTheHand.Net.Ports.BluetoothSerialPort.CreateServer

    I'm sorry that I can't help; I've no experience with PPC/CE.  Peter's away on holiday just now so if noone can help hopefully Peter'll be able to help when he gets back.
    Alan J. McFarlane
    http://www.alanjmcf.me.uk/
    Please follow-up in the newsgroup for the benefit of all.
    Have I helped? Consider visiting my Amazon wishlist, see my homepage.
  • 03-29-2007 7:34 PM In reply to

    Re: How to use InTheHand.Net.Ports.BluetoothSerialPort.CreateServer

    Does the Handle property look valid? It's possible that the allocation failed, because COM0 is the last port it will try to allocate. I haven't checked through the code yet to see if this is likely.

    Peter

    Peter Foot
    Microsoft Device Application Development MVP
    www.peterfoot.net | www.inthehand.com
  • 03-30-2007 10:52 PM In reply to

    • kebbs
    • Not Ranked
    • Joined on 02-28-2007
    • Posts 0

    Re: How to use InTheHand.Net.Ports.BluetoothSerialPort.CreateServer

    The handle is 0, which is I assume is not valid.
  • 04-15-2007 9:38 AM In reply to

    Re: How to use InTheHand.Net.Ports.BluetoothSerialPort.CreateServer

    Does the device have any virtual serial ports which can be allocated through the user interface and are these already in use - it's possible they are already allocated and there are no spare ports.
    Peter Foot
    Microsoft Device Application Development MVP
    www.peterfoot.net | www.inthehand.com
  • 06-04-2007 3:05 PM In reply to

    Re: How to use InTheHand.Net.Ports.BluetoothSerialPort.CreateServer

    Hi Peter,

    I have the same problem as kebbs. The returned COM is 0. I've also tried creating a virtual COM port using WIN32 RegisterDevice, but I didn't get any valid handles.

    What is the UI component you are refering to? I have an MDA PRO running WM5 and couldn't find any UI menu to analyze ports.

    Thanks in adavnce,

     Johannes
     

  • 07-10-2007 5:18 AM In reply to

    Re: How to use InTheHand.Net.Ports.BluetoothSerialPort.CreateServer

    On WM5 the virtual serial ports are found in the Bluetooth settings applet on the COM Ports tab e.g.

    Start > Settings > Connections > Bluetooth > COM Ports

    See if you can create a port manually here. I'm working on updating the code to better co-exist with this control panel (so the UI reflects the virtual com ports that are created)

    Peter

    Peter Foot
    Microsoft Device Application Development MVP
    www.peterfoot.net | www.inthehand.com
  • 01-28-2008 1:23 PM In reply to

    Re: How to use InTheHand.Net.Ports.BluetoothSerialPort.CreateServer

    Peter- I have a very similar problem, see http://inthehand.com/forums/p/1261/4682.aspx#4682 Any ideas? Thanks, Andy
  • 01-29-2008 3:53 PM In reply to

    Re: How to use InTheHand.Net.Ports.BluetoothSerialPort.CreateServer

    Hi Andy

    Have you tried using the control panel to do the creation manually?  Does that work?

    I think much of this is dependent on how the OEM sets the device up.  We use the facility described at http://blogs.msdn.com/cenet/archive/2005/08/18/453150.aspx  And if it doesn't work then we won't work either.  Do you have the btd.dll file mentioned there for instance (not that I know how this all works)?

    Do the error codes returned by our call to RegisterDevice make any sense?

    Alan

    Alan J. McFarlane
    http://www.alanjmcf.me.uk/
    Please follow-up in the newsgroup for the benefit of all.
    Have I helped? Consider visiting my Amazon wishlist, see my homepage.
  • 01-29-2008 5:31 PM In reply to

    Re: How to use InTheHand.Net.Ports.BluetoothSerialPort.CreateServer

    Alan- Thanks for the reply.

    >>Have you tried using the control panel to do the creation manually?

    Good point. When I go to Settings | Connections | Bluetooth on the COM port tab, there is nothing in the list box.

    Usually, I would see "New incoming port" on other devices.

    I tried using "Make this device visible to other devices" (is this necessary?), but no change.

    By checking the registry at "SOFTWARE\\Microsoft\\Bluetooth\\Serial\\Ports\\SupportedPorts", I see that COM0-COM9 are available.

    >>Do the error codes returned by our call to RegisterDevice make any sense?

    I haven't used it as source code for a while, only the DLL. I will load up the source code again and write back on the results.

    Any ideas?

    Thanks, Andy
  • 01-30-2008 10:18 AM In reply to

    Re: How to use InTheHand.Net.Ports.BluetoothSerialPort.CreateServer

    I think you need to talk to the OEM or to MSFT.  Maybe open a case at one of them -- they may charge though; MSFT would (correctly?) says its the OEM's fault in setting-up the device.

    You could try posting a question at the cenet blog, they were looking for things to write about, see "Since I'm running out of things to write about" at http://blogs.msdn.com/cenet/archive/2008/01/08/the-history-of-the-dcom-remoting-addon-pack.aspx  You can say the we (the library and its forums) get *lots* of question about this not working...

    Alan J. McFarlane
    http://www.alanjmcf.me.uk/
    Please follow-up in the newsgroup for the benefit of all.
    Have I helped? Consider visiting my Amazon wishlist, see my homepage.
Page 1 of 1 (11 items)
Copyright © 2001-2008 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy.