Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



How to implement Ioctl requests

The following code fragment shows how a discovery indication Ioctl would be implemented. This request would be queued on the secondary station prior to an attempted secondary connection. That way, the client would be able to indicate, in an appropriate fashion, when it has been discovered by a remote primary device.

...
//
// .. do an RSocketServ::NumProtocols() and RocketServ::FindProtocol()
//
RSocket sock1;
ret=sock1.Open(ss,pInfo.iAddrFamily,pInfo.iSockType,pInfo.iProtocol);
if (ret==KErrNone)
   {
   // Successfully opened socket 1
   }
else
    {
   // Failed to open socket
    }

//
// IOCTL DISCOVERY INDICATION
//
TRequestStatus status1;
TNameEntry log;
sock1.Ioctl(KDiscoveryIndicationIoctl,status1,&log,pInfo.iAddrFamily);
User::WaitForRequest(status1); // status1 should be KErrNone

TIrdaSockAddr addr(log().iAddr); // Takes a TSockAddr

// Remote machine dev addr: addr.GetRemoteDevAddr()
// Host machine dev addr: addr.GetHostDevAddr()
// Remote machine solicited: addr.GetSolicitedStatus()
// Remote machine sniff status: addr.GetSniffStatus()
// Remote machine Irlap version: addr.GetIrlapVersion()
// Remote no. of service hint bytes:addr.GetServiceHintByteCount()
// Remote first service hint byte: addr.GetFirstServiceHintByte()
// Remote machine character set: addr.GetCharacterSet()
// Remote machine name: log().iName