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) ); }
// Wraps GetLocalName() to provide a Python method interface. // Takes no arguments. // // Returns the local device name as a unicode python string. static PyObject* LightBlue_GetLocalName(PyObject* self, PyObject* args) { TBTDeviceName deviceName; if (!PyArg_ParseTuple(args, "")) return NULL; TInt err = GetLocalName(deviceName); if (err) return SPyErr_SetFromSymbianOSErr(err); return Py_BuildValue("u#", deviceName.Ptr(), deviceName.Length()); }
// --------------------------------------------------------- // CBTUiDeviceContainer::CreateListItemL // --------------------------------------------------------- void CBTUiDeviceContainer::CreateListItemL(const TBTDevice& aDevice, TBTDeviceName& aListItem) { TRACE_FUNC_ENTRY aListItem.Zero(); // may not needed TInt iconIndex = (TInt)(aDevice.iType); switch( iconIndex) { case EDeviceComputer: if(( aDevice.iStatus & EStatusBtuiConnected) == EStatusBtuiConnected) { aListItem.Append(DEV_TYPE_COMPUTER_CONNECT); } else { aListItem.Append(DEV_TYPE_COMPUTER); } break; case EDevicePhone: aListItem.Append(DEV_TYPE_PHONE); break; case EDeviceAudio: if(( aDevice.iStatus & EStatusBtuiConnected) == EStatusBtuiConnected) { aListItem.Append(DEV_TYPE_AUDIO_CONNECT); } else { aListItem.Append(DEV_TYPE_AUDIO); } break ; case EDeviceCarkit: if(( aDevice.iStatus & EStatusBtuiConnected) == EStatusBtuiConnected) { aListItem.Append(DEV_TYPE_CARKIT_CONNECT); } else { aListItem.Append(DEV_TYPE_CARKIT); } break ; case EDevicePrinter: aListItem.Append(DEV_TYPE_PRINTER); break; case EDeviceKeyboard: if(( aDevice.iStatus & EStatusBtuiConnected) == EStatusBtuiConnected) { aListItem.Append(DEV_TYPE_KEYBOARD_CONNECT); } else { aListItem.Append(DEV_TYPE_KEYBOARD); } break ; case EDeviceMice: if(( aDevice.iStatus & EStatusBtuiConnected) == EStatusBtuiConnected) { aListItem.Append(DEV_TYPE_MOUSE_CONNECT); } else { aListItem.Append(DEV_TYPE_MOUSE); } break; case EDeviceDefault: aListItem.Append(DEV_TYPE_DEFAULT); break; default: aListItem.Append('\t'); break; } aListItem.Append(aDevice.iName); if((aDevice.iStatus & EStatusTrusted) == EStatusTrusted && iGroup ==EGroupPaired ) { aListItem.Append(DEV_STATUS_AUTHORIZED); } else { aListItem.Append( DEV_STATUS_NORMAL ); } TRACE_FUNC_EXIT }