Hi,
I´m new on QT and Symbian.
I have to set up a rfcomm server to make my phone avaiable to other bluetooth devices (in this case, a pinpad).
I have already turned on the bluetooth, acquired a sign developer and all QTMobility options are working fine.
But when I try to connect the pinpad, it just don´t work.
I´m using this UUID: "00001101-0000-1000-8000-00805f9b34fb".
I don´t know which channel i have to use. The method (rfcommserver->serverPort()) returns 4. That´s ok?
I´m missing something? Someone can help me?
here is my code:
Code:void bluetooth::startServer() { QString deviceName; QBluetoothLocalDevice localDevice; if (rfcommServer) return; localDevice.powerOn(); localDevice.setHostMode(QBluetoothLocalDevice::HostDiscoverable); deviceName = localDevice.name(); rfcommServer = new QRfcommServer(this); connect(rfcommServer, SIGNAL(newConnection()), this, SLOT(vConectou())); if( rfcommServer->listen() ) { emit vShowMsg("Listening"); } else { emit vShowMsg("Error"); return; } serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceRecordHandle, (uint)0x00010010); QBluetoothServiceInfo::Sequence classId; classId << QVariant::fromValue(QBluetoothUuid(serviceUuid)); serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceClassIds, classId); serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceName, tr("Serial Port")); serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceDescription, tr("COM Port")); serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceProvider, deviceName ); serviceInfo.setServiceUuid(QBluetoothUuid(serviceUuid)); serviceInfo.setAttribute(QBluetoothServiceInfo::BrowseGroupList, QBluetoothUuid(QBluetoothUuid::PublicBrowseGroup)); QBluetoothServiceInfo::Sequence protocolDescriptorList; QBluetoothServiceInfo::Sequence protocol; protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::L2cap)); protocolDescriptorList.append(QVariant::fromValue(protocol)); protocol.clear(); protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::Rfcomm)) << QVariant::fromValue(rfcommServer->serverPort()); protocolDescriptorList.append(QVariant::fromValue(protocol)); serviceInfo.setAttribute(QBluetoothServiceInfo::ProtocolDescriptorList, protocolDescriptorList); if( serviceInfo.registerService() ) { emit vShowMsg("Waiting for connections..."); } else { emit vShowMsg("Error to create the service"); } }

Reply With Quote


