void QBtSingleDeviceSelectorUIPrivate::BTDeviceSelectedL()
{
	//Do something when BT device is selected
	//e.g. get details of the device the user selected    
  
	TBTDeviceResponseParams response = _finder->ResponseParams();  
	TBTDevAddr deviceAddress = response.BDAddr();
	TBTDeviceName deviceName = response.DeviceName();
	TBTDeviceClass deviceClass = response.DeviceClass();
	
	
	// on to qt types
	QBtAddress address (deviceAddress);
	
	// name
	QString name = QString::fromUtf16 (deviceName.Ptr(), deviceName.Length());
	
	// major device class
	QBtDevice::DeviceMajor majorClass;
	
	switch (deviceClass.MajorDeviceClass() )
	{
		case 0x00: //computer
			majorClass = QBtDevice::Miscellaneous;
			break;	     
		case 0x01:
			majorClass = QBtDevice::Computer;
			break;	
		case 0x02:
			majorClass = QBtDevice::Phone;
			break;
		case 0x03:
			majorClass = QBtDevice::LANAccess;
			break;   	
		case 0x04:
			majorClass = QBtDevice::AudioVideo;
			break;         	
		case 0x05:
			majorClass = QBtDevice::Peripheral;
			break;     
		case 0x06:
			majorClass = QBtDevice::Imaging;
			break;   
		default:
			majorClass = QBtDevice::Uncategorized;
			break;
	}
	
	// create device
	QBtDevice remoteDevice (name, address, majorClass);
	
	// if this throws, generate a leave as this is symbian code
	QT_TRYCATCH_LEAVING (emit _publicClass->discoveryCompleted (remoteDevice) );
		
}
Exemplo n.º 2
0
void CDeviceFinder::RunL()
{
    switch(iState)
    {
        case EDiscover:
        {
            TBTDeviceResponseParams resp = iResParams();                        
            iConnected = EFalse;
            iNotifier.CancelNotifier(KDeviceSelectionNotifierUid);
            iNotifier.Close();
        
            if(resp.IsValidBDAddr())
            {
                iObserver.DeviceSelected(resp.BDAddr());
            }
        }break;
            
        default:
            break;
    }
}