Tizen(Headless) Native API
6.0
|
The Diagnostics API provides functions to receive crash reports and request logs from other apps.
Required Header
#include <diagnostics.h>
Overview
This Diagnostics API allows applications to receive notification about newly created crash report, as well as request other apps to dump their logs in real time. Moreover, functions for reading crash and log contents are provided.
Related Features
This API is related with the following feature:
- http://tizen.org/feature/diagnostics
It is recommended to design feature related codes in your application for reliability.
You can check if a device supports the related features for this API by using System Information,thereby controlling the procedure of your application.
To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from Feature Element.
Functions | |
int | diagnostics_set_notification_cb (diagnostics_notification_cb callback, void *user_data) |
Sets the callback for bug report notification. | |
int | diagnostics_unset_notification_cb (void) |
Unsets the callback for bug report notification. | |
int | diagnostics_request_client_data (const char *client_id, const char **params, int params_size, diagnostics_data_h *data) |
Requests client to dump data. | |
int | diagnostics_data_read (diagnostics_data_h data, void *buf, size_t count, int timeout_ms, size_t *bytes_read) |
Reads diagnostics data. | |
int | diagnostics_data_destroy (diagnostics_data_h data) |
Frees diagnostics data. | |
int | diagnostics_get_client_id (diagnostics_ctx_h ctx, char **client_id) |
Gets diagnostics context provider's id. | |
int | diagnostics_get_data (diagnostics_ctx_h ctx, const char **params, int params_size, diagnostics_data_h *data) |
Gets report data. | |
int | diagnostics_destroy (diagnostics_ctx_h ctx) |
Frees diagnostics context. | |
Typedefs | |
typedef void * | diagnostics_ctx_h |
Diagnostics context. | |
typedef void * | diagnostics_data_h |
Diagnostics data. | |
typedef void(* | diagnostics_notification_cb )(diagnostics_ctx_h ctx, void *user_data) |
Notification callback fired when new bug report arrives. |
Typedef Documentation
typedef void* diagnostics_ctx_h |
Diagnostics context.
- Since :
- 6.0
typedef void* diagnostics_data_h |
Diagnostics data.
- Since :
- 6.0
typedef void(* diagnostics_notification_cb)(diagnostics_ctx_h ctx, void *user_data) |
Notification callback fired when new bug report arrives.
- Since :
- 6.0
- Remarks:
- ctx should be released with diagnostics_destroy()
- Parameters:
-
[in] ctx Diagnostics context handle [in] user_data The user data passed from the callback registration function
Enumeration Type Documentation
enum diagnostics_error_e |
Enumeration for error codes of Diagnostics.
- Since :
- 6.0
- Enumerator:
Function Documentation
int diagnostics_data_destroy | ( | diagnostics_data_h | data | ) |
Frees diagnostics data.
- Since :
- 6.0
- Parameters:
-
[in] data Diagnostics data handle
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
DIAGNOSTICS_ERROR_NONE Success DIAGNOSTICS_ERROR_NOT_SUPPORTED Not supported DIAGNOSTICS_ERROR_INVALID_PARAMETER Provided parameter is invalid
int diagnostics_data_read | ( | diagnostics_data_h | data, |
void * | buf, | ||
size_t | count, | ||
int | timeout_ms, | ||
size_t * | bytes_read | ||
) |
Reads diagnostics data.
- Since :
- 6.0
- Remarks:
- data should be released with diagnostics_data_destroy(). This function is intended for use in loop until EOF is reached. EOF is when bytes_read == 0 and function returns DIAGNOSTICS_ERROR_NONE.
- Parameters:
-
[in] data Diagnostics data handle [in,out] buf Buffer to store read data
Provided buffer must be large enough to contain count number of bytes[in] count Number of bytes to read [in] timeout_ms Timeout [ms] for reading requested number of bytes (timeout_ms <= 0 means to wait forever) [out] bytes_read Real number of read bytes
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
DIAGNOSTICS_ERROR_NONE Success DIAGNOSTICS_ERROR_NOT_SUPPORTED Not supported DIAGNOSTICS_ERROR_INVALID_PARAMETER Provided parameter is invalid DIAGNOSTICS_ERROR_TIMED_OUT Timeout occured DIAGNOSTICS_ERROR_TRY_AGAIN Try again DIAGNOSTICS_ERROR_IO_ERROR Internal error occured while trying to read data, result is unspecified and *bytes_read is not updated
int diagnostics_destroy | ( | diagnostics_ctx_h | ctx | ) |
Frees diagnostics context.
- Since :
- 6.0
- Parameters:
-
[in] ctx Diagnostics context handle
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
DIAGNOSTICS_ERROR_NONE Success DIAGNOSTICS_ERROR_NOT_SUPPORTED Not supported DIAGNOSTICS_ERROR_INVALID_PARAMETER Provided parameter is invalid
int diagnostics_get_client_id | ( | diagnostics_ctx_h | ctx, |
char ** | client_id | ||
) |
Gets diagnostics context provider's id.
- Since :
- 6.0
- Remarks:
- client_id should be released with free().
- Parameters:
-
[in] ctx Diagnostics context handle [out] client_id An id of the context provider
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
DIAGNOSTICS_ERROR_NONE Success DIAGNOSTICS_ERROR_NOT_SUPPORTED Not supported DIAGNOSTICS_ERROR_INVALID_PARAMETER Provided parameter is invalid
int diagnostics_get_data | ( | diagnostics_ctx_h | ctx, |
const char ** | params, | ||
int | params_size, | ||
diagnostics_data_h * | data | ||
) |
Gets report data.
- Warning:
- This is not for use by third-party applications.
- Since :
- 6.0
- Privilege Level:
- platform
- Privilege:
- Remarks:
- data should be released with diagnostics_data_destroy(). This function is permitted only to an app signed by platform level certificates.
- Parameters:
-
[in] ctx Diagnostics context handle [in] params Array of parameters
Refer to context provider's documentation for available parameters[in] params_size Number of parameters [out] data Diagnostics data handle
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
DIAGNOSTICS_ERROR_NONE Success DIAGNOSTICS_ERROR_NOT_SUPPORTED Not supported DIAGNOSTICS_ERROR_PERMISSION_DENIED Permission denied DIAGNOSTICS_ERROR_INVALID_PARAMETER Provided parameter is invalid DIAGNOSTICS_ERROR_IO_ERROR Internal error occured DIAGNOSTICS_ERROR_OUT_OF_MEMORY Not enough memory to create data handle
int diagnostics_request_client_data | ( | const char * | client_id, |
const char ** | params, | ||
int | params_size, | ||
diagnostics_data_h * | data | ||
) |
Requests client to dump data.
- Warning:
- This is not for use by third-party applications.
- Since :
- 6.0
- Privilege Level:
- platform
- Privilege:
- Remarks:
- data should be released with diagnostics_data_destroy(). This function is permitted only to an app signed by platform level certificates.
- Parameters:
-
[in] client_id An id of app or service to request [in] params Array of parameters [in] params_size Number of parameters [out] data Dumpsys data handle
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
DIAGNOSTICS_ERROR_NONE Success DIAGNOSTICS_ERROR_NOT_SUPPORTED Not supported DIAGNOSTICS_ERROR_PERMISSION_DENIED Permission denied DIAGNOSTICS_ERROR_INVALID_PARAMETER Provided parameter is invalid DIAGNOSTICS_ERROR_IO_ERROR Internal error occured DIAGNOSTICS_ERROR_OUT_OF_MEMORY Not enough memory to create data handle
int diagnostics_set_notification_cb | ( | diagnostics_notification_cb | callback, |
void * | user_data | ||
) |
Sets the callback for bug report notification.
- Since :
- 6.0
- Parameters:
-
[in] callback A callback function to set [in] user_data The user data to be passed to the callback function
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
DIAGNOSTICS_ERROR_NONE Success DIAGNOSTICS_ERROR_NOT_SUPPORTED Not supported DIAGNOSTICS_ERROR_INVALID_PARAMETER Provided parameter is invalid DIAGNOSTICS_ERROR_RESOURCE_BUSY Callback already registered DIAGNOSTICS_ERROR_IO_ERROR Internal error occured
int diagnostics_unset_notification_cb | ( | void | ) |
Unsets the callback for bug report notification.
- Since :
- 6.0
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
DIAGNOSTICS_ERROR_NONE Success DIAGNOSTICS_ERROR_NOT_SUPPORTED Not supported DIAGNOSTICS_ERROR_IO_ERROR Internal error occured