|
@@ -187,6 +187,11 @@ void CCameraConfigManageEntity::OnPreStart(
|
|
|
void CCameraConfigManageEntity::OnStarted()
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
+ if (0 == mlibAudioMgr->audio_mgr_initialize()) {
|
|
|
+ Dbg("Audio Manager Initialize success!");
|
|
|
+ } else {
|
|
|
+ Dbg("Audio Manager Initialize failed!");
|
|
|
+ }
|
|
|
RefreshCameras();
|
|
|
}
|
|
|
|
|
@@ -1151,6 +1156,82 @@ bool CCameraConfigManageEntity::AutoCorrectCameraByOnlyOne(camera_names_t &corre
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+void CCameraConfigManageEntity::GetMediaAvailableList(
|
|
|
+ SpReqAnsContext<CameraConfigManageService_GetMediaAvailableList_Req,
|
|
|
+ CameraConfigManageService_GetMediaAvailableList_Ans>::Pointer ctx)
|
|
|
+{
|
|
|
+ int count = 0;
|
|
|
+ const int maxCnt = 15;
|
|
|
+
|
|
|
+ CAutoArray<CSimpleStringA> cameras;
|
|
|
+ int icountmic(0);
|
|
|
+ int icountspeaker(0);
|
|
|
+
|
|
|
+ if (ctx->Req.type == 0 || (ctx->Req.type & 1)) {
|
|
|
+ capture_enum_cameras(cameras);
|
|
|
+ count += cameras.GetCount();
|
|
|
+ }
|
|
|
+ if (ctx->Req.type == 0 || (ctx->Req.type & 2)) {
|
|
|
+ icountmic = mlibAudioMgr->audio_get_device_count(true);
|
|
|
+ Dbg("audio input device(%d)", icountmic);
|
|
|
+ count += icountmic;
|
|
|
+ }
|
|
|
+ if (ctx->Req.type == 0 || (ctx->Req.type & 4)) {
|
|
|
+ icountspeaker = mlibAudioMgr->audio_get_device_count(false);
|
|
|
+ Dbg("audio output device(%d)", icountspeaker);
|
|
|
+ count += icountspeaker;
|
|
|
+ }
|
|
|
+
|
|
|
+ ctx->Ans.AvailableList.Init(count);
|
|
|
+ ctx->Ans.ListItemType.Init(count);
|
|
|
+ ctx->Ans.ListItemStatus.Init(count);
|
|
|
+ int curCnt(0);
|
|
|
+
|
|
|
+ if (ctx->Req.type == 0 || (ctx->Req.type & 1)) {
|
|
|
+ for (int i = 0; i < cameras.GetCount(); ++i) {
|
|
|
+ ctx->Ans.AvailableList[curCnt] = cameras[i];
|
|
|
+ ctx->Ans.ListItemType[curCnt] = 1;
|
|
|
+ ctx->Ans.ListItemStatus[curCnt] = 0;
|
|
|
+ Dbg("%d: %s", i, ctx->Ans.AvailableList[curCnt].GetData());
|
|
|
+ curCnt++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (ctx->Req.type == 0 || (ctx->Req.type & 2)) {
|
|
|
+ for (int i=0; i < icountmic; i++) {
|
|
|
+ char strname[MAX_PATH] = { 0 };
|
|
|
+ mlibAudioMgr->audio_get_device_name(strname, MAX_PATH, true, i);
|
|
|
+ ctx->Ans.AvailableList[curCnt] = strname;
|
|
|
+ ctx->Ans.ListItemType[curCnt] = 2;
|
|
|
+ ctx->Ans.ListItemStatus[curCnt] = 0;
|
|
|
+ Dbg("%d: %s", i, ctx->Ans.AvailableList[curCnt].GetData());
|
|
|
+ curCnt++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (ctx->Req.type == 0 || (ctx->Req.type & 4)) {
|
|
|
+ for (int i = 0; i < icountspeaker; i++) {
|
|
|
+ char strname[MAX_PATH] = { 0 };
|
|
|
+ mlibAudioMgr->audio_get_device_name(strname, MAX_PATH, false, i);
|
|
|
+ ctx->Ans.AvailableList[curCnt] = strname;
|
|
|
+ ctx->Ans.ListItemType[curCnt] = 4;
|
|
|
+ ctx->Ans.ListItemStatus[curCnt] = 0;
|
|
|
+ Dbg("%d: %s", i, ctx->Ans.AvailableList[curCnt].GetData());
|
|
|
+ curCnt++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ctx->Ans.result = curCnt;
|
|
|
+ ctx->Answer(Error_Succeed);
|
|
|
+}
|
|
|
+
|
|
|
+void CCameraConfigManageEntity::SetMediaDevice(SpReqAnsContext<CameraConfigManageService_SetMediaDevice_Req, CameraConfigManageService_SetMediaDevice_Ans>::Pointer ctx)
|
|
|
+{
|
|
|
+ ctx->Answer(Error_NotImpl);
|
|
|
+}
|
|
|
+
|
|
|
+void CCameraConfigManageEntity::TestAvailableMedieDev(SpReqAnsContext<CameraConfigManageService_TestAvailableMedieDev_Req, CameraConfigManageService_TestAvailableMedieDev_Ans>::Pointer ctx)
|
|
|
+{
|
|
|
+ ctx->Answer(Error_NotImpl);
|
|
|
+}
|
|
|
|
|
|
void CameraConfigManageServiceSession::Handle_BeginCameraConfigManage(
|
|
|
SpOnewayCallContext<CameraConfigManageService_BeginCameraConfigManage_Info>::Pointer ctx )
|
|
@@ -1518,19 +1599,22 @@ void CameraConfigManageServiceSession::Handle_AutoCorrectCameraConfig(
|
|
|
ctx->Answer(Error_Succeed);
|
|
|
}
|
|
|
|
|
|
-void CameraConfigManage::CameraConfigManageServiceSession::Handle_GetMediaAvailableList(SpReqAnsContext<CameraConfigManageService_GetMediaAvailableList_Req, CameraConfigManageService_GetMediaAvailableList_Ans>::Pointer ctx)
|
|
|
+void CameraConfigManageServiceSession::Handle_GetMediaAvailableList(SpReqAnsContext<CameraConfigManageService_GetMediaAvailableList_Req, CameraConfigManageService_GetMediaAvailableList_Ans>::Pointer ctx)
|
|
|
{
|
|
|
-
|
|
|
+ LOG_FUNCTION();
|
|
|
+ m_pEntity->GetMediaAvailableList(ctx);
|
|
|
}
|
|
|
|
|
|
-void CameraConfigManage::CameraConfigManageServiceSession::Handle_SetMediaDevice(SpReqAnsContext<CameraConfigManageService_SetMediaDevice_Req, CameraConfigManageService_SetMediaDevice_Ans>::Pointer ctx)
|
|
|
+void CameraConfigManageServiceSession::Handle_SetMediaDevice(SpReqAnsContext<CameraConfigManageService_SetMediaDevice_Req, CameraConfigManageService_SetMediaDevice_Ans>::Pointer ctx)
|
|
|
{
|
|
|
-
|
|
|
+ LOG_FUNCTION();
|
|
|
+ m_pEntity->SetMediaDevice(ctx);
|
|
|
}
|
|
|
|
|
|
-void CameraConfigManage::CameraConfigManageServiceSession::Handle_TestAvailableMedieDev(SpReqAnsContext<CameraConfigManageService_TestAvailableMedieDev_Req, CameraConfigManageService_TestAvailableMedieDev_Ans>::Pointer ctx)
|
|
|
+void CameraConfigManageServiceSession::Handle_TestAvailableMedieDev(SpReqAnsContext<CameraConfigManageService_TestAvailableMedieDev_Req, CameraConfigManageService_TestAvailableMedieDev_Ans>::Pointer ctx)
|
|
|
{
|
|
|
-
|
|
|
+ LOG_FUNCTION();
|
|
|
+ m_pEntity->TestAvailableMedieDev(ctx);
|
|
|
}
|
|
|
|
|
|
SP_BEGIN_ENTITY_MAP()
|