<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.flightgear.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Daweed</id>
	<title>FlightGear wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.flightgear.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Daweed"/>
	<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/Special:Contributions/Daweed"/>
	<updated>2026-06-10T12:23:18Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=FGInt_Rotary_Encoder&amp;diff=135460</id>
		<title>FGInt Rotary Encoder</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=FGInt_Rotary_Encoder&amp;diff=135460"/>
		<updated>2022-09-02T22:32:36Z</updated>

		<summary type="html">&lt;p&gt;Daweed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;RotaryEncoder class will be used to manage Rotary Encoder . Based on the MCP2307.{{FG Int Objects Modules sidebar}}&lt;br /&gt;
&lt;br /&gt;
Methods explain below show how to read the encoder, but to be managed, it need a worker that will allow to read&lt;br /&gt;
&lt;br /&gt;
==Displays Configuration File==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/Pedestal/rotenc.cfg''&lt;br /&gt;
&lt;br /&gt;
This file describes the configuration of the 2 rotary encoder used on the Radio panel.&lt;br /&gt;
&lt;br /&gt;
There are two separate parts in this file.&lt;br /&gt;
#a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
#the other sections each describe a display.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=ROTARY_ENC&lt;br /&gt;
library=RotaryEncoder&lt;br /&gt;
module=RotaryEncoder&lt;br /&gt;
properylist=device,encodername,port,in1,in2,swin,initvalue,minvalue,maxvalue,increment&lt;br /&gt;
createmethod=CreateRotEncoders&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=encodername&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=in1&lt;br /&gt;
prop05=in2&lt;br /&gt;
prop06=swin&lt;br /&gt;
prop07=initvalue&lt;br /&gt;
prop08=minvalue&lt;br /&gt;
prop09=maxvalue&lt;br /&gt;
prop10=increment&lt;br /&gt;
&lt;br /&gt;
[RMP0INNER]&lt;br /&gt;
device=IOPACK2&lt;br /&gt;
encodername=rmp0inner&lt;br /&gt;
port=A&lt;br /&gt;
in1=3&lt;br /&gt;
in2=4&lt;br /&gt;
swin=0&lt;br /&gt;
initvalue=0&lt;br /&gt;
minvalue=0&lt;br /&gt;
maxvalue=360&lt;br /&gt;
increment=1&lt;br /&gt;
&lt;br /&gt;
[RMP0OUTER]&lt;br /&gt;
device=IOPACK2&lt;br /&gt;
encodername=rmp0outer&lt;br /&gt;
port=A&lt;br /&gt;
in1=1&lt;br /&gt;
in2=2&lt;br /&gt;
swin=0&lt;br /&gt;
initvalue=0&lt;br /&gt;
minvalue=0&lt;br /&gt;
maxvalue=360&lt;br /&gt;
increment=1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===CONF Section===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
*'''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
*'''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
*'''module''' : Module name (Class name) in the library file that will be loaded.&lt;br /&gt;
*'''propertylist''' : List of parameter that are needed to create a '''display''' object.&lt;br /&gt;
*'''createmethod''' : Method from FG interface Class that will be used to create '''display''' objects.&lt;br /&gt;
'''''propertylist''''' and '''''createmethod''''' are '''deprecated''' and will be removed in the next release.&lt;br /&gt;
===PROPERTIES Section===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt '''RotaryEncoder''' in that case, take some parameters to create a display object, as like Number of digit, Common of the fist digit ... etc). This is how the interface will be able to understand and use the displays configurations to create them.&lt;br /&gt;
&lt;br /&gt;
In Segment Display, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device    # Device Logical Name&lt;br /&gt;
prop02=name      # Display Name&lt;br /&gt;
prop03=port      # MCP23017 Pins port&lt;br /&gt;
prop04=in1       # MCP23017 Rotary Encoder input1 pin&lt;br /&gt;
prop05=in2       # MCP23017 Rotary Encoder input2 pin&lt;br /&gt;
prop06=swin      # MCP23017 Rotary Encoder Switch input pin (if any, set 0 if none or not used)&lt;br /&gt;
prop07=initvalue # Rotary Encoder Initial value &lt;br /&gt;
prop08=minvalue  # Rotary Encoder minimal value&lt;br /&gt;
prop09=maxvalue  # Rotary Encoder maxvalue&lt;br /&gt;
prop10=increment # Rotary Encoder increment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
==Creating Rotary Encoder==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;SegDisplay&amp;quot; in the '''RotaryEncoder.py'''&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class RotaryEncoder:&lt;br /&gt;
    # Just the encoder, no switch, no LEDs&lt;br /&gt;
&lt;br /&gt;
    def __init__(self, device, encodername, port, in1, in2, swin, initvalue, minvalue, maxvalue, increment, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;here how Segment display should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a 7 segment display with this class you have to call :&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
RotaryEncoder(device, encodername, port, in1, in2, swin, initvalue, minvalue, maxvalue, increment, debug=0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
==Rotary Encoder Methods==&lt;br /&gt;
===getName()===&lt;br /&gt;
Returns the rotary encoder name according to you configuration.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0INNER = FGINT1.getElement('RMP0INNER')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0INNER.getName()&lt;br /&gt;
'rmp0inner'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===get_delta()===&lt;br /&gt;
&lt;br /&gt;
Return delta information when moving the rotary encoder. That allow to detect if rotary have been turn clockwise or counter-clockwiser&lt;br /&gt;
&lt;br /&gt;
Turning clockwise&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
fgint@fgintovhd:~ $ python3&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0INNER = FGINT1.getElement('RMP0INNER')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0INNER.get_delta()&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0INNER.get_delta()&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Turning counter-clockwise&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0INNER.get_delta()&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0INNER.get_delta()&lt;br /&gt;
-1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===get_switchstate()===&lt;br /&gt;
Return the switch pin state defined for the rotary encoder (if any) according to your configuration.&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
fgint@fgintovhd:~ $ python3&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0INNER = FGINT1.getElement('RMP0INNER')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0INNER.get_switchstate()&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Encoder button pushed&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0INNER.get_switchstate()&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rotary Encoder Worker ==&lt;br /&gt;
So as explain before, rotary encoder are not directly manage throught the RotaryEncoder Class but with a worker that will create a thread dedicate to the rotary encoder which will read regulary the rotary encoder state regarding the main loop state.&lt;br /&gt;
&lt;br /&gt;
Rotary Encoder Worker is created in the main script and we will see how later, but for now here all methods that you will need to manage rotary encoder&lt;br /&gt;
&lt;br /&gt;
== Rotary Encoder Worker Methods ==&lt;br /&gt;
&lt;br /&gt;
=== run() ===&lt;br /&gt;
start the rotary encoder worker (mandatory before reading the rotary encoder)&lt;br /&gt;
&lt;br /&gt;
=== get_delta() ===&lt;br /&gt;
Return delta information when moving the rotary encoder. That allow to detect if rotary have been turn clockwise or counter-clockwiser&lt;br /&gt;
&lt;br /&gt;
=== getValue() ===&lt;br /&gt;
Return the rotary encoder value&lt;br /&gt;
&lt;br /&gt;
=== setValue() ===&lt;br /&gt;
Set the rotary encoder value (can be used if needed to réinitialize the encoder value)&lt;br /&gt;
&lt;br /&gt;
=== getMinValue() ===&lt;br /&gt;
Return the minimum value&lt;br /&gt;
&lt;br /&gt;
=== getMaxValue() ===&lt;br /&gt;
Return the maximal value&lt;br /&gt;
&lt;br /&gt;
=== getIncrement() ===&lt;br /&gt;
Return increment value&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=FGInt_Rotary_Encoder&amp;diff=135459</id>
		<title>FGInt Rotary Encoder</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=FGInt_Rotary_Encoder&amp;diff=135459"/>
		<updated>2022-09-02T19:07:32Z</updated>

		<summary type="html">&lt;p&gt;Daweed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FG Int Objects Modules sidebar}}&lt;br /&gt;
&lt;br /&gt;
RotaryEncoder class will be used to manage Rotary Encoder . Based on the MCP2307.&lt;br /&gt;
&lt;br /&gt;
==Displays Configuration File==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/Pedestal/rotenc.cfg''&lt;br /&gt;
&lt;br /&gt;
This file describes the configuration of the 2 rotary encoder used on the Radio panel.&lt;br /&gt;
&lt;br /&gt;
There are two separate parts in this file.&lt;br /&gt;
#a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
#the other sections each describe a display.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=ROTARY_ENC&lt;br /&gt;
library=RotaryEncoder&lt;br /&gt;
module=RotaryEncoder&lt;br /&gt;
properylist=device,encodername,port,in1,in2,swin,initvalue,minvalue,maxvalue,increment&lt;br /&gt;
createmethod=CreateRotEncoders&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=encodername&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=in1&lt;br /&gt;
prop05=in2&lt;br /&gt;
prop06=swin&lt;br /&gt;
prop07=initvalue&lt;br /&gt;
prop08=minvalue&lt;br /&gt;
prop09=maxvalue&lt;br /&gt;
prop10=increment&lt;br /&gt;
&lt;br /&gt;
[RMP0INNER]&lt;br /&gt;
device=IOPACK2&lt;br /&gt;
encodername=rmp0inner&lt;br /&gt;
port=A&lt;br /&gt;
in1=3&lt;br /&gt;
in2=4&lt;br /&gt;
swin=0&lt;br /&gt;
initvalue=0&lt;br /&gt;
minvalue=0&lt;br /&gt;
maxvalue=360&lt;br /&gt;
increment=1&lt;br /&gt;
&lt;br /&gt;
[RMP0OUTER]&lt;br /&gt;
device=IOPACK2&lt;br /&gt;
encodername=rmp0outer&lt;br /&gt;
port=A&lt;br /&gt;
in1=1&lt;br /&gt;
in2=2&lt;br /&gt;
swin=0&lt;br /&gt;
initvalue=0&lt;br /&gt;
minvalue=0&lt;br /&gt;
maxvalue=360&lt;br /&gt;
increment=1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===CONF Section===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
*'''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
*'''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
*'''module''' : Module name (Class name) in the library file that will be loaded.&lt;br /&gt;
*'''propertylist''' : List of parameter that are needed to create a '''display''' object.&lt;br /&gt;
*'''createmethod''' : Method from FG interface Class that will be used to create '''display''' objects.&lt;br /&gt;
'''''propertylist''''' and '''''createmethod''''' are '''deprecated''' and will be removed in the next release.&lt;br /&gt;
===PROPERTIES Section===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt '''RotaryEncoder''' in that case, take some parameters to create a display object, as like Number of digit, Common of the fist digit ... etc). This is how the interface will be able to understand and use the displays configurations to create them.&lt;br /&gt;
&lt;br /&gt;
In Segment Display, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device    # Device Logical Name&lt;br /&gt;
prop02=name      # Display Name&lt;br /&gt;
prop03=port      # MCP23017 Pins port&lt;br /&gt;
prop04=in1       # MCP23017 Rotary Encoder input1 pin&lt;br /&gt;
prop05=in2       # MCP23017 Rotary Encoder input2 pin&lt;br /&gt;
prop06=swin      # MCP23017 Rotary Encoder Switch input pin (if any)&lt;br /&gt;
prop07=initvalue # Rotary Encoder Initial value &lt;br /&gt;
prop08=minvalue  # Rotary Encoder minimal value&lt;br /&gt;
prop09=maxvalue  # Rotary Encoder maxvalue&lt;br /&gt;
prop10=increment # Rotary Encoder increment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
==Creating Displays==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;SegDisplay&amp;quot; in the '''RotaryEncoder.py'''&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class RotaryEncoder:&lt;br /&gt;
    # Just the encoder, no switch, no LEDs&lt;br /&gt;
&lt;br /&gt;
    def __init__(self, device, encodername, port, in1, in2, swin, initvalue, minvalue, maxvalue, increment, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;here how Segment display should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a 7 segment display with this class you have to call :&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
RotaryEncoder(device, encodername, port, in1, in2, swin, initvalue, minvalue, maxvalue, increment, debug=0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
==Rotary Encoder Methods==&lt;br /&gt;
===getName()===&lt;br /&gt;
Returns the rotary encoder name according to you configuration.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
fgint@fgintovhd:~ $ python3&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===get_delta()===&lt;br /&gt;
Return delta information when moving the rotary encoder. That allow to detect if rotary have been turn clockwise or counter-clockwiser&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
fgint@fgintovhd:~ $ python3&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===get_switchstate()===&lt;br /&gt;
Return the switch pin state defined for the rotary encoder (if any) according to your configuration.&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
fgint@fgintovhd:~ $ python3&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=FGInt_Rotary_Encoder&amp;diff=135458</id>
		<title>FGInt Rotary Encoder</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=FGInt_Rotary_Encoder&amp;diff=135458"/>
		<updated>2022-09-02T18:53:09Z</updated>

		<summary type="html">&lt;p&gt;Daweed: Page Creation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FG Int Objects Modules sidebar}}&lt;br /&gt;
&lt;br /&gt;
Segments displays Class '''''SegDisplay''''' will be used to manage 7 segments digit displays. Based on the HT16K33, this Class will let you manage a full displays up to 8 digits per displays.&lt;br /&gt;
&lt;br /&gt;
==Displays Configuration File==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/RadioPanel/displays.cfg''&lt;br /&gt;
&lt;br /&gt;
This file describes the configuration of the 7-segment displays of the radio panel.&lt;br /&gt;
&lt;br /&gt;
There are two separate parts in this file.&lt;br /&gt;
#a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
#the other sections each describe a display.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=DISPLAYS&lt;br /&gt;
library=FGIntSegDisplay&lt;br /&gt;
module=SegDisplay&lt;br /&gt;
properylist=device,dispname,nbdigit,port,com1,decdigit&lt;br /&gt;
createmethod=createDisplays&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=nbdigit&lt;br /&gt;
prop04=port&lt;br /&gt;
prop05=com1&lt;br /&gt;
prop06=decdigit&lt;br /&gt;
&lt;br /&gt;
[ACTVFREQ]&lt;br /&gt;
name=ACTVFREQ&lt;br /&gt;
device=LEDPACK1&lt;br /&gt;
nbdigit=6&lt;br /&gt;
com1=1&lt;br /&gt;
port=B&lt;br /&gt;
decdigit=3&lt;br /&gt;
&lt;br /&gt;
[STBYFREQ]&lt;br /&gt;
name=STBYFREQ&lt;br /&gt;
device=LEDPACK1&lt;br /&gt;
nbdigit=6&lt;br /&gt;
com1=1&lt;br /&gt;
port=A&lt;br /&gt;
decdigit=3&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===CONF Section===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
*'''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
*'''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
*'''module''' : Module name (Class name) in the library file that will be loaded.&lt;br /&gt;
*'''propertylist''' : List of parameter that are needed to create a '''display''' object.&lt;br /&gt;
*'''createmethod''' : Method from FG interface Class that will be used to create '''display''' objects.&lt;br /&gt;
'''''propertylist''''' and '''''createmethod''''' are '''deprecated''' and will be removed in the next release.&lt;br /&gt;
===PROPERTIES Section===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Segment Display in that case, take some parameters to create a display object, as like Number of digit, Common of the fist digit ... etc). This is how the interface will be able to understand and use the displays configurations to create them.&lt;br /&gt;
&lt;br /&gt;
In Segment Display, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device   # Device Logical Name&lt;br /&gt;
prop02=name     # Display Name&lt;br /&gt;
prop03=nbdigit  # Number of Digits that make up the display&lt;br /&gt;
prop04=port     # HT16K33 Port that will own the display&lt;br /&gt;
prop05=com1     # First Common that will be used for the first digit. Other common will be determined with the digit number.&lt;br /&gt;
prop06=decdigit # Digit number where should be the dot.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
==Creating Displays==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;SegDisplay&amp;quot; in the '''FGIntSegDisplay.py'''&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class SegDisplay:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    This class allow Segment Display management&lt;br /&gt;
    based on hardware driver HT16K33&lt;br /&gt;
    Copyright FarmerSoft © 2017&lt;br /&gt;
    By Daweed&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
    digitnumber = {&lt;br /&gt;
        '0': 0x3F, '1': 0x06, '2': 0x5B, '3': 0x4F,&lt;br /&gt;
        '4': 0x66, '5': 0x6D, '6': 0x7D, '7': 0x07,&lt;br /&gt;
        '8': 0x7F, '9': 0x6F, 'A': 0x77, 'B': 0x7C,&lt;br /&gt;
        'C': 0x39, 'D': 0x5E, 'E': 0x79, 'F': 0x71,&lt;br /&gt;
        '-': 0x40, 'S': 0x6D, 't': 0x78, 'd': 0x5e,&lt;br /&gt;
        ' ' : 0x00&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, nbdigit, port, com1, decdigit, debug=0)&lt;br /&gt;
    .....&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;here how Segment display should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a 7 segment display with this class you have to call :&amp;lt;syntaxhighlight lang=&amp;quot;code&amp;quot;&amp;gt;&lt;br /&gt;
SegDisplay(device, name, nbdigit, port, com1, decdigit, [debug]) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
==Segments Displays Methods==&lt;br /&gt;
===getName()===&lt;br /&gt;
Returns the display name according to you configuration.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
daweed@farmerfgint:/opt/fgint $ python3&lt;br /&gt;
Python 3.4.2 (default, Oct 19 2014, 13:31:11) &lt;br /&gt;
[GCC 4.9.1] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; STBYFREQ = FGINT1.getElement('STBYFREQ')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; print(STBYFREQ)&lt;br /&gt;
&amp;lt;FGIntSegDisplay.SegDisplay object at 0x76939a50&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; STBYFREQ.getName()&lt;br /&gt;
'STBYFREQ'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getType()===&lt;br /&gt;
Return display type.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Oct 19 2014, 13:31:11) &lt;br /&gt;
[GCC 4.9.1] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; STBYFREQ = FGINT1.getElement('STBYFREQ')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; print(STBYFREQ)&lt;br /&gt;
&amp;lt;FGIntSegDisplay.SegDisplay object at 0x768a8190&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; STBYFREQ.getType()&lt;br /&gt;
'Segment Display'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getDigitNumer()===&lt;br /&gt;
Return the number of digit defined for the display according to your configuration.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Oct 19 2014, 13:31:11) &lt;br /&gt;
[GCC 4.9.1] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; STBYFREQ = FGINT1.getElement('STBYFREQ')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; print(STBYFREQ)&lt;br /&gt;
&amp;lt;FGIntSegDisplay.SegDisplay object at 0x768a8190&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; STBYFREQ.getDigitNumber()&lt;br /&gt;
6&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getStatus()===&lt;br /&gt;
Return the display status&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Oct 19 2014, 13:31:11) &lt;br /&gt;
[GCC 4.9.1] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; STBYFREQ = FGINT1.getElement('STBYFREQ')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; STBYFREQ.getStatus()&lt;br /&gt;
'OFF'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===setStatus(status)===&lt;br /&gt;
Set the Status display. status is 'ON' of 'OFF'&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Oct 19 2014, 13:31:11) &lt;br /&gt;
[GCC 4.9.1] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; STBYFREQ = FGINT1.getElement('STBYFREQ')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; STBYFREQ.getStatus()&lt;br /&gt;
'OFF'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; STBYFREQ.setStatus('ON')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; STBYFREQ.getStatus()&lt;br /&gt;
'ON'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===listDigitsRegister()===&lt;br /&gt;
Return display digit list according to your configuration&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Oct 19 2014, 13:31:11) &lt;br /&gt;
[GCC 4.9.1] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; STBYFREQ = FGINT1.getElement('STBYFREQ')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; STBYFREQ.listDigitsRegister()&lt;br /&gt;
# Digit 1 à l'adresse 0x0&lt;br /&gt;
&lt;br /&gt;
# Digit 2 à l'adresse 0x2&lt;br /&gt;
&lt;br /&gt;
# Digit 3 à l'adresse 0x4&lt;br /&gt;
&lt;br /&gt;
# Digit 4 à l'adresse 0x6&lt;br /&gt;
&lt;br /&gt;
# Digit 5 à l'adresse 0x8&lt;br /&gt;
&lt;br /&gt;
# Digit 6 à l'adresse 0xa&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getDigitRegister(digit)===&lt;br /&gt;
Return register address for the '''''digit'''''. Here we are getting digit register address for digit number 1, 2 and 3.&lt;br /&gt;
&lt;br /&gt;
'''Except for development or debugging''', there is no reason to invoke this method directly. It is a system method internal to the operation of the driver.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Oct 19 2014, 13:31:11) &lt;br /&gt;
[GCC 4.9.1] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; STBYFREQ = FGINT1.getElement('STBYFREQ')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; print(hex(STBYFREQ.getDigitRegister(1))) # Digit Nb 3 is at address 0x02&lt;br /&gt;
0x1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; print(hex(STBYFREQ.getDigitRegister(2))) # Digit Nb 3 is at address 0x03&lt;br /&gt;
0x3&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; print(hex(STBYFREQ.getDigitRegister(3))) # Digit Nb 3 is at address 0x05&lt;br /&gt;
0x5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===writeDigit(digit, value, decimal)===&lt;br /&gt;
Send '''''value'&amp;lt;nowiki/&amp;gt;''' on the digit number '''''digit'''''. If decimal is set to 1, the dot on segement display digit will be on.''&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Oct 19 2014, 13:31:11) &lt;br /&gt;
[GCC 4.9.1] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LEDPACK1 = FGINT1.getDevice('LEDPACK1')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; STBYFREQ = FGINT1.getElement('STBYFREQ')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LEDPACK1.configMCP(1)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LEDPACK1.Start()&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; STBYFREQ.writeDigit(1, 2, 0) # will display '2' on digit number 1, Digit Number 1 is the first from the left (counting from left to right)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; STBYFREQ.writeDigit(2,'-', 0) # will display a - on digit 2. Pay attention that the value have been set bewteen '', important if not a number&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; STBYFREQ.writeDigit(3, 8, 1) # will display '8' on digit number 3, dot activated&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[File:FGInt WriteDigit Method.png|WriteDigit Method, Segment display object exemple|link=https://wiki.flightgear.org/File:FGInt_WriteDigit_Method.png]]&lt;br /&gt;
&lt;br /&gt;
'''Pay attention that display have been connected with the first digit on the left'''&lt;br /&gt;
===writeDisplay(value, decimal)===&lt;br /&gt;
Will send '''''value''''' to display. If you need to send decimal value (Ex Frequency like 123.456), '''''decimal''''' need to be set to 1.&lt;br /&gt;
&lt;br /&gt;
For a decimal value, dot need to be remove before calling this methode. For Displaying 123.456 frequency , value need to be '''''123456'''''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Oct 19 2014, 13:31:11) &lt;br /&gt;
[GCC 4.9.1] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LEDPACK1 = FGINT1.getDevice('LEDPACK1')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; STBYFREQ = FGINT1.getElement('STBYFREQ')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LEDPACK1.configMCP(1)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LEDPACK1.Start()&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; STBYFREQ.writeDisplay(str('123.456').replace('.', ''), 1)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=ToogleSwitch_Class&amp;diff=135457</id>
		<title>ToogleSwitch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=ToogleSwitch_Class&amp;diff=135457"/>
		<updated>2022-09-02T18:49:56Z</updated>

		<summary type="html">&lt;p&gt;Daweed: Side Bar Update&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar|Name=GUI Navbar|title=FG Int Switches Classes|content1=* [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]|content9='''Navigation'''&lt;br /&gt;
* [[FG Int Objects Modules]]&lt;br /&gt;
* [[FG interface]]|contentstyle=text-align: left;}}&lt;br /&gt;
&lt;br /&gt;
Switches Class '''''ToogleSwitch''''' will be used to manage standard push button (momentary switch - only 1 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
&lt;br /&gt;
==Switches Configuration File==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/Pedestal/tglswitches.cfg''&lt;br /&gt;
&lt;br /&gt;
This file describes the '''TRANSFERT''' push button on the '''RMP Panel''' installed on the '''Pedestal'''.&lt;br /&gt;
&lt;br /&gt;
There are two separate parts in this file.&lt;br /&gt;
#a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
#the other sections each describe a display.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=TGLSWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=ToogleSwitch&lt;br /&gt;
properylist=device,name,port,pin,values,valuestype,initstate,checknode,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=initstate&lt;br /&gt;
prop08=checknode&lt;br /&gt;
prop09=node&lt;br /&gt;
&lt;br /&gt;
[RMP0TRSW]&lt;br /&gt;
name=rmp0trsw&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
port=B&lt;br /&gt;
pin=1&lt;br /&gt;
values=0,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
initstate=0&lt;br /&gt;
checknode=0&lt;br /&gt;
node=/fgint/radiopanel/rmp[0]/transfersw&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===CONF Section===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
*'''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
*'''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
*'''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''Switch''' Class&lt;br /&gt;
*'''propertylist''' : List of parameter that are needed to create a '''switch''' object.&lt;br /&gt;
===PROPERTIES Section===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt '''ToogleSwitches''' in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin         # MCP23017 input where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=initstate   # Value for initial state&lt;br /&gt;
prop07=checknode   # Actually not use. Set to 0&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
==Creating Switches==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;'''Switch'''&amp;quot; in the '''FGIntSwitch.py'''&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class ToogleSwitch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    Toogle Switch&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin, values, valuestype, initstate, checknode, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;here how switches should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a toogle switch with this class you have to call :&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
ToogleSwitch(device, name, port, pin, values, valuestype, initstate, checknode, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
==Toogle Switches Methods==&lt;br /&gt;
===getName()===&lt;br /&gt;
Return the switch Name according the configuration&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW = FGINT1.getElement('RMP0TRSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getName()&lt;br /&gt;
'rmp0trsw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getMillis()===&lt;br /&gt;
Return number of milisecond spent between the current time and the time define in the timestamp switch property. The timestamp property is updated internaly each time the toogle switch state change.&lt;br /&gt;
&lt;br /&gt;
Remember that it's the toogle switch state that is sent to sim, not the pin state. Each time the pin is set to 1, the switch state is updated.&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW = FGINT1.getElement('RMP0TRSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getMillis()&lt;br /&gt;
35940.058&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getMillis()&lt;br /&gt;
37063.936&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getMillis()&lt;br /&gt;
38351.924&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getMillis()&lt;br /&gt;
39441.908&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getMillis()&lt;br /&gt;
47510.832&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;as you can see, invoking the '''getMillis()''' methode without doing anything, the value still grow&lt;br /&gt;
&lt;br /&gt;
===getValueType()===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW = FGINT1.getElement('RMP0TRSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getValueType() ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW = FGINT1.getElement('RMP0TRSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getNode()===&lt;br /&gt;
&lt;br /&gt;
Return the node that is manage by the switch according the configuration file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW = FGINT1.getElement('RMP0TRSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getNode()&lt;br /&gt;
'/fgint/radiopanel/rmp[0]/transfersw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getTypedData()===&lt;br /&gt;
Return the typed value given as agument according to what have been set in the '''''valuestype''''' property&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW = FGINT1.getElement('RMP0TRSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getTypedData('1')&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getTypedData('0')&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getInputState()===&lt;br /&gt;
Return the actual pin state of the switch by reading the I/O Device&lt;br /&gt;
&lt;br /&gt;
Button released&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW = FGINT1.getElement('RMP0TRSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getInputState()&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Button maintained pushed&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getInputState()&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getSwitchState()===&lt;br /&gt;
Return the actual state of the switch&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW = FGINT1.getElement('RMP0PWSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getSwitchState()&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Set the switch 'On' on the panel&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'1'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getSwitchState()&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Combined with the value typing function&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ToogleState()===&lt;br /&gt;
&lt;br /&gt;
Flip the switch state according to configuration value&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW = FGINT1.getElement('RMP0PWSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getSwitchState()&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.ToogleState()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getSwitchState()&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.ToogleState()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getSwitchState()&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=RotarySwitch_Class&amp;diff=135456</id>
		<title>RotarySwitch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=RotarySwitch_Class&amp;diff=135456"/>
		<updated>2022-09-02T18:49:37Z</updated>

		<summary type="html">&lt;p&gt;Daweed: Side Bar Update&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar|Name=GUI Navbar|title=FG Int Switches Classes|content1=* [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]|content9='''Navigation'''&lt;br /&gt;
* [[FG Int Objects Modules]]&lt;br /&gt;
* [[FG interface]]|contentstyle=text-align: left;}}&lt;br /&gt;
&lt;br /&gt;
Switches Class '''''RotarySwitch''''' will be used to manage standard and binary rotary switches. &lt;br /&gt;
&lt;br /&gt;
'''''Standard Rotary Switc'''''h are one to one :  one position , one pin active.&lt;br /&gt;
&lt;br /&gt;
'''''Binary Rotary Switch''''' give binary code regarding the position.&lt;br /&gt;
&lt;br /&gt;
Number of input depend on how many position you need&lt;br /&gt;
==Rotary Switches Configuration File==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/EfisPanel/rotswitches.cfg''&lt;br /&gt;
&lt;br /&gt;
This file describes the rotary switches configuration that setup the ND modeused on the A320 / A330 EFIS panels. '''It's a standard rotary switch''' (bincode propoerty is set to 0)&lt;br /&gt;
&lt;br /&gt;
Values to send to simulator for this switch are :&lt;br /&gt;
*'''ils''' for '''ils mode'''&lt;br /&gt;
*'''vor''' for '''vor mode'''&lt;br /&gt;
*'''nav''' for '''nav mode'''&lt;br /&gt;
*'''arc''' for '''arc mode'''&lt;br /&gt;
*'''plan''' for '''plan mode'''&lt;br /&gt;
There are two separate parts in this file.&lt;br /&gt;
#a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
#the other sections each describe a display.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=ROTSWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=RotarySwitch&lt;br /&gt;
properylist=device,name,nbpos,pins,values,valuestype,node,bincode&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=nbpos&lt;br /&gt;
prop04=pins&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=node&lt;br /&gt;
prop08=bincode&lt;br /&gt;
&lt;br /&gt;
[EFIS0ROSERSW]&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
name=efis0rosersw&lt;br /&gt;
nbpos=5&lt;br /&gt;
pins=B5,B4,B3,B2,B1&lt;br /&gt;
values=ils,vor,nav,arc,plan&lt;br /&gt;
valuestype=str&lt;br /&gt;
node=None&lt;br /&gt;
bincode=0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===CONF Section===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
*'''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
*'''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
*'''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''''RotarySwitch''''' Class&lt;br /&gt;
*'''propertylist''' : List of parameter that are needed to create a '''''rotary''' '''switch''''' object.&lt;br /&gt;
===PROPERTIES Section===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt RotarySwitch in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Rotary Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=nbpos       # Number of position to manage&lt;br /&gt;
prop04=pins        # MCP23017 input list where the switch is connected (format is portpin Ex : B5 is pin 5 on port B)&lt;br /&gt;
prop05=values      # Values sent in position order seperate by coma (pos1val, pos2val, pos3val ... etc)&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
==Creating Switches==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;'''RotarySwitch'''&amp;quot; in the '''FGIntSwitch.py'''&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class RotarySwitch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    Rotary Switch&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, nbpos, pins, values, valuestype, node, bincode, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;here how double switches should be instantiated: To create a double switch with this class you have to call :&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
RotarySwitch(device, name, nbpos, pins, values, valuestype, node, bincode, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
==Switches Methods==&lt;br /&gt;
===getName()===&lt;br /&gt;
Return the switch Name according the configuration&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getName()&lt;br /&gt;
'efis0rosersw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getPins'''()''' ===&lt;br /&gt;
Return the input list defined in the configuration&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getPins()&lt;br /&gt;
{0: {'port': 'B', 'pin': '5'}, 1: {'port': 'B', 'pin': '4'}, 2: {'port': 'B', 'pin': '3'}, 3: {'port': 'B', 'pin': '2'}, 4: {'port': 'B', 'pin': '1'}}&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getValues() ===&lt;br /&gt;
Return values tab&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getValues()&lt;br /&gt;
['ils', 'vor', 'nav', 'arc', 'plan']&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getValueType()===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getValueType()&lt;br /&gt;
'str'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getNode()===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file. Node property is not used actually, but could be used to create protocol xml file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getNode()&lt;br /&gt;
'None'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getSwitchState()===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&lt;br /&gt;
Rotary switch on ''''ILS'''&amp;lt;nowiki/&amp;gt;' position&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getSwitchState()&lt;br /&gt;
'ils'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=DoubleSwitch_Class&amp;diff=135455</id>
		<title>DoubleSwitch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=DoubleSwitch_Class&amp;diff=135455"/>
		<updated>2022-09-02T18:49:20Z</updated>

		<summary type="html">&lt;p&gt;Daweed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar|title=FG Int Switches Classes|content1=* [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]|content9='''Navigation'''&lt;br /&gt;
* [[FG Int Objects Modules]]&lt;br /&gt;
* [[FG interface]]|contentstyle=text-align: left;|name=GUI Navbar}}&lt;br /&gt;
&lt;br /&gt;
Switches Class '''''DoubleSwitch''''' will be used to manage standard 3 position switches (2 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
==Double Switches Configuration File==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/OverHeadPanel/dblswitches.cfg''&lt;br /&gt;
&lt;br /&gt;
This file describes the '''double switch''' Strobe Light configuration used on the External &amp;amp; Internal Light panel on the Overhead.&lt;br /&gt;
&lt;br /&gt;
Values to send to simulator for this switch are : &lt;br /&gt;
&lt;br /&gt;
* 0 for '''off'''&lt;br /&gt;
* 0.5 for '''auto'''&lt;br /&gt;
* 1 for '''on'''&lt;br /&gt;
&lt;br /&gt;
There are two separate parts in this file.&lt;br /&gt;
#a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
#the other sections each describe a display.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=DBLSWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=DoubleSwitch&lt;br /&gt;
properylist=device,name,port,pin1,pin2,values,valuestype,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin1&lt;br /&gt;
prop05=pin2&lt;br /&gt;
prop06=values&lt;br /&gt;
prop07=valuestype&lt;br /&gt;
prop08=node&lt;br /&gt;
&lt;br /&gt;
[LTSSTROBESW]&lt;br /&gt;
name=ltstrobesw&lt;br /&gt;
device=IOPACK5&lt;br /&gt;
port=A&lt;br /&gt;
pin1=8&lt;br /&gt;
pin2=7&lt;br /&gt;
values=0,0.5,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===CONF Section===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
*'''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
*'''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
*'''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''DoubleSwitch''' Class&lt;br /&gt;
*'''propertylist''' : List of parameter that are needed to create a '''double''' '''switch''' object.&lt;br /&gt;
===PROPERTIES Section===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin1        # MCP23017 input1 where the switch is connected&lt;br /&gt;
prop04=pin2        # MCP23017 input2 where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state (order is pin state dependant : pin1=1 &amp;amp; pin2=0 =&amp;gt; value1,  pin1=0 &amp;amp; pin2=0 =&amp;gt; value2, pin1=0 &amp;amp; pin2=1 =&amp;gt; value3)&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=invert      # Describe if the input need to be manage inverted [ activate = 0 ]&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
==Creating Switches==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;'''DoubleSwitch'''&amp;quot; in the '''FGIntSwitch.py'''&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class DoubleSwitch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin1, pin2, values, valuestype, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;here how double switches should be instantiated&lt;br /&gt;
&lt;br /&gt;
To create a double switch with this class you have to call :&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
DoubleSwitch(device, name, port, pin1, pin2, values, valuestype, invert, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
==Switches Methods==&lt;br /&gt;
===getName()===&lt;br /&gt;
Return the switch Name according the configuration&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getName()&lt;br /&gt;
'ltstrobesw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getValueType()===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getNode()===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file. Node property is not used actually, but could be used to create protocol xml file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getNode()&lt;br /&gt;
'None'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getTypedData()===&lt;br /&gt;
Return the typed value given as agument according to what have been set in the '''''valuestype''''' property&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData('0')&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData('1')&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getSwitchState()===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&lt;br /&gt;
Double Switch in postiion 1&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Double Switch in postiion 2&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0.5'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Double Switch in postiion 3&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getSwitchState()&lt;br /&gt;
'1'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Combined with the value typing function&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData(LTSSTROBESW.getSwitchState()) # Switch in position 1&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData(LTSSTROBESW.getSwitchState()) # Switch in position 2&lt;br /&gt;
0.5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData(LTSSTROBESW.getSwitchState()) # Switch in position 3&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=135454</id>
		<title>Switch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=135454"/>
		<updated>2022-09-02T18:48:59Z</updated>

		<summary type="html">&lt;p&gt;Daweed: Side Bar Update&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar&lt;br /&gt;
| name	= GUI Navbar&lt;br /&gt;
| title = FG Int Switches Classes&lt;br /&gt;
| contentstyle = text-align: left;&lt;br /&gt;
| content1 = * [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]&lt;br /&gt;
| content9 = '''Navigation'''&lt;br /&gt;
* [[FG Int Objects Modules]]&lt;br /&gt;
* [[FG interface]]&lt;br /&gt;
}}&lt;br /&gt;
Switches Class '''''Switch''''' will be used to manage standard 2 position switches (only 1 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
&lt;br /&gt;
== Switches Configuration File ==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/RadioPanel/switches.cfg''&lt;br /&gt;
&lt;br /&gt;
Values to send to simulator for this switch are : &lt;br /&gt;
&lt;br /&gt;
* 0 for '''off'''&lt;br /&gt;
* 1 for '''on'''&lt;br /&gt;
&lt;br /&gt;
This file describes the 2 positions switches configuration used on the radio panel.&amp;lt;br /&amp;gt;There are two separate parts in this file.&lt;br /&gt;
&lt;br /&gt;
# a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
# the other sections each describe a display.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=SWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=Switch&lt;br /&gt;
properylist=device,name,port,pin,values,valuestype,invert,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=invert&lt;br /&gt;
prop08=node&lt;br /&gt;
&lt;br /&gt;
[RMP0PSW]&lt;br /&gt;
name=rmp0psw&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
port=A&lt;br /&gt;
pin=2&lt;br /&gt;
values=0,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
invert=0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CONF Section ===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
* '''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
* '''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
* '''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''Switch''' Class&lt;br /&gt;
* '''propertylist''' : List of parameter that are needed to create a '''switch''' object.&lt;br /&gt;
&lt;br /&gt;
=== PROPERTIES Section ===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin         # MCP23017 input where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=invert      # Describe if the input need to be manage inverted [ activate = 0 ]&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
&lt;br /&gt;
== Creating Switches ==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;'''Switch'''&amp;quot; in the '''FGIntSwitch.py'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class Switch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin, values, valuestype, invert, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here how switches should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a switch with this class you have to call :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;code&amp;quot;&amp;gt;&lt;br /&gt;
Switch(device, name, port, pin, values, valuestype, invert, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
&lt;br /&gt;
== Switches Methods ==&lt;br /&gt;
=== getName() ===&lt;br /&gt;
Return the switch Name according the configuration&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getName()&lt;br /&gt;
'rmp0psw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getValueType() ===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getNode() ===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getNode()&lt;br /&gt;
'None'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getTypedData() ===&lt;br /&gt;
Return the typed value given as agument according to what have been set in the '''''valuestype''''' property&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(0)&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(1)&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getSwitchState() ===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW = FGINT1.getElement('RMP0PWSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Set the switch 'On' on the panel&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'1'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Combined with the value typing function &amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=FGInt_Switches&amp;diff=135453</id>
		<title>FGInt Switches</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=FGInt_Switches&amp;diff=135453"/>
		<updated>2022-09-02T18:48:34Z</updated>

		<summary type="html">&lt;p&gt;Daweed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar&lt;br /&gt;
| name	= GUI Navbar&lt;br /&gt;
| title = FG Int Switches Classes&lt;br /&gt;
| contentstyle = text-align: left;&lt;br /&gt;
| content1 = * [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]&lt;br /&gt;
| content9 = '''Navigation'''&lt;br /&gt;
* [[FG Int Objects Modules]]&lt;br /&gt;
* [[FG interface]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
'''''Switches''''' classes will be used to manage standard switches and is based on the MCP23017 chipset.&lt;br /&gt;
Switches classes are grouped in the '''FGIntSwitch''' library. With this library you will be able to manage :&lt;br /&gt;
* [[Switch Class ]]: used to manage standard switch 2 positions&lt;br /&gt;
* [[ DoubleSwitch Class ]]: used to manage standard switch 3 positions&lt;br /&gt;
*  [[RotarySwitch Class]] : used to manage rotary switch with n positions&lt;br /&gt;
*  [[ToogleSwitch Class]] : used to manage push button switch (momentary switch)&lt;br /&gt;
&lt;br /&gt;
[[Category:FG Interface]]&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=RotarySwitch_Class&amp;diff=135452</id>
		<title>RotarySwitch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=RotarySwitch_Class&amp;diff=135452"/>
		<updated>2022-09-02T18:47:05Z</updated>

		<summary type="html">&lt;p&gt;Daweed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar|Name=GUI Navbar|title=FG Int Switches Classes|content1=* [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]|content9='''Navigation'''&lt;br /&gt;
* [[FG interface]]|contentstyle=text-align: left;}}&lt;br /&gt;
&lt;br /&gt;
Switches Class '''''RotarySwitch''''' will be used to manage standard and binary rotary switches. &lt;br /&gt;
&lt;br /&gt;
'''''Standard Rotary Switc'''''h are one to one :  one position , one pin active.&lt;br /&gt;
&lt;br /&gt;
'''''Binary Rotary Switch''''' give binary code regarding the position.&lt;br /&gt;
&lt;br /&gt;
Number of input depend on how many position you need&lt;br /&gt;
==Rotary Switches Configuration File==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/EfisPanel/rotswitches.cfg''&lt;br /&gt;
&lt;br /&gt;
This file describes the rotary switches configuration that setup the ND modeused on the A320 / A330 EFIS panels. '''It's a standard rotary switch''' (bincode propoerty is set to 0)&lt;br /&gt;
&lt;br /&gt;
Values to send to simulator for this switch are :&lt;br /&gt;
*'''ils''' for '''ils mode'''&lt;br /&gt;
*'''vor''' for '''vor mode'''&lt;br /&gt;
*'''nav''' for '''nav mode'''&lt;br /&gt;
*'''arc''' for '''arc mode'''&lt;br /&gt;
*'''plan''' for '''plan mode'''&lt;br /&gt;
There are two separate parts in this file.&lt;br /&gt;
#a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
#the other sections each describe a display.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=ROTSWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=RotarySwitch&lt;br /&gt;
properylist=device,name,nbpos,pins,values,valuestype,node,bincode&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=nbpos&lt;br /&gt;
prop04=pins&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=node&lt;br /&gt;
prop08=bincode&lt;br /&gt;
&lt;br /&gt;
[EFIS0ROSERSW]&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
name=efis0rosersw&lt;br /&gt;
nbpos=5&lt;br /&gt;
pins=B5,B4,B3,B2,B1&lt;br /&gt;
values=ils,vor,nav,arc,plan&lt;br /&gt;
valuestype=str&lt;br /&gt;
node=None&lt;br /&gt;
bincode=0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===CONF Section===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
*'''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
*'''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
*'''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''''RotarySwitch''''' Class&lt;br /&gt;
*'''propertylist''' : List of parameter that are needed to create a '''''rotary''' '''switch''''' object.&lt;br /&gt;
===PROPERTIES Section===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt RotarySwitch in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Rotary Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=nbpos       # Number of position to manage&lt;br /&gt;
prop04=pins        # MCP23017 input list where the switch is connected (format is portpin Ex : B5 is pin 5 on port B)&lt;br /&gt;
prop05=values      # Values sent in position order seperate by coma (pos1val, pos2val, pos3val ... etc)&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
==Creating Switches==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;'''RotarySwitch'''&amp;quot; in the '''FGIntSwitch.py'''&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class RotarySwitch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    Rotary Switch&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, nbpos, pins, values, valuestype, node, bincode, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;here how double switches should be instantiated: To create a double switch with this class you have to call :&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
RotarySwitch(device, name, nbpos, pins, values, valuestype, node, bincode, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
==Switches Methods==&lt;br /&gt;
===getName()===&lt;br /&gt;
Return the switch Name according the configuration&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getName()&lt;br /&gt;
'efis0rosersw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getPins'''()''' ===&lt;br /&gt;
Return the input list defined in the configuration&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getPins()&lt;br /&gt;
{0: {'port': 'B', 'pin': '5'}, 1: {'port': 'B', 'pin': '4'}, 2: {'port': 'B', 'pin': '3'}, 3: {'port': 'B', 'pin': '2'}, 4: {'port': 'B', 'pin': '1'}}&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getValues() ===&lt;br /&gt;
Return values tab&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getValues()&lt;br /&gt;
['ils', 'vor', 'nav', 'arc', 'plan']&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getValueType()===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getValueType()&lt;br /&gt;
'str'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getNode()===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file. Node property is not used actually, but could be used to create protocol xml file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getNode()&lt;br /&gt;
'None'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getSwitchState()===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&lt;br /&gt;
Rotary switch on ''''ILS'''&amp;lt;nowiki/&amp;gt;' position&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getSwitchState()&lt;br /&gt;
'ils'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=ToogleSwitch_Class&amp;diff=135451</id>
		<title>ToogleSwitch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=ToogleSwitch_Class&amp;diff=135451"/>
		<updated>2022-09-02T18:46:42Z</updated>

		<summary type="html">&lt;p&gt;Daweed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar|Name=GUI Navbar|title=FG Int Switches Classes|content1=* [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]|content9='''Navigation'''&lt;br /&gt;
* [[FG interface]]|contentstyle=text-align: left;}}&lt;br /&gt;
&lt;br /&gt;
Switches Class '''''ToogleSwitch''''' will be used to manage standard push button (momentary switch - only 1 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
&lt;br /&gt;
==Switches Configuration File==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/Pedestal/tglswitches.cfg''&lt;br /&gt;
&lt;br /&gt;
This file describes the '''TRANSFERT''' push button on the '''RMP Panel''' installed on the '''Pedestal'''.&lt;br /&gt;
&lt;br /&gt;
There are two separate parts in this file.&lt;br /&gt;
#a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
#the other sections each describe a display.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=TGLSWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=ToogleSwitch&lt;br /&gt;
properylist=device,name,port,pin,values,valuestype,initstate,checknode,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=initstate&lt;br /&gt;
prop08=checknode&lt;br /&gt;
prop09=node&lt;br /&gt;
&lt;br /&gt;
[RMP0TRSW]&lt;br /&gt;
name=rmp0trsw&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
port=B&lt;br /&gt;
pin=1&lt;br /&gt;
values=0,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
initstate=0&lt;br /&gt;
checknode=0&lt;br /&gt;
node=/fgint/radiopanel/rmp[0]/transfersw&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===CONF Section===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
*'''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
*'''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
*'''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''Switch''' Class&lt;br /&gt;
*'''propertylist''' : List of parameter that are needed to create a '''switch''' object.&lt;br /&gt;
===PROPERTIES Section===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt '''ToogleSwitches''' in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin         # MCP23017 input where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=initstate   # Value for initial state&lt;br /&gt;
prop07=checknode   # Actually not use. Set to 0&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
==Creating Switches==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;'''Switch'''&amp;quot; in the '''FGIntSwitch.py'''&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class ToogleSwitch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    Toogle Switch&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin, values, valuestype, initstate, checknode, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;here how switches should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a toogle switch with this class you have to call :&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
ToogleSwitch(device, name, port, pin, values, valuestype, initstate, checknode, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
==Toogle Switches Methods==&lt;br /&gt;
===getName()===&lt;br /&gt;
Return the switch Name according the configuration&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW = FGINT1.getElement('RMP0TRSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getName()&lt;br /&gt;
'rmp0trsw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getMillis()===&lt;br /&gt;
Return number of milisecond spent between the current time and the time define in the timestamp switch property. The timestamp property is updated internaly each time the toogle switch state change.&lt;br /&gt;
&lt;br /&gt;
Remember that it's the toogle switch state that is sent to sim, not the pin state. Each time the pin is set to 1, the switch state is updated.&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW = FGINT1.getElement('RMP0TRSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getMillis()&lt;br /&gt;
35940.058&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getMillis()&lt;br /&gt;
37063.936&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getMillis()&lt;br /&gt;
38351.924&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getMillis()&lt;br /&gt;
39441.908&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getMillis()&lt;br /&gt;
47510.832&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;as you can see, invoking the '''getMillis()''' methode without doing anything, the value still grow&lt;br /&gt;
&lt;br /&gt;
===getValueType()===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW = FGINT1.getElement('RMP0TRSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getValueType() ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW = FGINT1.getElement('RMP0TRSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getNode()===&lt;br /&gt;
&lt;br /&gt;
Return the node that is manage by the switch according the configuration file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW = FGINT1.getElement('RMP0TRSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getNode()&lt;br /&gt;
'/fgint/radiopanel/rmp[0]/transfersw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getTypedData()===&lt;br /&gt;
Return the typed value given as agument according to what have been set in the '''''valuestype''''' property&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW = FGINT1.getElement('RMP0TRSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getTypedData('1')&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getTypedData('0')&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getInputState()===&lt;br /&gt;
Return the actual pin state of the switch by reading the I/O Device&lt;br /&gt;
&lt;br /&gt;
Button released&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW = FGINT1.getElement('RMP0TRSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getInputState()&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Button maintained pushed&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getInputState()&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getSwitchState()===&lt;br /&gt;
Return the actual state of the switch&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW = FGINT1.getElement('RMP0PWSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getSwitchState()&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Set the switch 'On' on the panel&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'1'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getSwitchState()&lt;br /&gt;
0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Combined with the value typing function&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ToogleState()===&lt;br /&gt;
&lt;br /&gt;
Flip the switch state according to configuration value&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW = FGINT1.getElement('RMP0PWSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getSwitchState()&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.ToogleState()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getSwitchState()&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.ToogleState()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getSwitchState()&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=ToogleSwitch_Class&amp;diff=135450</id>
		<title>ToogleSwitch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=ToogleSwitch_Class&amp;diff=135450"/>
		<updated>2022-09-02T17:45:38Z</updated>

		<summary type="html">&lt;p&gt;Daweed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar|Name=GUI Navbar|title=FG Int Switches Classes|content1=* [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]|content9='''Navigation'''&lt;br /&gt;
* [[FG interface]]|contentstyle=text-align: left;}}&lt;br /&gt;
&lt;br /&gt;
Switches Class '''''ToogleSwitch''''' will be used to manage standard push button (momentary switch - only 1 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
&lt;br /&gt;
==Switches Configuration File==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/Pedestal/tglswitches.cfg''&lt;br /&gt;
&lt;br /&gt;
This file describes the '''TRANSFERT''' push button on the '''RMP Panel''' installed on the '''Pedestal'''.&lt;br /&gt;
&lt;br /&gt;
There are two separate parts in this file.&lt;br /&gt;
#a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
#the other sections each describe a display.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=TGLSWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=ToogleSwitch&lt;br /&gt;
properylist=device,name,port,pin,values,valuestype,initstate,checknode,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=initstate&lt;br /&gt;
prop08=checknode&lt;br /&gt;
prop09=node&lt;br /&gt;
&lt;br /&gt;
[RMP0TRSW]&lt;br /&gt;
name=rmp0trsw&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
port=B&lt;br /&gt;
pin=1&lt;br /&gt;
values=0,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
initstate=0&lt;br /&gt;
checknode=0&lt;br /&gt;
node=/fgint/radiopanel/rmp[0]/transfersw&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===CONF Section===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
*'''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
*'''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
*'''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''Switch''' Class&lt;br /&gt;
*'''propertylist''' : List of parameter that are needed to create a '''switch''' object.&lt;br /&gt;
===PROPERTIES Section===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin         # MCP23017 input where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=initstate   # Value for initial state&lt;br /&gt;
prop07=checknode   # Actually not use. Set to 0&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
==Creating Switches==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;'''Switch'''&amp;quot; in the '''FGIntSwitch.py'''&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class ToogleSwitch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    Toogle Switch&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin, values, valuestype, initstate, checknode, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;here how switches should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a toogle switch with this class you have to call :&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
ToogleSwitch(device, name, port, pin, values, valuestype, initstate, checknode, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
==Toogle Switches Methods==&lt;br /&gt;
===getName()===&lt;br /&gt;
Return the switch Name according the configuration&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW = FGINT1.getElement('RMP0TRSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getName()&lt;br /&gt;
'rmp0trsw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getMillis()===&lt;br /&gt;
Return number of milisecond spent between the current time and the time define in the timestamp switch property. The timestamp property is updated internaly each time the toogle switch state change.&lt;br /&gt;
&lt;br /&gt;
Remember that it's the toogle switch state that is sent to sim, not the pin state. Each time the pin is set to 1, the switch state is updated.&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW = FGINT1.getElement('RMP0TRSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getMillis()&lt;br /&gt;
35940.058&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getMillis()&lt;br /&gt;
37063.936&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getMillis()&lt;br /&gt;
38351.924&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getMillis()&lt;br /&gt;
39441.908&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getMillis()&lt;br /&gt;
47510.832&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;as you can see, invoking the '''getMillis()''' methode without doing anything, the value still grow&lt;br /&gt;
&lt;br /&gt;
===getValueType()===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW = FGINT1.getElement('RMP0TRSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getValueType() ===&lt;br /&gt;
&lt;br /&gt;
===getNode()===&lt;br /&gt;
&lt;br /&gt;
Return the node that is manage by the switch according the configuration file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW = FGINT1.getElement('RMP0TRSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0TRSW.getNode()&lt;br /&gt;
'/fgint/radiopanel/rmp[0]/transfersw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getTypedData()===&lt;br /&gt;
Return the typed value given as agument according to what have been set in the '''''valuestype''''' property&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(0)&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(1)&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getInputState()===&lt;br /&gt;
Return the actual pin state of the switch by reading the I/O Device&lt;br /&gt;
&lt;br /&gt;
===getSwitchState()===&lt;br /&gt;
Return the actual state of the switch&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW = FGINT1.getElement('RMP0PWSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Set the switch 'On' on the panel&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'1'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Combined with the value typing function&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===setSwitchState()===&lt;br /&gt;
Set the switch state&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW = FGINT1.getElement('RMP0PWSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ToogleSwitch()===&lt;br /&gt;
Flip the switch state according to configuration value&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW = FGINT1.getElement('RMP0PWSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=ToogleSwitch_Class&amp;diff=135449</id>
		<title>ToogleSwitch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=ToogleSwitch_Class&amp;diff=135449"/>
		<updated>2022-09-02T16:32:22Z</updated>

		<summary type="html">&lt;p&gt;Daweed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar|Name=GUI Navbar|title=FG Int Switches Classes|content1=* [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]|content9='''Navigation'''&lt;br /&gt;
* [[FG interface]]|contentstyle=text-align: left;}}&lt;br /&gt;
&lt;br /&gt;
Switches Class '''''ToogleSwitch''''' will be used to manage standard push button (momentary switch - only 1 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
&lt;br /&gt;
==Switches Configuration File==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/Pedestal/tglswitches.cfg''&lt;br /&gt;
&lt;br /&gt;
This file describes the '''IDENT''' push button on the '''ATC Panel'''.&lt;br /&gt;
&lt;br /&gt;
There are two separate parts in this file.&lt;br /&gt;
#a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
#the other sections each describe a display.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=TGLSWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=ToogleSwitch&lt;br /&gt;
properylist=device,name,port,pin,values,valuestype,initstate,checknode,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=initstate&lt;br /&gt;
prop08=checknode&lt;br /&gt;
prop09=node&lt;br /&gt;
&lt;br /&gt;
[ATCIDENTSW]&lt;br /&gt;
name=ATCIDENTSW&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
port=B&lt;br /&gt;
pin=8&lt;br /&gt;
values=0,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
initstate=0&lt;br /&gt;
checknode=0&lt;br /&gt;
node=/fgint/pedestal/atcpanel/ident&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===CONF Section===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
*'''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
*'''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
*'''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''Switch''' Class&lt;br /&gt;
*'''propertylist''' : List of parameter that are needed to create a '''switch''' object.&lt;br /&gt;
===PROPERTIES Section===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin         # MCP23017 input where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=initstate   # Value for initial state&lt;br /&gt;
prop07=checknode   # Actually not use. Set to 0&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
==Creating Switches==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;'''Switch'''&amp;quot; in the '''FGIntSwitch.py'''&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class ToogleSwitch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    Toogle Switch&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin, values, valuestype, initstate, checknode, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;here how switches should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a toogle switch with this class you have to call :&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
ToogleSwitch(device, name, port, pin, values, valuestype, initstate, checknode, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
==Switches Methods==&lt;br /&gt;
===getName()===&lt;br /&gt;
Return the switch Name according the configuration&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getName()&lt;br /&gt;
'rmp0psw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getMillis()===&lt;br /&gt;
Return number of milisecond spent between the current time and the time define in the timestamp switch property. The timestamp property is updated internaly each time the toogle switch state change.&lt;br /&gt;
&lt;br /&gt;
Remember that it's the toogle switch state that is sent to sim, not the pin state. Each time the pin is set to 1, the switch state is updated&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getName()&lt;br /&gt;
'rmp0psw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getValueType()===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getTypeData()===&lt;br /&gt;
Return the typed value given as agument according to what have been set in the '''''valuestype''''' property&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getNode()===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getNode()&lt;br /&gt;
'None'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getTypedData()===&lt;br /&gt;
Return the typed value given as agument according to what have been set in the '''''valuestype''''' property&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(0)&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(1)&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getInputState()===&lt;br /&gt;
Return the actual pin state of the switch by reading the I/O Device&lt;br /&gt;
&lt;br /&gt;
===getSwitchState()===&lt;br /&gt;
Return the actual state of the switch&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW = FGINT1.getElement('RMP0PWSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Set the switch 'On' on the panel&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'1'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Combined with the value typing function&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===setSwitchState()===&lt;br /&gt;
Set the switch state&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW = FGINT1.getElement('RMP0PWSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ToogleSwitch()===&lt;br /&gt;
Flip the switch state according to configuration value&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW = FGINT1.getElement('RMP0PWSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=ToogleSwitch_Class&amp;diff=135448</id>
		<title>ToogleSwitch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=ToogleSwitch_Class&amp;diff=135448"/>
		<updated>2022-09-02T16:30:55Z</updated>

		<summary type="html">&lt;p&gt;Daweed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar|title=FG Int Switches Classes|name=GUI Navbar|contentstyle=text-align: left;|content1=* [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]|content9='''Navigation'''&lt;br /&gt;
* [[FG interface]]}}&lt;br /&gt;
&lt;br /&gt;
Switches Class '''''ToogleSwitch''''' will be used to manage standard push button (momentary switch - only 1 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
&lt;br /&gt;
==Switches Configuration File==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/Pedestal/tglswitches.cfg''&lt;br /&gt;
&lt;br /&gt;
This file describes the '''IDENT''' push button on the '''ATC Panel'''.&lt;br /&gt;
&lt;br /&gt;
There are two separate parts in this file.&lt;br /&gt;
#a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
#the other sections each describe a display.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=TGLSWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=ToogleSwitch&lt;br /&gt;
properylist=device,name,port,pin,values,valuestype,initstate,checknode,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=initstate&lt;br /&gt;
prop08=checknode&lt;br /&gt;
prop09=node&lt;br /&gt;
&lt;br /&gt;
[ATCIDENTSW]&lt;br /&gt;
name=ATCIDENTSW&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
port=B&lt;br /&gt;
pin=8&lt;br /&gt;
values=0,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
initstate=0&lt;br /&gt;
checknode=0&lt;br /&gt;
node=/fgint/pedestal/atcpanel/ident&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===CONF Section===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
*'''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
*'''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
*'''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''Switch''' Class&lt;br /&gt;
*'''propertylist''' : List of parameter that are needed to create a '''switch''' object.&lt;br /&gt;
===PROPERTIES Section===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin         # MCP23017 input where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=initstate   # Value for initial state&lt;br /&gt;
prop07=checknode   # Actually not use. Set to 0&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
==Creating Switches==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;'''Switch'''&amp;quot; in the '''FGIntSwitch.py'''&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class ToogleSwitch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    Toogle Switch&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin, values, valuestype, initstate, checknode, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;here how switches should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a toogle switch with this class you have to call :&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
ToogleSwitch(device, name, port, pin, values, valuestype, initstate, checknode, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
==Switches Methods==&lt;br /&gt;
===getName()===&lt;br /&gt;
Return the switch Name according the configuration&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getName()&lt;br /&gt;
'rmp0psw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getMillis()===&lt;br /&gt;
Return number of milisecond spent between the current time and the time define in the timestamp switch property. The timestamp property is updated internaly each time the toogle switch state change.&lt;br /&gt;
&lt;br /&gt;
Remember that it's the toogle switch state that is sent to sim, not the pin state. Each time the pin is set to 1, the switch state is updated&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getName()&lt;br /&gt;
'rmp0psw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getValueType()===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getTypeData()===&lt;br /&gt;
Return the typed value given as agument according to what have been set in the '''''valuestype''''' property&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getNode()===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getNode()&lt;br /&gt;
'None'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getTypedData()===&lt;br /&gt;
Return the typed value given as agument according to what have been set in the '''''valuestype''''' property&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(0)&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(1)&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getInputState()===&lt;br /&gt;
Return the actual pin state of the switch by reading the I/O Device&lt;br /&gt;
&lt;br /&gt;
===getSwitchState()===&lt;br /&gt;
Return the actual state of the switch&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW = FGINT1.getElement('RMP0PWSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Set the switch 'On' on the panel&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'1'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Combined with the value typing function&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===setSwitchState()===&lt;br /&gt;
Set the switch state&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW = FGINT1.getElement('RMP0PWSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ToogleSwitch()===&lt;br /&gt;
Flip the switch state according to configuration value&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW = FGINT1.getElement('RMP0PWSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=ToogleSwitch_Class&amp;diff=135447</id>
		<title>ToogleSwitch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=ToogleSwitch_Class&amp;diff=135447"/>
		<updated>2022-09-02T16:30:36Z</updated>

		<summary type="html">&lt;p&gt;Daweed: Page Creation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Switches Class '''''ToogleSwitch''''' will be used to manage standard push button (momentary switch - only 1 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
&lt;br /&gt;
{{Sidebar|title=FG Int Switches Classes|name=GUI Navbar|contentstyle=text-align: left;|content1=* [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]|content9='''Navigation'''&lt;br /&gt;
* [[FG interface]]}}&lt;br /&gt;
&lt;br /&gt;
==Switches Configuration File==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/Pedestal/tglswitches.cfg''&lt;br /&gt;
&lt;br /&gt;
This file describes the '''IDENT''' push button on the '''ATC Panel'''.&lt;br /&gt;
&lt;br /&gt;
There are two separate parts in this file.&lt;br /&gt;
#a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
#the other sections each describe a display.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=TGLSWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=ToogleSwitch&lt;br /&gt;
properylist=device,name,port,pin,values,valuestype,initstate,checknode,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=initstate&lt;br /&gt;
prop08=checknode&lt;br /&gt;
prop09=node&lt;br /&gt;
&lt;br /&gt;
[ATCIDENTSW]&lt;br /&gt;
name=ATCIDENTSW&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
port=B&lt;br /&gt;
pin=8&lt;br /&gt;
values=0,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
initstate=0&lt;br /&gt;
checknode=0&lt;br /&gt;
node=/fgint/pedestal/atcpanel/ident&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===CONF Section===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
*'''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
*'''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
*'''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''Switch''' Class&lt;br /&gt;
*'''propertylist''' : List of parameter that are needed to create a '''switch''' object.&lt;br /&gt;
===PROPERTIES Section===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin         # MCP23017 input where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=initstate   # Value for initial state&lt;br /&gt;
prop07=checknode   # Actually not use. Set to 0&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
==Creating Switches==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;'''Switch'''&amp;quot; in the '''FGIntSwitch.py'''&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class ToogleSwitch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    Toogle Switch&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin, values, valuestype, initstate, checknode, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;here how switches should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a toogle switch with this class you have to call :&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
ToogleSwitch(device, name, port, pin, values, valuestype, initstate, checknode, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
==Switches Methods==&lt;br /&gt;
===getName()===&lt;br /&gt;
Return the switch Name according the configuration&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getName()&lt;br /&gt;
'rmp0psw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getMillis()===&lt;br /&gt;
Return number of milisecond spent between the current time and the time define in the timestamp switch property. The timestamp property is updated internaly each time the toogle switch state change.&lt;br /&gt;
&lt;br /&gt;
Remember that it's the toogle switch state that is sent to sim, not the pin state. Each time the pin is set to 1, the switch state is updated&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getName()&lt;br /&gt;
'rmp0psw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getValueType()===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getTypeData()===&lt;br /&gt;
Return the typed value given as agument according to what have been set in the '''''valuestype''''' property&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getNode()===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getNode()&lt;br /&gt;
'None'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getTypedData()===&lt;br /&gt;
Return the typed value given as agument according to what have been set in the '''''valuestype''''' property&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(0)&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(1)&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getInputState()===&lt;br /&gt;
Return the actual pin state of the switch by reading the I/O Device&lt;br /&gt;
&lt;br /&gt;
===getSwitchState()===&lt;br /&gt;
Return the actual state of the switch&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW = FGINT1.getElement('RMP0PWSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Set the switch 'On' on the panel&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'1'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Combined with the value typing function&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===setSwitchState()===&lt;br /&gt;
Set the switch state&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW = FGINT1.getElement('RMP0PWSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ToogleSwitch()===&lt;br /&gt;
Flip the switch state according to configuration value&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW = FGINT1.getElement('RMP0PWSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=RotarySwitch_Class&amp;diff=135446</id>
		<title>RotarySwitch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=RotarySwitch_Class&amp;diff=135446"/>
		<updated>2022-09-02T15:42:39Z</updated>

		<summary type="html">&lt;p&gt;Daweed: Typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar|Name=GUI Navbar|title=FG Int Switches Classes|content1=* [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]|content9='''Navigation'''&lt;br /&gt;
* [[FG interface]]|contentstyle=text-align: left;}}&lt;br /&gt;
&lt;br /&gt;
Switches Class '''''RotarySwitch''''' will be used to manage standard and binary rotary switches. &lt;br /&gt;
&lt;br /&gt;
'''''Standard Rotary Switc'''''h are one to one :  one position , one pin active.&lt;br /&gt;
&lt;br /&gt;
'''''Binary Rotary Switch''''' give binary code regarding the position.&lt;br /&gt;
&lt;br /&gt;
Number of input depend on how many position you need&lt;br /&gt;
==Rotary Switches Configuration File==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/EfisPanel/rotswitches.cfg''&lt;br /&gt;
&lt;br /&gt;
This file describes the rotary switches configuration that setup the ND modeused on the A320 / A330 EFIS panels. '''It's a standard rotary switch''' (bincode propoerty is set to 0)&lt;br /&gt;
&lt;br /&gt;
Values to send to simulator for this switch are :&lt;br /&gt;
*'''ils''' for '''ils mode'''&lt;br /&gt;
*'''vor''' for '''vor mode'''&lt;br /&gt;
*'''nav''' for '''nav mode'''&lt;br /&gt;
*'''arc''' for '''arc mode'''&lt;br /&gt;
*'''plan''' for '''plan mode'''&lt;br /&gt;
There are two separate parts in this file.&lt;br /&gt;
#a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
#the other sections each describe a display.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=ROTSWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=RotarySwitch&lt;br /&gt;
properylist=device,name,nbpos,pins,values,valuestype,node,bincode&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=nbpos&lt;br /&gt;
prop04=pins&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=node&lt;br /&gt;
prop08=bincode&lt;br /&gt;
&lt;br /&gt;
[EFIS0ROSERSW]&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
name=efis0rosersw&lt;br /&gt;
nbpos=5&lt;br /&gt;
pins=B5,B4,B3,B2,B1&lt;br /&gt;
values=ils,vor,nav,arc,plan&lt;br /&gt;
valuestype=str&lt;br /&gt;
node=None&lt;br /&gt;
bincode=0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===CONF Section===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
*'''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
*'''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
*'''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''''RotarySwitch''''' Class&lt;br /&gt;
*'''propertylist''' : List of parameter that are needed to create a '''''rotary''' '''switch''''' object.&lt;br /&gt;
===PROPERTIES Section===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Rotary Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=nbpos       # Number of position to manage&lt;br /&gt;
prop04=pins        # MCP23017 input list where the switch is connected (format is portpin Ex : B5 is pin 5 on port B)&lt;br /&gt;
prop05=values      # Values sent in position order seperate by coma (pos1val, pos2val, pos3val ... etc)&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
==Creating Switches==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;'''RotarySwitch'''&amp;quot; in the '''FGIntSwitch.py'''&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class RotarySwitch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    Rotary Switch&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, nbpos, pins, values, valuestype, node, bincode, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;here how double switches should be instantiated: To create a double switch with this class you have to call :&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
RotarySwitch(device, name, nbpos, pins, values, valuestype, node, bincode, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
==Switches Methods==&lt;br /&gt;
===getName()===&lt;br /&gt;
Return the switch Name according the configuration&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getName()&lt;br /&gt;
'efis0rosersw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getPins'''()''' ===&lt;br /&gt;
Return the input list defined in the configuration&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getPins()&lt;br /&gt;
{0: {'port': 'B', 'pin': '5'}, 1: {'port': 'B', 'pin': '4'}, 2: {'port': 'B', 'pin': '3'}, 3: {'port': 'B', 'pin': '2'}, 4: {'port': 'B', 'pin': '1'}}&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getValues() ===&lt;br /&gt;
Return values tab&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getValues()&lt;br /&gt;
['ils', 'vor', 'nav', 'arc', 'plan']&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getValueType()===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getValueType()&lt;br /&gt;
'str'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getNode()===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file. Node property is not used actually, but could be used to create protocol xml file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getNode()&lt;br /&gt;
'None'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getSwitchState()===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&lt;br /&gt;
Rotary switch on ''''ILS'''&amp;lt;nowiki/&amp;gt;' position&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getSwitchState()&lt;br /&gt;
'ils'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=FGInt_Switches&amp;diff=135445</id>
		<title>FGInt Switches</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=FGInt_Switches&amp;diff=135445"/>
		<updated>2022-09-02T15:41:40Z</updated>

		<summary type="html">&lt;p&gt;Daweed: Link &amp;amp; Link text correction&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar&lt;br /&gt;
| name	= GUI Navbar&lt;br /&gt;
| title = FG Int Switches Classes&lt;br /&gt;
| contentstyle = text-align: left;&lt;br /&gt;
| content1 = * [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]&lt;br /&gt;
| content9 = '''Navigation'''&lt;br /&gt;
* [[FG interface]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
'''''Switches''''' classes will be used to manage standard switches and is based on the MCP23017 chipset.&lt;br /&gt;
Switches classes are grouped in the '''FGIntSwitch''' library. With this library you will be able to manage :&lt;br /&gt;
* [[Switch Class ]]: used to manage standard switch 2 positions&lt;br /&gt;
* [[ DoubleSwitch Class ]]: used to manage standard switch 3 positions&lt;br /&gt;
*  [[RotarySwitch Class]] : used to manage rotary switch with n positions&lt;br /&gt;
*  [[ToogleSwitch Class]] : used to manage push button switch (momentary switch)&lt;br /&gt;
&lt;br /&gt;
[[Category:FG Interface]]&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=FGInt_Switches&amp;diff=135444</id>
		<title>FGInt Switches</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=FGInt_Switches&amp;diff=135444"/>
		<updated>2022-09-02T15:40:36Z</updated>

		<summary type="html">&lt;p&gt;Daweed: Page Link Correction&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar&lt;br /&gt;
| name	= GUI Navbar&lt;br /&gt;
| title = FG Int Switches Classes&lt;br /&gt;
| contentstyle = text-align: left;&lt;br /&gt;
| content1 = * [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]&lt;br /&gt;
| content9 = '''Navigation'''&lt;br /&gt;
* [[FG interface]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
'''''Switches''''' classes will be used to manage standard switches and is based on the MCP23017 chipset.&lt;br /&gt;
Switches classes are grouped in the '''FGIntSwitch''' library. With this library you will be able to manage :&lt;br /&gt;
* [[Switch Class ]]: used to manage standard switch 2 positions&lt;br /&gt;
* [[ DoubleSwitch Class ]]: used to manage standard switch 3 positions&lt;br /&gt;
*  [[RotarySwitch Class|RotarySwitch class]] : used to manage rotary switch with n positions&lt;br /&gt;
* [[ ToogleSwitch class ]]: used to manage push button switch (momentary switch)&lt;br /&gt;
&lt;br /&gt;
[[Category:FG Interface]]&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=FG_Interface:_How_it_works&amp;diff=135443</id>
		<title>FG Interface: How it works</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=FG_Interface:_How_it_works&amp;diff=135443"/>
		<updated>2022-09-02T15:38:26Z</updated>

		<summary type="html">&lt;p&gt;Daweed: /* Example demo */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FG Interface sidebar}}&lt;br /&gt;
Before diving deeper into the interface arcanes, I think it's a good idea to begin by explaining how the interface is structured and organized.&lt;br /&gt;
&lt;br /&gt;
The FG interface is hierarchical. At the top level, you will find the interface itself. Devices (hardware driver) will be created and owned by the interface. Each device on the bus can be called from the interface.&lt;br /&gt;
The objects (display, switch, encoder, etc.) will be built on a device throught the interface.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You have to see the interface a bit like a big index of your cockpit. The interface has all the configurations.&amp;lt;br /&amp;gt;&lt;br /&gt;
The interface knows all the elements of the cockpit that it must manage.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Concept ==&lt;br /&gt;
So an interface object (FGInterface Class) is created. From this object, methods will allow you to manage the interface.&lt;br /&gt;
Devices will be created on the interface. Access to low level device is possible throught the interface device object, but this devices should not, except in some case, be called directely. Hardware communication is based on a Class python dedicated to the I2C protocol.&lt;br /&gt;
&lt;br /&gt;
Then the cockpit elements are created on the interface and linked to one of the devices according to the configurations.&lt;br /&gt;
At any time, an element can be get, checked or updated throught the interface object.&lt;br /&gt;
&lt;br /&gt;
For memory : &lt;br /&gt;
&lt;br /&gt;
* FG Int : An instance of the FGInterface Class. It's the &amp;quot;super&amp;quot; class. Instance of this class own all interface object.&lt;br /&gt;
* Device : Hardware chip. An instance of a device class give access to device management.&lt;br /&gt;
* Object : Cockpit hardware. A object class give all method to manage the object.&lt;br /&gt;
&lt;br /&gt;
To link all classes, a protocol class have been implemented : I2CDevice. '''You should never call directly this class'''. All call needed should be done in the objects classes or in the devices classes.&lt;br /&gt;
&lt;br /&gt;
In the I2CDevice class you will have access to very low level method, use to setup and configure different things on the I2C Buses and I2C Devives (set or read a buffer, or just a bit of one buffer ... etc)&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
All the interface is ported by a set of configuration file.&lt;br /&gt;
At startup, when you create the interface, configuration is read &amp;amp; store in the interface object.&lt;br /&gt;
&lt;br /&gt;
3 configurations file minimum is needed :&lt;br /&gt;
* an interface configuration file.&lt;br /&gt;
Generics parameters can be found, as like interface name or module to be loaded. (Yeah interface is modular .. only needed things can be loaded)&lt;br /&gt;
* a devices configuration file.&lt;br /&gt;
Each devices are describe in this file. Devicename, deviceaddress and devicetype are the minimum to declare a device. &lt;br /&gt;
&lt;br /&gt;
* devicename need to be unique.&lt;br /&gt;
* deviceaddr is unique on one I2C buses.&lt;br /&gt;
* devicetype is needed to create the device object to call the &amp;quot;good&amp;quot; library.&amp;lt;br /&amp;gt;&lt;br /&gt;
* an objects configuration file.&lt;br /&gt;
Each object (cockpit element) need to be defined. Properties depends from each elements type. A switch configuration will not be the same as a display configuration.&lt;br /&gt;
&lt;br /&gt;
== Example demo ==&lt;br /&gt;
Throughout the documentation the examples will relate to the airbus A330 design some panel regarding where actuor are &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Airbus radio panel switch off.png|frameless|Airbus A330 Radio Panel Off]]          [[File:Airbus radio panel switch on.png|frameless|Airbus A330 Radio Panel On]]&lt;br /&gt;
&lt;br /&gt;
The radio panel will need 2 devices : &lt;br /&gt;
&lt;br /&gt;
* 1 HT16K33 to manage displays &amp;amp; light function.&lt;br /&gt;
* 1 MCP23016 to manage switches &amp;amp; rotary encoders.&lt;br /&gt;
&lt;br /&gt;
Function that will be created with the radio panel : &lt;br /&gt;
&lt;br /&gt;
* Standby Frequency display (6 Digit, decimal point after the third digit)&lt;br /&gt;
* Active Frequency display (6 Digit, decimal point after the third digit)&lt;br /&gt;
* Push button to switch frequency&lt;br /&gt;
* Power Switch&lt;br /&gt;
* Double Rotary Encoder to manage Standby Frequency&lt;br /&gt;
&lt;br /&gt;
Configuration files are describe on the [[FGInterface Class]] page&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|8MODOU447EE|||Airbus Radio Panel FG Interface Powered|frame}}&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=135442</id>
		<title>Switch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=135442"/>
		<updated>2022-09-02T15:34:00Z</updated>

		<summary type="html">&lt;p&gt;Daweed: Typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar&lt;br /&gt;
| name	= GUI Navbar&lt;br /&gt;
| title = FG Int Switches Classes&lt;br /&gt;
| contentstyle = text-align: left;&lt;br /&gt;
| content1 = * [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]&lt;br /&gt;
| content9 = '''Navigation'''&lt;br /&gt;
* [[FG interface]]&lt;br /&gt;
}}&lt;br /&gt;
Switches Class '''''Switch''''' will be used to manage standard 2 position switches (only 1 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
&lt;br /&gt;
== Switches Configuration File ==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/RadioPanel/switches.cfg''&lt;br /&gt;
&lt;br /&gt;
Values to send to simulator for this switch are : &lt;br /&gt;
&lt;br /&gt;
* 0 for '''off'''&lt;br /&gt;
* 1 for '''on'''&lt;br /&gt;
&lt;br /&gt;
This file describes the 2 positions switches configuration used on the radio panel.&amp;lt;br /&amp;gt;There are two separate parts in this file.&lt;br /&gt;
&lt;br /&gt;
# a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
# the other sections each describe a display.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=SWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=Switch&lt;br /&gt;
properylist=device,name,port,pin,values,valuestype,invert,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=invert&lt;br /&gt;
prop08=node&lt;br /&gt;
&lt;br /&gt;
[RMP0PSW]&lt;br /&gt;
name=rmp0psw&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
port=A&lt;br /&gt;
pin=2&lt;br /&gt;
values=0,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
invert=0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CONF Section ===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
* '''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
* '''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
* '''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''Switch''' Class&lt;br /&gt;
* '''propertylist''' : List of parameter that are needed to create a '''switch''' object.&lt;br /&gt;
&lt;br /&gt;
=== PROPERTIES Section ===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin         # MCP23017 input where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=invert      # Describe if the input need to be manage inverted [ activate = 0 ]&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
&lt;br /&gt;
== Creating Switches ==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;'''Switch'''&amp;quot; in the '''FGIntSwitch.py'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class Switch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin, values, valuestype, invert, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here how switches should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a switch with this class you have to call :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;code&amp;quot;&amp;gt;&lt;br /&gt;
Switch(device, name, port, pin, values, valuestype, invert, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
&lt;br /&gt;
== Switches Methods ==&lt;br /&gt;
=== getName() ===&lt;br /&gt;
Return the switch Name according the configuration&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getName()&lt;br /&gt;
'rmp0psw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getValueType() ===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getNode() ===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getNode()&lt;br /&gt;
'None'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getTypedData() ===&lt;br /&gt;
Return the typed value given as agument according to what have been set in the '''''valuestype''''' property&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(0)&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(1)&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getSwitchState() ===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW = FGINT1.getElement('RMP0PWSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Set the switch 'On' on the panel&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'1'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Combined with the value typing function &amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=DoubleSwitch_Class&amp;diff=135441</id>
		<title>DoubleSwitch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=DoubleSwitch_Class&amp;diff=135441"/>
		<updated>2022-09-02T15:33:14Z</updated>

		<summary type="html">&lt;p&gt;Daweed: /* Double Switches Configuration File */ Typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar|title=FG Int Switches Classes|content1=* [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]|content9='''Navigation'''&lt;br /&gt;
* [[FG interface]]|contentstyle=text-align: left;|name=GUI Navbar}}&lt;br /&gt;
&lt;br /&gt;
Switches Class '''''DoubleSwitch''''' will be used to manage standard 3 position switches (2 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
==Double Switches Configuration File==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/OverHeadPanel/dblswitches.cfg''&lt;br /&gt;
&lt;br /&gt;
This file describes the '''double switch''' Strobe Light configuration used on the External &amp;amp; Internal Light panel on the Overhead.&lt;br /&gt;
&lt;br /&gt;
Values to send to simulator for this switch are : &lt;br /&gt;
&lt;br /&gt;
* 0 for '''off'''&lt;br /&gt;
* 0.5 for '''auto'''&lt;br /&gt;
* 1 for '''on'''&lt;br /&gt;
&lt;br /&gt;
There are two separate parts in this file.&lt;br /&gt;
#a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
#the other sections each describe a display.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=DBLSWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=DoubleSwitch&lt;br /&gt;
properylist=device,name,port,pin1,pin2,values,valuestype,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin1&lt;br /&gt;
prop05=pin2&lt;br /&gt;
prop06=values&lt;br /&gt;
prop07=valuestype&lt;br /&gt;
prop08=node&lt;br /&gt;
&lt;br /&gt;
[LTSSTROBESW]&lt;br /&gt;
name=ltstrobesw&lt;br /&gt;
device=IOPACK5&lt;br /&gt;
port=A&lt;br /&gt;
pin1=8&lt;br /&gt;
pin2=7&lt;br /&gt;
values=0,0.5,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===CONF Section===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
*'''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
*'''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
*'''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''DoubleSwitch''' Class&lt;br /&gt;
*'''propertylist''' : List of parameter that are needed to create a '''double''' '''switch''' object.&lt;br /&gt;
===PROPERTIES Section===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin1        # MCP23017 input1 where the switch is connected&lt;br /&gt;
prop04=pin2        # MCP23017 input2 where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state (order is pin state dependant : pin1=1 &amp;amp; pin2=0 =&amp;gt; value1,  pin1=0 &amp;amp; pin2=0 =&amp;gt; value2, pin1=0 &amp;amp; pin2=1 =&amp;gt; value3)&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=invert      # Describe if the input need to be manage inverted [ activate = 0 ]&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
==Creating Switches==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;'''DoubleSwitch'''&amp;quot; in the '''FGIntSwitch.py'''&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class DoubleSwitch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin1, pin2, values, valuestype, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;here how double switches should be instantiated&lt;br /&gt;
&lt;br /&gt;
To create a double switch with this class you have to call :&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
DoubleSwitch(device, name, port, pin1, pin2, values, valuestype, invert, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
==Switches Methods==&lt;br /&gt;
===getName()===&lt;br /&gt;
Return the switch Name according the configuration&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getName()&lt;br /&gt;
'ltstrobesw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getValueType()===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getNode()===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file. Node property is not used actually, but could be used to create protocol xml file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getNode()&lt;br /&gt;
'None'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getTypedData()===&lt;br /&gt;
Return the typed value given as agument according to what have been set in the '''''valuestype''''' property&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData('0')&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData('1')&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getSwitchState()===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&lt;br /&gt;
Double Switch in postiion 1&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Double Switch in postiion 2&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0.5'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Double Switch in postiion 3&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getSwitchState()&lt;br /&gt;
'1'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Combined with the value typing function&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData(LTSSTROBESW.getSwitchState()) # Switch in position 1&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData(LTSSTROBESW.getSwitchState()) # Switch in position 2&lt;br /&gt;
0.5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData(LTSSTROBESW.getSwitchState()) # Switch in position 3&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=RotarySwitch_Class&amp;diff=135440</id>
		<title>RotarySwitch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=RotarySwitch_Class&amp;diff=135440"/>
		<updated>2022-09-02T15:28:56Z</updated>

		<summary type="html">&lt;p&gt;Daweed: Adding Side Bar&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar|Name=GUI Navbar|title=FG Int Switches Classes|content1=* [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]|content9='''Navigation'''&lt;br /&gt;
* [[FG interface]]|contentstyle=text-align: left;}}&lt;br /&gt;
&lt;br /&gt;
Switches Class '''''RotarySwitch''''' will be used to manage standard and binary rotary switches. &lt;br /&gt;
&lt;br /&gt;
'''''Standard Rotary Switc'''''h are one to one :  one position , one pin active.&lt;br /&gt;
&lt;br /&gt;
'''''Binary Rotary Switch''''' give binary code regarding the position.&lt;br /&gt;
&lt;br /&gt;
Number of input depend on how many position you need&lt;br /&gt;
==Rotary Switches Configuration File==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/EfisPanel/rotswitches.cfg''&lt;br /&gt;
&lt;br /&gt;
This file describes the rotary switches configuration that setup the ND modeused on the A320 / A330 EFIS panels. '''It's a standard rotary switch''' (bincode propoerty is set to 0)&lt;br /&gt;
&lt;br /&gt;
Values to send to simulator for this switch are :&lt;br /&gt;
*'''ils''' for '''ils mode'''&lt;br /&gt;
*'''vor''' for '''vor mode'''&lt;br /&gt;
*'''nav''' for '''nav mode'''&lt;br /&gt;
*'''arc''' for '''arc mode'''&lt;br /&gt;
*'''plan''' for '''plan mode'''&lt;br /&gt;
There are two separate parts in this file.&lt;br /&gt;
#a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
#the other sections each describe a display.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=ROTSWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=RotarySwitch&lt;br /&gt;
properylist=device,name,nbpos,pins,values,valuestype,node,bincode&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=nbpos&lt;br /&gt;
prop04=pins&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=node&lt;br /&gt;
prop08=bincode&lt;br /&gt;
&lt;br /&gt;
[EFIS0ROSERSW]&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
name=efis0rosersw&lt;br /&gt;
nbpos=5&lt;br /&gt;
pins=B5,B4,B3,B2,B1&lt;br /&gt;
values=ils,vor,nav,arc,plan&lt;br /&gt;
valuestype=str&lt;br /&gt;
node=None&lt;br /&gt;
bincode=0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===CONF Section===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
*'''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
*'''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
*'''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''''RotarySwitch''''' Class&lt;br /&gt;
*'''propertylist''' : List of parameter that are needed to create a '''''rotary''' '''switch''''' object.&lt;br /&gt;
===PROPERTIES Section===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Rotary Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=nbpos       # Number of position to manage&lt;br /&gt;
prop04=pins        # MCP23017 input list where the switch is connected (format is portpin Ex : B5 is pin 5 on port B)&lt;br /&gt;
prop05=values      # Values sent in position order seperate by coma (pos1val, pos2val, pos3val ... etc)&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
==Creating Switches==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;'''RotarySwitch'''&amp;quot; in the '''FGIntSwitch.py'''&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class RotarySwitch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    Rotary Switch&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, nbpos, pins, values, valuestype, node, bincode, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;here how double switches should be instantiated: To create a double switch with this class you have to call :&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
RotarySwitch(device, name, nbpos, pins, values, valuestype, node, bincode, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
==Switches Methods==&lt;br /&gt;
===getName()===&lt;br /&gt;
Return the switch Name according the configuration&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getName()&lt;br /&gt;
'efis0rosersw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''getPins()''' ===&lt;br /&gt;
Return the input list defined in the configuration&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getPins()&lt;br /&gt;
{0: {'port': 'B', 'pin': '5'}, 1: {'port': 'B', 'pin': '4'}, 2: {'port': 'B', 'pin': '3'}, 3: {'port': 'B', 'pin': '2'}, 4: {'port': 'B', 'pin': '1'}}&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getValues() ===&lt;br /&gt;
Return values tab&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getValues()&lt;br /&gt;
['ils', 'vor', 'nav', 'arc', 'plan']&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getValueType()===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getValueType()&lt;br /&gt;
'str'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getNode()===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file. Node property is not used actually, but could be used to create protocol xml file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getNode()&lt;br /&gt;
'None'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getSwitchState()===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&lt;br /&gt;
Rotary switch on ''''ILS'''&amp;lt;nowiki/&amp;gt;' position&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getSwitchState()&lt;br /&gt;
'ils'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=RotarySwitch_Class&amp;diff=135439</id>
		<title>RotarySwitch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=RotarySwitch_Class&amp;diff=135439"/>
		<updated>2022-09-02T15:26:30Z</updated>

		<summary type="html">&lt;p&gt;Daweed: Page Creation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Switches Class '''''RotarySwitch''''' will be used to manage standard and binary rotary switches. &lt;br /&gt;
&lt;br /&gt;
'''''Standard Rotary Switc'''''h are one to one :  one position , one pin active.&lt;br /&gt;
&lt;br /&gt;
'''''Binary Rotary Switch''''' give binary code regarding the position.&lt;br /&gt;
&lt;br /&gt;
Number of input depend on how many position you need&lt;br /&gt;
==Rotary Switches Configuration File==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/EfisPanel/rotswitches.cfg''&lt;br /&gt;
&lt;br /&gt;
This file describes the rotary switches configuration that setup the ND modeused on the A320 / A330 EFIS panels. '''It's a standard rotary switch''' (bincode propoerty is set to 0)&lt;br /&gt;
&lt;br /&gt;
Values to send to simulator for this switch are :&lt;br /&gt;
*'''ils''' for '''ils mode'''&lt;br /&gt;
*'''vor''' for '''vor mode'''&lt;br /&gt;
*'''nav''' for '''nav mode'''&lt;br /&gt;
*'''arc''' for '''arc mode'''&lt;br /&gt;
*'''plan''' for '''plan mode'''&lt;br /&gt;
There are two separate parts in this file.&lt;br /&gt;
#a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
#the other sections each describe a display.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=ROTSWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=RotarySwitch&lt;br /&gt;
properylist=device,name,nbpos,pins,values,valuestype,node,bincode&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=nbpos&lt;br /&gt;
prop04=pins&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=node&lt;br /&gt;
prop08=bincode&lt;br /&gt;
&lt;br /&gt;
[EFIS0ROSERSW]&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
name=efis0rosersw&lt;br /&gt;
nbpos=5&lt;br /&gt;
pins=B5,B4,B3,B2,B1&lt;br /&gt;
values=ils,vor,nav,arc,plan&lt;br /&gt;
valuestype=str&lt;br /&gt;
node=None&lt;br /&gt;
bincode=0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===CONF Section===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
*'''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
*'''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
*'''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''''RotarySwitch''''' Class&lt;br /&gt;
*'''propertylist''' : List of parameter that are needed to create a '''''rotary''' '''switch''''' object.&lt;br /&gt;
===PROPERTIES Section===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Rotary Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=nbpos       # Number of position to manage&lt;br /&gt;
prop04=pins        # MCP23017 input list where the switch is connected (format is portpin Ex : B5 is pin 5 on port B)&lt;br /&gt;
prop05=values      # Values sent in position order seperate by coma (pos1val, pos2val, pos3val ... etc)&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
==Creating Switches==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;'''RotarySwitch'''&amp;quot; in the '''FGIntSwitch.py'''&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class RotarySwitch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    Rotary Switch&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, nbpos, pins, values, valuestype, node, bincode, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;here how double switches should be instantiated: To create a double switch with this class you have to call :&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
RotarySwitch(device, name, nbpos, pins, values, valuestype, node, bincode, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
==Switches Methods==&lt;br /&gt;
===getName()===&lt;br /&gt;
Return the switch Name according the configuration&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getName()&lt;br /&gt;
'efis0rosersw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== '''getPins()''' ===&lt;br /&gt;
Return the input list defined in the configuration&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getPins()&lt;br /&gt;
{0: {'port': 'B', 'pin': '5'}, 1: {'port': 'B', 'pin': '4'}, 2: {'port': 'B', 'pin': '3'}, 3: {'port': 'B', 'pin': '2'}, 4: {'port': 'B', 'pin': '1'}}&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getValues() ===&lt;br /&gt;
Return values tab&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getValues()&lt;br /&gt;
['ils', 'vor', 'nav', 'arc', 'plan']&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===getValueType()===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getValueType()&lt;br /&gt;
'str'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getNode()===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file. Node property is not used actually, but could be used to create protocol xml file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getNode()&lt;br /&gt;
'None'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getSwitchState()===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&lt;br /&gt;
Rotary switch on ''''ILS'''&amp;lt;nowiki/&amp;gt;' position&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jul 25 2020, 13:03:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('efispanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW = FGINT1.getElement('EFIS0ROSERSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; EFIS0ROSERSW.getSwitchState()&lt;br /&gt;
'ils'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=135438</id>
		<title>Switch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=135438"/>
		<updated>2022-09-02T14:46:35Z</updated>

		<summary type="html">&lt;p&gt;Daweed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar&lt;br /&gt;
| name	= GUI Navbar&lt;br /&gt;
| title = FG Int Switches Classes&lt;br /&gt;
| contentstyle = text-align: left;&lt;br /&gt;
| content1 = * [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]&lt;br /&gt;
| content9 = '''Navigation'''&lt;br /&gt;
* [[FG interface]]&lt;br /&gt;
}}&lt;br /&gt;
Switches Class '''''Switch''''' will be used to manage standard 2 position switches (only 1 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
&lt;br /&gt;
== Switches Configuration File ==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/RadioPanel/switches.cfg''&lt;br /&gt;
&lt;br /&gt;
Values to send to simulator for this switch are : &lt;br /&gt;
&lt;br /&gt;
* 0 for '''off'''&lt;br /&gt;
* 1 for '''on'''&lt;br /&gt;
&lt;br /&gt;
This file describes the 2 positions switches configuration used on the radio panel.&amp;lt;br /&amp;gt;There are two separate parts in this file.&lt;br /&gt;
&lt;br /&gt;
# a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
# the other sections each describe a display.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=SWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=Switch&lt;br /&gt;
properylist=device,name,port,pin,values,valuestype,invert,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=invert&lt;br /&gt;
prop08=node&lt;br /&gt;
&lt;br /&gt;
[RMP0PSW]&lt;br /&gt;
name=rmp0psw&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
port=A&lt;br /&gt;
pin=2&lt;br /&gt;
values=0,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
invert=0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CONF Section ===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
* '''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
* '''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
* '''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''Switch''' Class&lt;br /&gt;
* '''propertylist''' : List of parameter that are needed to create a '''switch''' object.&lt;br /&gt;
&lt;br /&gt;
=== PROPERTIES Section ===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin         # MCP23017 input where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=invert      # Describe if the input need to be manage inverted [ activate = 0 ]&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
&lt;br /&gt;
== Creating Switches ==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;Switch&amp;quot; in the '''FGIntSwitch.py'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class Switch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin, values, valuestype, invert, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here how switches should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a switch with this class you have to call :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;code&amp;quot;&amp;gt;&lt;br /&gt;
Switch(device, name, port, pin, values, valuestype, invert, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
&lt;br /&gt;
== Switches Methods ==&lt;br /&gt;
=== getName() ===&lt;br /&gt;
Return the switch Name according the configuration&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getName()&lt;br /&gt;
'rmp0psw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getValueType() ===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getNode() ===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getNode()&lt;br /&gt;
'None'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getTypedData() ===&lt;br /&gt;
Return the typed value given as agument according to what have been set in the '''''valuestype''''' property&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(0)&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(1)&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getSwitchState() ===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW = FGINT1.getElement('RMP0PWSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Set the switch 'On' on the panel&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'1'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Combined with the value typing function &amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=DoubleSwitch_Class&amp;diff=135437</id>
		<title>DoubleSwitch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=DoubleSwitch_Class&amp;diff=135437"/>
		<updated>2022-09-02T14:45:12Z</updated>

		<summary type="html">&lt;p&gt;Daweed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar|title=FG Int Switches Classes|content1=* [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]|content9='''Navigation'''&lt;br /&gt;
* [[FG interface]]|contentstyle=text-align: left;|name=GUI Navbar}}&lt;br /&gt;
&lt;br /&gt;
Switches Class '''''DoubleSwitch''''' will be used to manage standard 3 position switches (2 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
==Double Switches Configuration File==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/OverHeadPanel/dblswitches.cfg''&lt;br /&gt;
&lt;br /&gt;
This file describes the double switches Strobe Light configuration used on the External &amp;amp; Internal Light panel on the Overhead.&lt;br /&gt;
&lt;br /&gt;
Values to send to simulator for this switch are : &lt;br /&gt;
&lt;br /&gt;
* 0 for '''off'''&lt;br /&gt;
* 0.5 for '''auto'''&lt;br /&gt;
* 1 for '''on'''&lt;br /&gt;
&lt;br /&gt;
There are two separate parts in this file.&lt;br /&gt;
#a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
#the other sections each describe a display.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=DBLSWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=DoubleSwitch&lt;br /&gt;
properylist=device,name,port,pin1,pin2,values,valuestype,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin1&lt;br /&gt;
prop05=pin2&lt;br /&gt;
prop06=values&lt;br /&gt;
prop07=valuestype&lt;br /&gt;
prop08=node&lt;br /&gt;
&lt;br /&gt;
[LTSSTROBESW]&lt;br /&gt;
name=ltstrobesw&lt;br /&gt;
device=IOPACK5&lt;br /&gt;
port=A&lt;br /&gt;
pin1=8&lt;br /&gt;
pin2=7&lt;br /&gt;
values=0,0.5,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===CONF Section===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
*'''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
*'''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
*'''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''DoubleSwitch''' Class&lt;br /&gt;
*'''propertylist''' : List of parameter that are needed to create a '''double''' '''switch''' object.&lt;br /&gt;
===PROPERTIES Section===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin1        # MCP23017 input where the switch is connected&lt;br /&gt;
prop04=pin2        # MCP23017 input where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state (order is pin state dependant : pin1=1 &amp;amp; pin2=0 =&amp;gt; value1,  pin1=0 &amp;amp; pin2=0 =&amp;gt; value2, pin1=0 &amp;amp; pin2=1 =&amp;gt; value3)&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=invert      # Describe if the input need to be manage inverted [ activate = 0 ]&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
==Creating Switches==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;Switch&amp;quot; in the '''FGIntSwitch.py'''&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class DoubleSwitch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin1, pin2, values, valuestype, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;here how double switches should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a double switch with this class you have to call :&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
DoubleSwitch(device, name, port, pin1, pin2, values, valuestype, invert, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
==Switches Methods==&lt;br /&gt;
===getName()===&lt;br /&gt;
Return the switch Name according the configuration&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getName()&lt;br /&gt;
'ltstrobesw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getValueType()===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getNode()===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file. Node property is not used actually, but could be used to create protocol xml file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getNode()&lt;br /&gt;
'None'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getTypedData()===&lt;br /&gt;
Return the typed value given as agument according to what have been set in the '''''valuestype''''' property&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData('0')&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData('1')&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getSwitchState()===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&lt;br /&gt;
Double Switch in postiion 1&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Double Switch in postiion 2&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0.5'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Double Switch in postiion 3&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getSwitchState()&lt;br /&gt;
'1'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Combined with the value typing function&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData(LTSSTROBESW.getSwitchState()) # Switch in position 1&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData(LTSSTROBESW.getSwitchState()) # Switch in position 2&lt;br /&gt;
0.5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData(LTSSTROBESW.getSwitchState()) # Switch in position 3&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=DoubleSwitch_Class&amp;diff=135436</id>
		<title>DoubleSwitch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=DoubleSwitch_Class&amp;diff=135436"/>
		<updated>2022-09-02T14:41:46Z</updated>

		<summary type="html">&lt;p&gt;Daweed: Adding Side Bar&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar|title=FG Int Switches Classes|content1=* [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]|content9='''Navigation'''&lt;br /&gt;
* [[FG interface]]|contentstyle=text-align: left;|name=GUI Navbar}}&lt;br /&gt;
&lt;br /&gt;
Switches Class Double'''''Switch''''' will be used to manage standard 3 position switches (2 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
==Double Switches Configuration File==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/RadioPanel/dblswitches.cfg''&lt;br /&gt;
&lt;br /&gt;
This file describes the double switches configuration used on the External &amp;amp; Internal Light panel on the Overhead.&lt;br /&gt;
&lt;br /&gt;
There are two separate parts in this file.&lt;br /&gt;
#a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
#the other sections each describe a display.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=DBLSWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=DoubleSwitch&lt;br /&gt;
properylist=device,name,port,pin1,pin2,values,valuestype,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin1&lt;br /&gt;
prop05=pin2&lt;br /&gt;
prop06=values&lt;br /&gt;
prop07=valuestype&lt;br /&gt;
prop08=node&lt;br /&gt;
&lt;br /&gt;
[LTSSTROBESW]&lt;br /&gt;
name=ltstrobesw&lt;br /&gt;
device=IOPACK5&lt;br /&gt;
port=A&lt;br /&gt;
pin1=8&lt;br /&gt;
pin2=7&lt;br /&gt;
values=0,0.5,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
&lt;br /&gt;
[LTSNAVSW]&lt;br /&gt;
name=ltsnavsw&lt;br /&gt;
device=IOPACK5&lt;br /&gt;
port=A&lt;br /&gt;
pin1=4&lt;br /&gt;
pin2=3&lt;br /&gt;
values=0,1,2&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
&lt;br /&gt;
[LTSNOSESW]&lt;br /&gt;
name=ltsnosesw&lt;br /&gt;
device=IOPACK5&lt;br /&gt;
port=A&lt;br /&gt;
pin1=2&lt;br /&gt;
pin2=1&lt;br /&gt;
values=0,0.5,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
&lt;br /&gt;
[LTSDOMESW]&lt;br /&gt;
name=ltsdomesw&lt;br /&gt;
device=IOPACK5&lt;br /&gt;
port=B&lt;br /&gt;
pin1=2&lt;br /&gt;
pin2=3&lt;br /&gt;
values=0,0.5,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
&lt;br /&gt;
[LTSANNUTESTSW]&lt;br /&gt;
name=ltsannutestsw&lt;br /&gt;
device=IOPACK5&lt;br /&gt;
port=B&lt;br /&gt;
pin1=4&lt;br /&gt;
pin2=5&lt;br /&gt;
values=0,1,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===CONF Section===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
*'''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
*'''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
*'''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''DoubleSwitch''' Class&lt;br /&gt;
*'''propertylist''' : List of parameter that are needed to create a '''double''' '''switch''' object.&lt;br /&gt;
===PROPERTIES Section===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin1        # MCP23017 input where the switch is connected&lt;br /&gt;
prop04=pin2        # MCP23017 input where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state (order is pin state dependant : pin1=1 &amp;amp; pin2=0 =&amp;gt; value1,  pin1=0 &amp;amp; pin2=0 =&amp;gt; value2, pin1=0 &amp;amp; pin2=1 =&amp;gt; value3)&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=invert      # Describe if the input need to be manage inverted [ activate = 0 ]&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
==Creating Switches==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;Switch&amp;quot; in the '''FGIntSwitch.py'''&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class DoubleSwitch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin1, pin2, values, valuestype, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;here how double switches should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a double switch with this class you have to call :&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
DoubleSwitch(device, name, port, pin1, pin2, values, valuestype, invert, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
==Switches Methods==&lt;br /&gt;
===getName()===&lt;br /&gt;
Return the switch Name according the configuration&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getName()&lt;br /&gt;
'ltstrobesw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getValueType()===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getNode()===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file. Node property is not used actually, but could be used to create protocol xml file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getNode()&lt;br /&gt;
'None'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getTypedData()===&lt;br /&gt;
Return the typed value given as agument according to what have been set in the '''''valuestype''''' property&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData('0')&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData('1')&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getSwitchState()===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&lt;br /&gt;
Double Switch in postiion 1&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Double Switch in postiion 2&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0.5'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Double Switch in postiion 3&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getSwitchState()&lt;br /&gt;
'1'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Combined with the value typing function&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData(LTSSTROBESW.getSwitchState()) # Switch in position 1&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData(LTSSTROBESW.getSwitchState()) # Switch in position 2&lt;br /&gt;
0.5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData(LTSSTROBESW.getSwitchState()) # Switch in position 3&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=DoubleSwitch_Class&amp;diff=135435</id>
		<title>DoubleSwitch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=DoubleSwitch_Class&amp;diff=135435"/>
		<updated>2022-09-02T14:36:21Z</updated>

		<summary type="html">&lt;p&gt;Daweed: Page Creation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Switches Class Double'''''Switch''''' will be used to manage standard 3 position switches (2 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
==Double Switches Configuration File==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/RadioPanel/dblswitches.cfg''&lt;br /&gt;
&lt;br /&gt;
This file describes the double switches configuration used on the External &amp;amp; Internal Light panel on the Overhead.&lt;br /&gt;
&lt;br /&gt;
There are two separate parts in this file.&lt;br /&gt;
#a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
#the other sections each describe a display.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=DBLSWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=DoubleSwitch&lt;br /&gt;
properylist=device,name,port,pin1,pin2,values,valuestype,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin1&lt;br /&gt;
prop05=pin2&lt;br /&gt;
prop06=values&lt;br /&gt;
prop07=valuestype&lt;br /&gt;
prop08=node&lt;br /&gt;
&lt;br /&gt;
[LTSSTROBESW]&lt;br /&gt;
name=ltstrobesw&lt;br /&gt;
device=IOPACK5&lt;br /&gt;
port=A&lt;br /&gt;
pin1=8&lt;br /&gt;
pin2=7&lt;br /&gt;
values=0,0.5,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
&lt;br /&gt;
[LTSNAVSW]&lt;br /&gt;
name=ltsnavsw&lt;br /&gt;
device=IOPACK5&lt;br /&gt;
port=A&lt;br /&gt;
pin1=4&lt;br /&gt;
pin2=3&lt;br /&gt;
values=0,1,2&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
&lt;br /&gt;
[LTSNOSESW]&lt;br /&gt;
name=ltsnosesw&lt;br /&gt;
device=IOPACK5&lt;br /&gt;
port=A&lt;br /&gt;
pin1=2&lt;br /&gt;
pin2=1&lt;br /&gt;
values=0,0.5,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
&lt;br /&gt;
[LTSDOMESW]&lt;br /&gt;
name=ltsdomesw&lt;br /&gt;
device=IOPACK5&lt;br /&gt;
port=B&lt;br /&gt;
pin1=2&lt;br /&gt;
pin2=3&lt;br /&gt;
values=0,0.5,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
&lt;br /&gt;
[LTSANNUTESTSW]&lt;br /&gt;
name=ltsannutestsw&lt;br /&gt;
device=IOPACK5&lt;br /&gt;
port=B&lt;br /&gt;
pin1=4&lt;br /&gt;
pin2=5&lt;br /&gt;
values=0,1,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===CONF Section===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
*'''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
*'''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
*'''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''DoubleSwitch''' Class&lt;br /&gt;
*'''propertylist''' : List of parameter that are needed to create a '''double''' '''switch''' object.&lt;br /&gt;
===PROPERTIES Section===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin1        # MCP23017 input where the switch is connected&lt;br /&gt;
prop04=pin2        # MCP23017 input where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state (order is pin state dependant : pin1=1 &amp;amp; pin2=0 =&amp;gt; value1,  pin1=0 &amp;amp; pin2=0 =&amp;gt; value2, pin1=0 &amp;amp; pin2=1 =&amp;gt; value3)&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=invert      # Describe if the input need to be manage inverted [ activate = 0 ]&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
==Creating Switches==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;Switch&amp;quot; in the '''FGIntSwitch.py'''&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class DoubleSwitch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin1, pin2, values, valuestype, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;here how double switches should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a double switch with this class you have to call :&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
DoubleSwitch(device, name, port, pin1, pin2, values, valuestype, invert, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
==Switches Methods==&lt;br /&gt;
===getName()===&lt;br /&gt;
Return the switch Name according the configuration&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getName()&lt;br /&gt;
'ltstrobesw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getValueType()===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getNode()===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file. Node property is not used actually, but could be used to create protocol xml file.&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getNode()&lt;br /&gt;
'None'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getTypedData()===&lt;br /&gt;
Return the typed value given as agument according to what have been set in the '''''valuestype''''' property&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData('0')&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData('1')&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===getSwitchState()===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&lt;br /&gt;
Double Switch in postiion 1&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW = FGINT1.getElement('LTSSTROBESW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Double Switch in postiion 2&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0.5'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Double Switch in postiion 3&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getSwitchState()&lt;br /&gt;
'1'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Combined with the value typing function&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData(LTSSTROBESW.getSwitchState()) # Switch in position 1&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData(LTSSTROBESW.getSwitchState()) # Switch in position 2&lt;br /&gt;
0.5&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; LTSSTROBESW.getTypedData(LTSSTROBESW.getSwitchState()) # Switch in position 3&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=DoubleSwitch_Class&amp;diff=135430</id>
		<title>DoubleSwitch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=DoubleSwitch_Class&amp;diff=135430"/>
		<updated>2022-09-02T13:55:53Z</updated>

		<summary type="html">&lt;p&gt;Daweed: Create Page DoubleSwitch Class&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Switches Class Double'''''Switch''''' will be used to manage standard 3 position switches (2 input needed per switch) and is based on the MCP23017.&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=135429</id>
		<title>Switch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=135429"/>
		<updated>2022-09-02T13:54:27Z</updated>

		<summary type="html">&lt;p&gt;Daweed: Correction&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar&lt;br /&gt;
| name	= GUI Navbar&lt;br /&gt;
| title = FG Int Switches Classes&lt;br /&gt;
| contentstyle = text-align: left;&lt;br /&gt;
| content1 = * [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]&lt;br /&gt;
| content9 = '''Navigation'''&lt;br /&gt;
* [[FG interface]]&lt;br /&gt;
}}&lt;br /&gt;
Switches Class '''''Switch''''' will be used to manage standard 2 position switches (only 1 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
&lt;br /&gt;
== Switches Configuration File ==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/RadioPanel/switches.cfg''&amp;lt;br /&amp;gt;&lt;br /&gt;
This file describes the 2 positions switches configuration used on the radio panel.&amp;lt;br /&amp;gt;&lt;br /&gt;
There are two separate parts in this file.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
# the other sections each describe a display.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=SWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=Switch&lt;br /&gt;
properylist=device,name,port,pin,values,valuestype,invert,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=invert&lt;br /&gt;
prop08=node&lt;br /&gt;
&lt;br /&gt;
[RMP0PSW]&lt;br /&gt;
name=rmp0psw&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
port=A&lt;br /&gt;
pin=2&lt;br /&gt;
values=0,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
invert=0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CONF Section ===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
* '''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
* '''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
* '''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''Switch''' Class&lt;br /&gt;
* '''propertylist''' : List of parameter that are needed to create a '''switch''' object.&lt;br /&gt;
&lt;br /&gt;
=== PROPERTIES Section ===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin         # MCP23017 input where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=invert      # Describe if the input need to be manage inverted [ activate = 0 ]&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
&lt;br /&gt;
== Creating Switches ==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;Switch&amp;quot; in the '''FGIntSwitch.py'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class Switch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin, values, valuestype, invert, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here how switches should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a switch with this class you have to call :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;code&amp;quot;&amp;gt;&lt;br /&gt;
Switch(device, name, port, pin, values, valuestype, invert, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
&lt;br /&gt;
== Switches Methods ==&lt;br /&gt;
=== getName() ===&lt;br /&gt;
Return the switch Name according the configuration&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getName()&lt;br /&gt;
'rmp0psw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getValueType() ===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getNode() ===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getNode()&lt;br /&gt;
'None'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getTypedData() ===&lt;br /&gt;
Return the typed value given as agument according to what have been set in the '''''valuestype''''' property&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(0)&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(1)&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getSwitchState() ===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW = FGINT1.getElement('RMP0PWSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Set the switch 'On' on the panel&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'1'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Combined with the value typing function &amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=135428</id>
		<title>Switch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=135428"/>
		<updated>2022-09-02T13:53:46Z</updated>

		<summary type="html">&lt;p&gt;Daweed: /* getSwitchState() */  Adding Documentation on this function&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar&lt;br /&gt;
| name	= GUI Navbar&lt;br /&gt;
| title = FG Int Switches Classes&lt;br /&gt;
| contentstyle = text-align: left;&lt;br /&gt;
| content1 = * [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]&lt;br /&gt;
| content9 = '''Navigation'''&lt;br /&gt;
* [[FG interface]]&lt;br /&gt;
}}&lt;br /&gt;
Segments switch Class '''''Switch''''' will be used to manage standard 2 position switches (only 1 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
&lt;br /&gt;
== Switches Configuration File ==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/RadioPanel/switches.cfg''&amp;lt;br /&amp;gt;&lt;br /&gt;
This file describes the 2 positions switches configuration used on the radio panel.&amp;lt;br /&amp;gt;&lt;br /&gt;
There are two separate parts in this file.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
# the other sections each describe a display.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=SWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=Switch&lt;br /&gt;
properylist=device,name,port,pin,values,valuestype,invert,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=invert&lt;br /&gt;
prop08=node&lt;br /&gt;
&lt;br /&gt;
[RMP0PSW]&lt;br /&gt;
name=rmp0psw&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
port=A&lt;br /&gt;
pin=2&lt;br /&gt;
values=0,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
invert=0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CONF Section ===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
* '''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
* '''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
* '''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''Switch''' Class&lt;br /&gt;
* '''propertylist''' : List of parameter that are needed to create a '''switch''' object.&lt;br /&gt;
&lt;br /&gt;
=== PROPERTIES Section ===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin         # MCP23017 input where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=invert      # Describe if the input need to be manage inverted [ activate = 0 ]&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
&lt;br /&gt;
== Creating Switches ==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;Switch&amp;quot; in the '''FGIntSwitch.py'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class Switch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin, values, valuestype, invert, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here how switches should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a switch with this class you have to call :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;code&amp;quot;&amp;gt;&lt;br /&gt;
Switch(device, name, port, pin, values, valuestype, invert, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
&lt;br /&gt;
== Switches Methods ==&lt;br /&gt;
=== getName() ===&lt;br /&gt;
Return the switch Name according the configuration&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getName()&lt;br /&gt;
'rmp0psw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getValueType() ===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getNode() ===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getNode()&lt;br /&gt;
'None'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getTypedData() ===&lt;br /&gt;
Return the typed value given as agument according to what have been set in the '''''valuestype''''' property&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(0)&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(1)&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getSwitchState() ===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.7.3 (default, Jan 22 2021, 20:04:44)&lt;br /&gt;
[GCC 8.3.0] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('overheadpanel.cfg')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW = FGINT1.getElement('RMP0PWSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'0'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Set the switch 'On' on the panel&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getSwitchState()&lt;br /&gt;
'1'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Combined with the value typing function &amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PWSW.getTypedData(RMP0PWSW.getSwitchState())&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=135427</id>
		<title>Switch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=135427"/>
		<updated>2022-09-02T13:42:17Z</updated>

		<summary type="html">&lt;p&gt;Daweed: Minor Correction (Typo &amp;amp; precision)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar&lt;br /&gt;
| name	= GUI Navbar&lt;br /&gt;
| title = FG Int Switches Classes&lt;br /&gt;
| contentstyle = text-align: left;&lt;br /&gt;
| content1 = * [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]&lt;br /&gt;
| content9 = '''Navigation'''&lt;br /&gt;
* [[FG interface]]&lt;br /&gt;
}}&lt;br /&gt;
Segments switch Class '''''Switch''''' will be used to manage standard 2 position switches (only 1 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
&lt;br /&gt;
== Switches Configuration File ==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/RadioPanel/switches.cfg''&amp;lt;br /&amp;gt;&lt;br /&gt;
This file describes the 2 positions switches configuration used on the radio panel.&amp;lt;br /&amp;gt;&lt;br /&gt;
There are two separate parts in this file.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
# the other sections each describe a display.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=SWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=Switch&lt;br /&gt;
properylist=device,name,port,pin,values,valuestype,invert,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=invert&lt;br /&gt;
prop08=node&lt;br /&gt;
&lt;br /&gt;
[RMP0PSW]&lt;br /&gt;
name=rmp0psw&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
port=A&lt;br /&gt;
pin=2&lt;br /&gt;
values=0,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
invert=0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CONF Section ===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
* '''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
* '''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
* '''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''Switch''' Class&lt;br /&gt;
* '''propertylist''' : List of parameter that are needed to create a '''switch''' object.&lt;br /&gt;
&lt;br /&gt;
=== PROPERTIES Section ===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin         # MCP23017 input where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=invert      # Describe if the input need to be manage inverted [ activate = 0 ]&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
&lt;br /&gt;
== Creating Switches ==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;Switch&amp;quot; in the '''FGIntSwitch.py'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class Switch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin, values, valuestype, invert, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here how switches should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a switch with this class you have to call :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;code&amp;quot;&amp;gt;&lt;br /&gt;
Switch(device, name, port, pin, values, valuestype, invert, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
&lt;br /&gt;
== Switches Methods ==&lt;br /&gt;
=== getName() ===&lt;br /&gt;
Return the switch Name according the configuration&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getName()&lt;br /&gt;
'rmp0psw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getValueType() ===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getNode() ===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getNode()&lt;br /&gt;
'None'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getTypedData() ===&lt;br /&gt;
Return the typed value given as agument according to what have been set in the '''''valuestype''''' property&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(0)&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(1)&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getSwitchState() ===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=135426</id>
		<title>Switch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=135426"/>
		<updated>2022-09-02T13:38:15Z</updated>

		<summary type="html">&lt;p&gt;Daweed: Side Bar Update&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar&lt;br /&gt;
| name	= GUI Navbar&lt;br /&gt;
| title = FG Int Switches Classes&lt;br /&gt;
| contentstyle = text-align: left;&lt;br /&gt;
| content1 = * [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]&lt;br /&gt;
| content9 = '''Navigation'''&lt;br /&gt;
* [[FG interface]]&lt;br /&gt;
}}&lt;br /&gt;
Segments switch Class '''''Switch''''' will be used to manage standard 2 position switches (only 1 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
&lt;br /&gt;
== Switches Configuration File ==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/RadioPanel/switches.cfg''&amp;lt;br /&amp;gt;&lt;br /&gt;
This file describes the 2 positions switches configuration used on the radio panel.&amp;lt;br /&amp;gt;&lt;br /&gt;
There are two separate parts in this file.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
# the other sections each describe a display.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=SWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=Switch&lt;br /&gt;
properylist=device,name,port,pin,values,valuestype,invert,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=invert&lt;br /&gt;
prop08=node&lt;br /&gt;
&lt;br /&gt;
[RMP0PSW]&lt;br /&gt;
name=rmp0psw&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
port=A&lt;br /&gt;
pin=2&lt;br /&gt;
values=0,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
invert=0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CONF Section ===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
* '''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
* '''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
* '''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''Switch''' Class&lt;br /&gt;
* '''propertylist''' : List of parameter that are needed to create a '''switch''' object.&lt;br /&gt;
&lt;br /&gt;
=== PROPERTIES Section ===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin         # MCP23017 input where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=invert      # Describe if the input need to be manage inverted [ activate = 0 ]&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
&lt;br /&gt;
== Creating Switches ==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;Switch&amp;quot; in the '''FGIntSwitch.py'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class Switch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin, values, valuestype, invert, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here how switches should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a switch with this class you have to call :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;code&amp;quot;&amp;gt;&lt;br /&gt;
Switch(device, name, port, pin, values, valuestype, invert, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
&lt;br /&gt;
== Switches Methods ==&lt;br /&gt;
=== getName() ===&lt;br /&gt;
Return the switch Name according the configuration&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getName()&lt;br /&gt;
'rmp0psw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getValueType() ===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getNode() ===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getValueType()&lt;br /&gt;
'None'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getTypedData() ===&lt;br /&gt;
Return the typed value given as agument&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(0)&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(1)&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getSwitchState() ===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=FGInt_Switches&amp;diff=135425</id>
		<title>FGInt Switches</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=FGInt_Switches&amp;diff=135425"/>
		<updated>2022-09-02T13:37:26Z</updated>

		<summary type="html">&lt;p&gt;Daweed: Side Bar Update&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar&lt;br /&gt;
| name	= GUI Navbar&lt;br /&gt;
| title = FG Int Switches Classes&lt;br /&gt;
| contentstyle = text-align: left;&lt;br /&gt;
| content1 = * [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]&lt;br /&gt;
| content9 = '''Navigation'''&lt;br /&gt;
* [[FG interface]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
'''''Switches''''' classes will be used to manage standard switches and is based on the MCP23017 chipset.&lt;br /&gt;
Switches classes are grouped in the '''FGIntSwitch''' library. With this library you will be able to manage :&lt;br /&gt;
* [[Switch Class ]]: used to manage standard switch 2 positions&lt;br /&gt;
* [[ DoubleSwitch Class ]]: used to manage standard switch 3 positions&lt;br /&gt;
* [[ RotarySwitch class ]]: used to manage rotary switch with n positions&lt;br /&gt;
* [[ ToogleSwitch class ]]: used to manage push button switch (momentary switch)&lt;br /&gt;
&lt;br /&gt;
[[Category:FG Interface]]&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=FGInt_Switches&amp;diff=135424</id>
		<title>FGInt Switches</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=FGInt_Switches&amp;diff=135424"/>
		<updated>2022-09-02T13:35:50Z</updated>

		<summary type="html">&lt;p&gt;Daweed: Update Side Bar&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar&lt;br /&gt;
| name	= GUI Navbar&lt;br /&gt;
| title = FG Int Switches Classes&lt;br /&gt;
| contentstyle = text-align: left;&lt;br /&gt;
| content1 = * [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]&lt;br /&gt;
| content2 = &lt;br /&gt;
| content9 = '''Navigation'''&lt;br /&gt;
* [[FG interface]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
'''''Switches''''' classes will be used to manage standard switches and is based on the MCP23017 chipset.&lt;br /&gt;
Switches classes are grouped in the '''FGIntSwitch''' library. With this library you will be able to manage :&lt;br /&gt;
* [[Switch Class ]]: used to manage standard switch 2 positions&lt;br /&gt;
* [[ DoubleSwitch Class ]]: used to manage standard switch 3 positions&lt;br /&gt;
* [[ RotarySwitch class ]]: used to manage rotary switch with n positions&lt;br /&gt;
* [[ ToogleSwitch class ]]: used to manage push button switch (momentary switch)&lt;br /&gt;
&lt;br /&gt;
[[Category:FG Interface]]&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=FG_Interface_schematics_and_PCBs&amp;diff=128114</id>
		<title>FG Interface schematics and PCBs</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=FG_Interface_schematics_and_PCBs&amp;diff=128114"/>
		<updated>2020-10-16T13:52:20Z</updated>

		<summary type="html">&lt;p&gt;Daweed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FG Interface hardware sidebar}}&lt;br /&gt;
You will in this section resources to build your own cockpit interface.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== FGINT-V3-MASTER-64 ==&lt;br /&gt;
FGINT-V3-MASTER-64 is a FG Interface Master Board, with 64 digital I/O. 2 of theese can be combine to a max of 128 digital I/O.&amp;lt;br/&amp;gt;&lt;br /&gt;
Daughter card(s) as like the Display Card can be connected directly on the Master Board.&amp;lt;br/&amp;gt;&lt;br /&gt;
On the FGINT-V3-MASTER-64 pages, you will find all resources needed to build the master interface board.&lt;br /&gt;
*Schema &amp;amp; PCB files in Kicad format&lt;br /&gt;
*Gerber Files [ ready to use for building process with online services as like jlcpcb.com, nextpcb.com or pcbway.com for example ]&lt;br /&gt;
*Componant list&lt;br /&gt;
&lt;br /&gt;
== FGINT-V3-MASTER-128 ==&lt;br /&gt;
FGINT-V3-MASTER-128 is a FG Interface Master Board, with 128 digital I/O and 256 led Out.&amp;lt;br/&amp;gt;&lt;br /&gt;
The board is not designed to receive daughter board.&amp;lt;/br&amp;gt;&lt;br /&gt;
On the FGINT-V3-MASTER-128 pages, you will find all resources needed to build the master interface board.&lt;br /&gt;
*Schema &amp;amp; PCB files in Kicad format&lt;br /&gt;
*Gerber Files [ ready to use for building process with online services as like jlcpcb.com, nextpcb.com or pcbway.com for example ]&lt;br /&gt;
*Componant list&lt;br /&gt;
&lt;br /&gt;
== Airbus A3xx series ATC Panel ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Airbus A3xx series FCU Panel ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Airbus A3xx series Radio Panel ==&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=FG_Interface_schematics_and_PCBs&amp;diff=128113</id>
		<title>FG Interface schematics and PCBs</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=FG_Interface_schematics_and_PCBs&amp;diff=128113"/>
		<updated>2020-10-16T13:51:21Z</updated>

		<summary type="html">&lt;p&gt;Daweed: /* FGINT-V3-MASTER-128 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FG Interface hardware sidebar}}&lt;br /&gt;
You will in this section resources to build your own cockpit interface.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== FGINT-V3-MASTER-64 ==&lt;br /&gt;
FGINT-V3-MASTER-64 is a FG Interface Master Board, with 64 digital I/O. 2 of theese can be combine to a max of 128 digital I/O.&amp;lt;br/&amp;gt;&lt;br /&gt;
Daughter card(s) as like the Display Card can be connected directly on the Master Board.&amp;lt;br/&amp;gt;&lt;br /&gt;
On the FGINT-V3-MASTER-64 pages, you will find all resources needed to build the master interface board.&lt;br /&gt;
*Schema &amp;amp; PCB files in Kicad format&lt;br /&gt;
*Gerber Files [ ready to use for building process with online services as like jlcpcb.com, nextpcb.com or pcbway.com for example ]&lt;br /&gt;
*Componant list&lt;br /&gt;
&lt;br /&gt;
== FGINT-V3-MASTER-128 ==&lt;br /&gt;
FGINT-V3-MASTER-128 is a FG Interface Master Board, with 128 digital I/O and 256 led Out.&amp;lt;br/&amp;gt;&lt;br /&gt;
The board is not designed to receive daughter board.&amp;lt;/br&amp;gt;&lt;br /&gt;
On the FGINT-V3-MASTER-128 pages, you will find all resources needed to build the master interface board.&lt;br /&gt;
*Schema &amp;amp; PCB files in Kicad format&lt;br /&gt;
*Gerber Files [ ready to use for building process with online services as like jlcpcb.com, nextpcb.com or pcbway.com for example ]&lt;br /&gt;
*Componant list&lt;br /&gt;
&lt;br /&gt;
== Airbus A3xx series ATC Panel ==&lt;br /&gt;
test.&lt;br /&gt;
&lt;br /&gt;
== Airbus A3xx series FCU Panel ==&lt;br /&gt;
test.&lt;br /&gt;
&lt;br /&gt;
== Airbus A3xx series Radio Panel ==&lt;br /&gt;
test.&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=FG_Interface_schematics_and_PCBs&amp;diff=128112</id>
		<title>FG Interface schematics and PCBs</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=FG_Interface_schematics_and_PCBs&amp;diff=128112"/>
		<updated>2020-10-16T13:50:54Z</updated>

		<summary type="html">&lt;p&gt;Daweed: /* FGINT-V3-MASTER-64 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FG Interface hardware sidebar}}&lt;br /&gt;
You will in this section resources to build your own cockpit interface.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== FGINT-V3-MASTER-64 ==&lt;br /&gt;
FGINT-V3-MASTER-64 is a FG Interface Master Board, with 64 digital I/O. 2 of theese can be combine to a max of 128 digital I/O.&amp;lt;br/&amp;gt;&lt;br /&gt;
Daughter card(s) as like the Display Card can be connected directly on the Master Board.&amp;lt;br/&amp;gt;&lt;br /&gt;
On the FGINT-V3-MASTER-64 pages, you will find all resources needed to build the master interface board.&lt;br /&gt;
*Schema &amp;amp; PCB files in Kicad format&lt;br /&gt;
*Gerber Files [ ready to use for building process with online services as like jlcpcb.com, nextpcb.com or pcbway.com for example ]&lt;br /&gt;
*Componant list&lt;br /&gt;
&lt;br /&gt;
== FGINT-V3-MASTER-128 ==&lt;br /&gt;
FGINT-V3-MASTER-128 is a FG Interface Master Board, with 128 digital I/O and 256 led Out&lt;br /&gt;
The board is not designed to receive daughter board.&lt;br /&gt;
On the FGINT-V3-MASTER-128 pages, you will find all resources needed to build the master interface board. &lt;br /&gt;
Schema &amp;amp; PCB files in Kicad format &lt;br /&gt;
Gerber Files [ ready to use for building process with online services as like jlcpcb.com, nextpcb.com or pcbway.com for example ]&lt;br /&gt;
Componant list&lt;br /&gt;
&lt;br /&gt;
== Airbus A3xx series ATC Panel ==&lt;br /&gt;
test.&lt;br /&gt;
&lt;br /&gt;
== Airbus A3xx series FCU Panel ==&lt;br /&gt;
test.&lt;br /&gt;
&lt;br /&gt;
== Airbus A3xx series Radio Panel ==&lt;br /&gt;
test.&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=FG_Interface_schematics_and_PCBs&amp;diff=128111</id>
		<title>FG Interface schematics and PCBs</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=FG_Interface_schematics_and_PCBs&amp;diff=128111"/>
		<updated>2020-10-16T13:49:57Z</updated>

		<summary type="html">&lt;p&gt;Daweed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FG Interface hardware sidebar}}&lt;br /&gt;
You will in this section resources to build your own cockpit interface.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== FGINT-V3-MASTER-64 ==&lt;br /&gt;
FGINT-V3-MASTER-64 is a FG Interface Master Board, with 64 digital I/O. 2 of theese can be combine to a max of 128 digital I/O&lt;br /&gt;
Daughter card(s) as like the Display Card can be connected directly on the Master Board.&lt;br /&gt;
On the FGINT-V3-MASTER-64 pages, you will find all resources needed to build the master interface board. &lt;br /&gt;
Schema &amp;amp; PCB files in Kicad format &lt;br /&gt;
Gerber Files [ ready to use for building process with online services as like jlcpcb.com, nextpcb.com or pcbway.com for example ]&lt;br /&gt;
Componant list&lt;br /&gt;
&lt;br /&gt;
== FGINT-V3-MASTER-128 ==&lt;br /&gt;
FGINT-V3-MASTER-128 is a FG Interface Master Board, with 128 digital I/O and 256 led Out&lt;br /&gt;
The board is not designed to receive daughter board.&lt;br /&gt;
On the FGINT-V3-MASTER-128 pages, you will find all resources needed to build the master interface board. &lt;br /&gt;
Schema &amp;amp; PCB files in Kicad format &lt;br /&gt;
Gerber Files [ ready to use for building process with online services as like jlcpcb.com, nextpcb.com or pcbway.com for example ]&lt;br /&gt;
Componant list&lt;br /&gt;
&lt;br /&gt;
== Airbus A3xx series ATC Panel ==&lt;br /&gt;
test.&lt;br /&gt;
&lt;br /&gt;
== Airbus A3xx series FCU Panel ==&lt;br /&gt;
test.&lt;br /&gt;
&lt;br /&gt;
== Airbus A3xx series Radio Panel ==&lt;br /&gt;
test.&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=FG_Interface_schematics_and_PCBs&amp;diff=128108</id>
		<title>FG Interface schematics and PCBs</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=FG_Interface_schematics_and_PCBs&amp;diff=128108"/>
		<updated>2020-10-16T13:36:09Z</updated>

		<summary type="html">&lt;p&gt;Daweed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Incomplete}}&lt;br /&gt;
{{FG Interface hardware sidebar}}&lt;br /&gt;
You will in this section resources to build your own cockpit interface.&lt;br /&gt;
&lt;br /&gt;
== FGINT-V3-MASTER-64 ==&lt;br /&gt;
&lt;br /&gt;
== FGINT-V3-MASTER-128 ==&lt;br /&gt;
&lt;br /&gt;
== Airbus A3xx series ATC Panel ==&lt;br /&gt;
&lt;br /&gt;
== Airbus A3xx series FCU Panel ==&lt;br /&gt;
&lt;br /&gt;
== Airbus A3xx series Radio Panel ==&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Template:FG_Interface_sidebar&amp;diff=128107</id>
		<title>Template:FG Interface sidebar</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Template:FG_Interface_sidebar&amp;diff=128107"/>
		<updated>2020-10-16T13:29:36Z</updated>

		<summary type="html">&lt;p&gt;Daweed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar&lt;br /&gt;
| name         = Template:FG Interface sidebar&lt;br /&gt;
| title        = [[FG Interface]]&lt;br /&gt;
| contentstyle = text-align: left;&lt;br /&gt;
| content1     = '''Raspberry PI Setup'''&lt;br /&gt;
* [[Raspberry OS setup]]&lt;br /&gt;
* [[Raspberry Python3 Installation]]&lt;br /&gt;
* [[Raspberry I2C Setup]]&lt;br /&gt;
* [[FG Interface installation]]&lt;br /&gt;
&lt;br /&gt;
| content2     = '''FG Interface'''&lt;br /&gt;
* [[FG Interface: How it works]]&lt;br /&gt;
* [[FGInterface Class]]&lt;br /&gt;
* [[I2C Devices Classes]]&lt;br /&gt;
* [[FG Int Objects Modules]]&lt;br /&gt;
* The FGIntServer&lt;br /&gt;
* XML Protocol File&lt;br /&gt;
&lt;br /&gt;
| content3     = '''Hadware'''&lt;br /&gt;
* [[FG Interface schematics and PCBs|FG Interface hardware]]&lt;br /&gt;
&lt;br /&gt;
[[File:FGInt front view.png|thumb|FG Interface. Final prototype alpha]]&lt;br /&gt;
| notemplate   = 1&lt;br /&gt;
}}&amp;lt;includeonly&amp;gt;&lt;br /&gt;
[[Category:FG Interface]]&lt;br /&gt;
&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{-}}&lt;br /&gt;
{{Informative template|1=&lt;br /&gt;
__NOTOC__&lt;br /&gt;
== Goal ==&lt;br /&gt;
&amp;lt;!-- Short description of the purpose of the template, any automatic categorization and if there is things to consider when using or maintaining the template --&amp;gt;&lt;br /&gt;
This sidebar is used for naviagtion in the [[FG Interface]] series of articles.&lt;br /&gt;
&lt;br /&gt;
Adding this template to a page will automatically add [[:Category:FG Interface]] to that page.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
Put this at the top of the aticle&lt;br /&gt;
&lt;br /&gt;
 {{obr}}'''FG Interface sidebar'''{{cbr}}&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Navigation templates]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Template:FG_Interface_hardware_sidebar&amp;diff=128106</id>
		<title>Template:FG Interface hardware sidebar</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Template:FG_Interface_hardware_sidebar&amp;diff=128106"/>
		<updated>2020-10-16T13:28:12Z</updated>

		<summary type="html">&lt;p&gt;Daweed: Adding New Enties&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar&lt;br /&gt;
| name         = FG Interface hardware sidebar&lt;br /&gt;
| title        = [[FG Interface schematics and PCBs|FG Interface hardware]]&lt;br /&gt;
| contentstyle = text-align: left;&lt;br /&gt;
| content1     = '''Raspberry PI Setup'''&lt;br /&gt;
* FGINT-V3-MASTER-64&lt;br /&gt;
* FGINT-V3-MASTER-128&lt;br /&gt;
* Airbus A3xx series ATC Panel&lt;br /&gt;
* Airbus A3xx series FCU Panel&lt;br /&gt;
* Airbus A3xx series Radio Panel&lt;br /&gt;
| content9 = '''Navigation'''&lt;br /&gt;
* [[FG Interface]]&lt;br /&gt;
| notemplate = 1&lt;br /&gt;
}}&amp;lt;includeonly&amp;gt;&lt;br /&gt;
[[Category:FG Interface]]&lt;br /&gt;
&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{-}}&lt;br /&gt;
{{Informative template|1=&lt;br /&gt;
__NOTOC__&lt;br /&gt;
== Goal ==&lt;br /&gt;
This sidebar is used for naviagtion in the [[FG Interface]] [[FG Interface schematics and PCBs|hardware]] series of articles.&lt;br /&gt;
&lt;br /&gt;
Adding this template to a page will automatically add [[:Category:FG Interface]] to that page.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
Put this at the top of the aticle&lt;br /&gt;
 {{obr}}'''FG Interface hardware sidebar'''{{cbr}}&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Navigation templates]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=FG_Interface_schematics_and_PCBs&amp;diff=121228</id>
		<title>FG Interface schematics and PCBs</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=FG_Interface_schematics_and_PCBs&amp;diff=121228"/>
		<updated>2019-12-11T08:42:39Z</updated>

		<summary type="html">&lt;p&gt;Daweed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FG Interface hardware sidebar}}&lt;br /&gt;
You will find in this section, all the plans, diagrams, PCB ... etc, in short all that relates to hardware for FG Interface and its construction.&lt;br /&gt;
Examples of panels can be presented and documented.&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=121206</id>
		<title>Switch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=121206"/>
		<updated>2019-12-03T08:32:22Z</updated>

		<summary type="html">&lt;p&gt;Daweed: /* Switches Methods */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar&lt;br /&gt;
| name	= GUI Navbar&lt;br /&gt;
| title = FG Int Objects Modules&lt;br /&gt;
| contentstyle = text-align: left;&lt;br /&gt;
| content1 = '''Modules Classes'''&lt;br /&gt;
* [[FGInt Segment Display]]&lt;br /&gt;
* [[FGInt SwitchLight]]&lt;br /&gt;
* [[FGInt Switches]]&lt;br /&gt;
* [[FGInt Rotary Encoder]]&lt;br /&gt;
| content2 = '''Switches Class'''&lt;br /&gt;
* [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]&lt;br /&gt;
| content9 = '''Navigation'''&lt;br /&gt;
* [[FG interface]]&lt;br /&gt;
}}&lt;br /&gt;
Segments switch Class '''''Switch''''' will be used to manage standard 2 position switches (only 1 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
&lt;br /&gt;
== Switches Configuration File ==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/RadioPanel/switches.cfg''&amp;lt;br /&amp;gt;&lt;br /&gt;
This file describes the 2 positions switches configuration used on the radio panel.&amp;lt;br /&amp;gt;&lt;br /&gt;
There are two separate parts in this file.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
# the other sections each describe a display.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=SWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=Switch&lt;br /&gt;
properylist=device,name,port,pin,values,valuestype,invert,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=invert&lt;br /&gt;
prop08=node&lt;br /&gt;
&lt;br /&gt;
[RMP0PSW]&lt;br /&gt;
name=rmp0psw&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
port=A&lt;br /&gt;
pin=2&lt;br /&gt;
values=0,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
invert=0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CONF Section ===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
* '''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
* '''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
* '''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''Switch''' Class&lt;br /&gt;
* '''propertylist''' : List of parameter that are needed to create a '''switch''' object.&lt;br /&gt;
&lt;br /&gt;
=== PROPERTIES Section ===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin         # MCP23017 input where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=invert      # Describe if the input need to be manage inverted [ activate = 0 ]&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
&lt;br /&gt;
== Creating Switches ==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;Switch&amp;quot; in the '''FGIntSwitch.py'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class Switch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin, values, valuestype, invert, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here how switches should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a switch with this class you have to call :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;code&amp;quot;&amp;gt;&lt;br /&gt;
Switch(device, name, port, pin, values, valuestype, invert, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
&lt;br /&gt;
== Switches Methods ==&lt;br /&gt;
=== getName() ===&lt;br /&gt;
Return the switch Name according the configuration&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getName()&lt;br /&gt;
'rmp0psw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getValueType() ===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getNode() ===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getValueType()&lt;br /&gt;
'None'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getTypedData() ===&lt;br /&gt;
Return the typed value given as agument&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(0)&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(1)&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getSwitchState() ===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=121205</id>
		<title>Switch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=121205"/>
		<updated>2019-12-03T08:31:51Z</updated>

		<summary type="html">&lt;p&gt;Daweed: /* Switches Methods */  Adding getName method&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar&lt;br /&gt;
| name	= GUI Navbar&lt;br /&gt;
| title = FG Int Objects Modules&lt;br /&gt;
| contentstyle = text-align: left;&lt;br /&gt;
| content1 = '''Modules Classes'''&lt;br /&gt;
* [[FGInt Segment Display]]&lt;br /&gt;
* [[FGInt SwitchLight]]&lt;br /&gt;
* [[FGInt Switches]]&lt;br /&gt;
* [[FGInt Rotary Encoder]]&lt;br /&gt;
| content2 = '''Switches Class'''&lt;br /&gt;
* [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]&lt;br /&gt;
| content9 = '''Navigation'''&lt;br /&gt;
* [[FG interface]]&lt;br /&gt;
}}&lt;br /&gt;
Segments switch Class '''''Switch''''' will be used to manage standard 2 position switches (only 1 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
&lt;br /&gt;
== Switches Configuration File ==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/RadioPanel/switches.cfg''&amp;lt;br /&amp;gt;&lt;br /&gt;
This file describes the 2 positions switches configuration used on the radio panel.&amp;lt;br /&amp;gt;&lt;br /&gt;
There are two separate parts in this file.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
# the other sections each describe a display.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=SWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=Switch&lt;br /&gt;
properylist=device,name,port,pin,values,valuestype,invert,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=invert&lt;br /&gt;
prop08=node&lt;br /&gt;
&lt;br /&gt;
[RMP0PSW]&lt;br /&gt;
name=rmp0psw&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
port=A&lt;br /&gt;
pin=2&lt;br /&gt;
values=0,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
invert=0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CONF Section ===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
* '''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
* '''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
* '''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''Switch''' Class&lt;br /&gt;
* '''propertylist''' : List of parameter that are needed to create a '''switch''' object.&lt;br /&gt;
&lt;br /&gt;
=== PROPERTIES Section ===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin         # MCP23017 input where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=invert      # Describe if the input need to be manage inverted [ activate = 0 ]&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
&lt;br /&gt;
== Creating Switches ==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;Switch&amp;quot; in the '''FGIntSwitch.py'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class Switch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin, values, valuestype, invert, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here how switches should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a switch with this class you have to call :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;code&amp;quot;&amp;gt;&lt;br /&gt;
Switch(device, name, port, pin, values, valuestype, invert, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
&lt;br /&gt;
== Switches Methods ==&lt;br /&gt;
=== getValueType() ===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getName() ===&lt;br /&gt;
Return the switch Name according the configuration&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getName()&lt;br /&gt;
'rmp0psw'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getNode() ===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getValueType()&lt;br /&gt;
'None'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getTypedData() ===&lt;br /&gt;
Return the typed value given as agument&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(0)&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(1)&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getSwitchState() ===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=121198</id>
		<title>Switch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=121198"/>
		<updated>2019-12-02T09:40:58Z</updated>

		<summary type="html">&lt;p&gt;Daweed: /* Switches Methods */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar&lt;br /&gt;
| name	= GUI Navbar&lt;br /&gt;
| title = FG Int Objects Modules&lt;br /&gt;
| contentstyle = text-align: left;&lt;br /&gt;
| content1 = '''Modules Classes'''&lt;br /&gt;
* [[FGInt Segment Display]]&lt;br /&gt;
* [[FGInt SwitchLight]]&lt;br /&gt;
* [[FGInt Switches]]&lt;br /&gt;
* [[FGInt Rotary Encoder]]&lt;br /&gt;
| content2 = '''Switches Class'''&lt;br /&gt;
* [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]&lt;br /&gt;
| content9 = '''Navigation'''&lt;br /&gt;
* [[FG interface]]&lt;br /&gt;
}}&lt;br /&gt;
Segments switch Class '''''Switch''''' will be used to manage standard 2 position switches (only 1 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
&lt;br /&gt;
== Switches Configuration File ==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/RadioPanel/switches.cfg''&amp;lt;br /&amp;gt;&lt;br /&gt;
This file describes the 2 positions switches configuration used on the radio panel.&amp;lt;br /&amp;gt;&lt;br /&gt;
There are two separate parts in this file.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
# the other sections each describe a display.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=SWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=Switch&lt;br /&gt;
properylist=device,name,port,pin,values,valuestype,invert,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=invert&lt;br /&gt;
prop08=node&lt;br /&gt;
&lt;br /&gt;
[RMP0PSW]&lt;br /&gt;
name=rmp0psw&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
port=A&lt;br /&gt;
pin=2&lt;br /&gt;
values=0,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
invert=0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CONF Section ===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
* '''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
* '''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
* '''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''Switch''' Class&lt;br /&gt;
* '''propertylist''' : List of parameter that are needed to create a '''switch''' object.&lt;br /&gt;
&lt;br /&gt;
=== PROPERTIES Section ===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin         # MCP23017 input where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=invert      # Describe if the input need to be manage inverted [ activate = 0 ]&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
&lt;br /&gt;
== Creating Switches ==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;Switch&amp;quot; in the '''FGIntSwitch.py'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class Switch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin, values, valuestype, invert, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here how switches should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a switch with this class you have to call :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;code&amp;quot;&amp;gt;&lt;br /&gt;
Switch(device, name, port, pin, values, valuestype, invert, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
&lt;br /&gt;
== Switches Methods ==&lt;br /&gt;
=== getValueType() ===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getNode() ===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getValueType()&lt;br /&gt;
'None'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getTypedData() ===&lt;br /&gt;
Return the typed value given as agument&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(0)&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getTypedData(1)&lt;br /&gt;
1&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getSwitchState() ===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=121197</id>
		<title>Switch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=121197"/>
		<updated>2019-12-02T09:27:19Z</updated>

		<summary type="html">&lt;p&gt;Daweed: /* getValueType() */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar&lt;br /&gt;
| name	= GUI Navbar&lt;br /&gt;
| title = FG Int Objects Modules&lt;br /&gt;
| contentstyle = text-align: left;&lt;br /&gt;
| content1 = '''Modules Classes'''&lt;br /&gt;
* [[FGInt Segment Display]]&lt;br /&gt;
* [[FGInt SwitchLight]]&lt;br /&gt;
* [[FGInt Switches]]&lt;br /&gt;
* [[FGInt Rotary Encoder]]&lt;br /&gt;
| content2 = '''Switches Class'''&lt;br /&gt;
* [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]&lt;br /&gt;
| content9 = '''Navigation'''&lt;br /&gt;
* [[FG interface]]&lt;br /&gt;
}}&lt;br /&gt;
Segments switch Class '''''Switch''''' will be used to manage standard 2 position switches (only 1 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
&lt;br /&gt;
== Switches Configuration File ==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/RadioPanel/switches.cfg''&amp;lt;br /&amp;gt;&lt;br /&gt;
This file describes the 2 positions switches configuration used on the radio panel.&amp;lt;br /&amp;gt;&lt;br /&gt;
There are two separate parts in this file.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
# the other sections each describe a display.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=SWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=Switch&lt;br /&gt;
properylist=device,name,port,pin,values,valuestype,invert,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=invert&lt;br /&gt;
prop08=node&lt;br /&gt;
&lt;br /&gt;
[RMP0PSW]&lt;br /&gt;
name=rmp0psw&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
port=A&lt;br /&gt;
pin=2&lt;br /&gt;
values=0,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
invert=0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CONF Section ===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
* '''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
* '''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
* '''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''Switch''' Class&lt;br /&gt;
* '''propertylist''' : List of parameter that are needed to create a '''switch''' object.&lt;br /&gt;
&lt;br /&gt;
=== PROPERTIES Section ===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin         # MCP23017 input where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=invert      # Describe if the input need to be manage inverted [ activate = 0 ]&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
&lt;br /&gt;
== Creating Switches ==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;Switch&amp;quot; in the '''FGIntSwitch.py'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class Switch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin, values, valuestype, invert, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here how switches should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a switch with this class you have to call :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;code&amp;quot;&amp;gt;&lt;br /&gt;
Switch(device, name, port, pin, values, valuestype, invert, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
&lt;br /&gt;
== Switches Methods ==&lt;br /&gt;
=== getValueType() ===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
Python 3.4.2 (default, Sep 26 2018, 07:16:01)&lt;br /&gt;
[GCC 4.9.2] on linux&lt;br /&gt;
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from FGInterface import FGInterface as FGINT&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1 = FGINT('radiopanel.cfg', 0)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createDevices()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; FGINT1.createElements()&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW = FGINT1.getElement('RMP0PSW')&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; RMP0PSW.getValueType()&lt;br /&gt;
'int'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getNode() ===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getTypedData() ===&lt;br /&gt;
Return the typed value given as agument&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getSwitchState() ===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=FG_Int_Objects_Modules&amp;diff=121196</id>
		<title>FG Int Objects Modules</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=FG_Int_Objects_Modules&amp;diff=121196"/>
		<updated>2019-12-02T09:23:17Z</updated>

		<summary type="html">&lt;p&gt;Daweed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{:FG Int Objects Modules sidebar}}&lt;br /&gt;
Modules in FG interface are Object Class , as like a map, to build a new object. You have learned about '''HT16K33''' and '''MCP23017''' classes, they are Modules, special Modules named in FG Interface world '''Devices'''. I made this difference to split and make the difference between switch , displays .. etc and the hardware driver chip.&amp;lt;br /&amp;gt;&lt;br /&gt;
All Modules Classes are loaded into the interface, ready to be used and can be requested with the '''getModule()''' Interface Method.&lt;br /&gt;
&lt;br /&gt;
To be loaded, the module need to be declared.&lt;br /&gt;
For memory, the main config file : &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[INT]&lt;br /&gt;
intname=RADIOPANEL&lt;br /&gt;
deviceconf=/opt/fgint/Config/RadioPanel/devices.cfg&lt;br /&gt;
&lt;br /&gt;
[MODULES]&lt;br /&gt;
module01=FGIntHT16K33,HT16K33&lt;br /&gt;
module02=FGIntMCP23017,MCP23017&lt;br /&gt;
module03=FGIntSegDisplay,SegDisplay&lt;br /&gt;
module04=FGIntSwDisplay,SwitchLight&lt;br /&gt;
module05=FGIntSwitch,Switch&lt;br /&gt;
module06=FGIntSwitch,ToogleSwitch&lt;br /&gt;
module07=RotaryEncoder,RotaryEncoder&lt;br /&gt;
&lt;br /&gt;
[AUXCONF]&lt;br /&gt;
displays=/opt/fgint/Config/RadioPanel/displays.cfg&lt;br /&gt;
swlights=/opt/fgint/Config/RadioPanel/swlights.cfg&lt;br /&gt;
switches=/opt/fgint/Config/RadioPanel/switches.cfg&lt;br /&gt;
tglswitches=/opt/fgint/Config/RadioPanel/tglswitches.cfg&lt;br /&gt;
encoders=/opt/fgint/Config/RadioPanel/rotenc.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the '''MODULES''' section, you can see all modules that will be loaded.&lt;br /&gt;
Here We are loading '''HT16K33''' from module file '''FGIntHT16K33.py'''. Same thing for the '''MCP23017''' Module in the '''FGIntMCP23017.py''', '''FGIntSegDisplay.py''' with the '''SegDisplay''' Class&lt;br /&gt;
&lt;br /&gt;
Some Module file can handle more than one Class, as like '''FGIntSwitch.py''' where you can find different Class for different switch types.&lt;br /&gt;
'''FGIntSwitch.py''' own the folling classes : &lt;br /&gt;
* '''Switch''' : Single switch 2 states&lt;br /&gt;
* '''DoubleSwitch''' : Single switch 3 states&lt;br /&gt;
* '''RotarySwitch''' : Use to manage a rotary switch (variable nb position)&lt;br /&gt;
* '''ToogleSwitch''' : Single Push button that will switch between 2 states at each push&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=FG_Int_Objects_Modules&amp;diff=121195</id>
		<title>FG Int Objects Modules</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=FG_Int_Objects_Modules&amp;diff=121195"/>
		<updated>2019-12-02T09:21:11Z</updated>

		<summary type="html">&lt;p&gt;Daweed: Radio Panel main configuration update&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{:FG Int Objects Modules sidebar}}&lt;br /&gt;
Modules in FG interface are Object Class , as like a map, to build a new object. You have learned about '''HT16K33''' and '''MCP23017''' classes, they are Modules, special Modules named in FG Interface world '''Devices'''. I made this difference to split and make the difference between switch , displays .. etc and the hardware driver chip.&amp;lt;br /&amp;gt;&lt;br /&gt;
All Modules Classes are loaded into the interface, ready to be used and can be requested with the '''getModule()''' Interface Method.&lt;br /&gt;
&lt;br /&gt;
To be loaded, the module need to be declared.&lt;br /&gt;
For memory, the main config file : &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[INT]&lt;br /&gt;
intname=RADIOPANEL&lt;br /&gt;
deviceconf=/opt/fgint/Config/RadioPanel/devices.cfg&lt;br /&gt;
&lt;br /&gt;
[MODULES]&lt;br /&gt;
module01=FGIntHT16K33,HT16K33&lt;br /&gt;
module02=FGIntMCP23017,MCP23017&lt;br /&gt;
module03=FGIntSegDisplay,SegDisplay&lt;br /&gt;
module04=FGIntSwDisplay,SwitchLight&lt;br /&gt;
module05=FGIntSwitch,Switch&lt;br /&gt;
module06=FGIntSwitch,ToogleSwitch&lt;br /&gt;
module07=RotaryEncoder,RotaryEncoder&lt;br /&gt;
&lt;br /&gt;
[AUXCONF]&lt;br /&gt;
displays=/opt/fgint/Config/RadioPanel/displays.cfg&lt;br /&gt;
swlights=/opt/fgint/Config/RadioPanel/swlights.cfg&lt;br /&gt;
switches=/opt/fgint/Config/RadioPanel/switches.cfg&lt;br /&gt;
tglswitches=/opt/fgint/Config/RadioPanel/tglswitches.cfg&lt;br /&gt;
encoders=/opt/fgint/Config/RadioPanel/rotenc.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the '''MODULES''' section, you can see all modules that will be loaded.&lt;br /&gt;
Here We are loading '''HT16K33''' from module file '''FGIntHT16K33.py'''. Same thing for the '''MCP23017''' Module in the '''FGIntMCP23017.py''' and '''FGIntSegDisplay.py''' with the '''SegDisplay''' Class&lt;br /&gt;
&lt;br /&gt;
Some Module file can handle more than one Class, as like '''FGIntSwitch.py''' where you can find different Class for different switch types.&lt;br /&gt;
'''FGIntSwitch.py''' own the folling classes : &lt;br /&gt;
* '''Switch''' : Single switch 2 states&lt;br /&gt;
* '''DoubleSwitch''' : Single switch 3 states&lt;br /&gt;
* '''RotarySwitch''' : Use to manage a rotary switch (variable nb position)&lt;br /&gt;
* '''ToogleSwitch''' : Single Push button that will switch between 2 states at each push&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As the radio panel had lots of push button, we need to load the '''ToogleSwitch''' Class.&amp;lt;br /&amp;gt;&lt;br /&gt;
We add it to the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[INT]&lt;br /&gt;
intname=RADIOPANEL&lt;br /&gt;
deviceconf=/opt/fgint/Config/devices.cfg&lt;br /&gt;
&lt;br /&gt;
[MODULES]&lt;br /&gt;
module01=FGIntHT16K33,HT16K33&lt;br /&gt;
module02=FGIntMCP23017,MCP23017&lt;br /&gt;
module03=FGIntSegDisplay,SegDisplay&lt;br /&gt;
module04=FGIntSwitch,Switch&lt;br /&gt;
module04=FGIntSwitch,ToogleSwitch&lt;br /&gt;
&lt;br /&gt;
[AUXCONF]&lt;br /&gt;
displays=/opt/fgint/Config/displays.cfg&lt;br /&gt;
switches=/opt/fgint/Config/switches.cfg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=121194</id>
		<title>Switch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=121194"/>
		<updated>2019-12-02T09:17:39Z</updated>

		<summary type="html">&lt;p&gt;Daweed: /* PROPERTIES Section */ Correction&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar&lt;br /&gt;
| name	= GUI Navbar&lt;br /&gt;
| title = FG Int Objects Modules&lt;br /&gt;
| contentstyle = text-align: left;&lt;br /&gt;
| content1 = '''Modules Classes'''&lt;br /&gt;
* [[FGInt Segment Display]]&lt;br /&gt;
* [[FGInt SwitchLight]]&lt;br /&gt;
* [[FGInt Switches]]&lt;br /&gt;
* [[FGInt Rotary Encoder]]&lt;br /&gt;
| content2 = '''Switches Class'''&lt;br /&gt;
* [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]&lt;br /&gt;
| content9 = '''Navigation'''&lt;br /&gt;
* [[FG interface]]&lt;br /&gt;
}}&lt;br /&gt;
Segments switch Class '''''Switch''''' will be used to manage standard 2 position switches (only 1 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
&lt;br /&gt;
== Switches Configuration File ==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/RadioPanel/switches.cfg''&amp;lt;br /&amp;gt;&lt;br /&gt;
This file describes the 2 positions switches configuration used on the radio panel.&amp;lt;br /&amp;gt;&lt;br /&gt;
There are two separate parts in this file.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
# the other sections each describe a display.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=SWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=Switch&lt;br /&gt;
properylist=device,name,port,pin,values,valuestype,invert,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=invert&lt;br /&gt;
prop08=node&lt;br /&gt;
&lt;br /&gt;
[RMP0PSW]&lt;br /&gt;
name=rmp0psw&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
port=A&lt;br /&gt;
pin=2&lt;br /&gt;
values=0,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
invert=0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CONF Section ===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
* '''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
* '''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
* '''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''Switch''' Class&lt;br /&gt;
* '''propertylist''' : List of parameter that are needed to create a '''switch''' object.&lt;br /&gt;
&lt;br /&gt;
=== PROPERTIES Section ===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin         # MCP23017 input where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=invert      # Describe if the input need to be manage inverted [ activate = 0 ]&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
&lt;br /&gt;
== Creating Switches ==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;Switch&amp;quot; in the '''FGIntSwitch.py'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class Switch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin, values, valuestype, invert, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here how switches should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a switch with this class you have to call :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;code&amp;quot;&amp;gt;&lt;br /&gt;
Switch(device, name, port, pin, values, valuestype, invert, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
&lt;br /&gt;
== Switches Methods ==&lt;br /&gt;
=== getValueType() ===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getNode() ===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getTypedData() ===&lt;br /&gt;
Return the typed value given as agument&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getSwitchState() ===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=121193</id>
		<title>Switch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=121193"/>
		<updated>2019-12-02T09:17:20Z</updated>

		<summary type="html">&lt;p&gt;Daweed: /* PROPERTIES Section */ Properties Informations&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar&lt;br /&gt;
| name	= GUI Navbar&lt;br /&gt;
| title = FG Int Objects Modules&lt;br /&gt;
| contentstyle = text-align: left;&lt;br /&gt;
| content1 = '''Modules Classes'''&lt;br /&gt;
* [[FGInt Segment Display]]&lt;br /&gt;
* [[FGInt SwitchLight]]&lt;br /&gt;
* [[FGInt Switches]]&lt;br /&gt;
* [[FGInt Rotary Encoder]]&lt;br /&gt;
| content2 = '''Switches Class'''&lt;br /&gt;
* [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]&lt;br /&gt;
| content9 = '''Navigation'''&lt;br /&gt;
* [[FG interface]]&lt;br /&gt;
}}&lt;br /&gt;
Segments switch Class '''''Switch''''' will be used to manage standard 2 position switches (only 1 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
&lt;br /&gt;
== Switches Configuration File ==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/RadioPanel/switches.cfg''&amp;lt;br /&amp;gt;&lt;br /&gt;
This file describes the 2 positions switches configuration used on the radio panel.&amp;lt;br /&amp;gt;&lt;br /&gt;
There are two separate parts in this file.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
# the other sections each describe a display.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=SWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=Switch&lt;br /&gt;
properylist=device,name,port,pin,values,valuestype,invert,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=invert&lt;br /&gt;
prop08=node&lt;br /&gt;
&lt;br /&gt;
[RMP0PSW]&lt;br /&gt;
name=rmp0psw&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
port=A&lt;br /&gt;
pin=2&lt;br /&gt;
values=0,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
invert=0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CONF Section ===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
* '''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
* '''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
* '''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''Switch''' Class&lt;br /&gt;
* '''propertylist''' : List of parameter that are needed to create a '''switch''' object.&lt;br /&gt;
&lt;br /&gt;
=== PROPERTIES Section ===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device      # Device Logical Name&lt;br /&gt;
prop02=name        # Switch Name&lt;br /&gt;
prop03=port        # MCP23017 port where the switch is connected&lt;br /&gt;
prop04=pin         # MC23017 input where the switch is connected&lt;br /&gt;
prop05=values      # Values that will be provided for the switch state&lt;br /&gt;
prop06=valuestype  # Typed Values that is used with this switch&lt;br /&gt;
prop07=invert      # Describe if the input need to be manage inverted [ activate = 0 ]&lt;br /&gt;
prop08=node        # FG Property that is manage by the switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
&lt;br /&gt;
== Creating Switches ==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;Switch&amp;quot; in the '''FGIntSwitch.py'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class Switch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin, values, valuestype, invert, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here how switches should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a switch with this class you have to call :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;code&amp;quot;&amp;gt;&lt;br /&gt;
Switch(device, name, port, pin, values, valuestype, invert, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
&lt;br /&gt;
== Switches Methods ==&lt;br /&gt;
=== getValueType() ===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getNode() ===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getTypedData() ===&lt;br /&gt;
Return the typed value given as agument&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getSwitchState() ===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=121192</id>
		<title>Switch Class</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Switch_Class&amp;diff=121192"/>
		<updated>2019-12-02T09:12:02Z</updated>

		<summary type="html">&lt;p&gt;Daweed: Adding Switches Methods&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sidebar&lt;br /&gt;
| name	= GUI Navbar&lt;br /&gt;
| title = FG Int Objects Modules&lt;br /&gt;
| contentstyle = text-align: left;&lt;br /&gt;
| content1 = '''Modules Classes'''&lt;br /&gt;
* [[FGInt Segment Display]]&lt;br /&gt;
* [[FGInt SwitchLight]]&lt;br /&gt;
* [[FGInt Switches]]&lt;br /&gt;
* [[FGInt Rotary Encoder]]&lt;br /&gt;
| content2 = '''Switches Class'''&lt;br /&gt;
* [[Switch Class]]&lt;br /&gt;
* [[DoubleSwitch Class]]&lt;br /&gt;
* [[RotarySwitch Class]]&lt;br /&gt;
* [[ToogleSwitch Class]]&lt;br /&gt;
| content9 = '''Navigation'''&lt;br /&gt;
* [[FG interface]]&lt;br /&gt;
}}&lt;br /&gt;
Segments switch Class '''''Switch''''' will be used to manage standard 2 position switches (only 1 input needed per switch) and is based on the MCP23017.&lt;br /&gt;
&lt;br /&gt;
== Switches Configuration File ==&lt;br /&gt;
Displays configuration file : ''/opt/fgint/Config/RadioPanel/switches.cfg''&amp;lt;br /&amp;gt;&lt;br /&gt;
This file describes the 2 positions switches configuration used on the radio panel.&amp;lt;br /&amp;gt;&lt;br /&gt;
There are two separate parts in this file.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# a general configuration part, in the CONF and PROPERTIES sections.&lt;br /&gt;
# the other sections each describe a display.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[CONF]&lt;br /&gt;
confname=SWITCHES&lt;br /&gt;
library=FGIntSwitch&lt;br /&gt;
module=Switch&lt;br /&gt;
properylist=device,name,port,pin,values,valuestype,invert,node&lt;br /&gt;
&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=invert&lt;br /&gt;
prop08=node&lt;br /&gt;
&lt;br /&gt;
[RMP0PSW]&lt;br /&gt;
name=rmp0psw&lt;br /&gt;
device=IOPACK1&lt;br /&gt;
port=A&lt;br /&gt;
pin=2&lt;br /&gt;
values=0,1&lt;br /&gt;
valuestype=int&lt;br /&gt;
node=None&lt;br /&gt;
invert=0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CONF Section ===&lt;br /&gt;
The '''CONF''' describe what type of object are describe here and how they will be built.&lt;br /&gt;
* '''confname''' : Nothing special here, just a name to set about what we are talking about.&lt;br /&gt;
* '''library''' : FG Interface python library from which the class will be loaded.&lt;br /&gt;
* '''module''' : Module name (Class name) in the library file that will be loaded. Here we are using the '''Switch''' Class&lt;br /&gt;
* '''propertylist''' : List of parameter that are needed to create a '''switch''' object.&lt;br /&gt;
&lt;br /&gt;
=== PROPERTIES Section ===&lt;br /&gt;
Properties section is defined to declare and order each parameter that is needed to create the elements (Super Class FGInt Switches in that case, take some parameters to create a switch object, as the input where the switch is connected on the interface). This is how the interface will be able to understand and use the switch configurations to create them.&lt;br /&gt;
&lt;br /&gt;
For Switches, to create one, you will need to provide for each required parameters. And the section gives the order in which the parameters will be called when creating the object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[PROPERTIES]&lt;br /&gt;
prop01=device&lt;br /&gt;
prop02=name&lt;br /&gt;
prop03=port&lt;br /&gt;
prop04=pin&lt;br /&gt;
prop05=values&lt;br /&gt;
prop06=valuestype&lt;br /&gt;
prop07=invert&lt;br /&gt;
prop08=node&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In '''PROPERTIES''' section, you have to provide parameters name and in which order. With this, FG interface just have to read parameters for each object and use them to create each object.&lt;br /&gt;
&lt;br /&gt;
== Creating Switches ==&lt;br /&gt;
The order of the parameters does not fall from the sky. If we look more closely at the Class &amp;quot;Switch&amp;quot; in the '''FGIntSwitch.py'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class Switch:&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Properties&lt;br /&gt;
    ###############&lt;br /&gt;
&lt;br /&gt;
    ###############&lt;br /&gt;
    # Constructor&lt;br /&gt;
    ###############&lt;br /&gt;
    def __init__(self, device, name, port, pin, values, valuestype, invert, node, debug=0):&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
here how switches should be instantiated:&lt;br /&gt;
&lt;br /&gt;
To create a switch with this class you have to call :&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;code&amp;quot;&amp;gt;&lt;br /&gt;
Switch(device, name, port, pin, values, valuestype, invert, node, [debug])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;'''debug'''&amp;quot; is not mandatory. If not provide, il will be automaticly set to 0&lt;br /&gt;
&lt;br /&gt;
But as already explained several times, you should not have to call this method directly. In normal operation, the objects will be created via the methods of the interface itself (with the '''createElement()''' and/or '''createElements()''' methods)&lt;br /&gt;
&lt;br /&gt;
== Switches Methods ==&lt;br /&gt;
=== getValueType() ===&lt;br /&gt;
Return the type of value that is used witch this switch. Can be bool (boolean), int (integer) or string (string) according with the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getNode() ===&lt;br /&gt;
Return the node that is manage by the switch according the configuration file.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getTypedData() ===&lt;br /&gt;
Return the typed value given as agument&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getSwitchState() ===&lt;br /&gt;
Return the actual state of the switch by reading the I/O Device&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daweed</name></author>
	</entry>
</feed>