Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. why QLowEnergyService::UnknownError
Forum Updated to NodeBB v4.3 + New Features

why QLowEnergyService::UnknownError

Scheduled Pinned Locked Moved Solved Mobile and Embedded
2 Posts 2 Posters 649 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    onunix
    wrote on last edited by
    #1

    when i call a QLowEnergyService discoverDetails() ,i first receive a stateChange, new State is QLowEnergyService::DiscoveringServices, then i get a error ,it's QLowEnergyService::UnknownError, but QLowEnergyService::ServiceDiscovered didn't appear, i don't know why ? how to find the reason ? I can get nothing from the UnknownError,

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tzijnge
      wrote on last edited by
      #2

      I had the exact same problem today. Fixed it eventually by making the connection to QLowEnergyController::serviceDiscovered queued (Qt::QueuedConnection).

      I don't really understand why this helps, but apparently the QLowEnergyController cannot create a QLowEnergyService object in an unqueued callback from the serviceDiscovered event. Maybe the internal administration of QlowEnergyController is not completely done yet at the time of the event and creating a service object at that point results in an unknown error (error string is empty, so that also doesn't help). I looked at the code of the Low Energy Scanner example and there they also don't use a queued connection (although the Qt::autoconnection type can result in a queued connection). Looks like a sloppy implementation on QT side: code only works if called from a certain thread and error message is completely uninformative.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved