Hi,
I am trying to transfer the image using obex profile so select uuid = 0x1105 & attribute = int[]{0x0001, 0x0003, 0x0008, 0x000C, 0x0100, 0x000F, 0x1101, 0x1000, 0x1001, 0x1002, 0x1115, 0x1116, 0x1117};, on selecting the target device able to get url = ”btgoep://002109D7F9D:9;authenticate=false;encrypt=false;master=true”
But on opening the bt connection it throw Javax.bluetooth.BluetoothConnectionException: Symbain error = -5
….
public void run() {
InputStream inputStream = null;
byte[] data=null;
StringBuffer str = new StringBuffer();
try {
int i = 0;
inputStream = getClass().getResourceAsStream("/icon.png");
while ((i = inputStream.read()) != -1) {
str.append((char) i);
}
data = str.toString().getBytes();
Connection conn = Connector.open(btURL); //throw exception here
ClientSession clientSession = (ClientSession)conn;
HeaderSet header = clientSession.createHeaderSet();
header.setHeader(HeaderSet.NAME,"test.png");
header.setHeader(HeaderSet.TYPE,"image/png");
header.setHeader(HeaderSet.LENGTH,new Long(data.length));
HeaderSet headerset = clientSession.connect(header);
Operation operation = clientSession.put(header);
OutputStream outStream = operation.openDataOutputStream();
outStream.write(data);
outStream.close();
operation.close();
clientSession.disconnect(null);
conn.close();
} catch (Exception ex) {
ex.printStackTrace();
append(" Exception ::=>" + ex + " clientSession ::=>");
display.setCurrent(this);
}
}
….

Reply With Quote

