Wireless Communication Library Support Forum

Frameworks => Bluetooth Framework => Topic started by: craigTheBrit on May 04, 2009, 08:08:28 AM

Title: OBEX Response code to J2ME client
Post by: craigTheBrit on May 04, 2009, 08:08:28 AM
Hello,

   I've implemented a J2ME client on a mobile phone that connects to a Java-based server on the PC in order to exchange information. I'd like to use your library to implement that server in Delphi, but I'm having a problem.

I'm using a TBFServer (I understand that the new WCL implementation is incomplete with regards to servers?) with a given service name and UUID, in combination with a TBFSerialEventsClient. The client makes an attempt to connect, which the BFServer detects. In the OnConnect event, I'd like to return the correct response code to the phone: OBEX_HTTP_OK (160, or $0A0), using the BFSerialEventsClient object. The present situation is that the J2ME app tries to connect but doesn't receive any response code from the server, so hangs. I want to send that code and then the phone will send the server some data, which I can receive using the BFSerialEventsClient's Read procedure. Is this the correct way to do it?

In short: what is the server code corresponding to this J2ME client code?

Code: [Select]
clientSession = (ClientSession) Connector.open(url, Connector.READ_WRITE, true);
...
HeaderSet hsConnectReply = clientSession.connect( clientSession.createHeaderSet() );         
...
if (hsConnectReply.getResponseCode() == ResponseCodes.OBEX_HTTP_OK) {
...

I appreciate your time!

Craig
Title: Re: OBEX Response code to J2ME client
Post by: Mike Petrichenko on May 04, 2009, 09:15:51 AM
Hi,

How can client send the code if phone is connected to the server? You should send the answer from server component, not from client.

Regarding WCL: http://www.btframework.com/compare.htm, http://www.btframework.com/download.htm
Title: Re: OBEX Response code to J2ME client
Post by: craigTheBrit on May 04, 2009, 11:06:32 AM
I Appreciate it Mike. I switched to the ObjectPushServer and my troubles evaporated!