#import "../SerialAndModem2.0/Modem.h"
#import <stdio.h>
#import <sys/file.h>
//
//Note that you cannot use the set notify methods here since
//there is no connection to the applkit.
//
main()
{
int ok;
id	theModem;

	theModem = [[Modem alloc] init];
	
 	ok = [theModem openRAW:"/dev/cufa" Baudrate:1200];
	[theModem setParity:NONE];
	ok = [theModem modemReset];
	if( ok == SERIALOK)
	{
			printf("calling modem dial\n");
			ok = [theModem modemDial:"276,7859" AutoBaud:YES];
			fprintf(stderr,"Modem returns %i\n",ok);
			fprintf(stderr,"modem status = %i\n",[theModem getModemStatus]);
			switch ( [theModem getModemStatus])
			{
				case IDLE:
					fprintf(stderr,"Modem IDLE\n");
					[theModem  modemHangup];
					break;
				case CONNECTED: //put your connected stuff here
					//if autobaud was yes then the port speed MAY have changed..
					fprintf(stderr,"Modem CONNECTED\n");
					fprintf(stderr,"last response from modem was\n",[theModem getLastResponse]);
					fprintf(stderr,"the modems speed is %i\n",[theModem baudrate]);
					break;
				case BUSY:
					fprintf(stderr,"Modem BUSY\n");
					[theModem  modemHangup];
					break;
				case NOCARRIER:
					fprintf(stderr,"Modem NOCARRIER\n");
					break;
				default:
					fprintf(stderr,"last response from modem was\n",[theModem getLastResponse]);
			}
	}
	[theModem closePort];
}
