Author Topic: OBEX Response code to J2ME client  (Read 8243 times)

craigTheBrit

  • Guest
OBEX Response code to J2ME client
« 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

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: OBEX Response code to J2ME client
« Reply #1 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

craigTheBrit

  • Guest
Re: OBEX Response code to J2ME client
« Reply #2 on: May 04, 2009, 11:06:32 AM »
I Appreciate it Mike. I switched to the ObjectPushServer and my troubles evaporated!

 

Sitemap 1 2 3 4 5 6 7