FGInterface Class: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
mNo edit summary
(Style edits)
Line 1: Line 1:
So, before you can act on the various elements of the interface, you have to create it.<br />
So, before you can act on the various elements of the interface, you have to create it. An interface is created by instantiating the Class '''FGInterface'''. Creating an FGInterface object requires two parameters:
An interface is created by instantiating the Class '''FGInterface'''.
Creating an FGInterface object requires two parameters:


<br />
<syntaxhighlight lang="python" inline>FGInterface(config_filename, debug_level)</syntaxhighlight>
<code>'''FGInterface'''(''config_filename'', ''debug level'')</code>
* config_file: The main configuration file (String, a file name in the "Config" directory)
<br />
* debug_level: Debug Level Value (Integer)
*config_file : The main configuration file (String, a file name in the "Config" directory)
*debug_level : Debug Level Value (Interger)
<br />
Example : Creating an interface named '''RADIOPANEL''' with a config file named '''radiopanel.cfg'''.<br />


Here is the Main Configuration File ('''''/opt/fgint/Config/radiopanel.cfg'''''):
Example: Creating an interface named '''RADIOPANEL''' with a config file named '''radiopanel.cfg'''.


<syntaxhighlight lang="ini" line start="6" highlight="1-25">
Here is the Main Configuration File (<tt>''/opt/fgint/Config/radiopanel.cfg''</tt>):
 
<syntaxhighlight lang="ini">
[INT]
[INT]
intname=RADIOPANEL
intname=RADIOPANEL
Line 27: Line 23:
Interface Création :  
Interface Création :  


<syntaxhighlight lang="python" line start="6" highlight="1-25">
<syntaxhighlight lang="python">
#!/usr/bin/env python3
#!/usr/bin/env python3


Line 44: Line 40:


INT1 = FGINT('radiopanel.cfg', 0)
INT1 = FGINT('radiopanel.cfg', 0)
</syntaxhighlight>
</syntaxhighlight>


{{WIP| Class Desciption in process}}
{{WIP| Class Desciption in process}}

Revision as of 15:49, 9 June 2017

So, before you can act on the various elements of the interface, you have to create it. An interface is created by instantiating the Class FGInterface. Creating an FGInterface object requires two parameters:

FGInterface(config_filename, debug_level)

  • config_file: The main configuration file (String, a file name in the "Config" directory)
  • debug_level: Debug Level Value (Integer)

Example: Creating an interface named RADIOPANEL with a config file named radiopanel.cfg.

Here is the Main Configuration File (/opt/fgint/Config/radiopanel.cfg):

[INT]
intname=RADIOPANEL

[MODULES]
module01=FGIntMCP23017,MCP23017
module02=FGIntHT16K33,HT16K33

[CONFFILE]
conffile01=C:\Users\david_albert\Documents\Flightgear\FarmerFGInt\fgint\Config\displays.cfg

Interface Création :

#!/usr/bin/env python3

# System Module Import
import socket
import os
import sys
import operator
import time
import struct

##############################
# Modules Import
##############################
from FGInterface import FGInterface as FGINT

INT1 = FGINT('radiopanel.cfg', 0)
WIP.png Work in progress
This article or section will be worked on in the upcoming hours or days.
Note: Class Desciption in process
See history for the latest developments.