Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
54 lines (42 sloc) 1.22 KB
import time
from py9b.link.base import LinkTimeoutException
from py9b.transport.base import BaseTransport as BT
from py9b.command.regio import ReadRegs, WriteRegs
from kivy.utils import platform
try:
from kivymd.toast import toast
except:
print('no toast for you')
# toast or print
def tprint(msg):
try:
toast(msg)
except:
print(msg)
class Command:
def __init__(self, conn):
self.new_sn = ''
self.device = ''
self.conn = conn
def setdev(self, d):
self.device = d.lower()
tprint(self.device+' selected as device')
def setnewsn(self, p):
self.new_sn = p
tprint(self.new_sn+' input for newsn')
def powerdown(self):
tran = self.conn._tran
tran.execute(WriteRegs(BT.ESC, 0x79, "<H", 0x0001))
tprint('Done')
def lock(self):
tran = self.conn._tran
tran.execute(WriteRegs(BT.ESC, 0x70, "<H", 0x0001))
tprint('Done')
def unlock(self):
tran = self.conn._tran
tran.execute(WriteRegs(BT.ESC, 0x71, "<H", 0x0001))
tprint('Done')
def reboot(self):
tran = self.conn._tran
tran.execute(WriteRegs(BT.ESC, 0x78, "<H", 0x0001))
tprint('Done')
You can’t perform that action at this time.