Author Topic: Complete Newbie needs help on sending files to Mobile phone  (Read 7056 times)

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2491
  • Karma: 1000
    • Wireless Communication Library
Re: Complete Newbie needs help on sending files to Mobile phone
« Reply #15 on: January 29, 2008, 06:32:37 PM »
Razr V3 is a strange device which works exactly different. :) I don't know yet the better way to send file to the Motorola V3 without pairing.

Regarding the code

var
  Radios: TBFBluetoothRadios;
begin
  BFAuthenticator1.Open;
  Devices := BFBluetoothDiscovery1.Discovery(Nil, False, False);
  AFileName := 'C:\Users\Lee\Pictures\kwikdata.gif';

  // Good idea to check is radio available.
  Radios := BFBluetoothDiscovery1.EnumRadios;

  if Assigned(Devices) then begin
    for Loop := 0 to Devices.Count - 1 do
        with BFObjectPushClient1 do begin
          BluetoothTransport.Radio := Radios[0]; // Here I think the radio always exists.
                                                                 // Also check - may be you have more then one radio founded so use Radios[1] if will not work
                                                                 // with radios[0]
          BluetoothTransport.Address := Devices[Loop].Address;

          try
            Open;
            try
              Put(AFileName); // Send file
            except
              on E : Exception do
                ShowMessage('File Send Failed'+#13+E.ClassName+' error raised, with message : '+E.Message);
            end;
            Close;
          except
            on E : Exception do
              ShowMessage('Open Falied'+#13+E.ClassName+' error raised, with message : '+E.Message);
          end;
        end;

    Devices.Free;
  end;
  BFAuthenticator1.Close;
  Close;
end;
WCL - Wireless Communication Library
TextBlue - Bluetooth Proximity Marketing Software
WCL Phone Explorer - Free Phone Content Manager

Offline leekey

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Complete Newbie needs help on sending files to Mobile phone
« Reply #16 on: January 29, 2008, 06:45:55 PM »
Mike,

sorry to be the bearer of bad news, the code that you gave me works fine for the motorola v3 but that always has worked fine, the samsung E900 still comes up with the error code 10022 regardless weather the phone is paired or not with th computer.

If I use this code though

Code: [Select]
  BFAuthenticator1.Open;
  with BFObjectPushClient1 do begin
    OpenDevice;
    if Active then begin
      try
        Put('C:\Users\Lee\Pictures\ryanair.jpg');
      finally
        Close;
      end;
    end;
  end;
  BFAuthenticator1.Close;

If the samsung is not paired the samsung will ask for the PIN number if I enter in the default that I have set in the code of '0000' it pairs and then sends the file. Again with this code above if the samsung is aready paired then it will send the file no problem.

I really could do with doing the above automatically so it does not ask for me to select which phone to send the file to.

Thanks

Lee

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2491
  • Karma: 1000
    • Wireless Communication Library
Re: Complete Newbie needs help on sending files to Mobile phone
« Reply #17 on: January 29, 2008, 06:52:14 PM »
Aha!

Did you write OnPINRequest handler for the TBFAuthenticator? Also try change BluetoothTransport.Authentication property to True for the Samsung cell.
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: Complete Newbie needs help on sending files to Mobile phone
« Reply #18 on: January 29, 2008, 06:55:09 PM »
May be the better way to solve the problem ASAP is to contact me online by MSN or ICQ? :) Contacts are here: http://www.btframework.com/contacts.htm
WCL - Wireless Communication Library
TextBlue - Bluetooth Proximity Marketing Software
WCL Phone Explorer - Free Phone Content Manager

Offline leekey

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Complete Newbie needs help on sending files to Mobile phone
« Reply #19 on: January 29, 2008, 07:01:30 PM »
Mike,

Yes I have a handler for the OnPINRequest and regardless if the phone is paired before or not I still get the 10022 error code with the following code

Code: [Select]
procedure TForm1.BFAuthenticator1PINRequest(Sender: TObject;
  DeviceAddress: String; var PIN: String);
begin
  PIN := '0000';
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  Radios: TBFBluetoothRadios;
  Devices: TBFBluetoothDevices;
  Loop: Integer;
  AFileName: String;

begin
  BFAuthenticator1.Open;

  Devices := BFBluetoothDiscovery1.Discovery(Nil, False, False);
  AFileName := 'C:\Users\Lee\Pictures\kwikdata.gif';

  // Good idea to check is radio available.
  Radios := BFBluetoothDiscovery1.EnumRadios;

  if Assigned(Devices) then begin
    for Loop := 0 to Devices.Count - 1 do
        with BFObjectPushClient1 do begin
          BluetoothTransport.Radio := Radios[0]; // Here I think the radio always exists.
          BluetoothTransport.Authentication := True;
          BluetoothTransport.Address := Devices[Loop].Address;

          try
            Open;
            try
              Put(AFileName); // Send file
            except
              on E : Exception do
                ShowMessage('File Send Failed'+#13+E.ClassName+' error raised, with message : '+E.Message);
            end;
            Close;
          except
            on E : Exception do
              ShowMessage('Open Falied'+#13+E.ClassName+' error raised, with message : '+E.Message);
          end;
        end;

    Devices.Free;
  end;
  BFAuthenticator1.Close;
  Close;
end;

But Like I say using the BFObjectPushClient1.OpenDevice; and manually connecting to the Samsung it works fine. !!

I'm afraid I got to go home now as my day has finished. I'll be back on tomorrow morning im in the UK by the way at about 8am onwards, I hope we can pick this up then.

Thanks again for your help

Lee

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2491
  • Karma: 1000
    • Wireless Communication Library
Re: Complete Newbie needs help on sending files to Mobile phone
« Reply #20 on: January 29, 2008, 07:07:47 PM »
It's interesting problem. I have one Samsung here and will test it tonight. I think you have found very interesting bug in the BTF :)
WCL - Wireless Communication Library
TextBlue - Bluetooth Proximity Marketing Software
WCL Phone Explorer - Free Phone Content Manager

Offline leekey

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Complete Newbie needs help on sending files to Mobile phone
« Reply #21 on: January 30, 2008, 10:10:30 AM »
Hi Mike,

I have made an interesting discovery regarding this problem with the samsung E900 phone.  If you run the application either inside or outside of the IDE I seem to get this 10022 error code when trying to do the "BFObjectPushClient1.Open".

If I run it through the IDE and create a breakpoint before the "BFObjectPushClient1.Open" and step through the code, when it gets to the "BFObjectPushClient1.Open" it takes a second or so and hey presto it connects, (well the samsung asks for a pin number). If I enter the pin of "0000" which I have set as in the "BFAuthenticator1 onpinrequest" it all works but i must tep through the code to get it to work.

I hope this helps in tracking down the problem.

Cheers

Lee

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2491
  • Karma: 1000
    • Wireless Communication Library
Re: Complete Newbie needs help on sending files to Mobile phone
« Reply #22 on: January 30, 2008, 12:05:24 PM »
Good day!

Try to add Sleep(500) before Open command. May be stack is busy when you tryed to connect or may be phone is busy with previouse discovery.
WCL - Wireless Communication Library
TextBlue - Bluetooth Proximity Marketing Software
WCL Phone Explorer - Free Phone Content Manager

Offline leekey

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Complete Newbie needs help on sending files to Mobile phone
« Reply #23 on: January 30, 2008, 12:09:17 PM »
Mike,

Thanks thats worked a treat, now one last question if you don't mind!!

Is there anyway to avoid the receiving mobile phone having to enter in the PIN as the receipeant is not going to know what the pin is? or is this specific to certain mobile phones as I dont have this problem with the motorola v3 that I have here just my samsung.

by the way I hope you don't mind I have added you to MSN.

Thanks again,

Lee

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2491
  • Karma: 1000
    • Wireless Communication Library
Re: Complete Newbie needs help on sending files to Mobile phone
« Reply #24 on: January 30, 2008, 12:30:13 PM »
The PIN request hard depends on the phoen model. I know that it can be setted for Samsung and for Motorola in the phone's menu. All other phones do not require PIN for ObjectPush. For the phones above (Samsung and Motorol) it can be disabled in menu. Unfortunatelly, there is no way to avoid this PIN request and no way to know what is the PIN. Also, old Razr V3 (first models) has firmware bug when it does not accept file by the ObjectPush profile, only by the FileTransfer. But it happens only with old V3 models which have old firmware version.

Sure, feel free to contact me online.
WCL - Wireless Communication Library
TextBlue - Bluetooth Proximity Marketing Software
WCL Phone Explorer - Free Phone Content Manager