deskcycle_btkclient.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:BlogCode 作者: yaptb 项目源码 文件源码
def __init__(self):

            #the structure for a bt keyboard input report (size is 10 bytes)

            self.state=[
                    0xA1, #this is an input report
                    0x01, #Usage report = Keyboard
                    #Bit array for Modifier keys
                    [0, #Right GUI - Windows Key
                     0, #Right ALT
                     0, #Right Shift
                     0, #Right Control
                     0, #Left GUI
                     0, #Left ALT
                     0, #Left Shift
                     0],    #Left Control
                    0x00,   #Vendor reserved
                    0x00,   #rest is space for 6 keys
                    0x00,
                    0x00,
                    0x00,
                    0x00,
                    0x00]


            print "setting up GPIO"

            GPIO.setmode(GPIO.BOARD)
            GPIO.setup(DeskCycle.PIN,GPIO.IN,pull_up_down=GPIO.PUD_UP)

            print "setting up DBus Client"  

            self.bus = dbus.SystemBus()
            self.btkservice = self.bus.get_object('org.yaptb.btkbservice','/org/yaptb/btkbservice')
            self.iface = dbus.Interface(self.btkservice,'org.yaptb.btkbservice')    


            #hard code the key to send
            self.state[4]=DeskCycle.KEYCODE
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号