Howto:Implementing a simple GCA system: Difference between revisions

Jump to navigation Jump to search
m (→‎GUI frontend: validate inputs at runtime)
Line 272: Line 272:
Once the underlying script is working well enough, we can look into providing a configuration GUI on top of the script using the Canvas GUI library:  
Once the underlying script is working well enough, we can look into providing a configuration GUI on top of the script using the Canvas GUI library:  
<syntaxhighlight lang="nasal">
<syntaxhighlight lang="nasal">
var (width,height) = (320,400);
var (width,height) = (320,450);
var title = 'GCA Dialog ';
var title = 'GCA Dialog ';


Line 354: Line 354:


'Airport': func(input) {
'Airport': func(input) {
var match = airportinfo(input);
if (match == nil or typeof(match) != 'ghost') return 1;
return 0;
return 0;
},
},


Line 381: Line 385:
},  
},  


'TransmissionInterval': func(input) {
return 0;
},


'TransmissionInterval': func(input) {
'TransmissionProperty': func(input) {
return 0;
return 0;
},  
},  
Line 390: Line 397:


var inputs = [
var inputs = [
{text: 'Aircraft root', default_value:'/position', focus:1, callback:nil, tooltip:'property path', validate: 'AircraftRoot', convert:nil, unit: 'property path'},
{text: 'Position root', default_value:'/position', focus:1, callback:nil, tooltip:'property path to position node', validate: 'AircraftRoot', convert:nil, unit: 'property path'},
{text: 'Airport', default_value:'KSFO', focus:0, callback:nil, tooltip:'ICAO ID, e.g. KSFO', validate: 'Airport', convert:nil, unit:'ICAO'},
{text: 'Airport', default_value:'KSFO', focus:0, callback:nil, tooltip:'ICAO ID, e.g. KSFO', validate: 'Airport', convert:nil, unit:'ICAO'},
{text: 'Runway', default_value:'28R', focus:0, callback:nil, tooltip:'runway identifier, e.g. 28L', validate: 'Runway', convert:nil, unit:'RWY'},
{text: 'Runway', default_value:'28R', focus:0, callback:nil, tooltip:'runway identifier, e.g. 28L', validate: 'Runway', convert:nil, unit:'RWY'},
Line 401: Line 408:
{text: 'Touchdown Offset', default_value:'0.00', focus:0, callback:nil, tooltip:'touchdown offset', validate: 'TouchdownOffset', convert:nil, unit:'m'},
{text: 'Touchdown Offset', default_value:'0.00', focus:0, callback:nil, tooltip:'touchdown offset', validate: 'TouchdownOffset', convert:nil, unit:'m'},
{text: 'Transmission interval', default_value:'5.00', focus:0, callback:nil, tooltip:'Controller/timer resolution', validate: 'TransmissionInterval', convert:nil, unit:'secs'},
{text: 'Transmission interval', default_value:'5.00', focus:0, callback:nil, tooltip:'Controller/timer resolution', validate: 'TransmissionInterval', convert:nil, unit:'secs'},
{text: 'Transmission property', default_value:'/sim/messages/approach', focus:0, callback:nil, tooltip:'property to use for transmissions. For example: /sim/multiplay/chat', validate: 'TransmissionProperty', convert:nil, unit:'property'},
]; # input fields
]; # input fields


Line 442: Line 450:
setupWidgetTooltip(widget:button, tooltip: "toggle GCA on/off");
setupWidgetTooltip(widget:button, tooltip: "toggle GCA on/off");


myLayout.addItem(button);
myLayout.addItem(button);</syntaxhighlight>
</syntaxhighlight>


== Visualizing the Approach ==
== Visualizing the Approach ==

Navigation menu