<commit_before>//------------------------------------------------------------------------------
// File: device.hpp
//
// Desc: Device factory - Manage IP Camera.
//
// Copyright (c) 2014-2018 opencvr.com All rights reserved.
//------------------------------------------------------------------------------

#ifndef __VSC_DEVICE_IMPL_H_
#define __VSC_DEVICE_IMPL_H_


inline string GetProgramDir()
{
#ifdef WIN32
    char exeFullPath[MAX_PATH]; // Full path

    string strPath = "";

    GetModuleFileNameA(NULL,exeFullPath, MAX_PATH);
    strPath=(string)exeFullPath;    // Get full path of the file

    int pos = strPath.find_last_of('\\', strPath.length());

    return strPath.substr(0, pos);  // Return the directory without the file name
#else
    return "ve/";
#endif
}


DeviceParam::DeviceParam()
{
	static int CameraNum = 0;
	memset(&m_Conf, 0, sizeof(m_Conf));
	m_Conf.data.conf.nId = 0;
	m_Conf.data.conf.nType = VSC_DEVICE_CAM;
	m_Conf.data.conf.nSubType = VSC_SUB_DEVICE_ONVIF;

	sprintf(m_Conf.data.conf.Name, "Camera");
	//strcpy(m_Conf.data.conf.Name, "CAMERA ");

	strcpy(m_Conf.data.conf.IP, "192.168.0.1");
	strcpy(m_Conf.data.conf.Port, "80");
	strcpy(m_Conf.data.conf.User, "admin");
	strcpy(m_Conf.data.conf.Password, "<PASSWORD>");

	strcpy(m_Conf.data.conf.RtspLocation, "/");
	string filePath = GetProgramDir() +  "/camera.mov";
	strcpy(m_Conf.data.conf.FileLocation, filePath.c_str());
	strcpy(m_Conf.data.conf.OnvifAddress, "/onvif/device_service");
	strcpy(m_Conf.data.conf.CameraIndex, "1");

	m_Conf.data.conf.UseProfileToken = 0;

	m_Conf.data.conf.Recording = 0;

	//TODO add default 
	m_Conf.data.conf.Mining = 0;
	m_Conf.data.conf.HWAccel = 0;
	strcpy(m_Conf.data.conf.OnvifProfileToken, "<PASSWORD>");
	strcpy(m_Conf.data.conf.OnvifProfileToken2, "<PASSWORD>");
	m_bOnvifUrlGetted = FALSE;
	m_bHasSubStream = FALSE;

}

DeviceParam::DeviceParam(VSCDeviceData &pData)
{
    memset(&m_Conf, 0, sizeof(m_Conf));

    memcpy(&m_Conf, &(pData), sizeof(m_Conf));
    //UpdateUrl();
}

inline std::string Replace(std::string &str, const char *string_to_replace, const char *new_string)
{
  // Find the first string to replace<commit_msg>add get & set param API<commit_after>//------------------------------------------------------------------------------
// File: device.hpp
//
// Desc: Device factory - Manage IP Camera.
//
// Copyright (c) 2014-2018 opencvr.com All rights reserved.
//------------------------------------------------------------------------------

#ifndef __VSC_DEVICE_IMPL_H_
#define __VSC_DEVICE_IMPL_H_


inline string GetProgramDir()
{
#ifdef WIN32
    char exeFullPath[MAX_PATH]; // Full path

    string strPath = "";

    GetModuleFileNameA(NULL,exeFullPath, MAX_PATH);
    strPath=(string)exeFullPath;    // Get full path of the file

    int pos = strPath.find_last_of('\\', strPath.length());

    return strPath.substr(0, pos);  // Return the directory without the file name
#else
    return "ve/";
#endif
}


DeviceParam::DeviceParam()
{
	static int CameraNum = 0;
	memset(&m_Conf, 0, sizeof(m_Conf));
	m_Conf.data.conf.nId = 0;
	m_Conf.data.conf.nType = VSC_DEVICE_CAM;
	m_Conf.data.conf.nSubType = VSC_SUB_DEVICE_ONVIF;

	sprintf(m_Conf.data.conf.Name, "Camera");
	//strcpy(m_Conf.data.conf.Name, "CAMERA ");

	strcpy(m_Conf.data.conf.IP, "192.168.0.1");
	strcpy(m_Conf.data.conf.Port, "80");
	strcpy(m_Conf.data.conf.User, "admin");
	strcpy(m_Conf.data.conf.Password, "<PASSWORD>");

	strcpy(m_Conf.data.conf.RtspLocation, "/");
	string filePath = GetProgramDir() +  "/camera.mov";
	strcpy(m_Conf.data.conf.FileLocation, filePath.c_str());
	strcpy(m_Conf.data.conf.OnvifAddress, "/onvif/device_service");
	strcpy(m_Conf.data.conf.CameraIndex, "1");

	m_Conf.data.conf.UseProfileToken = 0;

	m_Conf.data.conf.Recording = 0;

	//TODO add default 
	m_Conf.data.conf.Mining = 0;
	m_Conf.data.conf.HWAccel = 0;
	strcpy(m_Conf.data.conf.OnvifProfileToken, "<PASSWORD>");
	strcpy(m_Conf.data.conf.OnvifProfileToken2, "<PASSWORD>");
	m_bOnvifUrlGetted = FALSE;
	m_bHasSubStream = FALSE;
	m_bOnline = FALSE;

}

DeviceParam::DeviceParam(VSCDeviceData &pData)
{
	memset(&m_Conf, 0, sizeof(m_Conf));

	memcpy(&m_Conf, &(pData), sizeof(m_Conf));
	
	m_bOnvifUrlGetted = FALSE;
	m_bHasSubStream = FALSE;
	m_bOnline = FALSE;
}

inline std::string Replace(std::string &str, const char *string_to_replace, const char *new_string)
{
  // Find the first string to replace
{'fraction_non_alphanumeric': 0.21371971926647046, 'fraction_numerical': 0.014036676477247, 'mean_word_length': 3.148356807511737, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5299792', 'n_tokens_mistral': 1682, 'n_tokens_neox': 1612, 'n_words': 288}