kernel/eka/include/d32camerasc.inl
changeset 31 56f325a607ea
parent 0 a41df078684a
child 258 880ff05ad710
equal deleted inserted replaced
15:4122176ea935 31:56f325a607ea
    47 			}
    47 			}
    48 
    48 
    49 		TAny* capsBufPtr = User::Alloc(iCapsSize);
    49 		TAny* capsBufPtr = User::Alloc(iCapsSize);
    50 		if(NULL == capsBufPtr)
    50 		if(NULL == capsBufPtr)
    51 			{
    51 			{
    52 			iCapsSize = 0;
    52 			Close();
    53 			return KErrNoMemory;
    53 			return KErrNoMemory;
    54 			}
    54 			}
    55 
    55 
    56 		TPtr8 capsPtr((TUint8*)capsBufPtr, iCapsSize, iCapsSize);
    56 		TPtr8 capsPtr((TUint8*)capsBufPtr, iCapsSize, iCapsSize);
    57 		// Fill the Capability structure
    57 		// Fill the Capability structure
   155 inline TInt RDevCameraSc::FrameSizeCaps(TDevCamCaptureMode aCaptureMode, TUidPixelFormat aUidPixelFormat, TDes8& aFrameSizeCapsBuf)
   155 inline TInt RDevCameraSc::FrameSizeCaps(TDevCamCaptureMode aCaptureMode, TUidPixelFormat aUidPixelFormat, TDes8& aFrameSizeCapsBuf)
   156 	{
   156 	{
   157 	SFrameSizeCapsInfo info = {aUidPixelFormat, aCaptureMode};
   157 	SFrameSizeCapsInfo info = {aUidPixelFormat, aCaptureMode};
   158 	return(DoControl(EControlFrameSizeCaps, (TAny*)&aFrameSizeCapsBuf, &info));
   158 	return(DoControl(EControlFrameSizeCaps, (TAny*)&aFrameSizeCapsBuf, &info));
   159 	}
   159 	}
       
   160 
       
   161 //
       
   162 //
       
   163 //
       
   164 inline TInt RDevCameraSc::CheckAttributeSupported(TDevCamDynamicAttribute aAttribute)
       
   165 	{
       
   166 	TUint mask = 0;
   160 	
   167 	
   161 inline TInt RDevCameraSc::SetDynamicAttribute(TDevCamDynamicAttributes aAttribute, TUint aValue)
   168 	switch (aAttribute)
   162 	{
   169 		{
   163 	TInt r = KErrNone;
   170 		case ECamAttributeBrightness:
       
   171 			mask = KCamMiscBrightness;
       
   172 			break;
       
   173 			
       
   174 		case ECamAttributeContrast:
       
   175 			mask = KCamMiscContrast;
       
   176 			break;
       
   177 			
       
   178 		case ECamAttributeColorEffect:
       
   179 			mask = KCamMiscColorEffect;
       
   180 			break;
       
   181 			
       
   182 		default:
       
   183 			return KErrNotSupported;
       
   184 		}
   164 	
   185 	
   165 	// Are we not supported?
   186 	// Check that the attribute is supported by the hardware.
   166 	TInt misc = 0;
   187 	return (iCameraCaps->iCapsMisc & mask ? KErrNone : KErrNotSupported);
   167 	switch (aAttribute)
   188 	}
   168 		{
   189 	
   169 		case ECamAttributeBrightness:
   190 //
   170 			{
   191 //
   171 			misc = KCamMiscBrightness;
   192 //
   172 			break;
   193 inline TInt RDevCameraSc::SetDynamicAttribute(TDevCamDynamicAttribute aAttribute, TUint aValue)
   173 			}
   194 	{
   174 		case ECamAttributeContrast:
   195 	TInt err = CheckAttributeSupported(aAttribute);
   175 			{
   196 	if (err == KErrNone)
   176 			misc = KCamMiscContrast;
   197 		{
   177 			break;
   198 		err = KErrArgument;
   178 			}
       
   179 		case ECamAttributeColorEffect:
       
   180 			{
       
   181 			misc = KCamMiscColorEffect;
       
   182 			break;
       
   183 			}
       
   184 		default:
       
   185 			{
       
   186 			r = KErrBadName;
       
   187 			}
       
   188 		}
       
   189 
       
   190 	if (KErrNone != r)
       
   191 		{
       
   192 		return r;
       
   193 		}
       
   194 
       
   195 	if (!(iCameraCaps->iCapsMisc & misc))
       
   196 		{
       
   197 		r = KErrNotSupported;
       
   198 		}
       
   199 
       
   200 	else
       
   201 		{
       
   202 		TDynamicRange &range = iCameraCaps->iDynamicRange[aAttribute];
   199 		TDynamicRange &range = iCameraCaps->iDynamicRange[aAttribute];
   203 		// Not within range?
   200 		if ((aValue >= range.iMin) && (aValue <= range.iMax))
   204 		if (aValue < range.iMin || aValue > range.iMax)
   201 			{
   205 			{
   202 			err = DoControl(EControlSetDynamicAttribute, (TAny*)aAttribute, (TAny*)aValue);
   206 			r = KErrArgument;
   203 			}
   207 			}
   204 		}
   208 		else
   205 
   209 			{
   206 	return err;
   210 			r = DoControl(EControlSetDynamicAttribute,(TAny*)aAttribute, (TAny*)aValue);
   207 	}
   211 			}
   208 
   212 		}
   209 //
   213 
   210 //
   214 	return r;
   211 //
   215 	}
   212 inline TInt RDevCameraSc::GetDynamicAttribute(TDevCamDynamicAttribute aAttribute, TUint& aValue)
   216 
   213 	{
       
   214 	TInt err = CheckAttributeSupported(aAttribute);
       
   215 	if (err == KErrNone)
       
   216 		{
       
   217 		err = DoControl(EControlGetDynamicAttribute, (TAny*)aAttribute, (TAny*)&aValue);
       
   218 		}
       
   219 		
       
   220 	return err;
       
   221 	}
   217 #endif	// __KERNEL_MODE__
   222 #endif	// __KERNEL_MODE__