# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# bos720 src/bos/usr/sbin/install/ecc/lib/ECC/ModemListManager.pm 1.2 
#  
# Licensed Materials - Property of IBM 
#  
# Restricted Materials of IBM 
#  
# COPYRIGHT International Business Machines Corp. 2006,2007 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 
package ModemListManager;

use strict;
use lib '/usr/ecc/lib/ECC';
use Definitions;

################################################################################

sub get_type_list() {
	open MODEMLIST, "<".Definitions::MODEM_LIST or die $!;

	while ( my $line = <MODEMLIST> ) {
		my $entry = substr($line, 0, 43);
		$entry =~ s/\s+$//;
		print "$entry\n";
	}

	close MODEMLIST;
	return 0;
}

################################################################################

sub get_init_string() {
	my ($modem_type) = @_;
	my $init_string = "";

    open MODEMLIST, "<".Definitions::MODEM_LIST or die $!;
    while ( my $line = <MODEMLIST> ) {
		chomp($line);
        my $entry = substr($line, 0, 43);
        $entry =~ s/\s+$//;
		if ( $entry eq $modem_type ) {
			$init_string = substr($line, 52);
		}
    }

    close MODEMLIST;
    return $init_string;
}

################################################################################

sub get_reset_string() {
	my ($modem_type) = @_;
	my $reset_string = "";

    open MODEMLIST, "<".Definitions::MODEM_LIST or die $!;
    while ( my $line = <MODEMLIST> ) {
		chomp($line);
        my $entry = substr($line, 0, 43);
        $entry =~ s/\s+$//;
		if ( $entry eq $modem_type ) {
			$reset_string = substr($line, 44, 4);
		}
    }

    close MODEMLIST;
    return $reset_string;
}
	

1;
