Welcome, Guest. Please login or register.

Login with username, password and session length
May 19, 2012, 07:12:57 PM
Pages: [1]
  Print  
Topic: asking for example code RFComm bluetooth client server  (Read 2770 times)
« on: June 20, 2008, 02:47:57 AM »
Arch_Cancer
Newbie

View Profile
*
Karma: +0/-0
Posts: 2



hello there, i almost give up on finding a way to connect a client application using widcomm sdk on pc to server application using jsr82 j2me on mobile ph0ne ...

anybody can give me an example code for connecting both of them ...

if u can, or have some advice for me please give me that valueable thing...

my recent not working application :
- server deployed on mobile phone using jsr82 j2me
- client on pc using widcomm sdk visual c++ .net

or may be u can correct and give me advice for my code bellow...

Server (JSR82) :
Quote
private static final UUID APP_UUID = new UUID("F0E0D0C0B0A000908070605040302010", false);
private static final String URL = "btspp://localhost:"+APP_UUID+";name=My App;authorize=false";
private static final String APP_ID = "My App";
private static final int ATTR_ID = 0x1234;

try {
localDevice = LocalDevice.getLocalDevice();
localDevice.setDiscoverable(DiscoveryAgent.GIAC);
notifier = (StreamConnectionNotifier)Connector.open(URL);

DataElement base = new DataElement(DataElement.STRING, APP_ID);
record = localDevice.getRecord(notifier);
record.setAttributeValue(ATTR_ID, base);

connection = notifier.acceptAndOpen();
}
catch(Exception e) {
System.err.println(e.getMessage());
}

Client (Widcomm SDK) :
Quote
StartDiscovery(m_BdAddr, m_pServiceGuid)

CSdpDiscoveryRec Sdp_Record;

if ( ReadDiscoveryRecords(m_BdAddr, 1, &Sdp_Record, m_pServiceGuid) )
{
UINT8 scn;
SDP_DISC_ATTTR_VAL *pVal;

if ( Sdp_Record.FindRFCommScn(&scn) )
//if(Sdp_Record.FindAttribute(0x1234, pVal))

I can't find an RFComm channel number from server (the j2me one)

regards, Arch_Cancer

// sorry my bad english

« Last Edit: June 20, 2008, 02:50:18 AM by Arch_Cancer » Logged
 
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC