tscanner_dummy.py - electrum - Electrum Bitcoin wallet
HTML git clone https://git.parazyd.org/electrum
DIR Log
DIR Files
DIR Refs
DIR Submodules
---
tscanner_dummy.py (1501B)
---
1 ''' Dummy NFC Provider to be used on desktops in case no other provider is found
2 '''
3 from . import NFCBase
4 from kivy.clock import Clock
5 from kivy.logger import Logger
6 from kivy.app import App
7
8 class ScannerDummy(NFCBase):
9 '''This is the dummy interface that gets selected in case any other
10 hardware interface to NFC is not available.
11 '''
12
13 _initialised = False
14
15 name = 'NFCDummy'
16
17 def nfc_init(self):
18 # print 'nfc_init()'
19
20 Logger.debug('NFC: configure nfc')
21 self._initialised = True
22 self.nfc_enable()
23 return True
24
25 def on_new_intent(self, dt):
26 tag_info = {'type': 'dymmy',
27 'message': 'dummy',
28 'extra details': None}
29
30 # let Main app know that a tag has been detected
31 app = App.get_running_app()
32 app.tag_discovered(tag_info)
33 app.show_info('New tag detected.', duration=2)
34 Logger.debug('NFC: got new dummy tag')
35
36 def nfc_enable(self):
37 Logger.debug('NFC: enable')
38 if self._initialised:
39 Clock.schedule_interval(self.on_new_intent, 22)
40
41 def nfc_disable(self):
42 # print 'nfc_enable()'
43 Clock.unschedule(self.on_new_intent)
44
45 def nfc_enable_exchange(self, data):
46 ''' Start sending data
47 '''
48 Logger.debug('NFC: sending data {}'.format(data))
49
50 def nfc_disable_exchange(self):
51 ''' Disable/Stop ndef exchange
52 '''
53 Logger.debug('NFC: disable nfc exchange')