| Reply | « Previous Thread | Next Thread » |
|
Dear all,
i send a String "Hallo" to the Bluetooth Device(BlueSerial-Laptop) the string is comming on. The Devie ist answered but i don't know how i can receive the Strings from my Bluetooth Device(BlueSerial-Laptop) i send the String with the follwing Code. Can me someone help how i can receive the answer from Bluetooth Device(BlueSerial-Laptop) . I have try whith the Read() and Receive() functions from RSocket but it was nothing. Thanks for Your help. void CBT1AppUi::Init() { RSocketServ iSocketServer; RSocket iSendingSocket; iSocketServer.Connect(); TProtocolDesc pInfo; TBool BTFound; TInt KRfcommChannel; KRfcommChannel = 1; User::LeaveIfError(iSocketServer.FindProtocol(_L("BTLinkManager"),pInfo)); RHostResolver hr; User::LeaveIfError(hr.Open(iSocketServer,pInfo.iAddrFamily,pInfo.iProtocol)); TInquirySockAddr addr; TNameEntry entry; addr.SetIAC(KGIAC); addr.SetAction(KHostResInquiry|KHostResName); TRequestStatus status; hr.GetByAddress(addr, entry, status); User::WaitForRequest(status); if (status == KErrNone) { BTFound = EFalse; if ( entry().iName.Match( _L("BlueSerial-Laptop") ) != KErrNotFound) //Senden an BT device mit namen MyHandy { BTFound = ETrue; }else{ while (hr.Next(entry) != KErrHostResNoMoreResults) { if ( entry().iName.Match( _L("BlueSerial-Laptop") ) != KErrNotFound) { BTFound = ETrue; break; } } } if(BTFound) { TBTSockAddr iBTSockAddr( entry().iAddr); hr.Close(); User::LeaveIfError(iSendingSocket. Open(iSocketServer,KBTAddrFamily,KSockStream,KRFCOMM)); iBTSockAddr.SetBTAddr(iBTSockAddr.BTAddr()); iBTSockAddr.SetPort(KRfcommChannel); TRequestStatus istatus; iSendingSocket.Connect(iBTSockAddr,istatus); User::WaitForRequest(istatus); if (istatus== KErrNone) { // Write some simple data _LIT8(Init,"Hallo");// Send Init iSendingSocket.Write(tgt,istatus); User::WaitForRequest(istatus); iAppContainer->Send(); } }else{ // MyHandy is Off! hr.Close(); } }else{ // no bluetoth device hr.Close(); } } |
| Waldemar_Arndt |
| View Public Profile |
| Find all posts by Waldemar_Arndt |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|