⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 faxapi.cpp

📁 fax engine 传真引擎 relay fax 的开源项目 商业软件使用 高质量 高可靠
💻 CPP
📖 第 1 页 / 共 2 页
字号:
{
	CModem* pMdm = FaxApiGetModem( pModem );

	if( pMdm == NULL )
	{
		return FAXAPI_ERROR_BAD_MODEM;
	}

	if( pMdm->ThreadStarted() )
	{
		// can't change the port once the thread is started.
		return FAXAPI_ERROR_THREAD_STARTED;
	}

	pMdm->SetSendECM( bECMSupported );

	return FAXAPI_SUCCESS;
}

//////////////////////////////////////////////////////////////////////
// FaxApiSetSendFine
//////////////////////////////////////////////////////////////////////
int FAXAPI_CALL FaxApiSetSendFine( FaxApiModem pModem, bool bFineSupported )
{
	CModem* pMdm = FaxApiGetModem( pModem );

	if( pMdm == NULL )
	{
		return FAXAPI_ERROR_BAD_MODEM;
	}

	if( pMdm->ThreadStarted() )
	{
		// can't change the port once the thread is started.
		return FAXAPI_ERROR_THREAD_STARTED;
	}

	pMdm->SetSendFine( bFineSupported );

	return FAXAPI_SUCCESS;
}

//////////////////////////////////////////////////////////////////////
// FaxApiSetSendUnlimited
//////////////////////////////////////////////////////////////////////
int FAXAPI_CALL FaxApiSetSendUnlimited( FaxApiModem pModem, bool bUnlimitedSupported )
{
	CModem* pMdm = FaxApiGetModem( pModem );

	if( pMdm == NULL )
	{
		return FAXAPI_ERROR_BAD_MODEM;
	}

	if( pMdm->ThreadStarted() )
	{
		// can't change the port once the thread is started.
		return FAXAPI_ERROR_THREAD_STARTED;
	}

	pMdm->SetSendUnlimited( bUnlimitedSupported );

	return FAXAPI_SUCCESS;
}

//////////////////////////////////////////////////////////////////////
// FaxApiSetPulseDialing
//////////////////////////////////////////////////////////////////////
int FAXAPI_CALL FaxApiSetPulseDialing( FaxApiModem pModem, bool bPulseDialing )
{
	CModem* pMdm = FaxApiGetModem( pModem );

	if( pMdm == NULL )
	{
		return FAXAPI_ERROR_BAD_MODEM;
	}

	if( pMdm->ThreadStarted() )
	{
		// can't change the port once the thread is started.
		return FAXAPI_ERROR_THREAD_STARTED;
	}

	pMdm->SetPulseDialing( bPulseDialing );

	return FAXAPI_SUCCESS;
}

//////////////////////////////////////////////////////////////////////
// FaxApiEnableDebugLog
//////////////////////////////////////////////////////////////////////
int FAXAPI_CALL FaxApiEnableDebugLog( FaxApiModem pModem, bool bEnable, char* LogDirectory )
{
	CModem* pMdm = FaxApiGetModem( pModem );

	if( pMdm == NULL )
	{
		return FAXAPI_ERROR_BAD_MODEM;
	}

	if( pMdm->ThreadStarted() )
	{
		// can't change the port once the thread is started.
		return FAXAPI_ERROR_THREAD_STARTED;
	}

	pMdm->EnableDebugLog( bEnable, LogDirectory );

	return FAXAPI_SUCCESS;
}

//////////////////////////////////////////////////////////////////////
// FaxApiEnableDebugLog
//////////////////////////////////////////////////////////////////////

int FAXAPI_CALL FaxApiSetMaxPageRetries( FaxApiModem pModem, int nRetries )
{
	CModem* pMdm = FaxApiGetModem( pModem );

	if( pMdm == NULL )
	{
		return FAXAPI_ERROR_BAD_MODEM;
	}

	if( pMdm->ThreadStarted() )
	{
		// can't change the port once the thread is started.
		return FAXAPI_ERROR_THREAD_STARTED;
	}

	pMdm->SetMaxPageRetries( nRetries );

	return FAXAPI_SUCCESS;
}

//////////////////////////////////////////////////////////////////////
// FaxApiSetCSID
//////////////////////////////////////////////////////////////////////
int FAXAPI_CALL FaxApiSetCSID( FaxApiModem pModem, LPCSTR szString )
{
	CModem* pMdm = FaxApiGetModem( pModem );

	if( pMdm == NULL )
	{
		return FAXAPI_ERROR_BAD_MODEM;
	}

	if( pMdm->ThreadStarted() )
	{
		pMdm->ChangeCSID( szString );
		return FAXAPI_SUCCESS;
	}

	pMdm->SetCSID( szString );

	return FAXAPI_SUCCESS;
}

//////////////////////////////////////////////////////////////////////
// FaxApiSetSendBaud
//////////////////////////////////////////////////////////////////////
int FAXAPI_CALL FaxApiSetSendBaud( FaxApiModem pModem, int nBaud )
{
	CModem* pMdm = FaxApiGetModem( pModem );

	if( pMdm == NULL )
	{
		return FAXAPI_ERROR_BAD_MODEM;
	}

	if( pMdm->ThreadStarted() )
	{
		// can't change the port once the thread is started.
		return FAXAPI_ERROR_THREAD_STARTED;
	}

	pMdm->SetSendBaud( nBaud );

	return FAXAPI_SUCCESS;
}

//////////////////////////////////////////////////////////////////////
// FaxApiSetRecvBaud
//////////////////////////////////////////////////////////////////////
int FAXAPI_CALL FaxApiSetRecvBaud( FaxApiModem pModem, int nBaud )
{
	CModem* pMdm = FaxApiGetModem( pModem );

	if( pMdm == NULL )
	{
		return FAXAPI_ERROR_BAD_MODEM;
	}

	if( pMdm->ThreadStarted() )
	{
		// can't change the port once the thread is started.
		return FAXAPI_ERROR_THREAD_STARTED;
	}

	pMdm->SetRecvBaud( nBaud );

	return FAXAPI_SUCCESS;
}


//////////////////////////////////////////////////////////////////////
// FaxApiStartThread
//////////////////////////////////////////////////////////////////////
int FAXAPI_CALL FaxApiStartThread( FaxApiModem pModem, HANDLE hStop, DWORD faxThreadID )
{
	CModem* pMdm = FaxApiGetModem( pModem );

	if( pMdm == NULL )
	{
		return FAXAPI_ERROR_BAD_MODEM;
	}

	if( pMdm->ThreadStarted() )
	{
		// can't change the port once the thread is started.
		return FAXAPI_ERROR_THREAD_STARTED;
	}

	pMdm->Initialize( hStop, faxThreadID );

	return FAXAPI_SUCCESS;
}


//////////////////////////////////////////////////////////////////////
// FaxApiWaitForModemToExit
//////////////////////////////////////////////////////////////////////
int FAXAPI_CALL FaxApiWaitForModemToExit( FaxApiModem pModem )
{
	CModem* pMdm = FaxApiGetModem( pModem );

	if( pMdm == NULL )
	{
		return FAXAPI_ERROR_BAD_MODEM;
	}

	if( pMdm->ThreadStarted() == false)
	{
		// can't wait for the modem if isn't started
		return FAXAPI_ERROR_THREAD_STARTED;
	}

	DWORD dwResult = WaitForSingleObject( pMdm->GetHandle(), 5000 );

	if( dwResult == WAIT_OBJECT_0 )
	{
		return FAXAPI_SUCCESS;
	}
	else
	{
		return FAXAPI_ERROR_BAD_MODEM;
	}
}


//////////////////////////////////////////////////////////////////////
// FaxApiSendFax
//////////////////////////////////////////////////////////////////////
bool FAXAPI_CALL FaxApiSendFax( FaxApiModem pModem, char* szNumberToDial, char* szFaxFile )
{
	CModem* pMdm = FaxApiGetModem( pModem );

	if( pMdm == NULL )
	{
		return false;
	}

	if( pMdm->ThreadStarted() == false)
	{
		// can't wait for the modem if isn't started
		return false;
	}

	return pMdm->SendFax( szNumberToDial, szFaxFile );
}


//////////////////////////////////////////////////////////////////////
// FaxApiReceiveFax
//////////////////////////////////////////////////////////////////////
void FAXAPI_CALL FaxApiReceiveFax( FaxApiModem pModem, char* szFaxFile )
{
	CModem* pMdm = FaxApiGetModem( pModem );

	if( pMdm == NULL )
	{
		return;
	}

	if( pMdm->ThreadStarted() == false)
	{
		// can't wait for the modem if isn't started
		return;
	}

	pMdm->RecvFax( szFaxFile );
}


//////////////////////////////////////////////////////////////////////
// FaxApiAbortFax
//////////////////////////////////////////////////////////////////////
void FAXAPI_CALL FaxApiAbortFax( FaxApiModem pModem )
{
	CModem* pMdm = FaxApiGetModem( pModem );

	if( pMdm == NULL )
	{
		return;
	}

	if( pMdm->ThreadStarted() == false)
	{
		// can't abort fax if the modem isn't started
		return;
	}

	pMdm->AbortFax();
}

//////////////////////////////////////////////////////////////////////
// FaxApiDisconnect
//////////////////////////////////////////////////////////////////////
void FAXAPI_CALL FaxApiDisconnect( FaxApiModem pModem )
{
	CModem* pMdm = FaxApiGetModem( pModem );

	if( pMdm == NULL )
	{
		return;
	}

	if( pMdm->ThreadStarted() == false)
	{
		// can't abort fax if the modem isn't started
		return;
	}

	pMdm->Disconnect();
}


//////////////////////////////////////////////////////////////////////
// FaxApiClearRingCount
//////////////////////////////////////////////////////////////////////
void FAXAPI_CALL FaxApiClearRingCount( FaxApiModem pModem )
{
	CModem* pMdm = FaxApiGetModem( pModem );

	if( pMdm == NULL )
	{
		return;
	}

	if( pMdm->ThreadStarted() == false)
	{
		return;
	}

	pMdm->ClearRingCount();
}



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -