Re: [Interest] QNetworkConfigurationManager::isOnline always returns false on Android 11

2020-09-28 Thread ekke

Am 28.09.20 um 17:56 schrieb Thiago Macieira:

On Monday, 28 September 2020 00:49:49 PDT ekke wrote:

I wait 2 minutes and try again

if server still not reachable, repeat this max 5 times to avoid
endless-trying-to-connect

if still no success, I pause the Queue

User gets message and has to restart the Queue manually

message tells User to check if the server is OK (perhaps call the
admin), to check if device is really online, trying to switch wifi
on/off or to check if mobile network is active without allowing data
transfer...

In other words, if the user has the device in his/her pocket and walks over to
where a network with a captive portal exists, the device may pause the queue
and not resume it without user action. So the when the user comes back from
Starbucks and resumes work, the device will not transmit. At the end of the
day, when they try to sign off, they discover that nothing has been sent for 6
hours.

Is that correct?


yep - exactly

the only difference: a typical caregiver has no time to look for a 
Starbucks ;-)


he/she is driving from one patient to the next and if you're out in 
small villages it will happen soon, that you'll have no network 
coverage, which would stop transmitting.


and yes, when they try to sign off they'll notice nothing was sent.

esp in healthcare it's really important to send Vital Values, Wound 
Images, given drugs reports... as soon as possible to server


the great thing with watching for online SIGNAL: coming back to areas 
with better coverage the done work will automagically be sent to server.


(in reality: after getting ONLINE-SIGNAL I'm waiting 3 minutes and only 
if there's no OFFLINE-SIGNAL will then start to tranmit. This helps in 
areas where network comes and goes...


ekke

___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] QNetworkConfigurationManager::isOnline always returns false on Android 11

2020-09-28 Thread Thiago Macieira
On Saturday, 26 September 2020 09:46:39 PDT Marian Beermann wrote:
> An interface like this is inherently racy. QNCM (obsolete) may tell you
> you are online, you connect to the server, send your stuff, and while
> that happens the device goes offline and you get an error. You probably
> handle this case already.

In other situations, this is called a TOCTOU attack (time of check, time of 
use). For example:

if (!QFile::exists(filename))
return false;
QFile f(filename);
f.open(QIODevice::ReadOnly);
data = f.readAll();
return true;

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering



___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] QNetworkConfigurationManager::isOnline always returns false on Android 11

2020-09-28 Thread Marian Beermann
An interface like this is inherently racy. QNCM (obsolete) may tell you
you are online, you connect to the server, send your stuff, and while
that happens the device goes offline and you get an error. You probably
handle this case already.

Stuff like this is "informational" and you can't assume stuff will work,
because the API said you're online. Conversely, your servers might be
reachable even if it says the device is "offline". (What does "internet
connectivity" mean, after all? It's pretty hard to define...)

I second Thiago's suggestion - just keep trying quietly in the
background, don't rely on "device is online" indicators (either in Qt,
or in other frameworks/APIs).

If you only have a "heavy" API endpoint to use, I'd ask the backend
developers to add a lightweight "status" API endpoint you can use to
check if you can reach the server without necessarily doing any hard work.

Cheers, Marian

Am 26.09.20 um 17:53 schrieb ekke:
> Am 26.09.20 um 17:39 schrieb Thiago Macieira:
>> On Friday, 25 September 2020 23:58:26 PDT Alexander Dyagilev wrote:
>>> Hello,
>>>
>>> Tested with Qt 5.12.9. Any workarounds?
>> Suggestion: stop trying to check and assume that you are online.
>>
> imagine a mobile app for outpatient services, where a nurse visits
> patients and at each patient has to confirm services done and to send
> vital values and so on...
> 
> while on tour and visiting the patients the device sometimes is online,
> sometimes offline
> 
> all service items done are written to a queue. queue watches online
> state and always when the device is online items waiting in the queue
> are sent to server
> 
> in the evening when all work is done user can only log out if all work
> is sent to server - if not online he/she gets an info "you're not online
> - work items cannot be sent" ...
> 
> assuming that the device is online won't work in such kind of use-cases,
> pulling also is no good idea
> 
> (have some more mobile apps where it's also important always to know the
> online state)
> 
> ekke
> 
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Queued signals lost in 5.15.0 (works in 5.12.5) (Windows)

2020-09-28 Thread Thiago Macieira
On Sunday, 27 September 2020 22:08:53 PDT Rainer Wiesenfarth wrote:
> I found a workaround in our code by removing a call to
> QCoreApplication::processEvents() and reorganizing some code.

Remove all of them. Everywhere you're using them, they're wrong.

The best solution is to replace them with a "return" and move the code that 
existed below that point to another slot or event.

If you can't do that, then at least use QEventLoop and its quit() signal.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering



___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] QNetworkConfigurationManager::isOnline always returns false on Android 11

2020-09-28 Thread Thiago Macieira
On Monday, 28 September 2020 00:49:49 PDT ekke wrote:
> I wait 2 minutes and try again
> 
> if server still not reachable, repeat this max 5 times to avoid
> endless-trying-to-connect
> 
> if still no success, I pause the Queue
> 
> User gets message and has to restart the Queue manually
> 
> message tells User to check if the server is OK (perhaps call the
> admin), to check if device is really online, trying to switch wifi
> on/off or to check if mobile network is active without allowing data
> transfer...

In other words, if the user has the device in his/her pocket and walks over to 
where a network with a captive portal exists, the device may pause the queue 
and not resume it without user action. So the when the user comes back from 
Starbucks and resumes work, the device will not transmit. At the end of the 
day, when they try to sign off, they discover that nothing has been sent for 6 
hours.

Is that correct?

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering



___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] ** Caution Message may be spoofed ** Re: Sharing QItemSelectionModel with multiple views/proxy models

2020-09-28 Thread Murphy, Sean
> > I'm trying to get selections on one view to be replicated to the
> > other[...]> So how do I connect things up so that selections on view1
> > are propagate through the proxy model, and then the respective indices
> > are selected in view2, and vice versa?
> 
> Use QAbstractProxyModel::mapToSource() and mapFromSource(), or
> mapSelectionToSource() and mapSelectionFromSource().
> 
> Eg:
> QObject::connect(
> sourceSelectionModel,
> &QItemSelectionModel::selectionChanged,
> proxySelectionModel,
> [&](const QItemSelection &set) {
> QItemSelection newSet = proxyModel->mapSelectionFromSource(set);
> proxySelectionModel->select(newSet,
> QItemSelectionModel::ClearAndSelect);
> });
> 
> Repeat for each of the signals for QItemSelectionModel changes that should be
> mirrored, for each selection model. You can save some overhead by tracking
> which view originated the change, but QItemSelectionModel will detect empty
> change sets.

Thanks for the response. I ended up doing roughly the same thing.

I should have been more clear in my original post. I had found what looked like 
the relevant signals/functions to do the mapping as you described above before 
I 
posted. I wanted to make sure that I wasn't missing something in the 
model/selection model/proxy model system that AUTOMATICALLY made these 
connections for you. It seemed to me like this would be a fairly common use 
case - 
having multiple views that have differing levels of proxies, all feeding off 
from a 
common underlying data model, and wanting selections to be shared among views, 
once they are filtered through the proxies.

Sean


This message has been scanned for malware by Forcepoint. www.forcepoint.com
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] QNetworkConfigurationManager::isOnline always returns false on Android 11

2020-09-28 Thread ekke

Am 27.09.20 um 21:07 schrieb Thiago Macieira:

On Saturday, 26 September 2020 10:29:28 PDT ekke wrote:

If I'm following your suggestion trying to connect - what should I do if
I cannot connect ?

The same thing that you'd do if your watch classes told you were not online.
And the same thing you're doing right now if you think you're online and can't
connect, you must have a strategy for that too.

yep - here's my emergency strategy, if device isOnline but server cannot 
be reached:


I wait 2 minutes and try again

if server still not reachable, repeat this max 5 times to avoid 
endless-trying-to-connect


if still no success, I pause the Queue

User gets message and has to restart the Queue manually

message tells User to check if the server is OK (perhaps call the 
admin), to check if device is really online, trying to switch wifi 
on/off or to check if mobile network is active without allowing data 
transfer...


--

there are some thousand users out there in the wild working the whole 
day with my Qt 5.13.2 - apps relying on QNCM online state on Android (on 
iOS using iOS Reachability Classes. Starting w Qt 5.14 QNAM internally 
is using the Reachability Classes itself, so probably I can remove this 
platform-specific code 
https://bugreports.qt.io/browse/QTBUG-49751?focusedCommentId=475019&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-475019).


it happens only very very less times that a server is not reachable or 
online state is reported wrong


I don't want to use a timer and try to connect every x minutes to see if 
the user is online again - this will also dry the battery. The mobile OS 
already is watching this state so it would be great to get this SIGNAL 
from Qt on all platforms. BTW: next weeks I'll move all my apps to Qt 
5.15.1 to prepare them for Qt 6.


___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest