Ver código fonte

Z991239-5930 #comment 增加摄像头亮度获取和设置接口

80274480 8 meses atrás
pai
commit
9a99a58888

+ 98 - 0
Module/mod_mediacontroller/MediaController_client_g.h

@@ -548,6 +548,104 @@ public:
 		return Error;
 	}
 
+	ErrorCodeEnum GetCameraBrightness(MediaService_GetCameraBrightness_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	{
+		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
+		CAutoBuffer Buf = SpObject2Buffer(Req);
+		if (m_context.checkEmpty())
+		{
+			m_context.AutoGenerate();
+			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
+			m_context = m_context.upgradeLink();
+		}
+		auto ret = pFunc->AsyncRequest(MediaService_Method_GetCameraBrightness, MediaService_MethodSignature_GetCameraBrightness, Buf, spAsyncWait, m_context, dwTimeout);
+		m_context.clear();
+		return ret;
+	}
+	ErrorCodeEnum GetCameraBrightness(MediaService_GetCameraBrightness_Req &Req, MediaService_GetCameraBrightness_Ans &Ans, DWORD dwTimeout)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = GetCameraBrightness(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+	ErrorCodeEnum GetCameraBrightness(MediaService_GetCameraBrightness_Req &Req, MediaService_GetCameraBrightness_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = GetCameraBrightness(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+	ErrorCodeEnum GetCameraBrightness(MediaService_GetCameraBrightness_Req &Req, MediaService_GetCameraBrightness_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = GetCameraBrightness(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			CSimpleString str;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+
+	ErrorCodeEnum SetCameraBrightness(MediaService_SetCameraBrightness_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	{
+		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
+		CAutoBuffer Buf = SpObject2Buffer(Req);
+		if (m_context.checkEmpty())
+		{
+			m_context.AutoGenerate();
+			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
+			m_context = m_context.upgradeLink();
+		}
+		auto ret = pFunc->AsyncRequest(MediaService_Method_SetCameraBrightness, MediaService_MethodSignature_SetCameraBrightness, Buf, spAsyncWait, m_context, dwTimeout);
+		m_context.clear();
+		return ret;
+	}
+	ErrorCodeEnum SetCameraBrightness(MediaService_SetCameraBrightness_Req &Req, MediaService_SetCameraBrightness_Ans &Ans, DWORD dwTimeout)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = SetCameraBrightness(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+	ErrorCodeEnum SetCameraBrightness(MediaService_SetCameraBrightness_Req &Req, MediaService_SetCameraBrightness_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = SetCameraBrightness(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+	ErrorCodeEnum SetCameraBrightness(MediaService_SetCameraBrightness_Req &Req, MediaService_SetCameraBrightness_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = SetCameraBrightness(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			CSimpleString str;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+
 
 	bool SafeDelete()
 	{

+ 57 - 1
Module/mod_mediacontroller/MediaController_def_g.h

@@ -11,6 +11,7 @@ namespace MediaController {
 //
 // const goes here
 //
+
 #define MediaService_Method_GetAudioDevices 8
 #define MediaService_Method_GetVideoDevices 9
 #define MediaService_Method_GetCameraInfos 10
@@ -21,6 +22,8 @@ namespace MediaController {
 #define MediaService_Method_TurnOnCamera 15
 #define MediaService_Method_TurnOffCamera 16
 #define MediaService_Method_IsCameraOnStatus 17
+#define MediaService_Method_GetCameraBrightness 18
+#define MediaService_Method_SetCameraBrightness 19
 
 #define MediaService_MethodSignature_GetAudioDevices -819377328
 #define MediaService_MethodSignature_GetVideoDevices 616397805
@@ -32,7 +35,8 @@ namespace MediaController {
 #define MediaService_MethodSignature_TurnOnCamera -1801492539
 #define MediaService_MethodSignature_TurnOffCamera -1380301309
 #define MediaService_MethodSignature_IsCameraOnStatus -491616205
-
+#define MediaService_MethodSignature_GetCameraBrightness 129842938
+#define MediaService_MethodSignature_SetCameraBrightness 1186334350
 
 #define MediaService_LogCode_GetAudioDevices "QLR040220808"
 #define MediaService_LogCode_GetVideoDevices "QLR040220809"
@@ -44,6 +48,8 @@ namespace MediaController {
 #define MediaService_LogCode_TurnOnCamera "QLR040220815"
 #define MediaService_LogCode_TurnOffCamera "QLR040220816"
 #define MediaService_LogCode_IsCameraOnStatus "QLR040220817"
+#define MediaService_LogCode_GetCameraBrightness "QLR040220818"
+#define MediaService_LogCode_SetCameraBrightness "QLR040220819"
 
 struct MediaService_GetAudioDevices_Req
 {
@@ -218,9 +224,11 @@ struct MediaService_TurnOnCamera_Req
 
 struct MediaService_TurnOnCamera_Ans
 {
+	int result;
 
 	void Serialize(SpBuffer &Buf)
 	{
+		auto & buf = Buf & result;
 	}
 
 };
@@ -236,9 +244,11 @@ struct MediaService_TurnOffCamera_Req
 
 struct MediaService_TurnOffCamera_Ans
 {
+	int result;
 
 	void Serialize(SpBuffer &Buf)
 	{
+		auto & buf = Buf & result;
 	}
 
 };
@@ -263,6 +273,52 @@ struct MediaService_IsCameraOnStatus_Ans
 
 };
 
+struct MediaService_GetCameraBrightness_Req
+{
+	int icameraid;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & icameraid;
+	}
+
+};
+
+struct MediaService_GetCameraBrightness_Ans
+{
+	int ibrightness;
+	int result;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & ibrightness & result;
+	}
+
+};
+
+struct MediaService_SetCameraBrightness_Req
+{
+	int icameraid;
+	int ibrightness;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & icameraid & ibrightness;
+	}
+
+};
+
+struct MediaService_SetCameraBrightness_Ans
+{
+	int result;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & result;
+	}
+
+};
+
 
 ///////////////////////////
 

+ 54 - 0
Module/mod_mediacontroller/MediaController_server_g.h

@@ -100,6 +100,20 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
+		case MediaService_Method_GetCameraBrightness:
+			if (dwSignature == MediaService_MethodSignature_GetCameraBrightness) {
+				bOverlap = true;
+			} else {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
+		case MediaService_Method_SetCameraBrightness:
+			if (dwSignature == MediaService_MethodSignature_SetCameraBrightness) {
+				bOverlap = true;
+			} else {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
 		default:
 			Error = Error_MethodNotFound;
 			break;
@@ -161,6 +175,16 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
+		case MediaService_Method_GetCameraBrightness:
+			if (dwSignature != MediaService_MethodSignature_GetCameraBrightness) {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
+		case MediaService_Method_SetCameraBrightness:
+			if (dwSignature != MediaService_MethodSignature_SetCameraBrightness) {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
 		default:
 			Error = Error_MethodNotFound;
 			break;
@@ -218,6 +242,16 @@ public:
 	/// override by user
 	}
 
+	virtual void Handle_GetCameraBrightness(SpReqAnsContext<MediaService_GetCameraBrightness_Req, MediaService_GetCameraBrightness_Ans>::Pointer ctx)
+	{
+	/// override by user
+	}
+
+	virtual void Handle_SetCameraBrightness(SpReqAnsContext<MediaService_SetCameraBrightness_Req, MediaService_SetCameraBrightness_Ans>::Pointer ctx)
+	{
+	/// override by user
+	}
+
 	virtual void OnRequest(CSmartPointer<ITransactionContext> pTransactionContext)
 	{
 		CAutoBuffer Buf;
@@ -334,6 +368,26 @@ public:
 						Handle_IsCameraOnStatus(ctx);
 					}
 					break;
+				case MediaService_Method_GetCameraBrightness:
+					{
+						SpReqAnsContext<MediaService_GetCameraBrightness_Req,MediaService_GetCameraBrightness_Ans>::Pointer ctx;
+						ctx.Attach(new SpReqAnsContext<MediaService_GetCameraBrightness_Req,MediaService_GetCameraBrightness_Ans>(pTransactionContext));
+						SpBuffer2Object(Buf, ctx->Req);
+						pTransactionContext->GetLinkContext(ctx->link);
+						EntityResource::setLink(ctx->link);
+						Handle_GetCameraBrightness(ctx);
+					}
+					break;
+				case MediaService_Method_SetCameraBrightness:
+					{
+						SpReqAnsContext<MediaService_SetCameraBrightness_Req,MediaService_SetCameraBrightness_Ans>::Pointer ctx;
+						ctx.Attach(new SpReqAnsContext<MediaService_SetCameraBrightness_Req,MediaService_SetCameraBrightness_Ans>(pTransactionContext));
+						SpBuffer2Object(Buf, ctx->Req);
+						pTransactionContext->GetLinkContext(ctx->link);
+						EntityResource::setLink(ctx->link);
+						Handle_SetCameraBrightness(ctx);
+					}
+					break;
 				default:
 					assert(0);
 					break;

+ 24 - 0
Module/mod_mediacontroller/MediaService.xml

@@ -71,10 +71,16 @@
       <req>
         <param name="bPostCapInfo" type="bool"/>
       </req>
+      <res>
+        <param name="result" type="int"/>
+      </res>
     </twoway>
     <twoway name="TurnOffCamera" overlap="true" method_id="16">
       <req>
       </req>
+      <res>
+        <param name="result" type="int"/>
+      </res>
     </twoway>
     <twoway name="IsCameraOnStatus" overlap="true" method_id="17">
       <req>
@@ -82,6 +88,24 @@
       <res>
         <param name="biscameraon" type="bool"/>
       </res>
+    </twoway>
+    <twoway name="GetCameraBrightness" overlap="true" method_id="18">
+      <req>
+        <param name="icameraid" type="int"/>
+      </req>
+      <res>
+        <param name="ibrightness" type="int"/>
+        <param name="result" type="int"/>
+      </res>
+    </twoway>
+    <twoway name="SetCameraBrightness" overlap="true" method_id="19">
+      <req>
+        <param name="icameraid" type="int"/>
+        <param name="ibrightness" type="int"/>
+      </req>
+      <res>
+        <param name="result" type="int"/>
+      </res>
     </twoway>
 	</class>
   <!-- ÉÏÉãÏñÍ·Îȶ¨ÐÔÊý¾Ý -->

+ 37 - 2
Module/mod_mediacontroller/mod_mediacontroller.cpp

@@ -2200,6 +2200,16 @@ bool CMediaControllerEntity::GetPostCapInfoFlag()
 #endif
 #endif
 
+void CMediaControllerEntity::GetCameraBrightness(SpReqAnsContext<MediaService_GetCameraBrightness_Req, MediaService_GetCameraBrightness_Ans>::Pointer ctx)
+{
+
+}
+
+void CMediaControllerEntity::SetCameraBrightness(SpReqAnsContext<MediaService_SetCameraBrightness_Req, MediaService_SetCameraBrightness_Ans>::Pointer ctx)
+{
+
+}
+
 ChannelMediaControllerClient::ChannelMediaControllerClient( CMediaControllerEntity *pEntity ) : ChannelService_ClientBase(pEntity)
 {
 
@@ -2363,6 +2373,17 @@ void MediaServiceSession::Handle_IsCameraOnStatus(SpReqAnsContext<MediaService_I
 	ctx->Answer(Error_Succeed);
 }
 
+void MediaServiceSession::Handle_GetCameraBrightness(SpReqAnsContext<MediaService_GetCameraBrightness_Req, MediaService_GetCameraBrightness_Ans>::Pointer ctx)
+{
+	DbgToBeidou(ctx->link, __FUNCTION__)();
+	m_pEntity->GetCameraBrightness(ctx);
+}
+
+void MediaServiceSession::Handle_SetCameraBrightness(SpReqAnsContext<MediaService_SetCameraBrightness_Req, MediaService_SetCameraBrightness_Ans>::Pointer ctx)
+{
+
+}
+
 void MediaServiceSession::Handle_GetEnvCameraVideoCaptureInfo(SpReqAnsContext<MediaService_GetEnvCameraVideoCaptureInfo_Req, MediaService_GetEnvCameraVideoCaptureInfo_Ans>::Pointer ctx)
 {
 	DbgToBeidou(ctx->link, __FUNCTION__)();
@@ -2435,7 +2456,14 @@ void MediaServiceSession::Handle_TurnOnCamera(SpReqAnsContext<MediaService_TurnO
 #endif
 #endif
 
-	ctx->Answer(Error);
+	if (Error_Succeed == Error) {
+		ctx->Ans.result = 0;
+	}
+	else {
+		ctx->Ans.result = -1;
+	}
+
+	ctx->Answer(Error_Succeed);
 }
 
 void MediaServiceSession::Handle_TurnOffCamera(SpReqAnsContext<MediaService_TurnOffCamera_Req, MediaService_TurnOffCamera_Ans>::Pointer ctx)
@@ -2451,9 +2479,16 @@ void MediaServiceSession::Handle_TurnOffCamera(SpReqAnsContext<MediaService_Turn
 	}
 #endif
 #endif
+
 	ErrorCodeEnum CamRet = m_pEntity->StopAllCameras();
+	if (Error_Succeed == CamRet) {
+		ctx->Ans.result = 0;
+	}
+	else {
+		ctx->Ans.result = -1;
+	}
 
-	ctx->Answer(CamRet);
+	ctx->Answer(Error_Succeed);
 }
 
 SP_BEGIN_ENTITY_MAP()

+ 4 - 1
Module/mod_mediacontroller/mod_mediacontroller.h

@@ -54,7 +54,8 @@ public:
 	virtual void Handle_TurnOnCamera(SpReqAnsContext<MediaService_TurnOnCamera_Req, MediaService_TurnOnCamera_Ans>::Pointer ctx);
 	virtual void Handle_TurnOffCamera(SpReqAnsContext<MediaService_TurnOffCamera_Req, MediaService_TurnOffCamera_Ans>::Pointer ctx);
 	virtual void Handle_IsCameraOnStatus(SpReqAnsContext<MediaService_IsCameraOnStatus_Req, MediaService_IsCameraOnStatus_Ans>::Pointer ctx);
-
+	virtual void Handle_GetCameraBrightness(SpReqAnsContext<MediaService_GetCameraBrightness_Req, MediaService_GetCameraBrightness_Ans>::Pointer ctx);
+	virtual void Handle_SetCameraBrightness(SpReqAnsContext<MediaService_SetCameraBrightness_Req, MediaService_SetCameraBrightness_Ans>::Pointer ctx);
 private:
 	CMediaControllerEntity *m_pEntity;
 };
@@ -139,6 +140,8 @@ public:
 #endif
 
 	void SetCameraStateInfo(ErrorCodeEnum errorcode);
+	void GetCameraBrightness(SpReqAnsContext<MediaService_GetCameraBrightness_Req, MediaService_GetCameraBrightness_Ans>::Pointer ctx);
+	void SetCameraBrightness(SpReqAnsContext<MediaService_SetCameraBrightness_Req, MediaService_SetCameraBrightness_Ans>::Pointer ctx);
 
 public:
 	DeviceTypeEnum m_eDeviceType;