Use xnLog to init log, instead of doing it ourselves
This commit is contained in:
parent
a44d69dc6b
commit
69701edec5
|
@ -1,9 +1,9 @@
|
|||
[Log]
|
||||
; 0 - Verbose; 1 - Info; 2 - Warning; 3 - Error. Default - None
|
||||
Verbosity=3
|
||||
LogToConsole=0
|
||||
LogToFile=0
|
||||
LogWriteToAndroidLog=0
|
||||
;Verbosity=0
|
||||
;LogToConsole=1
|
||||
;LogToFile=1
|
||||
;LogToAndroidLog=1
|
||||
|
||||
[Device]
|
||||
;Override=
|
||||
|
|
|
@ -155,40 +155,10 @@ XnStatus Context::configure()
|
|||
#endif
|
||||
|
||||
// First, we should process the log related configuration as early as possible.
|
||||
XnInt32 nValue;
|
||||
XnChar strLogPath[XN_FILE_MAX_PATH] = {0};
|
||||
|
||||
//Test if log redirection is needed
|
||||
rc = xnOSReadStringFromINI(strOniConfigurationFile, "Log", "LogPath", strLogPath, XN_FILE_MAX_PATH);
|
||||
if (rc == XN_STATUS_OK)
|
||||
rc = xnLogInitFromINIFile(strOniConfigurationFile, "Log");
|
||||
if (XN_STATUS_OK != rc)
|
||||
{
|
||||
rc = xnLogSetOutputFolder(strLogPath);
|
||||
if (rc != XN_STATUS_OK)
|
||||
{
|
||||
xnLogWarning(XN_MASK_ONI_CONTEXT, "Failed to set log output folder: %s", xnGetStatusString(rc));
|
||||
}
|
||||
else
|
||||
{
|
||||
xnLogVerbose(XN_MASK_ONI_CONTEXT, "Log directory redirected to: %s", strLogPath);
|
||||
}
|
||||
}
|
||||
|
||||
rc = xnOSReadIntFromINI(strOniConfigurationFile, "Log", "Verbosity", &nValue);
|
||||
if (rc == XN_STATUS_OK)
|
||||
{
|
||||
xnLogSetMaskMinSeverity(XN_LOG_MASK_ALL, (XnLogSeverity)nValue);
|
||||
}
|
||||
|
||||
rc = xnOSReadIntFromINI(strOniConfigurationFile, "Log", "LogToConsole", &nValue);
|
||||
if (rc == XN_STATUS_OK)
|
||||
{
|
||||
xnLogSetConsoleOutput(nValue == 1);
|
||||
}
|
||||
|
||||
rc = xnOSReadIntFromINI(strOniConfigurationFile, "Log", "LogToFile", &nValue);
|
||||
if (rc == XN_STATUS_OK)
|
||||
{
|
||||
xnLogSetFileOutput(nValue == 1);
|
||||
return ONI_STATUS_ERROR;
|
||||
}
|
||||
|
||||
// Now that log was configured, we can start issues some log entries
|
||||
|
|
|
@ -9,6 +9,6 @@ endif
|
|||
LOCAL_CFLAGS += -O3 -ftree-vectorize -ffast-math -funroll-loops -fPIC -fvisibility=hidden
|
||||
|
||||
ifeq ($(ARCH_ARM_HAVE_NEON),true)
|
||||
LOCAL_CFLAGS += -DHAVE_NEON=1 -flax-vector-conversions
|
||||
LOCAL_CFLAGS += -DHAVE_NEON=1 -DXN_NEON -flax-vector-conversions
|
||||
LOCAL_ARM_NEON := true
|
||||
endif
|
||||
|
|
|
@ -36,7 +36,8 @@ LOCAL_CFLAGS += $(OPENNI2_CFLAGS)
|
|||
|
||||
# Includes
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(LOCAL_PATH)/../Include
|
||||
$(LOCAL_PATH)/../Include \
|
||||
$(LOCAL_PATH)/../ThirdParty/libusb-1.0.9-Android/libusb
|
||||
|
||||
ifdef PS_NDK_BUILD
|
||||
# building from NDK
|
||||
|
|
|
@ -402,22 +402,31 @@ XN_C_API XnStatus xnLogInitFromINIFile(const XnChar* cpINIFileName, const XnChar
|
|||
|
||||
LogData::GetInstance().SetMinSeverityGlobally(XN_LOG_SEVERITY_NONE);
|
||||
|
||||
nRetVal = xnOSReadIntFromINI(cpINIFileName, cpSectionName, "LogLevel", &nTemp);
|
||||
//Test if log redirection is needed
|
||||
XnChar strLogPath[XN_FILE_MAX_PATH] = {0};
|
||||
nRetVal = xnOSReadStringFromINI(cpINIFileName, cpSectionName, "LogPath", strLogPath, XN_FILE_MAX_PATH);
|
||||
if (nRetVal == XN_STATUS_OK)
|
||||
{
|
||||
nRetVal = xnLogBCSetSeverityFilter((XnLogSeverity)nTemp);
|
||||
nRetVal = xnLogSetOutputFolder(strLogPath);
|
||||
XN_IS_STATUS_OK(nRetVal);
|
||||
}
|
||||
|
||||
nRetVal = xnOSReadIntFromINI(cpINIFileName, cpSectionName, "Verbosity", &nTemp);
|
||||
if (nRetVal == XN_STATUS_OK)
|
||||
{
|
||||
nRetVal = xnLogSetMaskMinSeverity(XN_LOG_MASK_ALL, (XnLogSeverity)nTemp);
|
||||
XN_IS_STATUS_OK(nRetVal);
|
||||
}
|
||||
|
||||
// configure writers
|
||||
nRetVal = xnOSReadIntFromINI(cpINIFileName, cpSectionName, "LogWriteToConsole", &nTemp);
|
||||
nRetVal = xnOSReadIntFromINI(cpINIFileName, cpSectionName, "LogToConsole", &nTemp);
|
||||
if (nRetVal == XN_STATUS_OK)
|
||||
{
|
||||
nRetVal = xnLogSetConsoleOutput(nTemp);
|
||||
XN_IS_STATUS_OK(nRetVal);
|
||||
}
|
||||
|
||||
nRetVal = xnOSReadIntFromINI(cpINIFileName, cpSectionName, "LogWriteToFile", &nTemp);
|
||||
nRetVal = xnOSReadIntFromINI(cpINIFileName, cpSectionName, "LogToFile", &nTemp);
|
||||
if (nRetVal == XN_STATUS_OK)
|
||||
{
|
||||
nRetVal = xnLogSetFileOutput(nTemp);
|
||||
|
@ -425,7 +434,7 @@ XN_C_API XnStatus xnLogInitFromINIFile(const XnChar* cpINIFileName, const XnChar
|
|||
}
|
||||
|
||||
#if XN_PLATFORM == XN_PLATFORM_ANDROID_ARM
|
||||
nRetVal = xnOSReadIntFromINI(cpINIFileName, cpSectionName, "LogWriteToAndroidLog", &nTemp);
|
||||
nRetVal = xnOSReadIntFromINI(cpINIFileName, cpSectionName, "LogToAndroidLog", &nTemp);
|
||||
if (nRetVal == XN_STATUS_OK)
|
||||
{
|
||||
nRetVal = xnLogSetAndroidOutput(nTemp);
|
||||
|
@ -433,7 +442,7 @@ XN_C_API XnStatus xnLogInitFromINIFile(const XnChar* cpINIFileName, const XnChar
|
|||
}
|
||||
#endif
|
||||
|
||||
nRetVal = xnOSReadIntFromINI(cpINIFileName, cpSectionName, "LogWriteLineInfo", &nTemp);
|
||||
nRetVal = xnOSReadIntFromINI(cpINIFileName, cpSectionName, "LogLineInfo", &nTemp);
|
||||
if (nRetVal == XN_STATUS_OK)
|
||||
{
|
||||
nRetVal = xnLogSetLineInfo(nTemp);
|
||||
|
|
|
@ -17,13 +17,17 @@
|
|||
# *** Note: This module will only get built if compiled via the NDK! ***
|
||||
# ***
|
||||
|
||||
ifdef TARGET_BUILD_VARIANT
|
||||
# Building as part of the OS...
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
include $(LOCAL_PATH)/../../../BuildSystem/CommonAndroid.mk
|
||||
|
||||
ifdef PS_OS_BUILD
|
||||
$(info Skipping libusb in OS build...)
|
||||
else
|
||||
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
ifndef PS_NO_USB
|
||||
|
||||
# Sources
|
||||
LOCAL_SRC_FILES:= \
|
||||
|
@ -34,9 +38,6 @@ LOCAL_SRC_FILES:= \
|
|||
libusb/os/linux_usbfs.c \
|
||||
libusb/os/threads_posix.c
|
||||
|
||||
# C/CPP Flags
|
||||
LOCAL_CFLAGS += $(OPENNI2_CFLAGS) -DOPENNI2_EXPORT -fvisibility=default
|
||||
|
||||
# Includes
|
||||
LOCAL_C_INCLUDES += \
|
||||
$(LOCAL_PATH)/libusb/ \
|
||||
|
@ -52,4 +53,5 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/libusb
|
|||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
endif
|
||||
endif #NO_USB
|
||||
endif #OS_BUILD
|
||||
|
|
|
@ -61,7 +61,7 @@ public class OpenNIHelper {
|
|||
private String mActionUsbPermission;
|
||||
private DeviceOpenListener mDeviceOpenListener;
|
||||
private String mUri;
|
||||
private static final String TAG = "OpenNINIHelper";
|
||||
private static final String TAG = "OpenNIHelper";
|
||||
|
||||
/**
|
||||
* Used for receiving the result of {@link OpenNIHelper#requestDeviceOpen(String uri, DeviceOpenListener listener)}.
|
||||
|
|
Loading…
Reference in New Issue