diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 8df2893194..1539d1f5ee 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -251,6 +251,11 @@ sub help_screen{ print "\nEVENTS\n\n" unless $param ne ''; help_screen_line('--event_in_progress', ' ', 'Set event in progress'); + print "\nGIS\n\n" unless $param ne ''; + help_screen_line('--get_gis_agent', ' ', 'Gets agent GIS information'); + help_screen_line('--insert_gis_data', ' [] [] []', 'Sets new GIS data for specified agent'); + + print "\n"; exit; } @@ -275,10 +280,11 @@ sub api_call($$$;$$$$) { $params->{"other"} = $other; $params->{"return_type"} = $return_type; $params->{"other_mode"} = "url_encode_separator_|"; - + # Call the API. my $ua = new LWP::UserAgent; my $url = $pa_config->{"console_api_url"}; + my $response = $ua->post($url, $params); if ($response->is_success) { @@ -8043,6 +8049,14 @@ sub pandora_manage_main ($$$) { param_check($ltotal, 4, 5); cli_agent_update_custom_fields(); } + elsif ($param eq '--get_gis_agent') { + param_check($ltotal, 1, 0); + cli_get_gis_agent(); + } + elsif ($param eq '--insert_gis_data'){ + # param_check($ltotal, 4, 0); + cli_insert_gis_data(); + } else { print_log "[ERROR] Invalid option '$param'.\n\n"; $param = ''; @@ -8763,3 +8777,32 @@ sub pandora_validate_alert_id($$$$) { return 1; } + +############################################################################## +# Get GIS data from agent +############################################################################## + +sub cli_get_gis_agent(){ + + my $agent_id = @ARGV[2]; + + my $result = api_call(\%conf,'get', 'gis_agent', $agent_id); + print "$result \n\n "; + +} + +############################################################################## +# Set GIS data for specified agent +############################################################################## + +sub cli_insert_gis_data(){ + + my ($agent_id, $latitude, $longitude, $altitude) = @ARGV[2..5]; + my $agent_id = @ARGV[2]; + my @position = @ARGV[3..5]; + my $other = join('|', @position); + + my $result = api_call(\%conf,'set', 'gis_agent_only_position', $agent_id, undef, "$other"); + print "$result \n\n "; + +} \ No newline at end of file