|
@@ -13,31 +13,16 @@
|
|
|
|
|
|
using namespace Recorder;
|
|
|
|
|
|
+#ifndef MAX_LOG_LEN
|
|
|
+#define MAX_LOG_LEN 512
|
|
|
+#endif
|
|
|
+
|
|
|
+
|
|
|
#ifndef RVC_TRANSATCION_RECORD_SUFFIX
|
|
|
#define RVC_TRANSATCION_RECORD_SUFFIX "B_"
|
|
|
#endif // !RVC_TRANSATCION_RECORD_SUFFIX
|
|
|
|
|
|
|
|
|
-#define LOG_EVT_UI_RETURNMENU 0x30B00006 //退出到主菜单
|
|
|
-#define LOG_EVT_RECORDFAILED 0x31200001 //录像失败
|
|
|
-
|
|
|
-static void logCallbacks(void* ptr, int level, const char* fmt, va_list list)
|
|
|
-{
|
|
|
- int n = _vscprintf(fmt, list);
|
|
|
- if (n >= MAX_PATH) {
|
|
|
- char* buf = (char*)malloc((size_t)(n + 1));
|
|
|
- vsnprintf(buf, n + 1, fmt, list);
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", buf);
|
|
|
- free(buf);
|
|
|
- }
|
|
|
- else {
|
|
|
- char strlog[MAX_PATH] = { 0 };
|
|
|
- vsnprintf(strlog, MAX_PATH, fmt, list);
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", strlog);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
void RecordServiceSession::Handle_StartTransactionRecord(SpReqAnsContext<RecorderSerVice_StartTransactionRecord_Req, RecorderSerVice_StartTransactionRecord_Ans>::Pointer ctx)
|
|
|
{
|
|
|
LogEvent(Severity_Middle, LOG_EVT_BEGIN_HANDLE_BUSINESS, "begin handle business.");
|
|
@@ -48,7 +33,7 @@ void RecordServiceSession::Handle_StartTransactionRecord(SpReqAnsContext<Recorde
|
|
|
}
|
|
|
|
|
|
char strVideoName[MAX_PATH] = { 0 };
|
|
|
- _snprintf(strVideoName, MAX_PATH, "%s%s",RVC_TRANSATCION_RECORD_SUFFIX, ctx->Req.VideoName.GetData());
|
|
|
+ snprintf(strVideoName, MAX_PATH, "%s%s",RVC_TRANSATCION_RECORD_SUFFIX, ctx->Req.VideoName.GetData());
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("StartRecord and video name is %s.", strVideoName);
|
|
|
|
|
|
m_pEntity->StartRecord(strVideoName);
|
|
@@ -79,16 +64,111 @@ void CRecorderEntity::OnPreClose(EntityCloseCauseEnum eCloseCause,CSmartPointer<
|
|
|
pTransactionContext->SendAnswer(Error);
|
|
|
}
|
|
|
|
|
|
+ErrorCodeEnum CRecorderEntity::__OnStart(ErrorCodeEnum preOperationError)
|
|
|
+{
|
|
|
+ ErrorCodeEnum Error = Error_Succeed;
|
|
|
+ m_eDeviceType = RvcGetDeviceType();
|
|
|
+
|
|
|
+ if (preOperationError != Error_Succeed) {
|
|
|
+ return preOperationError;
|
|
|
+ }
|
|
|
+
|
|
|
+ m_iActiveCamera = CAMERA_TYPE_ENV;
|
|
|
+ m_iCameraState = 'N';
|
|
|
+
|
|
|
+ int iRecordMode = 0;
|
|
|
+ CSmartPointer<IConfigInfo> spConfig;
|
|
|
+ CSmartPointer<IEntityFunction> spFunction = GetFunction();
|
|
|
+ if (spFunction->OpenConfig(Config_CenterSetting, spConfig) == Error_Succeed) {
|
|
|
+ spConfig->ReadConfigValueInt("InteractiveControl", "RecordMode", iRecordMode);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (1 == iRecordMode) {
|
|
|
+ m_iRecordMode = 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Record Mode is %d.", m_iRecordMode);
|
|
|
+
|
|
|
+ InitRecorder();
|
|
|
+
|
|
|
+ int i = 0;
|
|
|
+ m_arrListener.Init(5);
|
|
|
+ GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, EVENT_MOD_BEGIN_RECORD, NULL, false);
|
|
|
+ GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, EVENT_MOD_END_RECORD, 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_Middle, Error_IgnoreAll, LOG_EVT_RECORDER_SECTION_FINISHED, NULL, false);
|
|
|
+ GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_RECORDER_WHOLE_FINISHED, NULL, false);
|
|
|
+
|
|
|
+ GetFunction()->RegistSysVarEvent(SYSVAR_ACTIVETRACKINGCAMERA,this);
|
|
|
+ GetFunction()->RegistSysVarEvent(SYSVAR_CAMERASTATE,this);
|
|
|
+ CSimpleStringA strValue;
|
|
|
+ GetFunction()->GetSysVar(SYSVAR_CAMERASTATE, strValue);
|
|
|
+ m_iCameraState = strValue[0];
|
|
|
+ if (strValue[0] == 'E'){
|
|
|
+ m_iActiveCamera = CAMERA_TYPE_OPT;
|
|
|
+ }
|
|
|
+ else if (strValue[0] == 'O'){
|
|
|
+ m_iActiveCamera = CAMERA_TYPE_ENV;
|
|
|
+ }
|
|
|
+ else if(strValue[0] == 'B'){
|
|
|
+ m_iActiveCamera = CAMERA_TYPE_ERROR;
|
|
|
+ }
|
|
|
+ else if (strValue[0] == 'N'){
|
|
|
+ m_iActiveCamera = CAMERA_TYPE_ENV;
|
|
|
+ }
|
|
|
+
|
|
|
+ Error = GetFunction()->RegistSysVarEvent("SessionID", this);
|
|
|
+ if (Error != Error_Succeed) {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("register sysvar %s failed!", "SessionID");
|
|
|
+ }
|
|
|
+
|
|
|
+ Error = GetFunction()->GetPath("Temp", m_TempDir);
|
|
|
+ if (Error != Error_Succeed) {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("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) {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("get global record save path failed!");
|
|
|
+ }
|
|
|
+ if (m_RecordSaveDir.GetLength() > 0 && m_RecordSaveDir[m_RecordSaveDir.GetLength()-1] != SPLIT_SLASH) {
|
|
|
+ m_RecordSaveDir += SPLIT_SLASH_STR;
|
|
|
+ }
|
|
|
+ return Error;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+ErrorCodeEnum CRecorderEntity::__OnClose(ErrorCodeEnum preOperationError)
|
|
|
+{
|
|
|
+ if (preOperationError != Error_Succeed) {
|
|
|
+ return preOperationError;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < m_arrListener.GetCount(); ++i) {
|
|
|
+ GetFunction()->UnsubscribeLog(m_arrListener[i]);
|
|
|
+ }
|
|
|
+
|
|
|
+ GetFunction()->UnregistSysVarEvent(SYSVAR_ACTIVETRACKINGCAMERA);
|
|
|
+ GetFunction()->UnregistSysVarEvent(SYSVAR_CAMERASTATE);
|
|
|
+ StopRecord();
|
|
|
+
|
|
|
+ return Error_Succeed;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
bool CRecorderEntity::InitRecorder()
|
|
|
{
|
|
|
- bool bRet = FALSE;
|
|
|
+ bool bRet = false;
|
|
|
|
|
|
- if ((ePadtype == m_eDeviceType) || (eMobilePadType == m_eDeviceType) || (eDesk2SType == m_eDeviceType)){
|
|
|
+ if ((ePadtype == m_eDeviceType) || (eMobilePadType == m_eDeviceType) || (eDesk2SType == m_eDeviceType)) {
|
|
|
//pad 版增加远端视频队列
|
|
|
m_pRecorder = new Clibvideorecord(&bRet, this, REC_COMMON_AUDIO_SHM_QUEUE,
|
|
|
REC_COMMON_VIDEO_ENV_SHM_RTP_QUEUE, NULL);
|
|
|
}
|
|
|
- else{
|
|
|
+ else {
|
|
|
// == 2
|
|
|
m_pRecorder = new Clibvideorecord(&bRet, this, REC_COMMON_AUDIO_SHM_QUEUE,
|
|
|
REC_COMMON_VIDEO_ENV_SHM_RTP_QUEUE, REC_COMMON_VIDEO_OPT_SHM_RTP_QUEUE);
|
|
@@ -107,126 +187,51 @@ bool CRecorderEntity::ReleaseRecorder()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-ErrorCodeEnum CRecorderEntity::__OnStart(ErrorCodeEnum preOperationError)
|
|
|
-{
|
|
|
- //MessageBoxA(0,0,0,0);
|
|
|
- m_eDeviceType = eStand2sType;
|
|
|
- //is Pad Version
|
|
|
- CSmartPointer<IEntityFunction> spFunction = GetFunction();
|
|
|
- CSystemStaticInfo stStaticinfo;
|
|
|
- spFunction->GetSystemStaticInfo(stStaticinfo);
|
|
|
- if (stricmp(stStaticinfo.strMachineType,"RVC.PAD")==0)
|
|
|
- {
|
|
|
- if (stricmp(stStaticinfo.strSite,"CMB.FLB")==0)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("the type is mobile pad");
|
|
|
- m_eDeviceType = eMobilePadType;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("the type is pad");
|
|
|
- m_eDeviceType = ePadtype;
|
|
|
- }
|
|
|
- }
|
|
|
- else if (stricmp(stStaticinfo.strMachineType,"RPM.Stand1S")==0)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("the type is rpm.stand1s");
|
|
|
- m_eDeviceType = eRpm1sType;
|
|
|
- }
|
|
|
- else if (stricmp(stStaticinfo.strMachineType,"RVC.Desk2S")==0)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("the type is Desk2S");
|
|
|
- m_eDeviceType = eDesk2SType;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("the type is standard");
|
|
|
- m_eDeviceType = eStand2sType;
|
|
|
- }
|
|
|
-
|
|
|
- m_terminalNo = stStaticinfo.strTerminalID;
|
|
|
-
|
|
|
- if (preOperationError != Error_Succeed)
|
|
|
- return preOperationError;
|
|
|
-
|
|
|
- ErrorCodeEnum Error = Error_Succeed;
|
|
|
- m_iActiveCamera = CAMERA_TYPE_ENV;
|
|
|
- m_iCameraState = 'N';
|
|
|
+CServerSessionBase* CRecorderEntity::OnNewSession(const char* pszRemoteEntityName, const char* pszClass)
|
|
|
+{
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s connected class = %s!", pszRemoteEntityName, pszClass);
|
|
|
+ return new RecordServiceSession(this);
|
|
|
+}
|
|
|
|
|
|
- InitRecorder();
|
|
|
-
|
|
|
- GetFunction()->SubscribeLog(m_SubIDStartRecord, this, Log_Event, Severity_Middle, Error_IgnoreAll, EVENT_MOD_BEGIN_RECORD, NULL, false);
|
|
|
- GetFunction()->SubscribeLog(m_SubIDStopRecord, this, Log_Event, Severity_Middle, Error_IgnoreAll, EVENT_MOD_END_RECORD, NULL, false);
|
|
|
- GetFunction()->SubscribeLog(m_SubIDReturnMenu, this, Log_Event, Severity_None, Error_IgnoreAll, LOG_EVT_UI_RETURNMENU, NULL, false);
|
|
|
-
|
|
|
- GetFunction()->RegistSysVarEvent(SYSVAR_ACTIVETRACKINGCAMERA,this);
|
|
|
- GetFunction()->RegistSysVarEvent(SYSVAR_CAMERASTATE,this);
|
|
|
- CSimpleStringA strValue;
|
|
|
- GetFunction()->GetSysVar(SYSVAR_CAMERASTATE, strValue);
|
|
|
- m_iCameraState = strValue[0];
|
|
|
- if (strValue[0] == 'E')
|
|
|
- {
|
|
|
- m_iActiveCamera = CAMERA_TYPE_OPT;
|
|
|
- }
|
|
|
- else if (strValue[0] == 'O')
|
|
|
- {
|
|
|
- m_iActiveCamera = CAMERA_TYPE_ENV;
|
|
|
- }
|
|
|
- else if(strValue[0] == 'B') ///////显示贴图
|
|
|
- {
|
|
|
- m_iActiveCamera = CAMERA_TYPE_ERROR;
|
|
|
- }
|
|
|
- else if (strValue[0] == 'N')
|
|
|
- {
|
|
|
- m_iActiveCamera = CAMERA_TYPE_ENV;
|
|
|
- }
|
|
|
-
|
|
|
- Error = GetFunction()->RegistSysVarEvent("SessionID", this);
|
|
|
- if (Error != Error_Succeed)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("register sysvar %s failed!", "SessionID");
|
|
|
- }
|
|
|
+void CRecorderEntity::Debug(record_loglevel elevel, const char *fmt, ...)
|
|
|
+{
|
|
|
+ if (RECORD_LOG_INFO <= elevel) {
|
|
|
+ va_list arg;
|
|
|
+ va_start(arg, fmt);
|
|
|
|
|
|
- // add by ly 2018/02/13
|
|
|
- Error = GetFunction()->GetPath("Temp", m_TempDir);
|
|
|
- if (Error != Error_Succeed) {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("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) {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("get global record save path failed!");
|
|
|
+ int n = vsnprintf(NULL, 0, fmt, arg);
|
|
|
+ if (n >= MAX_LOG_LEN) {
|
|
|
+ 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);
|
|
|
}
|
|
|
- if (m_RecordSaveDir.GetLength() > 0 && m_RecordSaveDir[m_RecordSaveDir.GetLength()-1] != SPLIT_SLASH) {
|
|
|
- m_RecordSaveDir += SPLIT_SLASH_STR;
|
|
|
+ else{
|
|
|
+ char strlog[MAX_LOG_LEN] = {0};
|
|
|
+ vsnprintf(strlog, MAX_LOG_LEN, fmt, arg);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", strlog);
|
|
|
}
|
|
|
-
|
|
|
- return Error;
|
|
|
+ va_end(arg);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-ErrorCodeEnum CRecorderEntity::__OnClose(ErrorCodeEnum preOperationError)
|
|
|
-{
|
|
|
- if (preOperationError != Error_Succeed)
|
|
|
- return preOperationError;
|
|
|
-
|
|
|
- GetFunction()->UnsubscribeLog(m_SubIDStopRecord);
|
|
|
- GetFunction()->UnsubscribeLog(m_SubIDStartRecord);
|
|
|
- GetFunction()->UnsubscribeLog(m_SubIDReturnMenu);
|
|
|
-
|
|
|
- GetFunction()->UnregistSysVarEvent(SYSVAR_ACTIVETRACKINGCAMERA);
|
|
|
- GetFunction()->UnregistSysVarEvent(SYSVAR_CAMERASTATE);
|
|
|
- StopRecord();
|
|
|
- return Error_Succeed;
|
|
|
}
|
|
|
|
|
|
|
|
|
-CServerSessionBase* CRecorderEntity::OnNewSession(const char* pszRemoteEntityName, const char* pszClass)
|
|
|
+void CRecorderEntity::vDebug(record_loglevel elevel, const char* str, va_list list)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s connected class = %s!", pszRemoteEntityName, pszClass);
|
|
|
- return new RecordServiceSession(this);
|
|
|
+ if (RECORD_LOG_INFO <= elevel) {
|
|
|
+ int n = vsnprintf(NULL, 0, str, list);
|
|
|
+ if (n >= MAX_LOG_LEN) {
|
|
|
+ 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_LOG_LEN] = { 0 };
|
|
|
+ vsnprintf(strlog, MAX_LOG_LEN, str, list);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", strlog);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
int CRecorderEntity::GetActiveCamera()
|
|
@@ -244,15 +249,13 @@ int CRecorderEntity::GetCameraState()
|
|
|
void CRecorderEntity::OnRecordFailed(eRvcRecordFailedCase eCase, const char *pszMessage, bool bRecordDevFault)
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("OnRecordFailed!");
|
|
|
- if (!bRecordDevFault)
|
|
|
- {
|
|
|
+ if (!bRecordDevFault){
|
|
|
LogEvent(Severity_Middle,LOG_EVT_RECORDFAILED,"0");
|
|
|
char strmsg[MAX_PATH] = {0};
|
|
|
_snprintf(strmsg, MAX_PATH, "{%s} 本地录音录像失败,已停止!", pszMessage ? pszMessage : " ");
|
|
|
LogWarn(Severity_Low, Error_Debug, LOG_EVT_RECORDING_FAILED, strmsg);
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
+ else{
|
|
|
LogEvent(Severity_Middle,LOG_EVT_RECORDFAILED,"1");
|
|
|
char strinfo[MAX_PATH] = {0};
|
|
|
_snprintf(strinfo, MAX_PATH, "{%s} 本地录音录像设备故障,尝试恢复中(预计10s内),请稍等", pszMessage ? pszMessage : " ");
|
|
@@ -275,7 +278,6 @@ void CRecorderEntity::OnRecordFinished()
|
|
|
|
|
|
void CRecorderEntity::OnASectionFinished(const char* pszMessage, int iSerialNum, bool bfinished)
|
|
|
{
|
|
|
- // filename
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("file %s finished.(SerialNum %d)", pszMessage, iSerialNum);
|
|
|
if (false == bfinished) {
|
|
|
LogEvent(Severity_Middle, LOG_EVT_RECORDER_SECTION_FINISHED, pszMessage);
|
|
@@ -290,25 +292,48 @@ void CRecorderEntity::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLogID,
|
|
|
const DWORD dwSysError,const DWORD dwUserCode,const DWORD dwEntityInstanceID, const WORD wEntityDevelID,
|
|
|
const CAutoArray<DWORD> &Param, const char *pszEntityName, const char *pszModuleName,const char *pszMessage, const linkContext& pLinkInfo)
|
|
|
{
|
|
|
- if (/*(dwUserCode == EVENT_MOD_CUSTOMERAWARE_BEGIN)||*/(dwUserCode == EVENT_MOD_BEGIN_RECORD))
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("start record!");
|
|
|
- StartRecord(pszMessage);
|
|
|
- }
|
|
|
- else if (/*(dwUserCode == EVENT_MOD_CUSTOMERAWARE_END)||*/(dwUserCode == EVENT_MOD_END_RECORD))
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("stop record!");
|
|
|
- StopRecord();
|
|
|
- //ReleaseRecorder();
|
|
|
- }
|
|
|
- else if (dwUserCode == LOG_EVT_UI_RETURNMENU) // 返回主菜单
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("user_code = 0x%08x.", dwUserCode);
|
|
|
+ switch (dwUserCode)
|
|
|
{
|
|
|
- //本地录像,退回到首页关闭当前文件,重新开始录制
|
|
|
- if (m_bStarted&&m_pRecorder)
|
|
|
+ case EVENT_MOD_BEGIN_RECORD:
|
|
|
+ if (0 == m_iRecordMode) {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("start record!");
|
|
|
+ StartRecord(pszMessage);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ case EVENT_MOD_END_RECORD:
|
|
|
+ if (0 == m_iRecordMode) {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("stop record!");
|
|
|
+ StopRecord();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ case LOG_EVT_UI_RETURNMENU:
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("exit to main!");
|
|
|
+ if (0 == m_iRecordMode) {
|
|
|
+ //本地录像,退回到首页关闭当前文件,重新开始录制
|
|
|
+ if (m_bStarted) {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("return menu,close video file!");
|
|
|
+ m_pRecorder->CloseVideoFile();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ case LOG_EVT_RECORDER_SECTION_FINISHED:
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("recorder section finished, and message is %s.", pszMessage);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ case LOG_EVT_RECORDER_WHOLE_FINISHED:
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("return menu,close video file!");
|
|
|
- m_pRecorder->CloseVideoFile();
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("recorder whole finished, and message is %s.", pszMessage);
|
|
|
}
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -319,33 +344,26 @@ void CRecorderEntity::OnSysVarEvent(const char *pszKey, const char *pszValue,con
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("camera state from : %c to %c", pszOldValue[0], pszValue[0]);
|
|
|
m_iCameraState = pszValue[0];
|
|
|
- if (pszValue[0] == 'E')
|
|
|
- {
|
|
|
+ if (pszValue[0] == 'E'){
|
|
|
m_iActiveCamera = CAMERA_TYPE_OPT;
|
|
|
}
|
|
|
- else if (pszValue[0] == 'O')
|
|
|
- {
|
|
|
+ else if (pszValue[0] == 'O'){
|
|
|
m_iActiveCamera = CAMERA_TYPE_ENV;
|
|
|
}
|
|
|
- else if(pszValue[0] == 'B') ///////显示贴图
|
|
|
- {
|
|
|
+ else if(pszValue[0] == 'B'){
|
|
|
m_iActiveCamera = CAMERA_TYPE_ERROR;
|
|
|
}
|
|
|
- else if (pszValue[0] == 'N')
|
|
|
- {
|
|
|
- m_iActiveCamera = CAMERA_TYPE_AUTO;
|
|
|
+ else if (pszValue[0] == 'N'){
|
|
|
+ m_iActiveCamera = CAMERA_TYPE_ENV;
|
|
|
}
|
|
|
}
|
|
|
else if (_stricmp(pszKey, SYSVAR_ACTIVETRACKINGCAMERA) == 0)
|
|
|
{
|
|
|
- if (m_iCameraState == 'N')
|
|
|
- {
|
|
|
- if (pszValue[0] == 'E')
|
|
|
- {
|
|
|
+ if (m_iCameraState == 'N'){
|
|
|
+ if (pszValue[0] == 'E'){
|
|
|
m_iActiveCamera = CAMERA_TYPE_ENV;
|
|
|
}
|
|
|
- else if (pszValue[0] == 'O')
|
|
|
- {
|
|
|
+ else if (pszValue[0] == 'O'){
|
|
|
m_iActiveCamera = CAMERA_TYPE_OPT;
|
|
|
}
|
|
|
}
|
|
@@ -355,11 +373,9 @@ void CRecorderEntity::OnSysVarEvent(const char *pszKey, const char *pszValue,con
|
|
|
CSimpleStringA strSessionID;
|
|
|
GetFunction()->GetSysVar("SessionID",strSessionID);
|
|
|
//如果sessionid改变且不为空,切换录像文件
|
|
|
- if(_stricmp(strSessionID,"N")!=0)
|
|
|
- {
|
|
|
- if (m_bStarted)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Sessionid change to %s,close record and start new video file",strSessionID.GetData());
|
|
|
+ if(_stricmp(strSessionID,"N")!=0){
|
|
|
+ if (m_bStarted && (0 == m_iRecordMode)){
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Session Id change to %s, close record and start new video file.",strSessionID);
|
|
|
m_pRecorder->ReNameVideoFile(strSessionID);
|
|
|
}
|
|
|
}
|
|
@@ -369,8 +385,7 @@ void CRecorderEntity::OnSysVarEvent(const char *pszKey, const char *pszValue,con
|
|
|
|
|
|
void CRecorderEntity::OnSelfTest(EntityTestEnum eTestType,CSmartPointer<ITransactionContext> pTransactionContext)
|
|
|
{
|
|
|
- if (Test_ShakeHand == eTestType)
|
|
|
- {
|
|
|
+ if (Test_ShakeHand == eTestType){
|
|
|
pTransactionContext->SendAnswer(Error_Succeed);
|
|
|
}
|
|
|
}
|
|
@@ -379,6 +394,7 @@ void CRecorderEntity::OnSelfTest(EntityTestEnum eTestType,CSmartPointer<ITransac
|
|
|
void CRecorderEntity::StartRecord(const char *videofilename)
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("videofilename = %s", videofilename);
|
|
|
+
|
|
|
int fps = 5;
|
|
|
Rvc_RecordAudioParam_t tAudioParams;
|
|
|
tAudioParams.eRecordType = eSingleSide;
|
|
@@ -398,57 +414,58 @@ void CRecorderEntity::StartRecord(const char *videofilename)
|
|
|
|
|
|
void CRecorderEntity::StopRecord()
|
|
|
{
|
|
|
- if (m_bStarted)
|
|
|
- {
|
|
|
+ if (m_bStarted) {
|
|
|
m_pRecorder->StopVideoRecord();
|
|
|
- m_bStarted = FALSE;
|
|
|
+ m_bStarted = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
-// CAviHostAPI
|
|
|
-void CRecorderEntity::Debug(record_loglevel elevel, const char* fmt, ...)
|
|
|
+DeviceTypeEnum CRecorderEntity::RvcGetDeviceType()
|
|
|
{
|
|
|
- if (RECORD_LOG_INFO <= elevel) {
|
|
|
- va_list arg;
|
|
|
- va_start(arg, fmt);
|
|
|
- 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);
|
|
|
+ DeviceTypeEnum eType = eStand2sType;
|
|
|
+ CSmartPointer<IEntityFunction> spFunction = GetFunction();
|
|
|
+ CSystemStaticInfo stStaticinfo;
|
|
|
+ spFunction->GetSystemStaticInfo(stStaticinfo);
|
|
|
+ if (_stricmp(stStaticinfo.strMachineType, "RVC.PAD") == 0) {
|
|
|
+ if (_stricmp(stStaticinfo.strSite, "CMB.FLB") == 0) {
|
|
|
+ eType = eMobilePadType;
|
|
|
}
|
|
|
else {
|
|
|
- char strlog[MAX_PATH] = { 0 };
|
|
|
- vsnprintf(strlog, MAX_PATH, fmt, arg);
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", strlog);
|
|
|
+ eType = ePadtype;
|
|
|
}
|
|
|
- va_end(arg);
|
|
|
}
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-void CRecorderEntity::vDebug(record_loglevel elevel, const char* str, va_list list)
|
|
|
-{
|
|
|
- if (RECORD_LOG_INFO <= elevel) {
|
|
|
- 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);
|
|
|
+ else if (_stricmp(stStaticinfo.strMachineType, "RVC.Desk2S") == 0) {
|
|
|
+ eType = eDesk2SType;
|
|
|
+ WORD nMajor = stStaticinfo.MachineVersion.GetMajor();
|
|
|
+ WORD nMinor = stStaticinfo.MachineVersion.GetMinor();
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("MachineVersion is %d.%d", nMajor, nMinor);
|
|
|
+ if (2 == nMajor) {
|
|
|
+ eType = eDesk2SIntegratedType;
|
|
|
}
|
|
|
}
|
|
|
+ else if (_stricmp(stStaticinfo.strMachineType, "RPM.Stand1S") == 0) {
|
|
|
+ eType = eRpm1sType;
|
|
|
+ }
|
|
|
+ else if (_stricmp(stStaticinfo.strMachineType, "RVC.Desk1S") == 0) {
|
|
|
+ eType = eDesk1SType;
|
|
|
+ }
|
|
|
+ else if (stricmp(stStaticinfo.strMachineType, "RVC.CardStore") == 0 || stricmp(stStaticinfo.strMachineType, "RVC.CardPrinter") == 0) {
|
|
|
+ eType = eCardStore;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ eType = eStand2sType;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (eType >= 0 && eType < sizeof(Device_Type_Table) / sizeof(char*)) {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("device type is %s.", Device_Type_Table[eType]);
|
|
|
+ }
|
|
|
+
|
|
|
+ return eType;
|
|
|
}
|
|
|
|
|
|
|
|
|
SP_BEGIN_ENTITY_MAP()
|
|
|
-SP_ENTITY(CRecorderEntity)
|
|
|
+ SP_ENTITY(CRecorderEntity)
|
|
|
SP_END_ENTITY_MAP()
|
|
|
|