__init__.py (1346B)
1 from kivy.uix.widget import Widget 2 from kivy.properties import ObjectProperty 3 from kivy.core import core_select_lib 4 5 __all__ = ('NFCBase', 'NFCScanner') 6 7 class NFCBase(Widget): 8 ''' This is the base Abstract definition class that the actual hardware dependent 9 implementations would be based on. If you want to define a feature that is 10 accessible and implemented by every platform implementation then define that 11 method in this class. 12 ''' 13 14 payload = ObjectProperty(None) 15 '''This is the data gotten from the tag. 16 ''' 17 18 def nfc_init(self): 19 ''' Initialize the adapter. 20 ''' 21 pass 22 23 def nfc_disable(self): 24 ''' Disable scanning 25 ''' 26 pass 27 28 def nfc_enable(self): 29 ''' Enable Scanning 30 ''' 31 pass 32 33 def nfc_enable_exchange(self, data): 34 ''' Enable P2P Ndef exchange 35 ''' 36 pass 37 38 def nfc_disable_exchange(self): 39 ''' Disable/Stop P2P Ndef exchange 40 ''' 41 pass 42 43 # load NFCScanner implementation 44 45 NFCScanner = core_select_lib('nfc_manager', ( 46 # keep the dummy implementation as the last one to make it the fallback provider.NFCScanner = core_select_lib('nfc_scanner', ( 47 ('android', 'scanner_android', 'ScannerAndroid'), 48 ('dummy', 'scanner_dummy', 'ScannerDummy')), True, 'electrum.gui.kivy')