Hello,
I have a mobile phone and I can connect to it using bluetooth and browse its directorys using brecham.obex
However, when I connect mobile phone to my computer using usb and try to connect to it, I receivethis: Unexpected OBEX response code: 0x00 (0).
Brecham.Obex.ObexResponseException was unhandled
Message="Unexpected OBEX response code: 0x00 (0)."
Source="Brecham.Obex"
StackTrace:
at Brecham.Obex.ObexClientSession.CheckResponseCode(ObexResponseCode responseCode, ObexHeaderCollection headers, ObexResponseCode expected, ObexResponseCode[ acceptableExpected)
at Brecham.Obex.ObexClientSession.WriteOneReadOneResponseIs(ObexCreatedPdu writePdu, Boolean isResponseToConnect, ObexResponseCode expected, ObexResponseCode[ acceptableExpected)
at Brecham.Obex.ObexClientSession.WriteOneReadOneConnectResponseIs(ObexCreatedPdu writePdu, ObexResponseCode expected, ObexResponseCode[ acceptableExpected)
at Brecham.Obex.ObexClientSession.Connect(ObexHeaderCollection headers)
at Brecham.Obex.ObexClientSession.Connect(Byte[ target)
Here is my code:
port = new SerialPort("COM4");
port.Open();
Stream bs = port.BaseStream;
session = new ObexClientSession(bs, UInt16.MaxValue);
session.Connect(ObexConstant.Target.FolderBrowsing); //This throws exception.
COM4 description is: Sony Ericsson Device 116 USB WMC Data Modem
I have tried it with COM6 (Sony Ericsson Device 116 USB WMC OBEX Interface
but I'm getting IOException: System.IO.IOException: A device attached to the system is not functioning.
at System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)
at System.IO.Ports.SerialStream.EndWrite(IAsyncResult asyncResult)
at System.IO.Ports.SerialStream.Write(Byte[ array, Int32 offset, Int32 count, Int32 timeout)
at System.IO.Ports.SerialStream.Write(Byte[ array, Int32 offset, Int32 count)
at Brecham.Obex.ObexClientSession.write(ObexCreatedPdu pdu)
at Brecham.Obex.ObexClientSession.WriteOneReadOne(ObexCreatedPdu writePdu, Byte[& buffer, Int32& pduLength)
at Brecham.Obex.ObexClientSession.WriteOneReadOneResponseIs(ObexCreatedPdu writePdu, Boolean isResponseToConnect, ObexResponseCode expected, ObexResponseCode[ acceptableExpected)
at Brecham.Obex.ObexClientSession.WriteOneReadOneConnectResponseIs(ObexCreatedPdu writePdu, ObexResponseCode expected, ObexResponseCode[ acceptableExpected)
at Brecham.Obex.ObexClientSession.Connect(ObexHeaderCollection headers)
at Brecham.Obex.ObexClientSession.Connect(Byte[ target)
Any ideas?
Thanks