Commit 4b59fad2 authored by rygelgit's avatar rygelgit

Added some more cyclic logic to come back to the main menu when performing...

Added some more cyclic logic to come back to the main menu when performing auto search and choose manual search and vice-versa.
parent 5fc37431
......@@ -39,46 +39,50 @@ use include::ActionResponseInclude;
use include::UPnPInclude;
use responsevalidator::ResponseValidator;
START:
our ($TEST_OPTION, $HOSTIP, $HOSTPORT) = '';
print "------- Choose an option -------\n";
print "1. Search DIAGE capable devices \n";
print "2. Manual DIAGE device testing \n";
print "3. Enter x to exit \n";
print "3. Exit Application \n";
print "Enter the option number : ";
our $SEARCH_OPTS = <>;
chomp $SEARCH_OPTS;
switch($SEARCH_OPTS){
case 1 {
case 1 {
my ($diage_devices, $diage_ip, $diage_port) = SearchDevices::lookup_diage_device;
print "Choose the corresponding device number to start testing: :\n";
my $diage_dev_count=0;
my $device_count=0;
print "****************************************\n";
print "****************************************\n";
foreach my $diage_temp (@$diage_devices) {
foreach my $device_temp (@$diage_devices) {
print "----------------------------------------\n";
print "[" . ($diage_dev_count + 1) . "] : " . $diage_temp->getfriendlyname() . "\n";
print "Device IP : " . @$diage_ip[$diage_dev_count] . "\n";
print "Device Port : " . @$diage_port[$diage_dev_count] . "\n";
$diage_dev_count++;
print "[" . ($device_count + 1) . "] : " . $device_temp->getfriendlyname() . "\n";
print "Device IP : " . @$diage_ip[$device_count] . "\n";
print "Device Port : " . @$diage_port[$device_count] . "\n";
$device_count++;
}
print "****************************************\n";
print "****************************************\n";
print "Choose the device number: ";
my $DEVICE_NO = <>;
chomp $DEVICE_NO;
$HOSTIP = @$diage_ip[$DEVICE_NO - 1];
$HOSTPORT = @$diage_port[$DEVICE_NO - 1];
Util::print_diagc_start;
}
case 2 {
Util::print_diagc_start;
}
case ('x') {
case 3 {
exit;
}
else { exit;}
......@@ -86,6 +90,7 @@ switch($SEARCH_OPTS){
}
while (1) {
GET_USER_OPT:
$TEST_OPTION = Util::get_user_options;
if ($SEARCH_OPTS eq '2') {
($HOSTIP, $HOSTPORT) = Util::get_manual_device_details;
......@@ -160,8 +165,8 @@ while (1) {
my $traceroute_res_response = TracerouteResponse::traceroute_response($HOSTIP, $HOSTPORT, $TESTID_INFO);
ResponseValidator::valiate_soap_response($traceroute_res_response);
}
case ('x') { exit; }
else { exit; }
case ('x') { goto START; }
else { goto GET_USER_OPT; }
}
Util::print_diagc_start;
}
......
......@@ -27,6 +27,7 @@ send(SSDP_SOCK, $ssdp_header, 0, $ssdp_multicast_msg);
my @device_list=();
my @device_addr=();
my @device_port=();
my $ssdp_response = '';
my ($reader_input, $reader_output, $ssdp_res_msg) = '';
vec($reader_input, fileno(SSDP_SOCK), 1) = 1;
......
......@@ -44,7 +44,7 @@ sub print_diagc_start {
print "9. GetNSLookupResult \n";
print "10. GetPingResult \n";
print "11. GetTracerouteResult \n";
print "x - Exit application \n";
print "x - Exit to main menu \n";
print " ---------------------\n";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment