Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PayloadConfig添加RenderCardPayload #55

Open
rxnh8255 opened this issue Mar 6, 2018 · 0 comments
Open

PayloadConfig添加RenderCardPayload #55

rxnh8255 opened this issue Mar 6, 2018 · 0 comments

Comments

@rxnh8255
Copy link

rxnh8255 commented Mar 6, 2018

源代码里面这个地方没有添加RenderCardPayload,
所以在

deviceModuleFactory.getScreenDeviceModule().addRenderListener(new 
  ScreenDeviceModule.IRenderListener() {
            @Override
            public void onRenderDirective(Directive directive) {
                Log.i(TAG, "传回的screen数据: "+directive.rawMessage);
                if(directive.getPayload() instanceof RenderCardPayload){
                    RenderCardPayload rcp =  (RenderCardPayload)directive.getPayload();
                    Log.i(TAG, "rcpType: "+rcp.type);
                    if(rcp.type == RenderCardPayload.Type.StandardCard){
                        //do something
                    }
                }
            }
        });

会报错
在com.baidu.duer.dcs.framework.message.PayloadConfig里面添加代码

private PayloadConfig() {
        payloadClass = new HashMap<>();

        // AudioInputImpl
        ...
        // Screen
        namespace = com.baidu.duer.dcs.devicemodule.screen.ApiConstants.NAMESPACE;
        name = com.baidu.duer.dcs.devicemodule.screen.ApiConstants.Directives.HtmlView.NAME;
        insertPayload(namespace, name, HtmlPayload.class);
        name = com.baidu.duer.dcs.devicemodule.screen.ApiConstants.Directives.RenderVoiceInputText.NAME;
        insertPayload(namespace, name, RenderVoiceInputTextPayload.class);
        //添加的代码
        name = com.baidu.duer.dcs.devicemodule.screen.ApiConstants.Directives.RenderCard.NAME;
        insertPayload(namespace, name, RenderCardPayload.class);
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant