public class send implements Runnable { private String filename ; private byte[] file; private String btconnectionurl; public send(String filename, byte[] file, String btconnectionurl) { this.filename = filename; this.file = file; this.btconnectionurl = "btgoep://"+btconnectionurl + ":9"; } public void run() { //com.intel.bluetooth.BlueCoveImpl.setConfigProperty("bluecove.connect.timeout", "5000"); // com.intel.bluetooth.BlueCoveImpl.setConfigProperty("bluecove.obex.timeout", "3000"); com.intel.bluetooth.BlueCoveImpl.setConfigProperty("bluecove.obex.mtu", "3840"); try{ Connection Con = (Connection) Connector.open(btconnectionurl,javax.microedition.io.Connector.READ_WRITE,true); ClientSession clientsession = (ClientSession) Con ;//nector.open(btconnectionurl,javax.microedition.io.Connector.READ_WRITE,true); HeaderSet header = clientsession.createHeaderSet(); header.setHeader(HeaderSet.NAME, filename); header.setHeader(HeaderSet.TYPE, "text"); header.setHeader(HeaderSet.LENGTH, new Long(file.length)); clientsession.connect(header); Operation putOperation = clientsession.put(header); OutputStream outputStream = putOperation.openOutputStream(); outputStream.write(file); outputStream.close(); putOperation.close(); clientsession.disconnect(null); } catch (Exception ex) { Logger.getLogger(send.class.getName()).log(Level.SEVERE, null, ex); } } }com.intel.bluetooth.BlueCoveImpl.setConfigProperty("bluecove.connect.timeout", "5000"); // com.intel.bluetooth.BlueCoveImpl.setConfigProperty("bluecove.obex.timeout", "3000"); com.intel.bluetooth.BlueCoveImpl.setConfigProperty("bluecove.obex.mtu", "3840"); try{ Connection Con = (Connection) Connector.open(btconnectionurl,javax.microedition.io.Connector.READ_WRITE,true); ClientSession clientsession = (ClientSession) Con ;//nector.open(btconnectionurl,javax.microedition.io.Connector.READ_WRITE,true); HeaderSet header = clientsession.createHeaderSet(); ////this area need fliping header.setHeader(HeaderSet.NAME, filename); header.setHeader(HeaderSet.TYPE, "text"); header.setHeader(HeaderSet.LENGTH, new Long(file.length)); clientsession.connect(header); Operation putOperation = clientsession.put(header); OutputStream outputStream = putOperation.openOutputStream(); outputStream.write(file); outputStream.close(); putOperation.close(); clientsession.disconnect(null); } catch (Exception ex) { Logger.getLogger(send.class.getName()).log(Level.SEVERE, null, ex); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)