Пример #1
0
 def slot_rebootPOS(self):
     ret = device().reboot()
     if(ret == 0):
         device().runApp()
     if(ret != 0):
         ErrMsg("download main app err!!!")
     self.getInput()
Пример #2
0
    def slot_downloadApp(self):
        print "download app..."
        print('path:%s' %self.path)
        fileName = ''
        sdm_enable = 0

        # read app config.ini
        sConfigure = configure()
        ret = sConfigure.loadConfig(0, self.path)
        if(ret == 0):
            localpath = sConfigure.sCfg['bin_path']
            ret = sConfigure.loadAppInfo()
            # not find appInfo.ini
            if(ret == 0):
                fileName = sConfigure.sCfg['[appInfo]appInfo->appFile']
            else:
                fileName = API_ChooseFile('*.img', localpath)
        # choose app file
        if(ret == 0 and len(fileName) <= 0):
            ret = -1
            print('>>> error: could not find app file')
        if(ret == 0 and sConfigure.sCfg['sdm_enable'] == 'true'):
            sdm_enable = 1
        if(ret == 0):
            ret = device().downloadApp(sdm_enable, '%s%s' %(localpath, fileName), updFile)
        if(ret != 0):
            ErrMsg("down app err!!!")
        self.getInput()
Пример #3
0
    def slot_downloadFont(self):
        print "download font..."
        print('path:%s' %self.path)

        # read app config.ini
        sConfigure = configure()
        ret = sConfigure.loadConfig(0, self.path)
        if(ret == 0):
            localpath = '%s/' %sConfigure.sCfg['[pdk]font->localpath']
            sdm_enable = 0
            if 'sdm_enable' in sConfigure.sCfg:
                if(sConfigure.sCfg['sdm_enable'] == 'true'):
                    sdm_enable = 1
            else:
                sysFile = API_Choose([0], 'Choose File System', 'LFS System|FAT System', '|')
                if(len(sysFile) <= 0):
                    ret = -1
                elif(sysFile == 'LFS System'):
                    sdm_enable = 1
        #----
        if(ret == 0):
            while True:
                if 'font_file' in sConfigure.sCfg:
                    font_list = sConfigure.sCfg['font_file']
                else:
                    font_list = sConfigure.sCfg['[pdk]config->font_list']
                if(len(font_list) <= 0):
                    ret = -1
                    break

                fontFile = API_Choose([0, 99, 'Select all'], 'Choose font file', font_list, ',\/')
                font_list = font_list.split(',')
                if(len(fontFile) <= 0):
                    break
                elif(fontFile != 'Select all'):
                    font_list = []
                    font_list.append(fontFile)

                for i,fileName in enumerate(font_list):
                    ret = device().pushFile(sdm_enable, '%s%s'%(localpath, fileName), fileName)
                if(fontFile == 'Select all'):
                    break

        if(ret != 0):
            ErrMsg("download font err!!!")
        self.getInput()
Пример #4
0
    def slot_setLogo(self):
        print "set logo..."
        print('path:%s' %self.path)

        # read app config.ini
        sConfigure = configure()
        ret = sConfigure.loadConfig(0, self.path)
        if(ret == 0):
            if 'logo_img' not in sConfigure.sCfg:
                fileName = API_ChooseFile('*.bmp', sConfigure.sCfg['[pdk]logo->localpath'])
            else:
                fileName = '%s/%s' %(sConfigure.sCfg['app_path'], sConfigure.sCfg['logo_img'])
            if(fileName == None or len(fileName) <= 0):
                ret = -1
        if(ret == 0):
            ret = device().setLogo(fileName)
        if(ret != 0):
            ErrMsg("set logo err!!!")
        self.getInput()
Пример #5
0
    def slot_downloadMainApp(self):
        print "download main app..."
        print('path:%s' %self.path)

        # read app config.ini
        sConfigure = configure()
        ret = sConfigure.loadConfig(0, self.path)
        if(ret == 0):
            if 'main_app' not in sConfigure.sCfg:
                fileName = API_ChooseFile('*.img', sConfigure.sCfg['[pdk]mainapp->localpath'])
            else:
                fileName = '%s%s' %(sConfigure.sCfg['[pdk]mainapp->localpath'], sConfigure.sCfg['main_app'])
            if(fileName == None or len(fileName) <= 0):
                ret = -1
        if(ret == 0):
            ret = device().downloadMainApp(fileName)
        if(ret == 0):
            self.slot_rebootPOS()
        if(ret != 0):
            ErrMsg("download main app err!!!")
            self.getInput()
Пример #6
0
    def slot_downloadResource(self):
        print "download resource..."
        print('path:%s' %self.path)

        # read app config.ini
        sConfigure = configure()
        ret = sConfigure.loadConfig(0, self.path)
        if(ret == 0):
            if 'param_file' not in sConfigure.sCfg:
                ret = -1
        if(ret == 0):
            sdm_enable = 0
            if(sConfigure.sCfg['sdm_enable'] == 'true'):
                sdm_enable = 1

            param_list = sConfigure.sCfg['param_file'].split(',')
            for i,fileName in enumerate(param_list):
                localpath = '%s/resource/%s' %(sConfigure.sCfg['app_path'], fileName)
                ret = device().pushFile(sdm_enable, localpath, fileName)

        if(ret != 0):
            ErrMsg("download param file err!!!")
        self.getInput()
Пример #7
0
    def slot_downloadSP(self):
        print "download sp..."
        print('path:%s' %self.path)

        # read app config.ini
        sConfigure = configure()
        ret = sConfigure.loadConfig(0, self.path)
        # 检索文件
        #if(ret == 0):

        if(ret == 0):
            sdm_enable = 0
            if(sConfigure.sCfg['sdm_enable'] == 'true'):
                sdm_enable = 1

            #sp_file = sConfigure.sCfg['sp_file']
            sp_file = "sp_p90.bin"
            localpath = 'tools/%s' %(sp_file)
            ret = device().pushFile(sdm_enable, localpath, "sp.bin")
        if(ret == 0):
            self.slot_rebootPOS()
        if(ret != 0):
            ErrMsg("download sp err!!!")
            self.getInput()
Пример #8
0
    def __init__(self, path=None):
        self.enableInput    = 1
        self.path           = path
        self.E_MenuType     = enum(MT_MainMenu=0, MT_ToolMenu=1)

        self.signals_home = {
            "1": device().formatFilesSystem,
            "2": device().setAutoRun,
            "3": device().setDontAutoRun,
            "4": self.slot_setLogo,
            "5": self.noSupport,
            "6": self.slot_downloadMainApp,
            "7": self.slot_downloadFont,

            "r": self.slot_rebootPOS,
            "q": API_Quit
        }

        self.signals_tool = {
            "1": self.slot_buildClean,
            "2": self.slot_build,
            "3": self.slot_downloadApp,

            "11": device().formatFilesSystem,
            "12": device().setAutoRun,
            "13": device().setDontAutoRun,
            "14": self.slot_setLogo,

            "21": self.noSupport,
            "22": self.slot_downloadMainApp,
            "23": self.slot_downloadFont,
            "24": self.slot_downloadResource,

            "r": self.slot_rebootPOS,
            "q": API_Quit
        }