.NET Components for Mobility

SerialPort connection on a funny hardware

Last post 09-09-2010 10:31 AM by alanjmcf. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 09-02-2010 3:42 AM

    • cail
    • Top 500 Contributor
    • Joined on 09-02-2010
    • Posts 4

    SerialPort connection on a funny hardware

    Hi all, Trying to establish a simple SerialPort connection (which is described in numerous topics here and in sample code), but again, having a problem. What I'm facing is
       BluetoothSecurity.PairRequest(deviceAddress, "0000");
    
    returns success, but then
       BluetoothClient.Connect(deviceAddress, BluetoothService.SerialPort);
    
    it says "No connection could be made because the target machine actively refused it". The funny thing is when I'm doing
        bdi.GetServiceRecords(BluetoothService.SerialPort)
    
    the device returns no records. However, it for sure supports serial port connection. Could this be a reason?

    Creating a virtual serial port also doesn't help. COM port is created successfully, but it is not visible from other software and couldn't be opened via .net framework interfaces..

    The device is noname china OBD-II bluetooth adapter - it for sure works and connects from another platform (nokia, j2me). The platform I'm trying to connect from is WinCE6.0 (PNA device).

    Advices are highly appreciated!

    Filed under: , ,
  • 09-05-2010 6:37 AM In reply to

    Re: SerialPort connection on a funny hardware

    Can you try doing bdi.GetServiceRecords(BluetoothService.L2CapProtocol)  What records does it return?  You can use the SdpBrowser sample if you want (I presume it runs ok on CE).

    You create the virtual COM port on CE?

    How does the device look from desktop Windows?  Do you have a dongle there that could be used to run the GetServiceRecords test there?

    (LATER: Just to note that someone else was wondering whether all the necessary modules were installed on their CE device: http://inthehand.co.uk/forums/t/3759.aspx)

  • 09-07-2010 4:28 AM In reply to

    • cail
    • Top 500 Contributor
    • Joined on 09-02-2010
    • Posts 4

    Re: SerialPort connection on a funny hardware

    alanjmcf:

    Can you try doing bdi.GetServiceRecords(BluetoothService.L2CapProtocol)  What records does it return?

    The same - zero records ;( This also confirmed by a third party bluetooth manager software (adeneo) - no services.
    alanjmcf:
    You create the virtual COM port on CE? How does the device look from desktop Windows?
    I've tried to create virtual com - but I don't see it in CE device manager, so assume it is not created. However, trying from .NET to reregister the same port second time fails! Desktop windows also shows no services (native stack). but I was able to successfully connect and use serial connection.

    Think I have to try native/socket access to overhelm this.

    Does anybody know any good sample of trivial BT connection from .net via native libs?

  • 09-08-2010 7:24 AM In reply to

    Re: SerialPort connection on a funny hardware

    So is this the car diagnostics kit that google suggests to me?  So it might be that, as they also supply the PC/etc software (correct?) then they just always have their server listen on a fixed RFCOMM Channel (port) and thus software connects to that port with no SDP lookup required...

    I can probably provide some help with cunning plans to find what port it is listening on, drop me an email at alanjmcf AT yahoo.com.

  • 09-08-2010 9:25 AM In reply to

    • cail
    • Top 500 Contributor
    • Joined on 09-02-2010
    • Posts 4

    Re: SerialPort connection on a funny hardware

    alanjmcf:

    So is this the car diagnostics kit that google suggests to me?  So it might be that, as they also supply the PC/etc software (correct?) then they just always have their server listen on a fixed RFCOMM Channel (port) and thus software connects to that port with no SDP lookup required...

    I can probably provide some help with cunning plans to find what port it is listening on, drop me an email at alanjmcf AT yahoo.com.

    http://www.dealextreme.com/details.dx/sku.16921 - If you want a specific link.
    But don't think the model or its PC software matters. I've heard that other OBD2 tools share serial port correctly and it is possible to connect them from PNA.

    Of course it is a fixed port, from my J2ME phone I easily connect to the unit just using
    Connector.open("btspp://devaddress:1", Connector.READ_WRITE)
    believe :1 is the port to connect.

    Hmm.. looking into the sources I see
    public class BluetoothEndPoint : EndPoint { private const int defaultPort = 0;

    Could this be a reason? Is there any sence trying
    ep = new BluetoothEndPoint(addr, BluetoothService.SerialPort, 1); client.Connect(ep); ?
  • 09-08-2010 2:03 PM In reply to

    Re: SerialPort connection on a funny hardware

    Yup that's what to do specify the port in the endpoint, but use service BluetoothService.Empty, otherwise the stack will do the SDP lookup.
  • 09-08-2010 4:12 PM In reply to

    • cail
    • Top 500 Contributor
    • Joined on 09-02-2010
    • Posts 4

    Re: SerialPort connection on a funny hardware

    alanjmcf:
    Yup that's what to do specify the port in the endpoint, but use service BluetoothService.Empty, otherwise the stack will do the SDP lookup.
    The preliminary result - it creates the socket. I see some transfer - but still have to figure if the communication is fine and correct.

    Thanks for your hints alot!

    BTW, I was able to connect specifying both BluetoothService.Empty and .SerialPort - seems no sdp search is done since I'm explicitly giving it a port number.

    The minor drawback is that I still can't create virtual serial port in a system, but let's assume this is because of that ripped winCE. I wanted to have it as an easy way to test existing OBD-II applications, but anyway having a connection I now can do the things by myself.
  • 09-09-2010 10:31 AM In reply to

    Re: SerialPort connection on a funny hardware

    Glad to hear you've got it working.

    After I posted I remembered that its whether the port is blank or not that matters, not whether the service is blank.  I've made a load of changes to the class documentation to make that clear.

Page 1 of 1 (8 items)
Copyright © 2001-2012 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy. OrcsWeb's Windows Cloud Server Hosting