/*----------------------------------------------------------------------------- * * Copyright 2001 - 2003 Eicon Networks Corporation * * All Rights Reserved * * This software is the property of Eicon Networks Corporation and/or its * subsidiaries ("Eicon Networks"). This copyright notice may not be removed, * modified or obliterated without the prior written permission of * Eicon Networks. * * No right, title, ownership or other interest in the software is hereby * granted or transferred. The information contained herein is subject * to change without notice and should not be construed as a commitment of * Eicon Networks. * * This application code is not part of any standard Eicon Networks product * and is provided to you solely for the purpose of assisting you in the * development of your applications with Diva Server SDK. The code is provided * "AS IS", without warranty of any kind. Eicon Networks shall not be * liable for any damages arising out of your use of this application, even * if it has been advised of the possibility of such damages. *----------------------------------------------------------------------------- * Sample for an outgoing call and sending a fax document. * * The sample shows how to connect a single call, to send a fax and to * disconnect. For every page a message is printed. * The sample is started from the command prompt. The phone number to dial * and the file to send must be specified as parameter. * * Note that this sample is designed to show very simple how to process a * single call and send a fax. Therefore the sample does not do any * error handling. *----------------------------------------------------------------------------*/ #include #ifdef WIN32 #include #endif #include #include "dssdk.h" /* * Some globals */ DivaAppHandle hApp = NULL; DivaCallHandle hSdkCall = NULL; AppCallHandle hMyCall = NULL; char FaxFile[200] = { 0 }; int exit_program = 0; void CallbackHandler ( DivaAppHandle hApp, DivaEvent Event, PVOID Param1, PVOID Param2 ) { DivaCallInfo Info; memset ( &Info, 0x00, sizeof ( Info ) ); Info.Size = sizeof ( Info ); switch (Event) { case DivaEventCallConnected: if ( DivaSendFax ( hSdkCall, FaxFile, DivaFaxFormatTIFF_ClassF ) == DivaSuccess ) { DivaGetCallInfo ( hSdkCall, &Info ); printf ( "Connected, Speed: %ld\n", Info.RxSpeed ); } else DivaDisconnect ( hSdkCall ); break; case DivaEventFaxPageSent: DivaGetCallInfo ( hSdkCall, &Info ); printf ( "Page %ld sent. Speed: %ld, ECM: %s \n", Info.dwFaxPages, Info.RxSpeed, Info.bECMActive ? "YES" : "NO" ); break; case DivaEventFaxSent: DivaGetCallInfo ( hSdkCall, &Info ); printf ( "Fax sent. Pages: %ld Speed: %ld, ECM: %s \n", Info.dwFaxPages, Info.RxSpeed, Info.bECMActive ? "YES" : "NO" ); DivaDisconnect ( hSdkCall ); break; case DivaEventCallDisconnected: hSdkCall = 0; DivaCloseCall ( Param2 ); printf ( "Disonnected\n" ); exit_program = 1; break; default: break; } } int main(int argc, char* argv[]) { int c; if ( argc < 3 ) { printf ( "USAGE: faxoutsimple \n\n" ); return -1; } strcpy ( FaxFile, argv[2] ); printf("Version: %ld.%ld, sending <%s>\n", (DivaGetVersion() >> 16) & 0xffff , DivaGetVersion() & 0xffff, FaxFile ); if (DivaInitialize() != DivaSuccess) return -1; hMyCall = (void *) 0x11223344; if ( DivaRegister ( &hApp, DivaEventModeCallback, (void *) CallbackHandler, 0, 1, 7, 2048 ) != DivaSuccess ) { return -1; } if ( DivaConnect ( hApp, hMyCall, &hSdkCall, argv[1], DivaCallTypeFax, LINEDEV_ALL ) != DivaSuccess ) return -1; printf ( "FaxOutSimple running, press to terminate\n" ); while ( 1 ) { #ifdef WIN32 c = _getch ( ); #else c = getc (stdin); #endif if ( c == 'q' ) break; if ( exit_program ) break; } printf ( "FaxOutSimple stopped\n" ); DivaUnregister ( hApp ); return ( 0 ); };