SystemDebug API
To use Samsung Product API,
<script type="text/javascript" src="$WEBAPIS/webapis/webapis.js"></script>
Should be loaded in index.html
This module defines system debugging APIs provided by the Tizen Samsung Product API.
Since : 6.5
Product : B2B
Privilege Level : Public
Privilege : http://tizen.org/privilege/filesystem.read
Summary of Interfaces and Methods
Interface | Method |
---|---|
SystemDebugObject | |
SystemDebugManager | DOMString getVersion(); void startDebugLogs(StartDebugLogInfo config, SuccessCallback onSuccess, ErrorCallback onError); void stopDebugLogs(SuccessCallback onSuccess, ErrorCallback onError); |
1. Type Definitions
1.1 StartDebugLogInfo
Defines a dictionary to store info for start debug logs.
dictionary StartDebugLogInfo {
DOMString serverUrl;
boolean downloadScript;
DOMString scriptUrl;
long logDuration;
};
The following values are supported
- serverUrl : provides url of the machine where LoggerWebServer is running. It is DOMString.
- downloadScript : provides True or False. True if epcontrol_info file is not present with the Widget else False. It is of type boolean.
- scriptUrl : provides the URL location to epcontrol_info file. It is of type DOMString.
- logDuration : provides the time for which you need to capture logs. It is of type long.
2. Interfaces
2.1 SystemDebugObject
The interface defines what is instantiated by the WebApi object of Tizen Samsung Product API.
The webapis.systemdebug object enables access to system debugging API functionality.
[NoInterfaceObject] interface SystemDebugObject {
readonly attribute SystemDebugManager systemdebug;
};
WebApi implements SystemDebugObject;
Attributes
- readonly SystemDebugManager systemdebug
SystemDebug API namespace
2.2 SystemDebugManager
Provides methods for System debugging functionalities.
[NoInterfaceObject] interface SystemDebugManager {
DOMString getVersion();
void startDebugLogs(StartDebugLogInfo config, SuccessCallback onSuccess, ErrorCallback onError);
void stopDebugLogs(SuccessCallback onSuccess, ErrorCallback onError);
};
Methods
getVersion
Retrieves the plugin version number.
DOMString getVersion();
Privilege Level : Public
Privilege : http://tizen.org/privilege/filesystem.read
Return Value :
- DOMString : Plugin version
Exceptions :
- WebAPIException
- with error type NotSupportedError, if API is not supported on platform.
- with error type SecurityError, if the application does not have the privilege to call this method.
Code Example :
try {
var version = webapis.systemdebug.getVersion();
console.log("Version: ", version);
} catch (error) {
console.log(" error code = " + error.code);
}
startDebugLogs
This method is used to start the log collection process.
void startDebugLogs(StartDebugLogInfo config, SuccessCallback onSuccess, ErrorCallback onError);
Privilege Level : Public
Privilege : http://tizen.org/privilege/filesystem.read
Parameters :
- config : provides an object of StartDebugLogInfo. All values are required and must be of same type as mentioned.
- onSuccess : Callback method to invoke when the call is successful. It is of type SuccessCallback.
- onError : Callback method to invoke when an error has occurred. It is of type ErrorCallback.
Exceptions :
- WebAPIException
- with error type TypeMismatchError, if any value or parameter is not compatible with its expected type.
- with error type SecurityError, if the application does not have the privilege to call this method.
- with error type NotSupportedError, if API is not supported on platform.
Code Example :
try {
const serverUrl = "http://<ip_address>:<port_of_server>/";
const downloadScript = true;
const scriptUrl = "http://<ip_address>:<port_of_epcontrol_script>/";
const logDuration = 1;
function onSuccess(){console.log("Success Callback is called.");}
function onError(error){console.log(error.message);}
config = {
'serverUrl' : serverUrl,
'downloadScript' : downloadScript,
'scriptUrl' : scriptUrl,
'logDuration' : Number(logDuration),
};
webapis.systemdebug.startDebugLogs(config, onSuccess, onError);
} catch (error) {
console.log(" error code = " + error.code);
}
stopDebugLogs
This method is used to stop the log collection process.
void stopDebugLogs(SuccessCallback onSuccess, ErrorCallback onError);
Privilege Level : Public
Privilege : http://tizen.org/privilege/filesystem.read
Parameters :
- onSuccess : Callback method to invoke when the call is successful. It is of type SuccessCallback.
- onError : Callback method to invoke when an error has occurred. It is of type ErrorCallback.
Exceptions :
- WebAPIException
- with error type TypeMismatchError, if any value or parameter is not compatible with its expected type.
- with error type SecurityError, if the application does not have the privilege to call this method.
- with error type NotSupportedError, if API is not supported on platform.
Code Example :
try {
function onSuccess(){console.log("Success Callback is called.");},
function onError(error){console.log(error.message);}
webapis.systemdebug.stopDebugLogs(onSuccess, onError);
} catch (error) {
console.log(" error code = " + error.code);
}
3. Full WebIDL
module SystemDebug {
dictionary StartDebugLogInfo {
DOMString serverUrl;
boolean downloadScript;
DOMString scriptUrl;
long logDuration;
};
[NoInterfaceObject] interface SystemDebugObject {
readonly attribute SystemDebugManager systemdebug;
};
WebApi implements SystemDebugObject;
[NoInterfaceObject] interface SystemDebugManager {
DOMString getVersion();
void startDebugLogs(StartDebugLogInfo config, SuccessCallback onSuccess, ErrorCallback onError);
void stopDebugLogs(SuccessCallback onSuccess, ErrorCallback onError);
};
};