Hi,

When I create a RFCOMM server the channel is automatically set by the system. I'd like to choose it myself, but for now I can't manage to do it !

I have this exception raised :

Bluetooth Server Running Error: javax.bluetooth.ServiceRegistrationException: wrong protocol description list attribue

Here is a block of code I have used to try changing the channel :

ServiceRecord sr = localDevice.getRecord(notifier);
DataElement protocolDescriptorList = sr.getAttributeValue(0x0004);
Enumeration protocolDescriptorListElems = (Enumeration)protocolDescriptorList.getValue();

DataElement newProtocolDescriptorList = new DataElement (DataElement.DATSEQ);
DataElement newRFCOMM = new DataElement (DataElement.DATSEQ);

DataElement deL2CAP = (DataElement)protocolDescriptorListElems.nextElement();
newProtocolDescriptorList.addElement(deL2CAP);

DataElement deRFCOMM = (DataElement)protocolDescriptorListElems.nextElement();
Enumeration deRFCOMMElems = (Enumeration)deRFCOMM.getValue();
DataElement deRFCOMMUUID = (DataElement)deRFCOMMElems.nextElement();
DataElement deRFCOMMChannel = (DataElement)deRFCOMMElems.nextElement();
DataElement deRFCOMMChannelNew = new DataElement(DataElement.U_INT_1, 14); // I try to change to channel 14
newRFCOMM.addElement(deRFCOMMUUID);
newRFCOMM.addElement(deRFCOMMChannelNew);
// here if I do newRFCOMM.addElement(deRFCOMMChannel); everything works fine

newProtocolDescriptorList.addElement(newRFCOMM);
sr.setAttributeValue(0x0004, newProtocolDescriptorList);

Thanks a lot to anybody would have an idea !!!
Oli