<s> """<STR_LIT>""" <EOL> import logging <EOL> from mpf . system . platform import Platform <EOL> from mpf . system . utility_functions import Util <EOL> class HardwarePlatform ( Platform ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , machine ) : <EOL> super ( HardwarePlatform , self ) . __init__ ( machine ) <EOL> self . log = logging . getLogger ( "<STR_LIT>" ) <EOL> self . log . debug ( "<STR_LIT>" ) <EOL> self . hw_switches = dict ( ) <EOL> self . initial_states_sent = False <EOL> self . features [ '<STR_LIT>' ] = <NUM_LIT:255> <EOL> self . features [ '<STR_LIT>' ] = False <EOL> self . features [ '<STR_LIT>' ] = False <EOL> self . features [ '<STR_LIT>' ] = False <EOL> self . features [ '<STR_LIT>' ] = False <EOL> self . machine . config [ '<STR_LIT>' ] = self . features <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' <EOL> def configure_driver ( self , config , device_type = '<STR_LIT>' ) : <EOL> driver = VirtualDriver ( config [ '<STR_LIT>' ] ) <EOL> driver . driver_settings = config <EOL> driver . driver_settings [ '<STR_LIT>' ] = <NUM_LIT:30> <EOL> return driver , config [ '<STR_LIT>' ] <EOL> def configure_switch ( self , config ) : <EOL> state = <NUM_LIT:0> <EOL> if config [ '<STR_LIT:type>' ] . upper ( ) == '<STR_LIT>' : <EOL> state = <NUM_LIT:1> <EOL> self . hw_switches [ config [ '<STR_LIT>' ] ] = state <EOL> switch = VirtualSwitch ( config [ '<STR_LIT>' ] ) <EOL> switch . driver_settings = config <EOL> return switch , config [ '<STR_LIT>' ] <EOL> def get_hw_switch_states ( self ) : <EOL> if not self . initial_states_sent : <EOL> if '<STR_LIT>' in self . machine . config : <EOL> initial_active_switches = [ self . machine . switches [ x ] . number for x in <EOL> Util . string_to_list ( <EOL> self . machine . config [ '<STR_LIT>' ] ) ] <EOL> for k , v in self . hw_switches . iteritems ( ) : <EOL> if k in initial_active_switches : <EOL> self . hw_switches [ k ] ^= <NUM_LIT:1> <EOL> self . initial_states_sent = True <EOL> else : <EOL> switches = [ x for x in self . machine . switches if x . platform == self ] <EOL> for switch in switches : <EOL> self . hw_switches [ switch . number ] = switch . state ^ switch . invert <EOL> return self . hw_switches <EOL> def configure_matrixlight ( self , config ) : <EOL> return VirtualMatrixLight ( config [ '<STR_LIT>' ] ) , config [ '<STR_LIT>' ] <EOL> def configure_led ( self , config ) : <EOL> return VirtualLED ( config [ '<STR_LIT>' ] ) <EOL> def configure_gi ( self , config ) : <EOL> return VirtualGI ( config [ '<STR_LIT>' ] ) , config [ '<STR_LIT>' ] <EOL> def configure_dmd ( self ) : <EOL> return VirtualDMD ( self . machine ) <EOL> def write_hw_rule ( self , * args , ** kwargs ) : <EOL> pass <EOL> def clear_hw_rule ( self , sw_name ) : <EOL> sw_num = self . machine . switches [ sw_name ] . number <EOL> for entry in self . hw_switch_rules . keys ( ) : <EOL> if entry . startswith ( <EOL> self . machine . switches . number ( sw_num ) . name ) : <EOL> del self . hw_switch_rules [ entry ] <EOL> class VirtualSwitch ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , number ) : <EOL> self . log = logging . getLogger ( '<STR_LIT>' ) <EOL> self . number = number <EOL> class VirtualMatrixLight ( object ) : <EOL> def __init__ ( self , number ) : <EOL> self . log = logging . getLogger ( '<STR_LIT>' ) <EOL> self . number = number <EOL> def on ( self , brightness = <NUM_LIT:255> , fade_ms = <NUM_LIT:0> , start = <NUM_LIT:0> ) : <EOL> pass <EOL> def off ( self ) : <EOL> pass <EOL> class VirtualLED ( object ) : <EOL> def __init__ ( self , number ) : <EOL> self . log = logging . getLogger ( '<STR_LIT>' ) <EOL> self . number = number <EOL> def color ( self , color , fade_ms = <NUM_LIT:0> , brightness_compensation = True ) : <EOL> pass <EOL> def disable ( self ) : <EOL> pass <EOL> def enable ( self , brightness_compensation = True ) : <EOL> pass <EOL> class VirtualGI ( object ) : <EOL> def __init__ ( self , number ) : <EOL> self . log = logging . getLogger ( '<STR_LIT>' ) <EOL> self . number = number <EOL> def on ( self , brightness , fade_ms , start ) : <EOL> pass <EOL> def off ( self ) : <EOL> pass <EOL> class VirtualDriver ( object ) : <EOL> def __init__ ( self , number ) : <EOL> self . log = logging . getLogger ( '<STR_LIT>' ) <EOL> self . number = number <EOL> def __repr__ ( self ) : <EOL> return "<STR_LIT>" . format ( self . number ) <EOL> def validate_driver_settings ( self , ** kwargs ) : <EOL> return dict ( ) <EOL> def disable ( self ) : <EOL> pass <EOL> def enable ( self ) : <EOL> pass <EOL> def pulse ( self , milliseconds = None ) : <EOL> if milliseconds : <EOL> return milliseconds <EOL> else : <EOL> return self . driver_settings [ '<STR_LIT>' ] <EOL> def state ( self ) : <EOL> pass <EOL> def tick ( self ) : <EOL> pass <EOL> def reconfigure ( self , polarity ) : <EOL> pass <EOL> class VirtualDMD ( object ) : <EOL> def __init__ ( self , machine ) : <EOL> pass <EOL> def update ( self , data ) : <EOL> pass </s>
