hp webos、pdk 插件在混合应用程序中失效。

发布于 2024-11-30 20:27:11 字数 709 浏览 1 评论 0原文

我一直在尝试从 mojo 混合应用程序调用 pdk 插件,并且也尝试使用 enyo 应用程序进行相同的操作。在这两种情况下,我的 pdk 插件都显示为 ,有趣的是,在 enyo 的情况下,我收到了插件注册完成后发送的plugin_ready 响应。

在 web-os 网站上,他们提到 pdk 插件的问题导致它看起来不可用。

但我找不到解决它的方法。

这就是我的插件的样子,

PDL_bool powerCall(PDL_JSParameters *params) {
    runsine();
  char *reply = "Done";
    PDL_JSReply(params, reply);
 return PDL_TRUE; 


}

int main(){
     int result = SDL_Init(SDL_INIT_VIDEO);


    PDL_Init(0);

    PDL_RegisterJSHandler("pawar", powerCall);

    PDL_JSRegistrationComplete();

    PDL_CallJS("ready", NULL, 0); // this is for enyo
    PDL_Quit();
    SDL_Quit();
return 0;
}

请建议我如何解决这个问题。我知道这是一项非常简单的任务,但我对花了这么长时间感到沮丧。

谢谢 香卡

I have been trying to call a pdk plugin from the mojo hybrid app and have also tried the same with enyo app. In both cases my pdk plugin is shown as , Interesting thing is in case of enyo, i received the plugin_ready response which is sent after the plugin registration is complete.

in the web-os site, they mentioned that it is the issue with pdk plugin that makes it look defunct.

but i could not find a method to resolve it.

This is how my plugin looks,

PDL_bool powerCall(PDL_JSParameters *params) {
    runsine();
  char *reply = "Done";
    PDL_JSReply(params, reply);
 return PDL_TRUE; 


}

int main(){
     int result = SDL_Init(SDL_INIT_VIDEO);


    PDL_Init(0);

    PDL_RegisterJSHandler("pawar", powerCall);

    PDL_JSRegistrationComplete();

    PDL_CallJS("ready", NULL, 0); // this is for enyo
    PDL_Quit();
    SDL_Quit();
return 0;
}

please suggest me how to solve this issue. i know its a very simple task and am frustrated that its taking this long.

Thanks
Shankar

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时光无声 2024-12-07 20:27:11

在您的插件中,您应该在调用“ready”函数之后、调用 PDL_Quit() 和 SDL_Quit() 之前进入事件循环。没有事件循环会导致插件进程立即退出。

以下是基于 PDK 附带的“简单”应用程序的示例:

int main(){
    int result = SDL_Init(SDL_INIT_VIDEO);
    PDL_Init(0);
    PDL_RegisterJSHandler("pawar", powerCall);
    PDL_JSRegistrationComplete();
    PDL_CallJS("ready", NULL, 0); // this is for enyo

    atexit(SDL_Quit);
    atexit(PDL_Quit);

    SDL_Event Event;
    bool paused = false;

    while (1) {
        bool gotEvent;
        if (paused) {
            SDL_WaitEvent(&Event);
            gotEvent = true;
        }
        else {
            gotEvent = SDL_PollEvent(&Event);
        }

        while (gotEvent) {
            switch (Event.type) {
                case SDL_ACTIVEEVENT:
                    if (Event.active.state == SDL_APPACTIVE) {
                        paused = !Event.active.gain;
                    }
                    break;

                case SDL_QUIT:
                    // We exit anytime we get a request to quit the app
                    // all shutdown code is registered via atexit() so this is clean.
                    exit(0);
                    break;

                // handle any other events interesting to your plugin here

                default:
                    break;
            }
            gotEvent = SDL_PollEvent(&Event);
        }
    }
    return 0;
}

In your plugin you should enter an event loop after you call the "ready" function, and before you call the PDL_Quit() and SDL_Quit(). Not having an event loop causes the plugin process to quit right away.

Here is an example based on the "simple" app that ships with the PDK:

int main(){
    int result = SDL_Init(SDL_INIT_VIDEO);
    PDL_Init(0);
    PDL_RegisterJSHandler("pawar", powerCall);
    PDL_JSRegistrationComplete();
    PDL_CallJS("ready", NULL, 0); // this is for enyo

    atexit(SDL_Quit);
    atexit(PDL_Quit);

    SDL_Event Event;
    bool paused = false;

    while (1) {
        bool gotEvent;
        if (paused) {
            SDL_WaitEvent(&Event);
            gotEvent = true;
        }
        else {
            gotEvent = SDL_PollEvent(&Event);
        }

        while (gotEvent) {
            switch (Event.type) {
                case SDL_ACTIVEEVENT:
                    if (Event.active.state == SDL_APPACTIVE) {
                        paused = !Event.active.gain;
                    }
                    break;

                case SDL_QUIT:
                    // We exit anytime we get a request to quit the app
                    // all shutdown code is registered via atexit() so this is clean.
                    exit(0);
                    break;

                // handle any other events interesting to your plugin here

                default:
                    break;
            }
            gotEvent = SDL_PollEvent(&Event);
        }
    }
    return 0;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文