1 ## Tizen.Inspections Guide
3 `Tizen.Inspections` is used to collect data from applications and services. This API allows you to receive inspection events as well as request inspection data on demand (ex. receive crash reports if a process in the system crashes).
7 Follow [get started](https://docs.tizen.org/application/dotnet/get-started/overview/) page to setup Visual Studio for .NET development.
9 To enable your application to use `Tizen.Inspections`:
11 1. To use `Tizen.Inspections` to collect inspectable data, the application must be signed with a platform level distributor certificate. Refer this [guide](https://docs.tizen.org/application/dotnet/tutorials/certificates/getting-the-certificates/) on how to sign an application with the custom certificate.
13 2. To use the methods and properties of the `Tizen.Inspections` namespace, include the namespace in your application::
16 Using Tizen.Inspections
19 ## Receive inspection events
21 `Tizen.Inspections` allows to receive status notification published by the platform (at future, Tizen inpsections will support to receive status notification published by manufacturer's applications).
23 In order to receive such notification, subscribe to the `EventReceived` event:
26 void callback(object sender, EventReceivedEventArgs e)
31 void getInspectableDataFromEvents()
33 Inspector.EventReceived += callback;
37 When a new event arrives, callback is called. To read the inspection data out of the inspection context use `GetInspectableData()`:
40 void callback(object sender, EventReceivedEventArgs e)
42 if (e.Context.ModuleID == "org.tizen.system.crash")
44 string[] parameters = {"cs_info_json"};
45 InspectionData data = e.Context.GetInspectableData(parameters);
52 Use the `parameters` argument to specify which data to read from the inspection context. Available parameters depend on the module that provides the context.
54 In case of `"org.tizen.system.crash"` module, the proper values are:
56 - `"cs_info_json"`: JSON report is returned, which contains information about crashed process such as callstack, mapped memory regions, and so on.
57 - `"cs_full"`: Full crash report ZIP archive is collected.
59 The obtained data is associated with the `data` Inspections handler. To read the data content, use `Read()` method:
62 void callback(object sender, EventReceivedEventArgs e)
64 if (e.Context.ModuleID == "org.tizen.system.crash")
66 string[] parameters = {"cs_info_json"};
67 InspectionData data = e.Context.GetInspectableData(parameters);
69 byte[] buf = new byte[100];
72 // Read data and check for EOF
73 if (data.Read(buf, 0, buf.Length) == 0)
77 Log.Info("InspectionsExample", System.Text.Encoding.UTF8.GetString(buf));
83 ## Request diagnostic data
85 `Tizen.Inspections` can also request diagnostic data from other modules (applications or services).
87 For this purpose, call `RequestInspectableData()`. The `moduleId` parameter must be the id of the module that supports `Tizen.Inspections` requests:
91 void requestInspectableData()
93 string moduleId = "org.tizen.some_service";
94 string[] parameters = {"custom_parameter"};
96 InspectionData data = Inspector.RequestInspectableData(moduleId, parameters);
98 byte[] buf = new byte[100];
101 // Read data and check for EOF
102 if (data.Read(buf, 0, buf.Length) == 0)
106 Log.Info("InspectionsExample", System.Text.Encoding.UTF8.GetString(buf));
111 As in above example, after successful request, data may be read with `Read()` method.
113 ## Related information
115 - Tizen 6.0 and Higher