使用C语言实现Greengrass IPC

0

【以下的问题经过翻译处理】 你好,

我们开发了一个使用[1]的Lambda可执行文件,在[2]中提到。

这在Greengrass Version 1(GGv1)中完全正常工作。

我们正在探索Greengrass Version 2(GGv2)。

由于Lambda excutable不受GGv2支持。我们按照[3]中提到的client device pattern进行操作。

The only time you would use the client device pattern is if your components are written in a programming language where an AWS IoT device SDK exists. In that case you can have a component act as a client device, but you will have to manage the creation of a thing and certificate in AWS IoT Core.

这很好,但我们最近遇到了一个问题。

使用client device pattern开发的自定义component, 无法在没有连接到互联网的情况下连接到Greengrass核心

component开发是基于AWS IoT Greengrass Core IPC库[4]来开发的,执行IPC时,不会发生同样的问题。

与使用AWS IoT Greengrass Core IPC库[4]开发的其他组件一样,我们希望使用使用client device paatern开发的自定义component能够在一致的条件下工作。

问题1-使用client device pattern的方法是否正确?

我们还考虑了以下几种替代方案-

  • 正如[7]中所述,我们可以使用[6]。但是,这似乎不可行,因为要将C中已编写的完整应用程序转换为C++。
  • 似乎可以通过编写自定义代码[5]来执行IPC。

问题2-如果编写自定义代码执行IPC是更好的方法。这种方法有多可行,我的意思是是否可行?谁能提供点参考步骤或者文档链接吗?

References - [1] - https://github.com/aws/aws-greengrass-core-sdk-c [2] - https://docs.aws.amazon.com/greengrass/v1/developerguide/lambda-functions.html [3] - https://aws.amazon.com/blogs/iot/implementing-local-client-devices-with-aws-iot-greengrass/ [4] - https://docs.aws.amazon.com/greengrass/v2/developerguide/interprocess-communication.html#ipc-service-connect [5] - https://forums.aws.amazon.com/thread.jspa?messageID=973781&#973781 [6] - https://github.com/aws/aws-iot-device-sdk-cpp-v2 [7] - https://forums.aws.amazon.com/message.jspa?messageID=994773#994773

profile picture
专家
已提问 5 个月前8 查看次数
1 回答
0

【以下的回答经过翻译处理】 你好,

据我所了解,你想开发一个组件(component),它能够运行你的可执行文件并与Greengrass core交互。

我认为最好的方案是使用C++ IPC SDK,正如你所指出的[6]。编写一个覆盖C++ SDK的层来暴露所需的功能应该很容易(确保符号不被混淆-例如方法https://isocpp.org/wiki/faq/mixing-c-and-cpp#call-cpp)。你不需要重写现有的C应用程序。

我想听听你认为你将面临哪些挑战。谢谢。

PS.我曾经使用过这种方法来从C代码中使用C++ SDK,但现在找不到现成的代码了。

profile picture
专家
已回答 5 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则