Changes

Jump to: navigation, search

Switch Class

1,597 bytes added, 08:32, 3 December 2019
m
Switches Methods
prop02=name # Switch Name
prop03=port # MCP23017 port where the switch is connected
prop04=pin # MC23017 MCP23017 input where the switch is connected
prop05=values # Values that will be provided for the switch state
prop06=valuestype # Typed Values that is used with this switch
== Switches Methods ==
=== getName() ===
Return the switch Name according the configuration
<syntaxhighlight lang="python">
Python 3.4.2 (default, Sep 26 2018, 07:16:01)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from FGInterface import FGInterface as FGINT
>>> FGINT1 = FGINT('radiopanel.cfg', 0)
>>> FGINT1.createDevices()
>>> FGINT1.createElements()
>>> RMP0PSW = FGINT1.getElement('RMP0PSW')
>>> RMP0PSW.getName()
'rmp0psw'
>>>
</syntaxhighlight>
 
=== getValueType() ===
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.
<syntaxhighlight lang="python">
Python 3.4.2 (default, Sep 26 2018, 07:16:01)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from FGInterface import FGInterface as FGINT
>>> FGINT1 = FGINT('radiopanel.cfg', 0)
>>> FGINT1.createDevices()
>>> FGINT1.createElements()
>>> RMP0PSW = FGINT1.getElement('RMP0PSW')
>>> RMP0PSW.getValueType()
'int'
>>>
</syntaxhighlight>
Return the node that is manage by the switch according the configuration file.
<syntaxhighlight lang="python">
Python 3.4.2 (default, Sep 26 2018, 07:16:01)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from FGInterface import FGInterface as FGINT
>>> FGINT1 = FGINT('radiopanel.cfg', 0)
>>> FGINT1.createDevices()
>>> FGINT1.createElements()
>>> RMP0PSW = FGINT1.getElement('RMP0PSW')
>>> RMP0PSW.getValueType()
'None'
>>>
</syntaxhighlight>
Return the typed value given as agument
<syntaxhighlight lang="python">
Python 3.4.2 (default, Sep 26 2018, 07:16:01)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from FGInterface import FGInterface as FGINT
>>> FGINT1 = FGINT('radiopanel.cfg', 0)
>>> FGINT1.createDevices()
>>> FGINT1.createElements()
>>> RMP0PSW = FGINT1.getElement('RMP0PSW')
>>> RMP0PSW.getTypedData(0)
0
>>> RMP0PSW.getTypedData(1)
1
>>>
</syntaxhighlight>
494
edits

Navigation menu