Mstar方案HDMI CEC按键发送流程及修改发送键值方法

    技术2022-07-10  106

    ===》表示该函数主要调用关系

    vendor\mstar\common\apps\MTvPlayer\src\com\mstar\tv\tvplayer\ui\RootActivity.java

    ===》onKeyDown()

            ===》sendCecKey(keyCode)

                  ====>mTvCecManager.sendCecKey(keyCode);

                             =====> native final boolean sendCecKey(int keyCode) 

    JNI调用

    vendor\mstar\common\libraries\tvapi\jni\com_mstar_android_tvapi_common_CecManager.cpp

    ====>jboolean com_mstar_android_tvapi_common_CecManager_sendCecKey()   

    此处会把android的key值做一次转换

    android2MufKey const astCECKeyTranslate[] = { // Note: except the null IR key, all other IR keys should appear once. {AKEYCODE_DPAD_UP, MVK_UP}, {AKEYCODE_DPAD_DOWN, MVK_DOWN}, {AKEYCODE_DPAD_LEFT, MVK_LEFT}, .... }

    AKEYCODE_DPAD_UP等按键值与Android传输下来的一致,其定义文件在:

    frameworks\native\include\android\Keycodes.h

    MVK_UP等数值表示转换后发送下去的值,其定义文件在

    vendor\mstar\common\libraries\tvapi\jni\muf\CustomerKeycode.h

    ===》srv->sendCecKey(astCECKeyTranslate[i].mufKeyCode)

          ....CecManager调用sendCecKey...

               ....CecManagerService::...         

               =====》BOOL MSrv_CEC::SendCECKey(U32 keycode)

                      =====》SendCECKeyFromTVtoDev(MUF_Keycode keycode)

                              =====》transferIrKeyToCecKey(keycode)

                              

    SendCECKey与SendCECKeyFromTVtoDev和transferIrKeyToCecKey都位于MSrv_CEC.cpp文件中

    路径为:project\msrv\commom\src\MSrv_CEC.cpp

    transferIrKeyToCecKey会再次将接收到的keycode转换为自定义的keycode

    EN_MAPI_CEC_MSG_USER_CTRL_PARM MSrv_CEC::transferIrKeyToCecKey(MUF_Keycode IRKey) { ....... //Get customer key mapping stKeyMap = getCecKeyFromTvtoDevCustomerTable(); if((stKeyMap == NULL) || (stKeyMap[0].CECKey == E_MAPI_MSB_UNKNOW)) { // Default key mapping stKeyMap = CECTxUICommandTable; } ........... return CECKey; }

    默认使用CECTxUICommandTable其定义为

    // Default Key mapping for sending key from TV to HDMI device _ST_CEC_IR_KEY_PAIR_T CECTxUICommandTable[] = { {E_MAPI_MSG_UI_PLAY, MVK_PLAY}, {E_MAPI_MSG_UI_STOP, MVK_STOP}, {E_MAPI_MSG_UI_PAUSE, MVK_PAUSE}, .... }

    E_MAPI_MSG_UI_XXX的定义位于:

    MStarSDK/src/datatype/mapi_cec_datatype.h

    Processed: 0.051, SQL: 9