Greengrass IPC using c

0

Hello,

We have a Lambda executable developed using [1] as mentioned here - [2].
This is working completely fine with Greengrass Version 1 (GGv1)

We are currently exploring the Greengrass Version 2 (GGv2).
Since Lambda executable is not supported in GGv2 . We followed a client device pattern as mentioned here - [3]

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.

This is working well but we came across an issue recently.

The custom component developed using client device pattern fails to connect with the Greengrass core when Greengrass core is not connected to internet.
The same issue does not occur when component is developed to perform IPC using AWS IoT Greengrass Core IPC libraries [4].
We wanted the custom component we developed using client device pattern to work in consistent like other components developed using AWS IoT Greengrass Core IPC libraries [4] .

Question 1 - Is it the correct approach to use client device pattern ?

We also thought about few alternative approaches as below -

  • As mentioned here [7] , we can use [6] . But this wont seem to be feasible to convert complete application already written in C to C++
  • It seems it is possible to perform IPC by writing custom code [5]

Question 2 - if it is the better approach to write custom code to perform IPC. How feasible is this approach, I mean is it possible to do the same. Could some one provide some steps or guidelines or links to do the same?

Could some one help with the above queries?

Thank you.

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

已提問 2 年前檢視次數 368 次
2 個答案
0
已接受的答案

Hi,
So from what I understand, you want to develop a component which can run your executable and talk to Greengrass core.
I think the best path forward is to use the C++ IPC SDK as you pointed out [6]. It should be pretty straightforward to write a layer over the C++ SDK to expose the functionality you need (Make sure the symbols are not mangled - example method https://isocpp.org/wiki/faq/mixing-c-and-cpp#call-cpp). You won't need to rewrite your existing C application.

I want to hear what are the challenges you think you will face with the approach. Thanks

PS. I have used this approach to use C++ SDK from C code but don't have the code handy ATM.

已回答 2 年前
profile picture
專家
已審閱 10 個月前
0

Hi sushantAtAws,

Thank you for the response.
It seems it could be possible as suggested by you to write a layer over the C++ SDK to expose the functionality and looks the better approach.

I am able to run the mixed C and C++ code.
Thank you so much again.

已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南