|
@@ -8,6 +8,11 @@
|
|
|
#include <algorithm>
|
|
|
#ifdef RVC_OS_WIN
|
|
|
#include <Windows.h>
|
|
|
+#else
|
|
|
+#include <dirent.h>
|
|
|
+#include <sys/ioctl.h>
|
|
|
+#include <sys/stat.h>
|
|
|
+#include <sys/fcntl.h>
|
|
|
#endif
|
|
|
|
|
|
#include "mod_customeraware/Event.h"
|
|
@@ -244,11 +249,13 @@ static CSimpleStringA DecryptString(LPCTSTR lpszEncrpyted)
|
|
|
|
|
|
void SalesRecordServiceSession::Handle_GetOFLVideoRecords( SpReqAnsContext<SalesRecorderSerVice_GetOFLVideoRecords_Req, SalesRecorderSerVice_GetOFLVideoRecords_Ans>::Pointer ctx )
|
|
|
{
|
|
|
+ DbgToBeidou(ctx->link, __FUNCTION__)();
|
|
|
ctx->Answer(Error_Succeed);
|
|
|
}
|
|
|
|
|
|
void SalesRecordServiceSession::Handle_CheckVideoDiskStatus( SpReqAnsContext<SalesRecorderSerVice_CheckVideoDiskStatus_Req, SalesRecorderSerVice_CheckVideoDiskStatus_Ans>::Pointer ctx )
|
|
|
{
|
|
|
+ DbgToBeidou(ctx->link, __FUNCTION__)();
|
|
|
int nFreeRatio = 0;
|
|
|
int bSufficient = CheckDiskStatus((LPCTSTR)ctx->Req.DriveLetter,m_pEntity->m_max_disk_percent,&nFreeRatio);
|
|
|
ctx->Ans.IsSufficient = bSufficient;
|
|
@@ -258,21 +265,21 @@ void SalesRecordServiceSession::Handle_CheckVideoDiskStatus( SpReqAnsContext<Sal
|
|
|
|
|
|
void SalesRecordServiceSession::Handle_PlayVideo(SpReqAnsContext<SalesRecorderSerVice_PlayVideo_Req, SalesRecorderSerVice_PlayVideo_Ans>::Pointer ctx)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("PlayVideo.");
|
|
|
+ DbgToBeidou(ctx->link, __FUNCTION__)();
|
|
|
ErrorCodeEnum ErrorCode = m_pEntity->HandleDisplayVideo();
|
|
|
ctx->Answer(ErrorCode);
|
|
|
}
|
|
|
|
|
|
void SalesRecordServiceSession::Handle_SaveVideo(SpReqAnsContext<SalesRecorderSerVice_SaveVideo_Req, SalesRecorderSerVice_SaveVideo_Ans>::Pointer ctx)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Save Video.");
|
|
|
+ DbgToBeidou(ctx->link, __FUNCTION__)();
|
|
|
ErrorCodeEnum ErrorCode = m_pEntity->HandleSaveVideo();
|
|
|
ctx->Answer(ErrorCode);
|
|
|
}
|
|
|
|
|
|
void SalesRecordServiceSession::Handle_StopRecord(SpReqAnsContext<SalesRecorderSerVice_StopRecord_Req, SalesRecorderSerVice_StopRecord_Ans>::Pointer ctx)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Stop Record.");
|
|
|
+ DbgToBeidou(ctx->link, __FUNCTION__)();
|
|
|
ErrorCodeEnum ErrorCode = m_pEntity->HandleStopRecord((LPCTSTR)CSimpleStringW2A(ctx->Req.VideoName));
|
|
|
ctx->Answer(ErrorCode);
|
|
|
}
|
|
@@ -280,6 +287,7 @@ void SalesRecordServiceSession::Handle_StopRecord(SpReqAnsContext<SalesRecorderS
|
|
|
|
|
|
void SalesRecordServiceSession::Handle_SetAudioTransFlag(SpReqAnsContext<SalesRecorderSerVice_SetAudioTransFlag_Req, SalesRecorderSerVice_SetAudioTransFlag_Ans>::Pointer ctx)
|
|
|
{
|
|
|
+ DbgToBeidou(ctx->link, __FUNCTION__)();
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Audio transmission flag is %s.", ctx->Req.TransFlag ? "true" : "false");
|
|
|
ctx->Answer(Error_Succeed);
|
|
|
}
|
|
@@ -287,6 +295,7 @@ void SalesRecordServiceSession::Handle_SetAudioTransFlag(SpReqAnsContext<SalesRe
|
|
|
|
|
|
void SalesRecordServiceSession::Handle_StopShowVideo(SpReqAnsContext<SalesRecorderSerVice_StopShowVideo_Req, SalesRecorderSerVice_StopShowVideo_Ans>::Pointer ctx)
|
|
|
{
|
|
|
+ DbgToBeidou(ctx->link, __FUNCTION__)();
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Stop Show Video.");
|
|
|
ErrorCodeEnum ErrorCode = m_pEntity->HandleStopShowVideo();
|
|
|
ctx->Answer(ErrorCode);
|
|
@@ -294,6 +303,7 @@ void SalesRecordServiceSession::Handle_StopShowVideo(SpReqAnsContext<SalesRecord
|
|
|
|
|
|
void SalesRecordServiceSession::Handle_PlaySalesRecord(SpReqAnsContext<SalesRecorderSerVice_PlaySalesRecord_Req, SalesRecorderSerVice_PlaySalesRecord_Ans>::Pointer ctx)
|
|
|
{
|
|
|
+ DbgToBeidou(ctx->link, __FUNCTION__)();
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Stop Show Video.");
|
|
|
ErrorCodeEnum ErrorCode = m_pEntity->HandlePlaySalesRecordVideo(ctx->Req.WndX, ctx->Req.WndY, ctx->Req.WndWidth, ctx->Req.WndHeight);
|
|
|
ctx->Answer(ErrorCode);
|
|
@@ -301,10 +311,26 @@ void SalesRecordServiceSession::Handle_PlaySalesRecord(SpReqAnsContext<SalesReco
|
|
|
|
|
|
void SalesRecordServiceSession::Handle_StartRemoteRecord(SpReqAnsContext<SalesRecorderSerVice_StartRemoteRecord_Req, SalesRecorderSerVice_StartRemoteRecord_Ans>::Pointer ctx)
|
|
|
{
|
|
|
+ DbgToBeidou(ctx->link, __FUNCTION__)();
|
|
|
ErrorCodeEnum ErrorCode = m_pEntity->HandleStartRecord(ctx->Req.VideoName.GetData(), true);
|
|
|
ctx->Answer(ErrorCode);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+void SalesRecordServiceSession::Handle_DeleteVideo(SpReqAnsContext<SalesRecorderSerVice_DeleteVideo_Req, SalesRecorderSerVice_DeleteVideo_Ans>::Pointer ctx)
|
|
|
+{
|
|
|
+ DbgToBeidou(ctx->link, __FUNCTION__)();
|
|
|
+ ErrorCodeEnum ErrorCode = m_pEntity->HandleDeleteVideo();
|
|
|
+ ctx->Answer(ErrorCode);
|
|
|
+}
|
|
|
+
|
|
|
+void SalesRecordServiceSession::Handle_AppendWatermark(SpReqAnsContext<SalesRecorderSerVice_AppendWatermark_Req, SalesRecorderSerVice_AppendWatermark_Ans>::Pointer ctx)
|
|
|
+{
|
|
|
+ DbgToBeidou(ctx->link, __FUNCTION__)();
|
|
|
+ ErrorCodeEnum ErrorCode = m_pEntity->HandleVideoAppendWatermark(CSimpleStringW2A(ctx->Req.VideoName).GetData(), ctx->Req.Watermark.GetData());
|
|
|
+ ctx->Answer(ErrorCode);
|
|
|
+}
|
|
|
+
|
|
|
CServerSessionBase * CSalesRecorderEntity::OnNewSession( const char* pszRemoteEntityName, const char * pszClass )
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s connected class = %s!", pszRemoteEntityName, pszClass);
|
|
@@ -394,12 +420,11 @@ ErrorCodeEnum CSalesRecorderEntity::__OnStart( ErrorCodeEnum preOperationError )
|
|
|
|
|
|
int i = 0;
|
|
|
|
|
|
- m_arrListener.Init(4);
|
|
|
- GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_UI_DELETEVIDEO, NULL, false);
|
|
|
+ m_arrListener.Init(3);
|
|
|
GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_None, Error_IgnoreAll, LOG_EVT_UI_RETURNMENU, NULL, false);
|
|
|
GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_None, Error_IgnoreAll, LOG_EVT_UI_VIDEOAPPENDWATERMARK, NULL, false);
|
|
|
GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_High, Error_IgnoreAll, LOG_EVT_SALESRECORD_ENTITY_EXCEPTION, NULL, false);
|
|
|
-
|
|
|
+
|
|
|
GetFunction()->RegistSysVarEvent(SYSVAR_ACTIVETRACKINGCAMERA,this);
|
|
|
GetFunction()->RegistSysVarEvent(SYSVAR_CAMERASTATE,this);
|
|
|
CSimpleStringA strValue;
|
|
@@ -671,29 +696,10 @@ void CSalesRecorderEntity::OnLog( const CAutoArray<CUUID> &SubIDs, const CUUID n
|
|
|
// 响应客户经理销售录像相关的事件
|
|
|
switch (dwUserCode)
|
|
|
{
|
|
|
- case LOG_EVT_UI_SHOWVIDEO:
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("show video record.");
|
|
|
- HandleDisplayVideo();
|
|
|
- break;
|
|
|
-
|
|
|
- case LOG_EVT_UI_SAVEVIDEO:
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("save record!");
|
|
|
- HandleSaveVideo();
|
|
|
- break;
|
|
|
-
|
|
|
- case LOG_EVT_UI_DELETEVIDEO:
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("delete record!");
|
|
|
- HandleDeleteVideo();
|
|
|
- break;
|
|
|
-
|
|
|
case LOG_EVT_UI_RETURNMENU:
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("return menu.");
|
|
|
//HandleReturnMenu();
|
|
|
break;
|
|
|
- case LOG_EVT_UI_VIDEOAPPENDWATERMARK:
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("handle video append water mark param is %s.", pszMessage);
|
|
|
- HandleVideoAppendWatermark(pszMessage);
|
|
|
- break;
|
|
|
|
|
|
case LOG_EVT_SALESRECORD_ENTITY_EXCEPTION:
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("handle sales record entity exception, and message is %s.", pszMessage);
|
|
@@ -793,8 +799,9 @@ ErrorCodeEnum CSalesRecorderEntity::PlaySalesRecordVideo( const char *videofilen
|
|
|
}
|
|
|
|
|
|
|
|
|
-void CSalesRecorderEntity::DeleteVideo( const char *videofilename)
|
|
|
+ErrorCodeEnum CSalesRecorderEntity::DeleteVideo( const char *videofilename)
|
|
|
{
|
|
|
+ ErrorCodeEnum ErrorCode = Error_Succeed;
|
|
|
if(!m_bStarted)
|
|
|
{
|
|
|
CSimpleStringA strPath;
|
|
@@ -826,10 +833,16 @@ void CSalesRecorderEntity::DeleteVideo( const char *videofilename)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ ErrorCode = Error_NotExist;
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("[DeleteVideo] videos not exist or have been deleted!");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ else {
|
|
|
+ ErrorCode = Error_NotImpl;
|
|
|
+ }
|
|
|
+
|
|
|
+ return ErrorCode;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -848,6 +861,7 @@ static unsigned long GetFileSize(const char* filename)
|
|
|
return statbuf.st_size;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
ErrorCodeEnum CSalesRecorderEntity::SaveVideo( const char * videofilename)
|
|
|
{
|
|
|
ErrorCodeEnum ErrorCode = Error_Succeed;
|
|
@@ -924,6 +938,7 @@ ErrorCodeEnum CSalesRecorderEntity::SaveVideo( const char * videofilename)
|
|
|
return ErrorCode;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
CSimpleStringA CSalesRecorderEntity::GetTerminalStage()
|
|
|
{
|
|
|
CSmartPointer<IEntityFunction> Func = GetFunction();
|
|
@@ -947,27 +962,23 @@ void CSalesRecorderEntity::SecureClientRelease()
|
|
|
}
|
|
|
|
|
|
|
|
|
-// 请求InteractiveControl结束录像 add by ly 2018/03/12
|
|
|
ErrorCodeEnum CSalesRecorderEntity::StopRecordVideo()
|
|
|
{
|
|
|
auto rc = Error_Succeed;
|
|
|
|
|
|
auto pUIClient = new InteractiveControl::UIService_ClientBase(this);
|
|
|
|
|
|
- if(pUIClient->Connect() != Error_Succeed)
|
|
|
- {
|
|
|
+ if(pUIClient->Connect() != Error_Succeed){
|
|
|
pUIClient->SafeDelete();
|
|
|
pUIClient = NULL;
|
|
|
rc = Error_DevConnFailed;
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
+ else{
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("UIClient connected success!");
|
|
|
InteractiveControl::UIService_StopRecordVideo_Req req;
|
|
|
InteractiveControl::UIService_StopRecordVideo_Ans ans;
|
|
|
rc = (*pUIClient)(EntityResource::getLink().upgradeLink())->StopRecordVideo(req, ans, 5000);
|
|
|
- if(rc != Error_Succeed)
|
|
|
- {
|
|
|
+ if(rc != Error_Succeed){
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Stop record video failed return 0x%08x", rc);
|
|
|
}
|
|
|
|
|
@@ -1150,18 +1161,8 @@ ErrorCodeEnum CSalesRecorderEntity::HandlePlaySalesRecordVideo(int iWndX, int iW
|
|
|
ErrorCodeEnum CSalesRecorderEntity::HandleStopShowVideo()
|
|
|
{
|
|
|
// 视频播放 libwmpplayer
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("stop show video record file name is %s!", m_SalesVideoName);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("stop show video record file name is %s!", m_SalesVideoName);
|
|
|
ErrorCodeEnum ErrorCode = Error_Succeed;
|
|
|
- if(m_bIsShowVideo)
|
|
|
- {
|
|
|
- //DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("m_pPlayer = %p while play!", m_pPlayer);
|
|
|
- //m_pPlayer->Close();
|
|
|
- m_bIsShowVideo = FALSE;
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("succeed to stop show video!");
|
|
|
- }
|
|
|
- else{
|
|
|
- ErrorCode = Error_NotImpl;
|
|
|
- }
|
|
|
return ErrorCode;
|
|
|
}
|
|
|
|
|
@@ -1170,15 +1171,11 @@ ErrorCodeEnum CSalesRecorderEntity::HandleStopShowVideo()
|
|
|
ErrorCodeEnum CSalesRecorderEntity::HandleSaveVideo()
|
|
|
{
|
|
|
ErrorCodeEnum ErrorCode = Error_Succeed;
|
|
|
+
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Save Record Name is %s.", m_SalesVideoName);
|
|
|
+
|
|
|
// 将视频从tmp移动到uploadvideo
|
|
|
- if (!strstr(m_SalesVideoName, "OFL")) // edit by ly 20180228
|
|
|
- {
|
|
|
- ErrorCode = SaveVideo(m_SalesVideoName+2);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ErrorCode = SaveVideo(m_SalesVideoName+4);
|
|
|
- }
|
|
|
+ ErrorCode = SaveVideo(m_SalesVideoName+2);
|
|
|
|
|
|
ZeroMemory(m_SalesVideoName,sizeof(m_SalesVideoName));
|
|
|
|
|
@@ -1186,14 +1183,20 @@ ErrorCodeEnum CSalesRecorderEntity::HandleSaveVideo()
|
|
|
}
|
|
|
|
|
|
|
|
|
-void CSalesRecorderEntity::HandleDeleteVideo()
|
|
|
+ErrorCodeEnum CSalesRecorderEntity::HandleDeleteVideo()
|
|
|
{
|
|
|
+ ErrorCodeEnum ErrorCode = Error_Succeed;
|
|
|
+
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Delete Record Name is %s.", m_SalesVideoName);
|
|
|
// 删除tmp中的视频
|
|
|
- DeleteVideo(m_SalesVideoName);
|
|
|
+ ErrorCode = DeleteVideo(m_SalesVideoName);
|
|
|
|
|
|
ZeroMemory(m_SalesVideoName,sizeof(m_SalesVideoName));
|
|
|
+
|
|
|
+ return ErrorCode;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
void CSalesRecorderEntity::HandleReturnMenu()
|
|
|
{
|
|
|
CSimpleStringA strValue;
|
|
@@ -1211,28 +1214,24 @@ void CSalesRecorderEntity::HandleReturnMenu()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void CSalesRecorderEntity::HandleVideoAppendWatermark(const char* pszMessage)
|
|
|
+
|
|
|
+ErrorCodeEnum CSalesRecorderEntity::HandleVideoAppendWatermark(const char* pszVideoName, const wchar_t* pszWaterMark)
|
|
|
{
|
|
|
- if (NULL == pszMessage){
|
|
|
- return;
|
|
|
+ ErrorCodeEnum Error = Error_Failed;
|
|
|
+ if (NULL == pszWaterMark){
|
|
|
+ return Error_Param;
|
|
|
}
|
|
|
|
|
|
- wchar_t*result[10] = {0};
|
|
|
- auto arr1 = CSimpleStringA2W(pszMessage).Split('|');
|
|
|
- auto arr2 = CAutoArray<CSimpleStringW>(arr1.GetCount());
|
|
|
- int icount = sizeof(result)/sizeof(char*);
|
|
|
- for (int i = 0; i < arr1.GetCount() && i < sizeof(result)/sizeof(char*); i++)
|
|
|
- {
|
|
|
- arr2[i] = CSimpleStringW(arr1[i]);
|
|
|
- result[i] = (wchar_t*)arr2[i].GetData();
|
|
|
+ if (m_bStarted && (NULL != m_pRecorder)){
|
|
|
+ if (m_pRecorder->SetRightVideoWaterMark(pszWaterMark)) {
|
|
|
+ Error = Error_Succeed;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- if (m_bStarted && (NULL != m_pRecorder))
|
|
|
- {
|
|
|
- m_pRecorder->SetRightVideoWaterMark(result[1]);
|
|
|
- }
|
|
|
+ return Error;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
ErrorCodeEnum CSalesRecorderEntity::HandleSalesRecordEntityException(const char* pszMessage)
|
|
|
{
|
|
|
// 通知到业务中台
|
|
@@ -1252,6 +1251,7 @@ ErrorCodeEnum CSalesRecorderEntity::HandleSalesRecordEntityException(const char*
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
bool CSalesRecorderEntity::InitSalesRecorder()
|
|
|
{
|
|
|
bool bRet = FALSE;
|