Re: [Interest] QLowEnergyController always disconnected after service discovery finished

2018-11-01 Thread Alex Blasche
Hi,

all the comments from Jérôme apply and unfortunately I have had similar issues 
with early Android devices/versions.

I wanted to add one more way you can debug on Linux (since that's what you are 
using). You may use wireshark which can log the traffic on your local bt 
device. Maybe this reveals sth...

In this case the error message says that the cause is somewhere on the 
peripheral side. Therefore you may even want to enable some sort of logging on 
the peripheral side. If it happens to be an Android device you can for example 
enable HCI logging in the developer options.

--
Alex


From: Interest  on 
behalf of Jérôme Godbout 
Sent: Wednesday, 31 October 2018 3:16:01 PM
To: nus1998
Cc: interest@qt-project.org
Subject: Re: [Interest] QLowEnergyController always disconnected after service 
discovery finished

Hi,
I’m still having some trouble with some particular Android device running 5.0.1 
to 5.1.1 that I could not figure out so far. I have trouble attaching adb to 
those devices (thanks Samsung for the missing commands). But I have seen some 
MTU badly handled on devices making the disconnection.

If you connect successfully and do nothing else and the connection reset, it 
might be a message that is badly handled by the device and the BLE stack on old 
Android seem picky about thoses error.  The 15 seconds if constant after 
connection probably point to some exchange at lower level.

You might want to test with NRFConnect and monitor the whole exchange with the 
console into that application. This might give you some hint for the device 
side fixes (if you can control that part).  The unknown problems mention above 
I can repeat them with NRFConnect but I’m still not sure why the BlueZ want to 
disconnect even if MTU is handled properly by device (as per specification at 
least).

If you have any information we could share the information and maybe I could 
finally find a fix (or a workaround) for this. Here’s my list of device that 
display the problem for me and the information I have gather so far:


  *   Open nRFConnect application
  *   Connect to the device
  *   Into the top right options (3 dots icon) select show log
  *   Use the debug level from the lower left corner
  *   Once the device connect and the device finish discovering application 
services and characteristic, it will display the following error:  Error 34 
(0x22) GATT CONN LMP TIMEOUT
Device that show th problems:

  *   Google Nexus 7", Android 6.0.1 (the only one I could test out).
  *   Galaxy S4, Android 5.0.1  (debug impossible from Qt Creator)
  *   Galaxy Tab A, Android 5.1.1 (debug impossible from Qt Creator)
  *   LG K4 LTE, Android 5.1.1 (I don’t have this device, it’s a client that 
had it)
Deives that doesn’t show this behavior that I have tested and debugged:

  *   Google LG Nexus 5, Android 6.0.1
  *   All iOS device
  *   LG (multiples one with Android 8.0)
  *   Google Pixel 2 Android 9.0

Good luck,
Jerome

From: nus1998 
Sent: October 30, 2018 9:16 PM
To: Jérôme Godbout 
Cc: interest@qt-project.org
Subject: Re:RE: [Interest] QLowEnergyController always disconnected after 
service discovery finished

Hi Jerome,

Thanks for your advice, I seperated charateristics reading with service 
discovery and Error1:"no attribute in ..." is disappeared.

However, the QLowEnergyController is still disconnected several seconds after 
service discovery is finished, still there is error of "Connection timed out" 
or "Connection reset by peer". I wonder is this BLE feature and is it normal? 
as when I use "BLE analyser" on android phone to read BLE devices, there are 
all automatically disconnected in several seconds after connection is 
estabilished.

B.R.
Jie


At 2018-10-30 21:10:34, "Jérôme Godbout" 
mailto:godbo...@amotus.ca>> wrote:

Hi,

You should find and resolve the first error, any error could lead to 
disconnection:
qt.bluetooth.bluez: Error1: "no attribute in given range found" last command: 
10 handle: 1
m_controller discoveryFinished
Also make sure you finish the discovery before you start doing any other 
services/characteristics discovery with BlueZ.

Side note: In the case of the Bluez (especially the Android one), give it some 
delay between your request and avoid sending multiple request at the same time. 
After you connect put a sleep delay of a few hundred ms and always request a 
single services and characteristic at a time.

The stack is so buggy it’s the only way to make it work properly and reliably. 
Don’t base your “it work” with BlueZ on a single test run, the results change a 
lot with the device load and BLE usage by other application. iOS and OS X on 
the other hand seem t work just fine, they do not need the artificial delay, so 
it’s a delay festival with ifdef.

Jerome

From: Interest 
mailto:amotus...@qt-project.org>>
 On Behalf Of nus1998
Sent: October 30, 2018 4:42 AM
To: interest@qt-project.org
Subject: 

Re: [Interest] Multiple Qt Bluetooth Low Energy servers on one device using Qt?

2018-11-01 Thread Erik Botö
On Thu, Nov 1, 2018 at 10:57 AM Christian Kandeler 
wrote:

> On Thu, 1 Nov 2018 08:11:55 +0100
> Erik Botö  wrote:
>
> > I want to expose multiple BLE services from one device using Qt (on
> linux),
> > but don't know how to do it if it's even possible.
> >
> > In my specific case I want my device to be both a heart rate service
> (HRS)
> > and a cycling power service (CPS).
> >
> > My testing code is very similar to the heart rate server example from
> Qt's
> > documentation,
> > http://doc.qt.io/qt-5/qtbluetooth-heartrate-server-main-cpp.html, and
> I've
> > tried the following two approaches:
> >
> >1. Using two QLowEnergyControllers from one application
>
> AFAIK, a QLowEnergyController instance represents a device, so I don't
> think this is possible (unless you address two distinct BLE devices).
>
> >2. Using one QLowEnergyController, but adding two different services
> >using bleController->addService().
>
> That should work.
>
> > However it doesn't seems like either one is working properly.
>
> You'll have to be more specific than that.
>

So I figured I might as well turn it in to a minimalistic example to show
the problem, and of course it turns out it works. The "fun" thing is that I
actually played around with this a year ago but never got it working, even
when trying a minimal example. But that code is long gone, but obviously it
had a bug in it since I only got updates for one of the services back then.

Thanks for pointing out it should work, which made me have another go at it.

Cheers,
Erik


>
>
> Christian
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Multiple Qt Bluetooth Low Energy servers on one device using Qt?

2018-11-01 Thread Erik Botö
I want to expose multiple BLE services from one device using Qt (on linux),
but don't know how to do it if it's even possible.

In my specific case I want my device to be both a heart rate service (HRS)
and a cycling power service (CPS).

My testing code is very similar to the heart rate server example from Qt's
documentation,
http://doc.qt.io/qt-5/qtbluetooth-heartrate-server-main-cpp.html, and I've
tried the following two approaches:

   1. Using two QLowEnergyControllers from one application
   2. Using one QLowEnergyController, but adding two different services
   using bleController->addService().

However it doesn't seems like either one is working properly.

Can this be done, and if so, what is the correct way?
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Multiple Qt Bluetooth Low Energy servers on one device using Qt?

2018-11-01 Thread Christian Kandeler
On Thu, 1 Nov 2018 08:11:55 +0100
Erik Botö  wrote:

> I want to expose multiple BLE services from one device using Qt (on linux),
> but don't know how to do it if it's even possible.
> 
> In my specific case I want my device to be both a heart rate service (HRS)
> and a cycling power service (CPS).
> 
> My testing code is very similar to the heart rate server example from Qt's
> documentation,
> http://doc.qt.io/qt-5/qtbluetooth-heartrate-server-main-cpp.html, and I've
> tried the following two approaches:
> 
>1. Using two QLowEnergyControllers from one application

AFAIK, a QLowEnergyController instance represents a device, so I don't think 
this is possible (unless you address two distinct BLE devices).

>2. Using one QLowEnergyController, but adding two different services
>using bleController->addService().

That should work.

> However it doesn't seems like either one is working properly.

You'll have to be more specific than that.


Christian
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] [Qt-creator] Qt 5.12 Beta 3 showstopper: ts wrong for release builds w QtQuickCompiler

2018-11-01 Thread ekke
Am 01.11.18 um 12:12 schrieb ekke:
> just found the reason:
> in my release builds Qt Quick Compiler is enabled, so
>
> CONFIG+=qtquickcompiler
>
> corrupts the translation in 5.12 Beta3 on macOS, Abdroid, iOS (works
> well for 5.11.2)
>
> is this known or should I report a bug ?
>
and if I should report a bug - is this a QtCreator or Qt Bug ?
seems to depend from Qt Version not QtCreator
>
>
> ekke
>
> Am 31.10.18 um 20:09 schrieb ekke:
>> while testing Qt 5.12 Beta 3 / QtC 4.7.2 (on macOS 10.13.6) I noticed
>> that translations are wrong in release mode.
>>
>> per ex: translations for de and en
>>
>> build and deploy in debug mode: all is OK
>>
>> build and deploy in release mode: many strings not translated into de
>>
>> (noticed the same with Qt 5.12 Beta 2 / QtC 4.7,1)
>>
>> happens on Android, iOS, macOS
>>
>> see screenshots here
>> https://app.box.com/s/806vaydfkp0mym98d85j71cloebi6wxu from QtWS 2018
>> App https://github.com/ekke/c2gQtWS_x
>>
>>
>> it doesn't happen only for one project - it happens in all projects
>>
>> of course I did a clean build, lupdate/lrelease doesn't help
>>
>>
>> same projects with exactly same ts files in Qt 5.11.2 / QtC 4.7.1
>>
>> build and deploy as debug or release: both works as expected
>>
>>
>> is this already known or should I open a QtCreator bug ?
>>
>>
>> for me this is a showstopper
>>
>> ekke
>>
>> ___
>> Qt-creator mailing list
>> qt-crea...@qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/qt-creator
>>
>
>
>
> ___
> Qt-creator mailing list
> qt-crea...@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator

-- 

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


Re: [Interest] Detect connected Bluetooth keyboard under Android

2018-11-01 Thread Roman Wüger
Hi Alex,
thanks for the hint. My plan was that the user should pair and connect the 
keyboard manually in the settings dialog. In the application i only want to 
know if a keyboard is connected, otherwise I will show an onscreen keyboard.

Thanks

Regards
Roman


> Am 30.10.2018 um 08:24 schrieb Alex Blasche :
> 
> As a disclaimer I have not really done any HID work on Android, but based on 
> the Android docs you need to use the BluetoothHidDevice class to interact 
> with such keyboards. BluetoothHidDevice.Callback.onConnectionStateChanged is 
> probably what you need.
> 
> This Android API is not available via Qt APIs. QBluetoothLocalDevice is for 
> the local Bluetooth device which is not the remote Bluetooth keyboard and HID 
> connects/disconnects cannot be done programmatically by design. The user has 
> to make the connection manually. Therefore I am assuming the platform does 
> not expose such devices via the usual discovery mechanisms either. You have 
> to write your own Java/JNI code to interact with the class.
> 
> --
> Alex
> 
> 
> From: Interest  on 
> behalf of Roman Wüger 
> Sent: Monday, 29 October 2018 11:37:32 PM
> To: Qt Project MailingList
> Subject: [Interest] Detect connected Bluetooth keyboard under Android
> 
> Hi @all,
> 
> i played with the QBluetoothLocalDevice and QBluetoothDiscoveryAgent to 
> detected if a Bluetooth keyboard is connected to an android tablet.
> 
> However, I can’t find out the correct way. I tried to read the 
> majordeviceclass and minordeviceclass but it doesn‘t work, I only get 31,0 
> but the documentation says that 5 should be the major device class. The 
> keyboard works in any input fields, but I can‘t find it.
> 
> I only need a signal if a keyboard connects/disconnects like 
> hardwareKeyboardConnected(bool)
> 
> What do I need for that?
> 
> Thanks in advance
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

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


[Interest] Qt Champions 2018 nominations open

2018-11-01 Thread Andy Shaw
Hi!

We have now opened the nominations for Qt Champions in 2018!

As before, please think about who has helped you out the most during the past 
year and nominate them via the Qt wiki at https://wiki.qt.io/QtChampions.

The categories are:

Community Builder
Content Creator
Quality Assurer
Developer
Fixer
Ambassador
Rookie of the Year
Maverick

The criteria for the nominations can be found on the same page. If there is 
anyone who should be in several categories, or has done something that does not 
fit in any of the categories. then please mention this too!

The nominations will be kept open until the 16th December 2018 and the winners 
announced soon after that. Qt Champions will receive hand-picked Qt Champion 
items and a full Qt license for a year.

So please go to https://wiki.qt.io/QtChampions and make your nominations!

Kind regards,
Andy
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Qt API annoyances: where to log/discuss?

2018-11-01 Thread Giuseppe D'Angelo via Interest

Il 31/10/18 21:59, Jason H ha scritto:
Thanks Giuseppe! That's getting closer :-) however the expression boggles my mind. "originals | ranges::view::transform" there's a lot of compiler voodoo there. I'm trying to keep up on all the C++0xYZ developments, and still trying to wrap my head around SFINAE. I had to look up CTAD, and that looks like a very good enhancement. I think Qt should hide a lot of that compiler iteration from me ;-) 


You can replace Qt with "the libraries I use". They will hide the 
complexity of compiler magic from you (where do you _see_ the magic in 
the lines I pasted?).


And every time you use C++ you have the Standard Library with you, which 
(crossing fingers) will have ranges in C++2a; why should Qt spend any 
time at all implementing something like that?


If anything, this means that QImage should be adapted to be usable 
through ranges (!).




It is an unfortunate phenomenon that I am spending more time decrypting 
compiler Voodoo.


Sorry, I don't get this. If you're just using the features, why would 
you care about they're implemented? What's there to decrypt?


Just rest assured that any feature coming from the Standard Library 
comes from the very same people building your compiler, so it will get 
implemented in the best way possible.


Cheers,
--
Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts



smime.p7s
Description: Firma crittografica S/MIME
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Qt 5.11.2 for Android Prebuilt- Crash in the First Non-Qt JNI

2018-11-01 Thread coroberti .
Hi,
I was trying to build my Qt widget app that is working on Android
since Qt 5.3, later 5.7 and 5.9
using downloaded offline Qt 5.11.2.

Using Qt JNI seems to be working properly, like:
RequestPermissions =

QAndroidJniObject("com/domain/myapp/permissions/RequestPermissions",
  "(Landroid/app/Activity;)V",
  QtAndroid::androidActivity().object()
  );

// Checking for errors in the JNI
QAndroidJniEnvironment env;
if (env->ExceptionCheck()) {
// Handle exception here.
env->ExceptionClear();
}

Unfortunately, the very first non-Qt JNI in my app crashes it.
JNIEnv* env;
if (g_javaVM->AttachCurrentThread(, NULL)<0)
{
return false;
}
jboolean res = env->CallStaticBooleanMethod(s_sharingClassID,
s_sharingMyFuncMethodID);
g_javaVM->DetachCurrentThread();

This is not something specific JNI, but really the first one non-Qt
JNI crashes it.


Is there any initialization or some magic in the new Qt JNI that could impact
non-Qt JNI?

Should I detach thread manually after Qt JNI?


rt : art/runtime/runtime.cc:1537]
Thread[11,tid=6741,Native,Thread*=0xe4ab5f00,peer=0x12c11ee0,"qtMainLoopThread"]
attempting to detach while still running code
F art : art/runtime/runtime.cc:424] Runtime aborting...
F art : art/runtime/runtime.cc:424] Aborting thread:
F art : art/runtime/runtime.cc:424] "qtMainLoopThread" prio=5 tid=11 Native
F art : art/runtime/runtime.cc:424] | group="" sCount=0 dsCount=0
obj=0x12c11ee0 self=0xe4ab5f00
F art : art/runtime/runtime.cc:424] | sysTid=6741 nice=0 cgrp=default
sched=0/0 handle=0xf07bc920
F art : art/runtime/runtime.cc:424] | state=R schedstat=( 78120491
95764296 62 ) utm=6 stm=1 core=0 HZ=100
F art : art/runtime/runtime.cc:424] | stack=0xf06ba000-0xf06bc000
stackSize=1038KB
F art : art/runtime/runtime.cc:424] | held mutexes= "abort lock"

F art : art/runtime/runtime.cc:424] native: #00 pc 0058848e
/system/lib/libart.so
(_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIciP12BacktraceMapPKcPNS_9ArtMethodEPv+238)
F art : art/runtime/runtime.cc:424] native: #01 pc 00553ebe
/system/lib/libart.so
(_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcbP12BacktraceMap+526)
F art : art/runtime/runtime.cc:424] native: #02 pc 00550ebb
/system/lib/libart.so
(_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcbP12BacktraceMap+75)
F art : art/runtime/runtime.cc:424] native: #03 pc 0053c8d3
/system/lib/libart.so
(_ZNK3art10AbortState10DumpThreadERNSt3__113basic_ostreamIcNS1_11char_traitsIcPNS_6ThreadE+67)
F art : art/runtime/runtime.cc:424] native: #04 pc 0053c6a7
/system/lib/libart.so
(_ZNK3art10AbortState4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIc+615)
F art : art/runtime/runtime.cc:424] native: #05 pc 0052cc0b
/system/lib/libart.so (_ZN3art7Runtime5AbortEPKc+155)
F art : art/runtime/runtime.cc:424] native: #06 pc 0011def3
/system/lib/libart.so (_ZN3art10LogMessageD1Ev+1939)
F art : art/runtime/runtime.cc:424] native: #07 pc 0052c679
/system/lib/libart.so (_ZN3art7Runtime19DetachCurrentThreadEv+377)
F art : art/runtime/runtime.cc:424] native: #08 pc 003a1d85
/system/lib/libart.so (_ZN3art3JII19DetachCurrentThreadEP7_JavaVM+69)
F art : art/runtime/runtime.cc:424] native: #09 pc 0013572d
/data/app/com.domain.myapplication-2/lib/x86/libMyapplication.so
(_ZN14AndroidSharing12isMyFuncEv+109)
F art : art/runtime/runtime.cc:424] native: #10 pc 00099f30
/data/app/com.domain.myapplication-2/lib/x86/libMyapplication.so
(_ZN12GPreferences19check_if_myfuncEv+48)
F art : art/runtime/runtime.cc:424] native: #11 pc 00074d09
/data/app/com.domain.myapplication-2/lib/x86/libMyapplication.so
(_ZN8TextEditC1EP7QWidget+2377)
F art : art/runtime/runtime.cc:424] native: #12 pc 00051b7b
/data/app/com.domain.myapplication-2/lib/x86/libMyapplication.so
(main+747)
F art : art/runtime/runtime.cc:424] at
org.qtproject.qt5.android.QtNative$6.run(QtNative.java:359)
F art : art/runtime/runtime.cc:424] at
org.qtproject.qt5.android.QtThread$1.run(QtThread.java:61)
F art : art/runtime/runtime.cc:424] at java.lang.Thread.run(Thread.java:761)
F art : art/runtime/runtime.cc:424] Dumping all threads without
appropriate locks held: thread list lock mutator lock
F art : art/runtime/runtime.cc:424] All threads:

F art : art/runtime/runtime.cc:424] DALVIK THREADS (14):

F art : art/runtime/runtime.cc:424] "qtMainLoopThread" prio=5 tid=11 Runnable
F art : art/runtime/runtime.cc:424] | sysTid=6741 nice=0 cgrp=default
sched=0/0 handle=0xf07bc920
F art : art/runtime/runtime.cc:424] | state=R schedstat=( 92273427
100558772 70 ) utm=6 stm=2 core=0 HZ=100
F art : art/runtime/runtime.cc:424] | stack=0xf06ba000-0xf06bc000
stackSize=1038KB
F art : art/runtime/runtime.cc:424] | held mutexes= "abort lock"
"mutator lock"(shared held)

F art : art/runtime/runtime.cc:424] native: #00 pc 0058848e

Re: [Interest] Qt API annoyances: where to log/discuss?

2018-11-01 Thread Giuseppe D'Angelo via Interest

Hi,

Il 01/11/18 21:14, Jason H ha scritto:

originals | ranges::view::transform([](int i) { return i * 3; });

The bitwise OR operator, descending multiple namespaces.
It makes my point. That these very common functional programming paradigms 
(map, reduce, etc)  are (needlessly?) obtuse in C++.


Sorry, what is the point? Is it hard to read, write, teach, learn, 
understand, extend...? What is the baseline we're comparing it against?




Further more, my point is made qgain with this talk about C++2a. It's something 
that can be done now, but i shouldn't have to wait, Qt can implement these 
however it can today and move to ranges when available.


A bit too convenient to just ask someone else to do a _lot_ of work for 
you... anyhow, you don't have to wait:



https://github.com/ericniebler/range-v3


And again, why should Qt invest precious development bandwidth 
reinventing half-cooked solutions for problems solved in an excellent 
way elsewhere? As I said in the other thread, not using C++-latest costs 
_you_ more. It shouldn't cost anything for Qt.


My 2 c,
--
Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts



smime.p7s
Description: Firma crittografica S/MIME
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Qt API annoyances: where to log/discuss?

2018-11-01 Thread Jason H
> Sent: Thursday, November 01, 2018 at 3:44 PM
> From: "Giuseppe D'Angelo" 
> To: "Jason H" 
> Cc: interest@qt-project.org
> Subject: Re: [Interest] Qt API annoyances: where to log/discuss?
>
> Il 31/10/18 21:59, Jason H ha scritto:
> > Thanks Giuseppe! That's getting closer :-) however the expression boggles 
> > my mind. "originals | ranges::view::transform" there's a lot of compiler 
> > voodoo there. I'm trying to keep up on all the C++0xYZ developments, and 
> > still trying to wrap my head around SFINAE. I had to look up CTAD, and that 
> > looks like a very good enhancement. I think Qt should hide a lot of that 
> > compiler iteration from me ;-) 
> 
> You can replace Qt with "the libraries I use". They will hide the 
> complexity of compiler magic from you (where do you _see_ the magic in 
> the lines I pasted?).
> 
> And every time you use C++ you have the Standard Library with you, which 
> (crossing fingers) will have ranges in C++2a; why should Qt spend any 
> time at all implementing something like that?
> 
> If anything, this means that QImage should be adapted to be usable 
> through ranges (!).
> 
> 
> > It is an unfortunate phenomenon that I am spending more time decrypting 
> > compiler Voodoo.
> 
> Sorry, I don't get this. If you're just using the features, why would 
> you care about they're implemented? What's there to decrypt?
> 
> Just rest assured that any feature coming from the Standard Library 
> comes from the very same people building your compiler, so it will get 
> implemented in the best way possible.


originals | ranges::view::transform([](int i) { return i * 3; });

The bitwise OR operator, descending multiple namespaces. 
It makes my point. That these very common functional programming paradigms 
(map, reduce, etc)  are (needlessly?) obtuse in C++.

Further more, my point is made qgain with this talk about C++2a. It's something 
that can be done now, but i shouldn't have to wait, Qt can implement these 
however it can today and move to ranges when available. 


> Cheers,
> -- 
> Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer
> KDAB (France) S.A.S., a KDAB Group company
> Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
> KDAB - The Qt, C++ and OpenGL Experts
> 
>
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QLowEnergyController always disconnected after service discovery finished

2018-11-01 Thread Jérôme Godbout
A good reference for the BLE snoops is here:
http://www.fte.com/WebHelp/BPA600/Content/Documentation/WhitePapers/BPA600/Encryption/GettingAndroidLinkKey/RetrievingHCIlog.htm

Note: take care, Samsung device (yet again) have a different path form all 
other devices.

-Original Message-
From: Alex Blasche  
Sent: November 1, 2018 11:11 AM
To: Jérôme Godbout ; nus1998 
Cc: interest@qt-project.org
Subject: Re: [Interest] QLowEnergyController always disconnected after service 
discovery finished

Hi,

all the comments from Jérôme apply and unfortunately I have had similar issues 
with early Android devices/versions.

I wanted to add one more way you can debug on Linux (since that's what you are 
using). You may use wireshark which can log the traffic on your local bt 
device. Maybe this reveals sth...

In this case the error message says that the cause is somewhere on the 
peripheral side. Therefore you may even want to enable some sort of logging on 
the peripheral side. If it happens to be an Android device you can for example 
enable HCI logging in the developer options.

--
Alex


From: Interest  on 
behalf of Jérôme Godbout 
Sent: Wednesday, 31 October 2018 3:16:01 PM
To: nus1998
Cc: interest@qt-project.org
Subject: Re: [Interest] QLowEnergyController always disconnected after service 
discovery finished

Hi,
I'm still having some trouble with some particular Android device running 5.0.1 
to 5.1.1 that I could not figure out so far. I have trouble attaching adb to 
those devices (thanks Samsung for the missing commands). But I have seen some 
MTU badly handled on devices making the disconnection.

If you connect successfully and do nothing else and the connection reset, it 
might be a message that is badly handled by the device and the BLE stack on old 
Android seem picky about thoses error.  The 15 seconds if constant after 
connection probably point to some exchange at lower level.

You might want to test with NRFConnect and monitor the whole exchange with the 
console into that application. This might give you some hint for the device 
side fixes (if you can control that part).  The unknown problems mention above 
I can repeat them with NRFConnect but I'm still not sure why the BlueZ want to 
disconnect even if MTU is handled properly by device (as per specification at 
least).

If you have any information we could share the information and maybe I could 
finally find a fix (or a workaround) for this. Here's my list of device that 
display the problem for me and the information I have gather so far:


  *   Open nRFConnect application
  *   Connect to the device
  *   Into the top right options (3 dots icon) select show log
  *   Use the debug level from the lower left corner
  *   Once the device connect and the device finish discovering application 
services and characteristic, it will display the following error:  Error 34 
(0x22) GATT CONN LMP TIMEOUT
Device that show th problems:

  *   Google Nexus 7", Android 6.0.1 (the only one I could test out).
  *   Galaxy S4, Android 5.0.1  (debug impossible from Qt Creator)
  *   Galaxy Tab A, Android 5.1.1 (debug impossible from Qt Creator)
  *   LG K4 LTE, Android 5.1.1 (I don't have this device, it's a client that 
had it)
Deives that doesn't show this behavior that I have tested and debugged:

  *   Google LG Nexus 5, Android 6.0.1
  *   All iOS device
  *   LG (multiples one with Android 8.0)
  *   Google Pixel 2 Android 9.0

Good luck,
Jerome

From: nus1998 
Sent: October 30, 2018 9:16 PM
To: Jérôme Godbout 
Cc: interest@qt-project.org
Subject: Re:RE: [Interest] QLowEnergyController always disconnected after 
service discovery finished

Hi Jerome,

Thanks for your advice, I seperated charateristics reading with service 
discovery and Error1:"no attribute in ..." is disappeared.

However, the QLowEnergyController is still disconnected several seconds after 
service discovery is finished, still there is error of "Connection timed out" 
or "Connection reset by peer". I wonder is this BLE feature and is it normal? 
as when I use "BLE analyser" on android phone to read BLE devices, there are 
all automatically disconnected in several seconds after connection is 
estabilished.

B.R.
Jie


At 2018-10-30 21:10:34, "Jérôme Godbout" 
mailto:godbo...@amotus.ca>> wrote:

Hi,

You should find and resolve the first error, any error could lead to 
disconnection:
qt.bluetooth.bluez: Error1: "no attribute in given range found" last command: 
10 handle: 1 m_controller discoveryFinished Also make sure you finish the 
discovery before you start doing any other services/characteristics discovery 
with BlueZ.

Side note: In the case of the Bluez (especially the Android one), give it some 
delay between your request and avoid sending multiple request at the same time. 
After you connect put a sleep delay of a few hundred ms and always request a 
single services and characteristic at a time.

The stack is so buggy it's the 

Re: [Interest] Detect connected Bluetooth keyboard under Android

2018-11-01 Thread Jérôme Godbout
There is no way yet to achieve that, at least that I know of, the only thing 
you can do is monitor the space and dimension to see if the virtual keyboard is 
displayed. The Android OS will display the soft keyboard or not on his own. You 
can only try to monitor to see if any changes on size have occurred and you can 
assume it's for a keyboard. More info can be found over here:
https://stackoverflow.com/questions/2150078/how-to-check-visibility-of-software-keyboard-in-android
https://groups.google.com/forum/#!topic/android-platform/FyjybyM0wGA

It's really sad this cannot be easily monitored.

-Original Message-
From: Interest  On Behalf 
Of Roman Wüger
Sent: November 1, 2018 5:58 AM
To: Alex Blasche 
Cc: Qt Project MailingList 
Subject: Re: [Interest] Detect connected Bluetooth keyboard under Android

Hi Alex,
thanks for the hint. My plan was that the user should pair and connect the 
keyboard manually in the settings dialog. In the application i only want to 
know if a keyboard is connected, otherwise I will show an onscreen keyboard.

Thanks

Regards
Roman


> Am 30.10.2018 um 08:24 schrieb Alex Blasche :
> 
> As a disclaimer I have not really done any HID work on Android, but based on 
> the Android docs you need to use the BluetoothHidDevice class to interact 
> with such keyboards. BluetoothHidDevice.Callback.onConnectionStateChanged is 
> probably what you need.
> 
> This Android API is not available via Qt APIs. QBluetoothLocalDevice is for 
> the local Bluetooth device which is not the remote Bluetooth keyboard and HID 
> connects/disconnects cannot be done programmatically by design. The user has 
> to make the connection manually. Therefore I am assuming the platform does 
> not expose such devices via the usual discovery mechanisms either. You have 
> to write your own Java/JNI code to interact with the class.
> 
> --
> Alex
> 
> 
> From: Interest  on 
> behalf of Roman Wüger 
> Sent: Monday, 29 October 2018 11:37:32 PM
> To: Qt Project MailingList
> Subject: [Interest] Detect connected Bluetooth keyboard under Android
> 
> Hi @all,
> 
> i played with the QBluetoothLocalDevice and QBluetoothDiscoveryAgent to 
> detected if a Bluetooth keyboard is connected to an android tablet.
> 
> However, I can’t find out the correct way. I tried to read the 
> majordeviceclass and minordeviceclass but it doesn‘t work, I only get 31,0 
> but the documentation says that 5 should be the major device class. The 
> keyboard works in any input fields, but I can‘t find it.
> 
> I only need a signal if a keyboard connects/disconnects like 
> hardwareKeyboardConnected(bool)
> 
> What do I need for that?
> 
> Thanks in advance
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

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