bugreport-service: Get bugreport based on event data 27/256827/5 accepted/tizen/unified/20210417.022231 submit/tizen/20210416.144436
authorMateusz Moscicki <m.moscicki2@partner.samsung.com>
Fri, 9 Apr 2021 10:57:15 +0000 (12:57 +0200)
committerMateusz Moscicki <m.moscicki2@partner.samsung.com>
Fri, 16 Apr 2021 11:23:56 +0000 (13:23 +0200)
commit51a13685fe9a624cabb1ea68ab94c0ac62c13163
treea092224546d3253a7bc04e4296c51bb50b087026
parente50317136f25a710961e857f2dfd226236f3bfc1
bugreport-service: Get bugreport based on event data

A bugreport identifier is sent along with BugreportCreated event so that
client can request the details of the bugreport to which the event
related:

  static void bugreport_created_cb(diagnostics_ctx_h ctx, void *user_data)
  {
      ...
      const char *params[] = {"--type", "crash-info-json"};
      diagnostics_data_h data;
      diagnostics_get_data(ctx, params, ARRAY_SIZE(params), &data);

      size_t bytes;
      char buff[1024];
      diagnostics_data_read(data, buff, sizeof(buff), 0, &bytes);
      ...
  }

  int main()
  {
      ...
      diagnostics_set_notification_cb(bugreport_created_cb, NULL);
      diagnostics_subscribe_event("BugreportCreated", "org.tizen.bugreport-service");
      g_main_loop_run(mainloop);
      ...
  }

Change-Id: I056f16743e656504dcefe0972eae00bc4b6f58ab
13 files changed:
packaging/crash-worker.spec
src/bugreport-service/CMakeLists.txt
src/bugreport-service/bugreport-service.c
src/bugreport-service/diagnostics/diagnostics_dump.c
src/crash-manager/CMakeLists.txt
src/crash-manager/crash-manager.c
src/shared/bugreport-util.c [new file with mode: 0644]
src/shared/bugreport-util.h [new file with mode: 0644]
src/shared/util.c
tests/system/CMakeLists.txt
tests/system/bugreport_created/bugreport_created.sh.template [new file with mode: 0644]
tests/system/utils/CMakeLists.txt
tests/system/utils/diagnostics_bugreporttest.c [new file with mode: 0644]