📄 propertycontainer.cpp
字号:
}
break;
case ESensrvIntProperty:
{
TInt intMax(0),intMin(0);
propChannelPropertyList[pos].GetMaxValue(intMax);
propChannelPropertyList[pos].GetMinValue(intMin);
TInt ScNumber(0);
propChannelPropertyList[pos].GetValue(ScNumber);
CAknNumberQueryDialog* Dialog = CAknNumberQueryDialog::NewL(ScNumber,CAknQueryDialog::ENoTone);
Dialog->PrepareLC(R_SC_DIALOG);
Dialog->SetPromptL(_L("New value"));
Dialog->SetMinimumAndMaximum(intMin,intMax);
if(Dialog->RunLD())
{
TSensrvProperty property;
iSensrvSensorChannel->GetPropertyL(propChannelPropertyList[pos].GetPropertyId(),propChannelPropertyList[pos].PropertyItemIndex(), property );
property.SetValue(ScNumber);
iSensrvSensorChannel->SetProperty( property );
MakeListBoxL();
}
}
break;
case ESensrvRealProperty:
{
TReal realMax(0),realMin(0);
propChannelPropertyList[pos].GetMaxValue(realMax);
propChannelPropertyList[pos].GetMinValue(realMin);
TReal ScNumber(0);
propChannelPropertyList[pos].GetValue(ScNumber);
CAknFloatingPointQueryDialog* Dialog = CAknFloatingPointQueryDialog::NewL(ScNumber,CAknQueryDialog::ENoTone);
Dialog->PrepareLC(R_REAL_DIALOG);
Dialog->SetPromptL(_L("New value"));
Dialog->SetMinimumAndMaximum(realMin,realMax);
if(Dialog->RunLD())
{
TSensrvProperty property;
iSensrvSensorChannel->GetPropertyL(propChannelPropertyList[pos].GetPropertyId(),propChannelPropertyList[pos].PropertyItemIndex(), property );
property.SetValue(ScNumber);
iSensrvSensorChannel->SetProperty( property );
MakeListBoxL();
}
}
break;
case ESensrvBufferProperty:
{
TBuf8<150> bufVal;
propChannelPropertyList[pos].GetValue(bufVal);
hjelpper.Copy(bufVal);
CAknTextQueryDialog* Dialog = CAknTextQueryDialog::NewL(hjelpper,CAknQueryDialog::ENoTone);
Dialog->PrepareLC(R_ASK_NAME_DIALOG);
Dialog->SetPromptL(_L("New value"));
if(Dialog->RunLD())
{
bufVal.Copy(hjelpper);
TSensrvProperty property;
iSensrvSensorChannel->GetPropertyL(propChannelPropertyList[pos].GetPropertyId(),propChannelPropertyList[pos].PropertyItemIndex(), property );
property.SetValue(bufVal);
iSensrvSensorChannel->SetProperty( property );
MakeListBoxL();
}
}
break;
}
}
}
propChannelPropertyList.Reset();
}
}
/*
-----------------------------------------------------------------------------
----------------------------------------------------------------------------
*/
void CProppertyContainer::ShowInfoL(void)
{
if(iSensrvSensorChannel && iMyListBox)
{
TInt pos(iMyListBox->CurrentItemIndex());
TBuf<400> hjelpper;
RSensrvPropertyList propChannelPropertyList;
iSensrvSensorChannel->GetAllPropertiesL(propChannelPropertyList);
if(pos >= 0 && pos < propChannelPropertyList.Count())
{
hjelpper.Append(_L("Item index = "));
hjelpper.AppendNum(propChannelPropertyList[pos].PropertyItemIndex());
if(propChannelPropertyList[pos].ReadOnly())
{
hjelpper.Append(_L("\nRead Only"));
}
switch(propChannelPropertyList[pos].PropertyType())
{
case ESensrvUninitializedProperty:
{
hjelpper.Append(_L("\nType: Uninitialized"));
}
break;
case ESensrvIntProperty:
{
TInt intMax(0),intMin(0);
hjelpper.Append(_L("\nType: Int"));
propChannelPropertyList[pos].GetMaxValue(intMax);
propChannelPropertyList[pos].GetMinValue(intMin);
hjelpper.Append(_L("\n-Max = "));
hjelpper.AppendNum(intMax);
hjelpper.Append(_L("\n-Min = "));
hjelpper.AppendNum(intMin);
}
break;
case ESensrvRealProperty:
{
hjelpper.Append(_L("\nType: Real"));
TReal realMax(0),realMin(0);
propChannelPropertyList[pos].GetMaxValue(realMax);
propChannelPropertyList[pos].GetMinValue(realMin);
hjelpper.Append(_L("\n-Max = "));
hjelpper.AppendNum((TInt)realMax);
hjelpper.Append(_L("\n-Min = "));
hjelpper.AppendNum((TInt)realMin);
}
break;
case ESensrvBufferProperty:
{
hjelpper.Append(_L("\nType: Buffer"));
}
break;
}
hjelpper.Append(_L("\nSecurity:"));
hjelpper.Append(_L("\n-SecureId = "));
hjelpper.AppendNum(propChannelPropertyList[pos].GetSecurityInfo().iSecureId,EHex);
hjelpper.Append(_L("\n-VendorId = "));
hjelpper.AppendNum(propChannelPropertyList[pos].GetSecurityInfo().iVendorId,EHex);
hjelpper.Append(_L("\nCapabilities: "));
if(propChannelPropertyList[pos].GetSecurityInfo().iCaps.HasCapability(ECapabilityTCB))
{
hjelpper.Append(_L("\n-TCB"));
}
if(propChannelPropertyList[pos].GetSecurityInfo().iCaps.HasCapability(ECapabilityCommDD))
{
hjelpper.Append(_L("\n-CommDD"));
}
if(propChannelPropertyList[pos].GetSecurityInfo().iCaps.HasCapability(ECapabilityPowerMgmt))
{
hjelpper.Append(_L("\n-PowerMgmt"));
}
if(propChannelPropertyList[pos].GetSecurityInfo().iCaps.HasCapability(ECapabilityMultimediaDD))
{
hjelpper.Append(_L("\n-MultimediaDD"));
}
if(propChannelPropertyList[pos].GetSecurityInfo().iCaps.HasCapability(ECapabilityReadDeviceData))
{
hjelpper.Append(_L("\n-ReadDeviceData"));
}
if(propChannelPropertyList[pos].GetSecurityInfo().iCaps.HasCapability(ECapabilityWriteDeviceData))
{
hjelpper.Append(_L("\n-WriteDeviceData"));
}
if(propChannelPropertyList[pos].GetSecurityInfo().iCaps.HasCapability(ECapabilityDRM))
{
hjelpper.Append(_L("\n-DRM"));
}
if(propChannelPropertyList[pos].GetSecurityInfo().iCaps.HasCapability(ECapabilityTrustedUI))
{
hjelpper.Append(_L("\n-TrustedUI"));
}
if(propChannelPropertyList[pos].GetSecurityInfo().iCaps.HasCapability(ECapabilityProtServ))
{
hjelpper.Append(_L("\n-ProtServ"));
}
if(propChannelPropertyList[pos].GetSecurityInfo().iCaps.HasCapability(ECapabilityDiskAdmin))
{
hjelpper.Append(_L("\n-DiskAdmin"));
}
if(propChannelPropertyList[pos].GetSecurityInfo().iCaps.HasCapability(ECapabilityNetworkControl))
{
hjelpper.Append(_L("\n-NetworkControl"));
}
if(propChannelPropertyList[pos].GetSecurityInfo().iCaps.HasCapability(ECapabilityAllFiles))
{
hjelpper.Append(_L("\n-AllFiles"));
}
if(propChannelPropertyList[pos].GetSecurityInfo().iCaps.HasCapability(ECapabilitySwEvent))
{
hjelpper.Append(_L("\n-SwEvent"));
}
if(propChannelPropertyList[pos].GetSecurityInfo().iCaps.HasCapability(ECapabilityNetworkServices))
{
hjelpper.Append(_L("\n-NetworkServices"));
}
if(propChannelPropertyList[pos].GetSecurityInfo().iCaps.HasCapability(ECapabilityLocalServices))
{
hjelpper.Append(_L("\n-LocalServices"));
}
if(propChannelPropertyList[pos].GetSecurityInfo().iCaps.HasCapability(ECapabilityReadUserData))
{
hjelpper.Append(_L("\n-ReadUserData"));
}
if(propChannelPropertyList[pos].GetSecurityInfo().iCaps.HasCapability(ECapabilityWriteUserData))
{
hjelpper.Append(_L("\n-WriteUserData"));
}
if(propChannelPropertyList[pos].GetSecurityInfo().iCaps.HasCapability(ECapabilityLocation))
{
hjelpper.Append(_L("\n-Location"));
}
if(propChannelPropertyList[pos].GetSecurityInfo().iCaps.HasCapability(ECapabilitySurroundingsDD))
{
hjelpper.Append(_L("\n-SurroundingsDD"));
}
if(propChannelPropertyList[pos].GetSecurityInfo().iCaps.HasCapability(ECapabilityUserEnvironment))
{
hjelpper.Append(_L("\n-UserEnvironment"));
}
STATIC_CAST(CTestAppUi*,CEikonEnv::Static()->EikAppUi())->ShowDialogL(hjelpper,_L("Info"));
}
propChannelPropertyList.Reset();
}
}
/*
-----------------------------------------------------------------------------
----------------------------------------------------------------------------
*/
void CProppertyContainer::UpdateScrollBar(CEikListBox* aListBox)
{
if (aListBox)
{
TInt pos(aListBox->View()->CurrentItemIndex());
if (aListBox->ScrollBarFrame())
{
aListBox->ScrollBarFrame()->MoveVertThumbTo(pos);
}
}
}
/*
-----------------------------------------------------------------------------
----------------------------------------------------------------------------
*/
void CProppertyContainer::Draw(const TRect& /*aRect*/) const
{
CWindowGc& gc = SystemGc();
gc.Clear(Rect());
}
/*
-----------------------------------------------------------------------------
----------------------------------------------------------------------------
*/
TKeyResponse CProppertyContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aEventCode)
{
TKeyResponse Ret = EKeyWasNotConsumed;
if(iMyListBox)
{
Ret = iMyListBox->OfferKeyEventL(aKeyEvent,aEventCode);
}
return Ret;
}
/*
-----------------------------------------------------------------------------
----------------------------------------------------------------------------
*/
CCoeControl* CProppertyContainer::ComponentControl( TInt /*aIndex*/) const
{
return iMyListBox;
}
/*
-----------------------------------------------------------------------------
----------------------------------------------------------------------------
*/
TInt CProppertyContainer::CountComponentControls() const
{
if(iMyListBox)
return 1;
else
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -