.NET Components for Mobility

problem witch seding message to phone

Last post 06-25-2009 6:11 AM by alanjmcf. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 06-04-2009 8:12 AM

    • gregor
    • Top 500 Contributor
    • Joined on 06-01-2009
    • Posts 5

    problem witch seding message to phone

    Hello have a problem witch sendig message to phone i have a Bluetooth connecteed to usbs port in PC i connect to Bluetooth in mi phone to this evrithin work but if i wont somtink send to the phone nohink hepen. Below i write the code.thenks for eny help. try { bc = new BluetoothClient(); bc.Connect(new BluetoothEndPoint((BluetoothAddress)cmbDevices.SelectedValue, service, 2)); System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); Byte[ msg = encoding.GetBytes("12345"); NetworkStream str = bc.GetStream(); str.Write(msg, 0, msg.Length); bc.Close(); } catch { } soryy but id ont now how post the code
  • 06-04-2009 11:12 AM In reply to

    Re: problem witch seding message to phone

    Which service do you want to use on the phone?  OPP to push a file to it, FTP to get a file from it, or perhaps SPP to connect to its modem?  See e.g. http://www.alanjmcf.me.uk/comms/bluetooth/Bluetooth Profiles and 32feet.NET.html

    What service did you use in the Connect call??  What error (i.e. exception) occurred?

    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.
  • 06-04-2009 12:31 PM In reply to

    • gregor
    • Top 500 Contributor
    • Joined on 06-01-2009
    • Posts 5

    Re: problem witch seding message to phone

    I would like to send be Bluetooth in me PC a file to me phone a service to connect PC witch phone i use private Guid service = BluetoothService.SerialPort;
  • 06-08-2009 5:40 AM In reply to

    Re: problem witch seding message to phone

    You can't send a file to the SerialPort (SPP) service; it is likely expecting AT command.  Use class ObexWebRequest to send files to the OPP service.
    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.
  • 06-23-2009 6:09 AM In reply to

    • gregor
    • Top 500 Contributor
    • Joined on 06-01-2009
    • Posts 5

    Re: problem witch seding message to phone

     Hello i have done what you propose and i have get a exeption when i have run bellow code :

     

    ObexClientSession sessionFileSending = new ObexClientSession(service1, 65535);

    sessionFileSending.Connect();  - here i have get a error

     

    {"Unexpected OBEX response code: 0x80 (128)."} What is wrong the lenght of buffor 65635 or somethink else

     

    gretings gregor

  • 06-23-2009 9:35 AM In reply to

    Re: problem witch seding message to phone

    0x80 is a seriously odd result code.  How did you create "service1"?  If you used BluetoothClient, what BluetoothService did you use?  ObexObjectPush?
    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.
  • 06-23-2009 9:59 AM In reply to

    • gregor
    • Top 500 Contributor
    • Joined on 06-01-2009
    • Posts 5

    Re: problem witch seding message to phone

    TheBluetoothService  i use serialport and  ObexObjectPush bot was thi same exetion the pad to create the service1 is

     

    Guid service = BluetoothService.SerialPort;

    bc = new BluetoothClient();
    BluetoothEndPoint serverEP = new BluetoothEndPoint((BluetoothAddress)adres, service, 2);
    bc.Connect(serverEP);


    NetworkStream service1;
    if (bc.Connected)
    {

    service1 = bc.GetStream();
    ObexClientSession sessionFileSending = new ObexClientSession(service1, 65535);
    sessionFileSending.Connect();

    }

     thanks for help gregor

  • 06-24-2009 3:56 AM In reply to

    • gregor
    • Top 500 Contributor
    • Joined on 06-01-2009
    • Posts 5

    Re: problem witch seding message to phone

     hello i have found the problem a use a port number 2 inessesery in

     

    BluetoothEndPoint serverEP = new BluetoothEndPoint((BluetoothAddress)adres, service, 2);

     

    witch out dis port work perfecly thanks for all help

     

    gretings gregor

  • 06-25-2009 6:11 AM In reply to

    Re: problem witch seding message to phone

    Glad to hear you solved it!  Yup, using ports is almost always unnecessary in Bluetooth.

    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 (9 items)
Copyright © 2001-2010 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy.