connectivity/com.nokia.tcf/native/TCFNative/TCFServer/BaseCom.cpp
changeset 366 b054461d2f85
parent 60 9d2210c8eed2
equal deleted inserted replaced
365:666472f6d7ae 366:b054461d2f85
    21 CBaseCom::CBaseCom()
    21 CBaseCom::CBaseCom()
    22 {
    22 {
    23 #ifdef _DEBUG
    23 #ifdef _DEBUG
    24 	if (gDoLogging)
    24 	if (gDoLogging)
    25 	{
    25 	{
    26 		FILE* f = fopen("c:\\tcf\\basecommlog.txt", "at");
    26 //		FILE* f = fopen("c:\\tcf\\basecommlog.txt", "at");
    27 		fprintf(f, "CBaseCom::CBaseCom() (default constructor)\n");
    27 //		fprintf(f, "CBaseCom::CBaseCom() (default constructor)\n");
    28 		fclose(f);
    28 //		fclose(f);
    29 	}
    29 	}
    30 #endif
    30 #endif
    31 	m_isConnected = false;
    31 	m_isConnected = false;
    32 	m_pBuffer = NULL;
    32 	m_pBuffer = NULL;
    33 	m_numberBytes = 0;
    33 	m_numberBytes = 0;
    42 CBaseCom::CBaseCom(ConnectData* connectSettings, DWORD connectionId, CBaseProtocol* protocol)
    42 CBaseCom::CBaseCom(ConnectData* connectSettings, DWORD connectionId, CBaseProtocol* protocol)
    43 {
    43 {
    44 #ifdef _DEBUG
    44 #ifdef _DEBUG
    45 	if (gDoLogging)
    45 	if (gDoLogging)
    46 	{
    46 	{
    47 		FILE* f = fopen("c:\\tcf\\basecommlog.txt", "at");
    47 //		FILE* f = fopen("c:\\tcf\\basecommlog.txt", "at");
    48 		fprintf(f, "connectSettings=%x connectionId=%d, protocol=%x\n", connectSettings, connectionId, protocol);
    48 //		fprintf(f, "connectSettings=%x connectionId=%d, protocol=%x\n", connectSettings, connectionId, protocol);
    49 		fclose(f);
    49 //		fclose(f);
    50 	}
    50 	}
    51 #endif
    51 #endif
    52 	m_isConnected = false;
    52 	m_isConnected = false;
    53 	m_pBuffer = NULL;
    53 	m_pBuffer = NULL;
    54 	m_numberBytes = 0;
    54 	m_numberBytes = 0;
    61 	m_Protocol = protocol;
    61 	m_Protocol = protocol;
    62 
    62 
    63 	m_ConnectSettings = new ConnectData();
    63 	m_ConnectSettings = new ConnectData();
    64 	memcpy(m_ConnectSettings, connectSettings, sizeof(ConnectData));
    64 	memcpy(m_ConnectSettings, connectSettings, sizeof(ConnectData));
    65 
    65 
    66 #if (defined(LOG_COMM) || defined(LOG_PROCCOMM)) && defined(_DEBUG)
    66 #if defined(_DEBUG)
    67 	if (gDoLogging)
    67 	if (gDoLogging)
    68 	{
    68 	{
       
    69 #if defined(LOG_COMM)
    69 		m_CommDebugLog = new TCDebugLog("TCF_Comm", connectionId, 2000L);
    70 		m_CommDebugLog = new TCDebugLog("TCF_Comm", connectionId, 2000L);
       
    71 #else
       
    72 		m_CommDebugLog = NULL;
       
    73 #endif
       
    74 #if defined(LOG_PROCCOMM)
    70 		m_ProcDebugLog = new TCDebugLog("TCF_CommP", connectionId, 2000L);
    75 		m_ProcDebugLog = new TCDebugLog("TCF_CommP", connectionId, 2000L);
       
    76 #else
       
    77 		m_ProcDebugLog = NULL;
       
    78 #endif
    71 	}
    79 	}
    72 #endif
    80 #endif
    73 }
    81 }
    74 
    82 
    75 CBaseCom::~CBaseCom()
    83 CBaseCom::~CBaseCom()
    76 {
    84 {
    77 #ifdef _DEBUG
    85 #ifdef _DEBUG
    78 	if (gDoLogging)
    86 	if (gDoLogging)
    79 	{
    87 	{
    80 		FILE* f = fopen("c:\\tcf\\basecommlog.txt", "at");
    88 //		FILE* f = fopen("c:\\tcf\\basecommlog.txt", "at");
    81 		fprintf(f, "CBaseCom::~CBaseCom()\n");
    89 //		fprintf(f, "CBaseCom::~CBaseCom()\n");
    82 		fclose(f);
    90 //		fclose(f);
    83 	}
    91 	}
    84 #endif
    92 #endif
    85 	if (m_pBuffer)
    93 	if (m_pBuffer)
    86 		delete[] m_pBuffer;
    94 		delete[] m_pBuffer;
    87 
    95