|
|
@@ -266,7 +266,7 @@ static BOOL FindMatchedFile(LPCSTR sFindPath, LPCSTR sFindFileName, ULONGLONG& u
|
|
|
#endif
|
|
|
|
|
|
|
|
|
-CSimpleStringA DecryptString(LPCTSTR lpszEncrpyted)
|
|
|
+static CSimpleStringA DecryptString(LPCTSTR lpszEncrpyted)
|
|
|
{
|
|
|
if (NULL == lpszEncrpyted) {
|
|
|
return CSimpleStringA("");
|
|
|
@@ -304,14 +304,14 @@ void SalesRecordServiceSession::Handle_CheckVideoDiskStatus( SpReqAnsContext<Sal
|
|
|
|
|
|
void SalesRecordServiceSession::Handle_PlayVideo(SpReqAnsContext<SalesRecorderSerVice_PlayVideo_Req, SalesRecorderSerVice_PlayVideo_Ans>::Pointer ctx)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("PlayVideo name is %s.", (LPCTSTR)CSimpleStringW2A(ctx->Req.VideoName));
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("PlayVideo.");
|
|
|
ErrorCodeEnum ErrorCode = m_pEntity->HandleDisplayVideo();
|
|
|
ctx->Answer(ErrorCode);
|
|
|
}
|
|
|
|
|
|
void SalesRecordServiceSession::Handle_SaveVideo(SpReqAnsContext<SalesRecorderSerVice_SaveVideo_Req, SalesRecorderSerVice_SaveVideo_Ans>::Pointer ctx)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Save Video name is %s.", (LPCTSTR)CSimpleStringW2A(ctx->Req.VideoName));
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Save Video.");
|
|
|
ErrorCodeEnum ErrorCode = m_pEntity->HandleSaveVideo();
|
|
|
ctx->Answer(ErrorCode);
|
|
|
}
|
|
|
@@ -332,14 +332,14 @@ void SalesRecordServiceSession::Handle_SetAudioTransFlag(SpReqAnsContext<SalesRe
|
|
|
|
|
|
void SalesRecordServiceSession::Handle_StopShowVideo(SpReqAnsContext<SalesRecorderSerVice_StopShowVideo_Req, SalesRecorderSerVice_StopShowVideo_Ans>::Pointer ctx)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Stop Show Video name is %s.", (LPCTSTR)CSimpleStringW2A(ctx->Req.VideoName));
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Stop Show Video.");
|
|
|
ErrorCodeEnum ErrorCode = m_pEntity->HandleStopShowVideo();
|
|
|
ctx->Answer(ErrorCode);
|
|
|
}
|
|
|
|
|
|
void SalesRecordServiceSession::Handle_PlaySalesRecord(SpReqAnsContext<SalesRecorderSerVice_PlaySalesRecord_Req, SalesRecorderSerVice_PlaySalesRecord_Ans>::Pointer ctx)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Stop Show Video name is %s.", (LPCTSTR)CSimpleStringW2A(ctx->Req.VideoName));
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, 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);
|
|
|
}
|
|
|
@@ -375,12 +375,6 @@ ErrorCodeEnum CSalesRecorderEntity::__OnStart( ErrorCodeEnum preOperationError )
|
|
|
m_bIsAudioNsOn = false;
|
|
|
m_iAudioNsPolicy = 2;
|
|
|
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- if (SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS)){
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Set Process(%d) RealTime Priority Success.",GetCurrentProcessId());
|
|
|
- }
|
|
|
-#endif
|
|
|
-
|
|
|
m_eDeviceType = RvcGetDeviceType();
|
|
|
|
|
|
int iAudioQuality = 3;
|
|
|
@@ -389,8 +383,7 @@ ErrorCodeEnum CSalesRecorderEntity::__OnStart( ErrorCodeEnum preOperationError )
|
|
|
m_max_disk_percent = MAX_DISK_PERCENT; // add by ly 2018/02/24
|
|
|
CSmartPointer<IConfigInfo> spConfig;
|
|
|
CSmartPointer<IEntityFunction> spFunction = GetFunction();
|
|
|
- if (spFunction->OpenConfig(Config_CenterSetting, spConfig) == Error_Succeed)
|
|
|
- {
|
|
|
+ if (spFunction->OpenConfig(Config_CenterSetting, spConfig) == Error_Succeed) {
|
|
|
spConfig->ReadConfigValueInt("SalesRecorder","MaxDiskPercent",m_max_disk_percent);
|
|
|
spConfig->ReadConfigValueInt("SalesRecorder","AudioSampleRate",m_audio_samplerate);
|
|
|
spConfig->ReadConfigValueInt("SalesRecorder","AudioBitRate",m_audio_out_bitrate);
|
|
|
@@ -400,8 +393,8 @@ ErrorCodeEnum CSalesRecorderEntity::__OnStart( ErrorCodeEnum preOperationError )
|
|
|
spConfig->ReadConfigValueInt("SalesRecorder","IsAudioNsOn",iIsAudioNsOn);
|
|
|
spConfig->ReadConfigValueInt("SalesRecorder","AudioQuality",iAudioQuality);
|
|
|
}
|
|
|
- if (m_max_disk_percent <= 0 || m_max_disk_percent >= 100)
|
|
|
- {
|
|
|
+
|
|
|
+ if (m_max_disk_percent <= 0 || m_max_disk_percent >= 100) {
|
|
|
m_max_disk_percent = MAX_DISK_PERCENT;
|
|
|
}
|
|
|
|
|
|
@@ -411,72 +404,35 @@ ErrorCodeEnum CSalesRecorderEntity::__OnStart( ErrorCodeEnum preOperationError )
|
|
|
m_bIsAudioNsOn = true;
|
|
|
}
|
|
|
|
|
|
- if (m_bWholeSection != 0 && m_bWholeSection != 1)
|
|
|
- {
|
|
|
+ if (m_bWholeSection != 0 && m_bWholeSection != 1){
|
|
|
m_bWholeSection = FALSE;
|
|
|
}
|
|
|
|
|
|
- if (m_bApplyHighQuality != 0 && m_bApplyHighQuality != 1)
|
|
|
- {
|
|
|
+ if (m_bApplyHighQuality != 0 && m_bApplyHighQuality != 1){
|
|
|
m_bApplyHighQuality = FALSE;
|
|
|
}
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("[dbg] m_bApplyHighQuality:%d",m_bApplyHighQuality);
|
|
|
|
|
|
m_bEwsRecord = FALSE;
|
|
|
|
|
|
- if (preOperationError != Error_Succeed)
|
|
|
+ if (preOperationError != Error_Succeed) {
|
|
|
return preOperationError;
|
|
|
+ }
|
|
|
|
|
|
ErrorCodeEnum Error = Error_Succeed;
|
|
|
m_iActiveCamera = CAMERA_TYPE_ENV;
|
|
|
m_iCameraState = 'N';
|
|
|
|
|
|
int i = 0;
|
|
|
- if (ePadtype == m_eDeviceType||eMobilePadType == m_eDeviceType||eDesk2SType == m_eDeviceType||eDesk1SType == m_eDeviceType||eDesk2SIntegratedType == m_eDeviceType)
|
|
|
- {
|
|
|
- // add by ly(edit by ly 2018/03/12)
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- m_pPlayer = new Clibwmpplayer(this);
|
|
|
-#else
|
|
|
- //m_pPlayer = new Clibmediaplayer(this);
|
|
|
-#endif // RVC_OS_WIN
|
|
|
- m_arrListener.Init(9);
|
|
|
- GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_UI_STARTRECORD, NULL, false);
|
|
|
- GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_UI_STARTAFTERPREVIEWRECORD, NULL, false);
|
|
|
- //GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_UI_STOPRECORD, NULL, false);
|
|
|
- //GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_UI_SHOWVIDEO, NULL, false);
|
|
|
- //GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_UI_SAVEVIDEO, NULL, false);
|
|
|
- GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_UI_DELETEVIDEO, NULL, false);
|
|
|
- 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, EVENT_UKEY_PULLOUT, 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_Middle, Error_IgnoreAll, LOG_EVT_UI_STARTREMOTERECORD, NULL, false);
|
|
|
- //GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_UI_STOPREMOTERECORD, NULL, false);
|
|
|
- GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_High, Error_IgnoreAll, LOG_EVT_SALESRECORD_ENTITY_EXCEPTION, NULL, false);
|
|
|
- GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_High, Error_IgnoreAll, LOG_EVT_AUDIOSTREAM_TRANSMISSION_FAILED, NULL, false);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // add by ly @2018/01/10
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
- m_pPlayer = new Clibwmpplayer(this);
|
|
|
-#else
|
|
|
- //m_pPlayer = new Clibmediaplayer(this);
|
|
|
-#endif // RVC_OS_WIN
|
|
|
- m_arrListener.Init(8);
|
|
|
- GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_UI_STARTRECORD, NULL, false);
|
|
|
- GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_UI_STARTAFTERPREVIEWRECORD, NULL, false);
|
|
|
- //GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_UI_STOPRECORD, NULL, false);
|
|
|
- //GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_UI_SHOWVIDEO, NULL, false);
|
|
|
- //GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_UI_SAVEVIDEO, NULL, false);
|
|
|
- GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_UI_DELETEVIDEO, NULL, false);
|
|
|
- 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_Middle, Error_IgnoreAll, LOG_EVT_UI_STARTREMOTERECORD, NULL, false);
|
|
|
- //GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_UI_STOPREMOTERECORD, NULL, false);
|
|
|
- GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_High, Error_IgnoreAll, LOG_EVT_SALESRECORD_ENTITY_EXCEPTION, NULL, false);
|
|
|
- GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_High, Error_IgnoreAll, LOG_EVT_AUDIOSTREAM_TRANSMISSION_FAILED, NULL, false);
|
|
|
- }
|
|
|
+
|
|
|
+ m_arrListener.Init(7);
|
|
|
+ GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_UI_STARTRECORD, NULL, false);
|
|
|
+ GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_UI_STARTAFTERPREVIEWRECORD, NULL, false);
|
|
|
+ GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_UI_DELETEVIDEO, NULL, false);
|
|
|
+ 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()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_High, Error_IgnoreAll, LOG_EVT_AUDIOSTREAM_TRANSMISSION_FAILED, NULL, false);
|
|
|
|
|
|
GetFunction()->RegistSysVarEvent(SYSVAR_ACTIVETRACKINGCAMERA,this);
|
|
|
GetFunction()->RegistSysVarEvent(SYSVAR_CAMERASTATE,this);
|
|
|
@@ -492,22 +448,18 @@ ErrorCodeEnum CSalesRecorderEntity::__OnStart( ErrorCodeEnum preOperationError )
|
|
|
|
|
|
GetFunction()->RegistSysVarEvent(SYSVAR_CALLTYPE, this);
|
|
|
GetFunction()->GetSysVar(SYSVAR_CALLTYPE, strValue);
|
|
|
- if (strValue[0] == CALLTYPE_NORMAL)
|
|
|
- {
|
|
|
+ if (strValue[0] == CALLTYPE_NORMAL) {
|
|
|
m_nSysCallType = 0;
|
|
|
}
|
|
|
- else if (strValue[0] == CALLTYPE_MOBILE)
|
|
|
- {
|
|
|
+ else if (strValue[0] == CALLTYPE_MOBILE) {
|
|
|
m_nSysCallType = 1;
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
+ else {
|
|
|
assert(0);
|
|
|
}
|
|
|
|
|
|
Error = GetFunction()->RegistSysVarEvent("SessionID", this);
|
|
|
- if (Error != Error_Succeed)
|
|
|
- {
|
|
|
+ if (Error != Error_Succeed) {
|
|
|
LOG_TRACE("register sysvar %s failed!", "SessionID");
|
|
|
}
|
|
|
|
|
|
@@ -516,13 +468,16 @@ ErrorCodeEnum CSalesRecorderEntity::__OnStart( ErrorCodeEnum preOperationError )
|
|
|
if (Error != Error_Succeed) {
|
|
|
LOG_TRACE("get global record temp path failed!");
|
|
|
}
|
|
|
+
|
|
|
if (m_TempDir.GetLength() > 0 && m_TempDir[m_TempDir.GetLength()-1] != SPLIT_SLASH) {
|
|
|
m_TempDir += SPLIT_SLASH_STR;
|
|
|
}
|
|
|
+
|
|
|
Error = GetFunction()->GetPath("UploadVideo", m_RecordSaveDir);
|
|
|
if (Error != Error_Succeed) {
|
|
|
LOG_TRACE("get global record save path failed!");
|
|
|
}
|
|
|
+
|
|
|
if (m_RecordSaveDir.GetLength() > 0 && m_RecordSaveDir[m_RecordSaveDir.GetLength()-1] != SPLIT_SLASH) {
|
|
|
m_RecordSaveDir += SPLIT_SLASH_STR;
|
|
|
}
|
|
|
@@ -628,7 +583,18 @@ void CSalesRecorderEntity::Debug(record_loglevel elevel, const char* fmt, ...)
|
|
|
if (RECORD_LOG_DEBUG <= elevel) {
|
|
|
va_list arg;
|
|
|
va_start(arg, fmt);
|
|
|
- vDbg(fmt, arg);
|
|
|
+ int n = _vscprintf(fmt, arg);
|
|
|
+ if (n >= MAX_PATH) {
|
|
|
+ char* buf = (char*)malloc((size_t)(n + 1));
|
|
|
+ vsnprintf(buf, n + 1, fmt, arg);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", buf);
|
|
|
+ free(buf);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ char strlog[MAX_PATH] = { 0 };
|
|
|
+ vsnprintf(strlog, MAX_PATH, fmt, arg);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", strlog);
|
|
|
+ }
|
|
|
va_end(arg);
|
|
|
}
|
|
|
}
|
|
|
@@ -636,7 +602,18 @@ void CSalesRecorderEntity::Debug(record_loglevel elevel, const char* fmt, ...)
|
|
|
void CSalesRecorderEntity::vDebug(record_loglevel elevel, const char* str, va_list list)
|
|
|
{
|
|
|
if (RECORD_LOG_DEBUG <= elevel) {
|
|
|
- vDbg(str, list);
|
|
|
+ int n = _vscprintf(str, list);
|
|
|
+ if (n >= MAX_PATH) {
|
|
|
+ char* buf = (char*)malloc((size_t)(n + 1));
|
|
|
+ vsnprintf(buf, n + 1, str, list);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", buf);
|
|
|
+ free(buf);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ char strlog[MAX_PATH] = { 0 };
|
|
|
+ vsnprintf(strlog, MAX_PATH, str, list);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", strlog);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|