<s> from jnius import autoclass <EOL> from plyer . facades import IrBlaster <EOL> from plyer . platforms . android import activity , SDK_INT , ANDROID_VERSION <EOL> if SDK_INT >= <NUM_LIT> : <EOL> Context = autoclass ( '<STR_LIT>' ) <EOL> ir_manager = activity . getSystemService ( Context . CONSUMER_IR_SERVICE ) <EOL> else : <EOL> ir_manager = None <EOL> class AndroidIrBlaster ( IrBlaster ) : <EOL> def _exists ( self ) : <EOL> if ir_manager and ir_manager . hasIrEmitter ( ) : <EOL> return True <EOL> return False <EOL> @ property <EOL> def multiply_pulse ( self ) : <EOL> '''<STR_LIT>''' <EOL> return not ( SDK_INT == <NUM_LIT> and <EOL> int ( str ( ANDROID_VERSION . RELEASE ) . rsplit ( '<STR_LIT:.>' , <NUM_LIT:1> ) [ - <NUM_LIT:1> ] ) < <NUM_LIT:3> ) <EOL> def _get_frequencies ( self ) : <EOL> if not ir_manager : <EOL> return None <EOL> if hasattr ( self , '<STR_LIT>' ) : <EOL> return self . _frequencies <EOL> ir_frequencies = ir_manager . getCarrierFrequencies ( ) <EOL> if not ir_frequencies : <EOL> return [ ] <EOL> frequencies = [ ] <EOL> for freqrange in ir_frequencies : <EOL> freq = ( freqrange . getMinFrequency ( ) , freqrange . getMaxFrequency ( ) ) <EOL> frequencies . append ( freq ) <EOL> self . _frequencies = frequencies <EOL> return frequencies <EOL> def _transmit ( self , frequency , pattern , mode ) : <EOL> if self . multiply_pulse and mode == '<STR_LIT>' : <EOL> pattern = self . periods_to_microseconds ( frequency , pattern ) <EOL> elif not self . multiply_pulse and mode == '<STR_LIT>' : <EOL> pattern = self . microseconds_to_periods ( frequency , pattern ) <EOL> ir_manager . transmit ( frequency , pattern ) <EOL> def instance ( ) : <EOL> return AndroidIrBlaster ( ) </s>
