+ free(argv);
+ return NULL;
+ }
+
+ return pipeline;
+}
+
+static void
+run_in_thread(GrpcClient *client)
+{
+ grpc::Status status = client->Wait();
+}
+
+static void
+app_status_callback(::agl_shell_ipc::AppStateResponse app_response, void *data)
+{
+ (void) data;
+
+ std::cout << " >> AppStateResponse app_id " <<
+ app_response.app_id() << ", with state " <<
+ app_response.state() << std::endl;
+
+ // there's no implicit deactivation for an activation of another app so
+ // assume that another application got activate we are also deactived
+ if (app_response.state() == 2 && app_response.app_id() != my_app_id) {
+ // suspend pipeline
+ std::cout << "Suspending gstreamer pipeline" << std::endl;
+ }
+}
+
+
+int main(int argc, char* argv[])
+{
+ int ret = 0;
+ struct sigaction sa;
+ struct receiver_data receiver_data = {};
+ struct display* display;
+ struct window* window;
+
+ // always start the grpc client
+ GrpcClient *client = new GrpcClient();
+
+ // subscribe to events to be able to suspend/pause the video
+ // feed
+ std::thread th = std::thread(run_in_thread, client);
+ client->AppStatusState(app_status_callback, &receiver_data);
+
+ // for starting the application from the beginning, with a diffrent
+ // role we need to handle that creating the main window
+ if (argc >= 2 && strcmp(argv[1], "float") == 0) {
+ client->SetAppFloat(std::string(my_app_id), 30, 400);