Mobile UI app options

Find and share HowTos to various installations / configurations!
8 posts • Page 1 of 1
johna_ssa
Posts:21
Joined: Wed Jan 28, 2015 6:14 pm

Mobile UI app options

Post by johna_ssa »

Is there a way to set "command line" options for the mobile UI app?

Specifically, I would like the be able to set -dbg option. My libraries and panel code use the DebugFN() function extensively to log debug and error messages to the log file/viewer. I use -dbg err to enable error messages, -dbg dbg to enable debug messages, and -dbg err,dbg to enable both.

I want to enable these messages for the Mobile UI running on my Android tablet. I've already confirmed that I can log to a log file using Debug() and send it to my workstation.

Is anyone else using the Mobile UI yet?

mkoller
Posts:741
Joined: Fri Sep 17, 2010 9:03 am

Re: Mobile UI app options

Post by mkoller »

Yes you can.
use the config entry
dbg = "flag1,flag2"

johna_ssa
Posts:21
Joined: Wed Jan 28, 2015 6:14 pm

Re: Mobile UI app options

Post by johna_ssa »

Thanks for the quick reply.

I think that worked. However, the log file I generated may be too big now. When I try to "Send Logfiles" from the Android app to the "server", I get the following error:

Error Downloading http://192.168.0.11:80/logFileUpload - server replied: Request Entity Too Large

Is there a way to reset or remove the log files on the Android tablet with the Mobile App so I can start from empty log files?

mkoller
Posts:741
Joined: Fri Sep 17, 2010 9:03 am

Re: Mobile UI app options

Post by mkoller »

Different options:
- remove the project from your device. This will remove the complete project directory tree including logfiles
- increase the size of an upload the server accepts by using httpSetMaxContentLength(size) in the CTRL manager server script
- reduce the maximum logfile size by using the config entry maxLogFileSize

mkoller
Posts:741
Joined: Fri Sep 17, 2010 9:03 am

Re: Mobile UI app options

Post by mkoller »

and even another option:
- do not even try to upload the logfiles. Just connect your device via USB cable to your PC and use adb logcat to directly read the debug output when it happens (The UI on Android uses __android_log_write(ANDROID_LOG_DEBUG, "WinCC_OA", ...) for all Debug* functions)

https://developer.android.com/studio/co ... ogcat.html

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Mobile UI app options

Post by leoknipp »

Hello,

an additional remark: Maybe it's better to use DebugTN() or DebugFTN() instead of DebugN()/DebugFN() .
At the debug message you will then get time information which makes it easier to analyze as you can see at the logfile when the debug message was written.

Best Regards
Leopold Knipp
Senior Support Specialist

johna_ssa
Posts:21
Joined: Wed Jan 28, 2015 6:14 pm

Re: Mobile UI app options

Post by johna_ssa »

I loaded Android Studio and after some effort I got adb connecting to my tablet. It took a couple hours to figure out that I need to download the manufacturer's USB driver for my Samsung tablet. Despite connecting as a media (MTP) or camera (PTP) device with the standard windows drivers, the tablet would not show up in the adb device list. Once I installed the Samsung USB driver and waited a few minutes (not sure why I had to do that) it showed up. The logging displayed as you said it would.

My problem turned out to be a classic WinCC OA remote UI issue. I had daylight savings time enabled on the tablet but it wasn't enabled on the IPC running WinCC OA server. Most of my DP queries look up a "report number" and determine what time it last changed to a given value. Using that time, it then looks up the value(s) of various fields to determine their values. It's a poor man's relational database. The time value returned from the first query is converted to local time. Since the tablet was applying daylight savings time and the IPC was not, it was off by an hour. This impacted the subsequent queries for the values of the various fields.

It's fixed now.

Thanks again for the help.

johna_ssa
Posts:21
Joined: Wed Jan 28, 2015 6:14 pm

Re: Mobile UI app options

Post by johna_ssa »

Here's a little more detail to help anyone interested in getting log messages in realtime from a Mobile UI app running on an Android device.

Connect your Android device to your host PC with a USB cable and enable "Developer Mode" on the device. Check Youtube.com for the appropriate method to do this on your device/version of Android. On my Samsung Galaxy Tab S I went to Settings | About Device and tapped on the "Build Number" several times until it reported "Developer Mode" enabled.

It's important to download and install the correct USB driver for your Android device. The default Window's driver might work for MTP and PTP mode with your device. However, it will likely not support the debug mode. Look for the correct driver on the manufacturer website. In my case, I went to the Samsung pages and downloaded the Windows driver for the Galaxy Tab S.

You can download and install the Android Studio Command Line tools only (without the full Studio IDE).

Android Studio command line tools for Windows
Android Studio command line tools for Linux

The installer will check the version of the JDK package you have installed. If it needs to be installed or updated, it will let you know and provide a link to get it.

For Windows users, the Android Studio tools installer does not update your PATH. So you will have to change directories or use a full path name to the ...\\android-sdk\\platform-tools directory. I'm not sure if you have to do the same for Linux. But, I suspect you will.

Once you are in the platform-tools directory, the following command line will start the Android debugger and will filter out all the other application log messages displaying only the messages from the WinCC OA mobile app.

Code: Select all

adb logcat WinCC_OA:D *:s

8 posts • Page 1 of 1