locked
Bluetooth connectivity? RRS feed

  • Question

  • Hi there.

    In .NET 2.0 (and also 1.1) is there a way I can transfer/recieve files via bluetooth?

    I guess we could open the serial port for COM7/8? (the bluetooth COM?) in .NET 2.0 but how would we do this in .NET 1.1?

    As well as this, How would I be able to transfer/recieve a file?

    I have done things like this (transferring) using serialization and so on but I am wondering if we, I assume we do, use the network stream to get the bytes of a file we wish to transfer?

    Once we send the bytes of the file - I guess we can close the connection to pretty much indicate the client that the file has been finished transferring (of course not great practice as there could be communication errors so if we close the connection prematurely the client would assume the file has been completed in transferring but at this time im not worried).

     

    I think I may have code somewhere to transfer/get the bytes of a file and transmit it but I am wondering if this approach will be suitable for .NET CF? The devices to transfer data to and from will be between 2 smartphones, of WM2003SE or WM5.

    Any input on this would be greatly appreciated on how to:

    open the bluetooth connection

    let the recepient accept the connection

    transfer file

     

    Thank-you :)

    Tuesday, May 23, 2006 9:45 PM

Answers

  • Hi,

    CF 2.0 supports the managed SerialPort class that you may use to transmit a file over Bluetooth virtual serial ports (you would need to create a virtual serial port with your bluetooth manager prior to opening the port). There is no such support in CF 1.0 but you may consider using OpenNETCF that has an implementation of serial port classes:

    http://www.opennetcf.org/library/OpenNETCF.IO.Serial.html

    OpenNETCF also provides managed Socket based APIs over Bluetooth.

    Regarding the actual mechanism used to transfer the file, I think the transfer will probably consists of read/write of arrays of bytes that you read from the file with FileStream. You may serialize and send the size of the file at the beginning of the transfer, or close the connection to indicate the end of the file, as long as your application is handling both sides of the transfer. If not, you would need to investigate and modify your application to accommodate the application on the other side. I think there are file transfer profiles (GOEP, FTP) in Bluetooth that may be of interest to you.

    Cheers,

    Anthony Wong [MSFT]

    Wednesday, May 24, 2006 11:24 PM

All replies

  • Hi,

    CF 2.0 supports the managed SerialPort class that you may use to transmit a file over Bluetooth virtual serial ports (you would need to create a virtual serial port with your bluetooth manager prior to opening the port). There is no such support in CF 1.0 but you may consider using OpenNETCF that has an implementation of serial port classes:

    http://www.opennetcf.org/library/OpenNETCF.IO.Serial.html

    OpenNETCF also provides managed Socket based APIs over Bluetooth.

    Regarding the actual mechanism used to transfer the file, I think the transfer will probably consists of read/write of arrays of bytes that you read from the file with FileStream. You may serialize and send the size of the file at the beginning of the transfer, or close the connection to indicate the end of the file, as long as your application is handling both sides of the transfer. If not, you would need to investigate and modify your application to accommodate the application on the other side. I think there are file transfer profiles (GOEP, FTP) in Bluetooth that may be of interest to you.

    Cheers,

    Anthony Wong [MSFT]

    Wednesday, May 24, 2006 11:24 PM
  • Many thanks - this is great! Once again, a solution for MS is always there!

     

    Thursday, May 25, 2006 1:31 AM