Driver Programming: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
A [[Device Class]] is a '''main.py''' file in which a python class-Object is inherited from a parent class called EmptyDeviceClass. | A [[Device Class]] is a '''main.py''' file in which a python class-Object is inherited from a parent class called EmptyDeviceClass. | ||
{{syntaxhighlight|lang=python|code= | {{syntaxhighlight|lang=python|code= | ||
from EmptyDeviceClass import EmptyDevice | from EmptyDeviceClass import EmptyDevice # Loading the EmptyDevice Class | ||
class Device(EmptyDevice): # Creating a new Device Class by inheriting from EmptyDevice | |||
class Device(EmptyDevice): | def __init__(self): # The python class object need to be initialized | ||
EmptyDevice.__init__(self) # Finally, the initialization of EmptyDevice has to be done | |||
def __init__(self): | |||
EmptyDevice.__init__(self) | |||
}} | }} | ||
This | This is a minimal working example to create a Device Class. |
Revision as of 08:37, 9 November 2017
A Device Class is a main.py file in which a python class-Object is inherited from a parent class called EmptyDeviceClass.
from EmptyDeviceClass import EmptyDevice # Loading the EmptyDevice Class
class Device(EmptyDevice): # Creating a new Device Class by inheriting from EmptyDevice
def __init__(self): # The python class object need to be initialized
EmptyDevice.__init__(self) # Finally, the initialization of EmptyDevice has to be done
This is a minimal working example to create a Device Class.