# -*- coding: UTF-8 -*-
import Chroma22293

if __name__ == "__main__":
    print '测试C++ Pyd库'
    # 打开设备
    if not Chroma22293.OpenDevice(3, 115200, 8, 0, 1):
        print "打开设备失败"

    print "成功打开设备……"
    # print "获取设备版本：", Chroma22293.GetDeviceSoft()
    # print "获取设备信息：\n", Chroma22293.GetDeviceName()

    if Chroma22293.GetBufStatus():
        print "\nGetBufStatus 成功"
    else:
        print "\nGetBufStatus 失败"

    if Chroma22293.SetPattern(11):
        print "\nSetPattern 成功"
    else:
        print "\nSetPattern 失败"

    if Chroma22293.SetTiming(11):
        print "\nSetTiming 成功"
    else:
        print "\nSetTiming 失败"

    if Chroma22293.SetTimingPattern(11, 11):
        print "\nSetTimingPattern 成功"
    else:
        print "\nSetTimingPattern 失败"

    # 设置Blue；
    if Chroma22293.SetBlueOFF():
        print "\nSetBlueOFF 成功"
    else:
        print "\nSetBlueOFF 失败"

    if Chroma22293.SetBlueON():
        print "\nSetBlueON 成功"
    else:
        print "\nSetBlueON 失败"

    # 设置Green；
    if Chroma22293.SetGreenOFF():
        print "\nSetGreenOFF 成功"
    else:
        print "\nSetGreenOFF 失败"

    if Chroma22293.SetGreenON():
        print "\nSetGreenON 成功"
    else:
        print "\nSetGreenON 失败"

    # 设置Red；
    if Chroma22293.SetRedOFF():
        print "\nSetRedOFF 成功"
    else:
        print "\nSetRedOFF 失败"

    if Chroma22293.SetRedON():
        print "\nSetRedON 成功"
    else:
        print "\nSetRedON 失败"

    # 设置kb lock；
    if Chroma22293.SetKeyBoardLock():
        print "\nSetKeyBoardLock 成功"
    else:
        print "\nSetKeyBoardLock 失败"

    if Chroma22293.SetKeyBoardUnLock():
        print "\nSetKeyBoardUnLock 成功"
    else:
        print "\nSetKeyBoardUnLock 失败"
    
    # 关掉设备;
    Chroma22293.CloseDevice()
