Add `GetCurrentEndpoint` method to Java.
This commit is contained in:
Родитель
124c7be134
Коммит
27d65f57e8
|
@ -521,4 +521,6 @@ public class LogManager {
|
|||
* @return boolean value for success or failure
|
||||
*/
|
||||
public native static boolean isViewerEnabled();
|
||||
|
||||
public native static String getCurrentEndpoint();
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ LOGMANAGER_INSTANCE
|
|||
|
||||
extern "C"
|
||||
{
|
||||
std::shared_ptr<DefaultDataViewer> spDefaultDataViewer;
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_com_microsoft_applications_events_LogManager_initializeDiagnosticDataViewer(
|
||||
JNIEnv* env,
|
||||
|
@ -15,7 +16,7 @@ JNIEXPORT jboolean JNICALL Java_com_microsoft_applications_events_LogManager_ini
|
|||
jstring jstrEndpoint) {
|
||||
auto machineIdentifier = JStringToStdString(env, jstrMachineIdentifier);
|
||||
auto endpoint = JStringToStdString(env, jstrEndpoint);
|
||||
std::shared_ptr<DefaultDataViewer> spDefaultDataViewer = std::make_shared<DefaultDataViewer>(nullptr, machineIdentifier);
|
||||
spDefaultDataViewer = std::make_shared<DefaultDataViewer>(nullptr, machineIdentifier);
|
||||
if (spDefaultDataViewer->EnableRemoteViewer(endpoint)) {
|
||||
LogManager::GetDataViewerCollection().UnregisterAllViewers();
|
||||
LogManager::GetDataViewerCollection().RegisterViewer(std::static_pointer_cast<IDataViewer>(spDefaultDataViewer));
|
||||
|
@ -29,13 +30,32 @@ JNIEXPORT jboolean JNICALL Java_com_microsoft_applications_events_LogManager_ini
|
|||
JNIEXPORT void JNICALL Java_com_microsoft_applications_events_LogManager_disableViewer(
|
||||
JNIEnv* env,
|
||||
jclass /* this */) {
|
||||
LogManager::GetDataViewerCollection().UnregisterAllViewers();
|
||||
if(spDefaultDataViewer != nullptr)
|
||||
{
|
||||
spDefaultDataViewer->DisableViewer();
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_com_microsoft_applications_events_LogManager_isViewerEnabled(
|
||||
JNIEnv* env,
|
||||
jclass /* this */) {
|
||||
return LogManager::GetDataViewerCollection().IsViewerEnabled();
|
||||
if(spDefaultDataViewer != nullptr)
|
||||
{
|
||||
return LogManager::GetDataViewerCollection().IsViewerEnabled(spDefaultDataViewer->GetName());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
JNIEXPORT jString JNICALL Java_com_microsoft_applications_events_LogManager_getCurrentEndpoint(
|
||||
JNIEnv* env,
|
||||
jclass /* this */) {
|
||||
if(spDefaultDataViewer != nullptr)
|
||||
{
|
||||
return spDefaultDataViewer->GetCurrentEndpoint();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
Загрузка…
Ссылка в новой задаче