FGInterface Class: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
Red Leader (talk | contribs) (Style edits) |
||
Line 1: | Line 1: | ||
So, before you can act on the various elements of the interface, you have to create it. | 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: | |||
< | <syntaxhighlight lang="python" inline>FGInterface(config_filename, debug_level)</syntaxhighlight> | ||
* config_file: The main configuration file (String, a file name in the "Config" directory) | |||
* 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 ( | |||
Example: Creating an interface named '''RADIOPANEL''' with a config file named '''radiopanel.cfg'''. | |||
<syntaxhighlight lang="ini | 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 | <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)
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. |