Hi All,
Is it possible to transfer files from PC to Mobile(BT faciliated Mobile) vice versa without using Bluetooth Dongles/adapter?
Is it possible through Programming?
Is any programming needed, While using Bluetooth adapter?
Thanks
Banupriya
Hi All,
Is it possible to transfer files from PC to Mobile(BT faciliated Mobile) vice versa without using Bluetooth Dongles/adapter?
Is it possible through Programming?
Is any programming needed, While using Bluetooth adapter?
Thanks
Banupriya
hi,
if u want to send file b/w two devices they should ve bluetooth enabled.
A pc may ve bluetooth usb adapter or some other bluetooth device.
And every bluetooth device has some profiles(services) like file transfer,obex(object exchange) etc..
so u need not write any code for sending the files.the manufacturers ll provide those with driver.
--shiva
I have seen some Programming in some site for Client-server model.
Then can any one temme Why this program is for?
/* FTclient.jar */
package phone;
/*original imports */
import java.io.*;
import java.util.*;
import javax.microedition.io.*;
/* switch of J2se netbeans dev kit */
import javax.bluetooth.*;
// import javax.obex.*;
/* add the de.aventna obex */
import de.avetana.bluetooth.obex.OBEXConnection;
import de.avetana.bluetooth.obex.HeaderSetImpl;
import de.avetana.bluetooth.obex.CommandHandler;
import de.avetana.bluetooth.obex.MD5;
import de.avetana.bluetooth.obex.OperationImpl;
import de.avetana.bluetooth.obex.SessionNotifierImpl;
import de.avetana.javax.obex.Authenticator;
import de.avetana.javax.obex.ClientSession;
import de.avetana.javax.obex.HeaderSet;
import de.avetana.javax.obex.Operation;
import de.avetana.javax.obex.PasswordAuthentication;
import de.avetana.javax.obex.ResponseCodes;
import de.avetana.javax.obex.ServerRequestHandler;
import de.avetana.javax.obex.ServiceRegistrationException;
import de.avetana.javax.obex.SessionNotifier;
public class FTClient implements DiscoveryListener {
LocalDevice local = null;
DiscoveryAgent agent = null;
int[] attrSet = null;
RemoteDevice btDev = null;
String serviceURL = null;
ClientSession con = null;
HeaderSet hdr = null;
public FTClient() throws BluetoothStateException{
// initialize the stack, if needed
local = LocalDevice.getLocalDevice();
agent = local.getDiscoveryAgent();
agent.startInquiry(DiscoveryAgent.GIAC, this);
}
public void deviceDiscovered(RemoteDevice btDevice,DeviceClass cod){
btDev = btDevice;
System.out.println("Device discovered " +
btDevice.getBluetoothAddress());
}
public void servicesDiscovered(int transID, ServiceRecord[] servRecord){
System.out.println("Discovered a service ....");
for(int i =0; i < servRecord.length; i++){
serviceURL =
servRecord[i].getConnectionURL(ServiceRecord.NOAUTHENTICATE_NOENCRYPT,
true);
System.out.println("The service URL is " + serviceURL);
}
}
public void serviceSearchCompleted(int transID, int respCode){
System.out.println("Service search completed ........... ");
System.out.println("Opening a connection with the server ....");
try{
con = (ClientSession)Connector.open(serviceURL);
hdr = con.connect(hdr);
System.out.println("Response code of the server after connect..." +
hdr.getResponseCode());
//Sending a request to server for file Hello.txt
hdr = con.createHeaderSet();
hdr.setHeader(HeaderSet.TYPE,"text/vCard");
hdr.setHeader(HeaderSet.NAME,"Hello.txt");
Operation op = con.get(hdr);
//The server is now sending the file
InputStream in = op.openInputStream();
// Writing the file from server to local file system.
StreamConnection filestream =
(StreamConnection)Connector.open("file://name=HelloFile.txt;mode=w");
OutputStream out = filestream.openOutputStream();
//read and write the data
int data = in.read();
while(data != -1){
out.write((byte)data);
data = in.read();
}
// send the DISCONNECT Operation
//con.disconnect();
// cleanup
op.close();
in.close();
out.close();
}
catch(IOException e){
System.out.println(e.getMessage());
}
}
public void inquiryCompleted(int discType){
System.out.println("Inquiry completed ... ");
UUID[] uuids = new UUID[1];
uuids[0] = new UUID("1106",true);
try{
if(btDev == null){
System.out.println("No device has been discovered, " +
"hence not worth proceeding exiting .... ");
System.exit(1);
}
System.out.println("Now searching for services ........ ");
agent.searchServices(attrSet, uuids, btDev, this);
}
catch(BluetoothStateException e) {System.out.println(e.getMessage());}
}
public static void main(String args[]) throws IOException {
FTClient client = new FTClient();
}
}
Can anyone provide the same code in C++ using serial port communication.because socket programming i already tried .please help me. I want the programm for windows platform
Hi Banupriya
i have seen your post in 2007. Have you found the solution. I need codes for the same problem
please Help
ragesh
ragesh, could you ask your question in more detail? Which programming language and device do you want to use?