Author Topic: WidComm produces weird TBFBluetoothDevice.Name  (Read 2055 times)

Offline downstruck

  • Newbie
  • *
  • Posts: 10
  • Karma: 0
WidComm produces weird TBFBluetoothDevice.Name
« on: January 06, 2007, 12:49:37 PM »
Hello, Mike.

Bravo for your great VCL. I'm evaluating your Bluetooth Framework with Delphi 7 and found a trouble. I use WidComm driver and do Discovery. Seems the driver produces weird TBFBluetoothDevice.Name. It happens on device name with unusual characters. The name will contain some replacement characters preceeding with an ? character. So, each unusual character replaced by 2 characters. I try the same code on other computer with Microsoft XP's bluetooth driver. It produces the correct name. Should I handle this on my code or can you do something on yours?

Seems your BF uses synchronous access so I use threads to make my program won't freeze. I find occasionally the program shows error while quiting although the error message only flashed (I can't read the message) and it quits as expected. Is it about your protection? Is it safe to use your VCL in multithreading?

When I transfer a file thru OBEX, a rejection will result an exception that uncatchable. Here's my code:

Code: [Select]
procedure TTransferThread.Execute;
var
  FBFOPC: TBFObjectPushClient;
  FBFA: TBFAuthenticator;
begin
  FBFOPC := TBFObjectPushClient.Create(Nil);
  FBFA := TBFAuthenticator.Create(Nil);

  try
    try
      FBFOPC.BluetoothTransport.Address := FDestAddr;
      FBFOPC.BluetoothTransport.Authentication := FPasskey <> '';
      FBFA.OnPINRequest := BFAuthenticatorPINRequest;

      FBFOPC.Open;

      try
        FBFOPC.Put(FFileName);
        FDoneMsg := 'File has been successfully transfered.';
        FSuccess := True;
        FBFOPC.Close;
      except
        FBFOPC.LastError;
      end;

    except
      on E: Exception do begin
        FSuccess := False;
        if (Pos('10013', E.Message) > 0) or (Pos('10051', E.Message) > 0) then
          FDoneMsg := 'Transfer is error cause authentication was failed.'
        else
          if (Pos('10060', E.Message) > 0) then
            FDoneMsg := 'Transfer is error cause connection was failed.'
          else
            FDoneMsg := 'Transfer is error. ' + E.Message;
      end;
    end;

  finally
    FBFA.Free;
    FBFOPC.Free;
  end;
end;

On the code above I am also trying to handle authentication whenever it needs. But, it never works. Can you point me why?

Thank you very much, Mike. I'm now trying to amazes my boss with your great software and getting his aprrovement to buy for the company.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2491
  • Karma: 1000
    • Wireless Communication Library
Re: WidComm produces weird TBFBluetoothDevice.Name
« Reply #1 on: January 06, 2007, 01:32:30 PM »
Good time of the day!

First at all: Happy New Year! :)

So. About your questions.
1. What is your device correct name? It seems like a bug in WidComm stub dll. So I will try find it. Unfortunatelly, on my devices it works fine. But i try give to it russian names. May be that is a problem (national characters in device name).
2. Yes. BTF works in synchroniouse mode (internal it async. but for better usage i makes syncronize inside). The error about you talking is a BFAuthenticator error. This component can't be used in thread. I try describe it int next point:
3. As I wrote before TBFAuthentication can't be used in thread. It already async inside BTF and call events in async mode. Cause it syncronized internally to work correct with VCL. All that you should to do just place on TBFAuthenticator on the main form. And of cause you should active it by calling BFAuthenticator.Open method. When you application finished call BFAuthenticator.Close method (not so neede because when component destroy it will closed).

Thank you.
WCL - Wireless Communication Library
TextBlue - Bluetooth Proximity Marketing Software
WCL Phone Explorer - Free Phone Content Manager

Offline downstruck

  • Newbie
  • *
  • Posts: 10
  • Karma: 0
Re: WidComm produces weird TBFBluetoothDevice.Name
« Reply #2 on: January 06, 2007, 02:08:39 PM »
Hi again, Mike!

Wow, flash response! Great!

This is the name weirdness:

R?nn? -> R?~nn?

As in my code from previous post, I'm trying to send file with thread. Is it BFAuthenticator somehow connected with TBFObjectPushClient that I put (created) in a thread? I mean, should I do authentication before trying to send the file? My idea is to do an unauthenticated transfer if the thread it's not given a FPassKey, thus the thread performs authenticated transfer when it has FPassKey. This is all for anticipating when a destination does or does not require authentication on receiving file. If I try to understand your explanation seems the authentication must be done before sending the file. But, TBFObjectPushClient.BluetoothTransport.Authentication seems tells me that the BluetoothTransport would receive authentication request from destination device. Then, BluetoothTransport should handle it. So, I am guessing there is when an BFAuthentication should start working. If I'm wrong, where does that property fit or what does the property mean exactly?

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2491
  • Karma: 1000
    • Wireless Communication Library
Re: WidComm produces weird TBFBluetoothDevice.Name
« Reply #3 on: January 06, 2007, 03:05:53 PM »
OK. I will fix device name recognition ASAP. Seems like national characters bug.

TBFAuthenticator can be active even if Authenticate property if false. It will send PIN only if Authentication property is True.
To detect is device need aythentication or not try connect with Authentication = False. If error will reaise so device need authentication.
You do not need authenticate devices before send data. It will makes automatically by TBFAuthentocator if needed.
WCL - Wireless Communication Library
TextBlue - Bluetooth Proximity Marketing Software
WCL Phone Explorer - Free Phone Content Manager

Offline downstruck

  • Newbie
  • *
  • Posts: 10
  • Karma: 0
Re: WidComm produces weird TBFBluetoothDevice.Name
« Reply #4 on: January 07, 2007, 01:57:31 PM »
Hello, Mike!

  • OK, thank you. I suspect it's about WideString but you're the one who know exactly.
  • Please, fix the help file, cause it's rather difficult to see documentation of inherited properties/methods.
  • We will use your product in various programming languages (Delphi, VB, .NET, etc.) in Windows, should we purchase two packages (VCL and ActiveX), since I don't see ActiveX component in VCL package eventhough in Deluxe edition contains ActiveX code?
  • Is it possible to manage bluetooth configuration from BTF? Such as disabling Discoverable and Connectable. Surely we want our network to be secured.




Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2491
  • Karma: 1000
    • Wireless Communication Library
Re: WidComm produces weird TBFBluetoothDevice.Name
« Reply #5 on: January 07, 2007, 03:03:12 PM »
Good time of the day!

1. Welcome! :)
2. Already 50% done. :)
3. The better way is Delux license. Because using VCL in Delphi is better then ActiveX in Delphi. And ActiveX you can use in other laguages. Delux license includes both (VCL and ActiveX) and full source codes for it (VCL and ActiveX).
4. Yes. In 5.0 it will be. Unfortunatelly, not all BTstack make it pisiible. That is why I am not inlude this functions in current and previouse versions. But if you need it then I include. It is not difficult.
WCL - Wireless Communication Library
TextBlue - Bluetooth Proximity Marketing Software
WCL Phone Explorer - Free Phone Content Manager

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2491
  • Karma: 1000
    • Wireless Communication Library
Re: WidComm produces weird TBFBluetoothDevice.Name
« Reply #6 on: January 08, 2007, 01:09:21 AM »
Methods for enabling/desabling discoverable and connactable mods implemented.
WCL - Wireless Communication Library
TextBlue - Bluetooth Proximity Marketing Software
WCL Phone Explorer - Free Phone Content Manager