1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- # -*- coding:utf-8 -*-
- from ssat_sdk import sat_environment
- import sys,os
- from ConfigParser import *
- try:
- SAT_HOME = sat_environment.getSATRCUDIR()
- BlueToothDir = "bluetooth"
- TW_BLEK_Path = os.path.join(SAT_HOME,BlueToothDir,"TW_BLEK.ini")
- Home_Init = True
- except KeyError, e:
- print "KeyError:", e.message
- class BLKConfig():
- def __init__(self):
- if not os.path.exists(TW_BLEK_Path):
- print 'TW_BLEK.ini文件不存在,采用默认按键配置'
- self.CFGParser = ConfigParser()
- self.CFGParser.read(TW_BLEK_Path)
- '''
- 将TW_BLEK.ini配置中的所有案件加载到字典中。
- '''
- def loadBLEKey(self):
- section = "BLE_KEY"
- try:
- optionList = self.CFGParser.options(section)
- blkDic = {}
- for option in optionList:
- value = self.CFGParser.get(section, option)
- blkDic[option.lower()] = value
- return blkDic
- except Exception,e:
- print "TW_BLEK.ini配置异常"
- return None
- blkCFG = BLKConfig()
- BLK_DIC = blkCFG.loadBLEKey()
- if BLK_DIC is None:
- BLK_DIC = {
- #0C
- "mute":"0C00E2",
- "vol+":"0C00E9",
- "vol-":"0C00EA",
- "power":"0C0079",
- "ch+":"0C009C",
- "ch-":"0C009D",
- "home":"0C0223",
- "back":"0C0224",
- #07
- "rightarrow":"07004F",
- "leftarrow":"070050",
- "downarrow":"070051",
- "uparrow":"070052",
- "enter":"070028",
- "menu":"070065",
- "settings":"0700A8",
- "epg":"07008E"
- }
- # print "BLK_DIC:",BLK_DIC
|