Duty slot in my sensor signal connection related problem class.

I fanned simple class based on the NDK documentation found here - http://developer.blackberry.com/native/documentation/cascades/device_comm/sensors/

But in my case signals do not plug on slots and returns always false. I was just wondering what I did wrong? Looks all logical.

Here's the class:

#include 
#include "Sensors.h"

Sensors::Sensors(QObject *parent) : QObject(parent) {
    // Create the compass sensor.
    m_CompassSensor = new QCompass(this);
    m_Accelerometer = new QAccelerometer(this);

    // Set the orientation mode to fixed so that sensor readings
    // aren't affected by device orientation.
    //m_CompassSensor->setAxesOrientationMode(QCompass::FixedOrientation);

    // If any Q_ASSERT statement(s) indicate that the slot failed
    // to connect to the signal, make sure you know exactly why this
    // has happened. This is not normal, and will cause your app
    // to stop working
    bool res = connect(m_Accelerometer,
                       SIGNAL(readingChanged()),
                       this,
                       SLOT(accelReadingChanged()));

    res = connect(m_CompassSensor,
                       SIGNAL(readingChanged()),
                       this,
                       SLOT(compassReadingChanged()));
    Q_ASSERT(res);

    // Since the variable is not used in the app, this is
    // added to avoid a compiler warning.
    Q_UNUSED(res);

    m_CompassSensor->start();
}

Sensors::~Sensors() {
    m_CompassSensor->stop();
}

void Sensors::compassReadingChanged()
{
    QCompassReading *reading = m_CompassSensor->reading();
    qreal azimuth = reading->azimuth();
    qDebug() << "The azimuth is " << azimuth << " degrees.";
}

void Sensors::accelReadingChanged()
{
    QAccelerometerReading *reading = m_Accelerometer->reading();
    qreal x = reading->x();
    qreal y = reading->y();
    qreal z = reading->z();

    // For debugging purposes
    qDebug() << "x acceleration: " << x;
    qDebug() << "y acceleration: " << y;
    qDebug() << "z acceleration: " << z;
}

Here is the header

/*
 * Sensors.h
 *
 *  Created on: 2014-02-01
 *      Author: misha
 */

#ifndef SENSORS_H_
#define SENSORS_H_

#include 
#include 
#include 
#include 
#include 

using namespace QtMobility;

class Sensors : public QObject{
public:
    Sensors(QObject *parent = 0);
    virtual ~Sensors();

private:
    QCompass *m_CompassSensor;
    QAccelerometer *m_Accelerometer;
public slots:
    void compassReadingChanged();
    void accelReadingChanged();
};

#endif /* SENSORS_H_ */

Please advise!  I was fighting with this for a few days already... I bet I missed something important but s mall

Thank you

Hello! Q_OBJECT macro is missing from the top of the class declaration:

class Sensors : public QObject{  Q_OBJECT
public:
  Sensors(QObject *parent = 0);

p.s. This line changes, the first could not connect will not be detected. It should probably be & =

res = connect(m_CompassSensor,

Tags: BlackBerry Developers

Similar Questions

  • Need to display the speed of speed Hall sensor SIgnal

    Hi all

    I have a speed Hall effect sensor. I'm observing the signal of the sensor to LabView via NI DAC USB-6008. Could someone please help me in the design of a logic that allows to display the wheel on Labview speed according to the reached the sensor signal? It will be really helpful if someone can come up with logic.

    Thank you very much in anticipation

    Sorry, that was the bad VI.

    It's the good VI:

  • How to read and display a my a miccrontroller (MCB1700) on labview signal connected via a port on a PXI machine CAN

    How to read and display a my a miccrontroller (MCB1700) on labview signal connected via a port on a machine PXI CAN?

    I tried using a DAQ Assistant, but the port is not included as one of the physical channels supported, even if all his drivers are up to date.

    Help, please...

    Thank you.

    If you can read it in MAX, then you should be able to run the NI CAN example.

    Help-> find examples

    Find the CAN and watch CAN Receive.vi.

    Basically, set up the network, open the object, read in a loop close object when it is done.

    If you have any questions about the example, go ahead and post your vi and we can work from there.

  • because of related problems or Internet Explore could not download your auto proxy script click ok to continue with standard proxy settings

    "because of related problems or Internet Explore not able to download your automatic proxy script click ok to continue with standard proxy settings"-this window always appears, then I open the Internet Explorer browser. Also I have to reboot the computer because the internet connection is lost 3 - 4 times per hour. Need good advice how to solve the problem. Thank you!

    In Internet Explorer, click on Tools > Internet Options > connections > LAN settings and uncheck all the boxes.

  • Signal connect problem

    Hi all

    I have a problem strange connection of signals to the slot machines. I have the following code:

    Container container = root->findChild ("timeline_container");
    m_pForeignWindow = (ForeignWindowControl *) (container-> at (0));

    m_pForeingWindow is not null here

    Boolean success = connect (m_pForeignWindow,
    SIGNAL (windowAttached (screen_window_t, const QString &, const QString &)),.
    This,
    SLOT (onWindowAttached (screen_window_t, const QString &, const QString &)));))

    success is true here

    success = QObject::connect (m_pForeignWindow,
    SIGNAL (touch(TouchEvent *)),
    m_timeline,
    CRACK (onTouch(TouchEvent *)));

    success is false here

    Research with the debugger, I got the following message:

    Object::connect: No such signal bb::cascades:ForeignWindowControl:touch(TouchEvent_*)

    but this signal exists for all objects in VisualNode... What I am doing wrong?

    Kind regards.

    See if it actually compiles.  FDI in the current beta version is infamous for being reported wrong these errors, so I suggest to turn them off.

    Window-> Preferences-> C / C++-> the analysis of Code-> Qt syntax problem

  • very slow niswitch with signal connected (PXI-2535)

    First time using a switching FET card, running base vi where I connect a line and two columns, and make a measure of resistance with a multimeter.

    I found that with the digital multimeter connected, IE the applied signal, the switch may take more than 5 seconds to close. (Ohm DMM reading 26 ohms after 5 seconds, the 'debounce expectation' although all good reported vi)

    If the DMM is not connected, sometimes instantaniously. (disconnect the DMM, perform the trigger, connect the DMM - instant closing)

    Anyone experienced the same thing?

    Found the problem.

    Seems the FET card goes into protection mode if you do not connect the DMM - signal to the chassis GND.

    After that, it worked fine.

  • Omega flow meter sensor daq connection

    Hi all

    I have sensor Omega FTB 1302 and NI DAQ 6229. Sensor has analog output. I do not know how to connect these sensor and daq.please help


  • Strong signal; connectivity limited; no ip address

    All of a sudden my laptop does not connect to the router linksys wrt54g version 6.  The laptop shows a signal strong but under limited connectivity status or not.  I downloaded the new firmware for the router, but still have the problem.  I can connect to other networks wireless without any problem, so I think it's the router not my network card.   Any suggestions?

    Have you updated the firmware on the router...?

    Reset you the router after the upgrade of the firmware...? If this is not the case, press in and hold the reset for 30 seconds button... Release the reset button... Unplug the power cable from your router, wait 30 seconds and reconnect the power cable... Now re - configure your router...

    As it is your framework of Internet Service cable follow this link .

  • WRT110 Wireless - unable to detect the signal/connection.

    Recently lost connectivity to an existing wireless connection I had set up over the past months.  The two XP laptop with Dell Wireless WLAN Card and box of Wii is no longer connect or detect the signal.  Curiously, WiFi stood momentarily after the reset of power on the router but then disappeared. I connect well with connection wired and mobile detects all my neighbors SSID.  All the lights on the router are bed... but no wireless signal.  I even joined a wireless USB device to my desktop pc to test.  It detected all the SSID of the neighbors but not mine.  Even with the laptop.

    Troubleshooting steps I did:

    -Router-

    Power recycled.

    Held reset button.

    Linksys firmware to 1.0.5 update

    Configuration is modified to enable the SSID Broadcast

    -Laptop-

    Card driver WLAN Dell upgrade vA17 4.170.5 to 4.170.77.18 vA22

    People with disabilities Dell Wireless utility and enabled Windows Wireless configuration.  Either the Dell or Windows detected my wireless signal wireless utility.  Both will detect AND connect to the open connection of the neighbor.

    Appreciate any idea or other troubleshooting suggestions.

    Readjust the settings of your router wireless...

    Open an Internet Explorer browser on your computer (desktop) wired page. In the address bar type - 192.168.1.1 and press ENTER... Let the empty user name & password use admin lowercase...

    For wireless settings, follow these steps: -.
    Click on the Wireless tab
    -Here, select manual configuration... Wireless network mode must be mixed...
    -Provide a unique name in the name box of the wireless network (SSID) in order to differentiate your network from your network of neighbors...
    -Set the Standard - 20 MHz Radio band and change the Standard channel to 11-2, 462 GHz... Wireless SSID broadcast should be enabled and then click on save settings...
    Please take note of the name of the wireless network (SSID) because it's the network identifier...

    For wireless security: -.
    Click the sub-tab under wireless > Wireless Security...
    Change the mode of WEP wireless security, encryption must be 64-bit. Let the empty password, do not type in anything... Under type of WEP Key 1 in all 10 numbers please (numbers only and no mailbox for example: your 10-digit phone number) and click on save settings... Please note the 1 WEP key as it comes to the security key for the wireless network...

    Click the settings advanced wireless
    Change the interval of tag to 75 > change the Fragmentation threshold to 2304, change the RTS threshold to 2304 > click 'save settings '...
    Now let's see if you can locate your wireless network and try to connect...

  • 1370 wlan mini-pci card - media disconnected? no signal, connects to the network

    I installed a dell pc on a 1370 wlan mini card

    Dell inspiron 1200 reference.

    I get a signal of 1% with the wireless network wizard. I was able to

    get in touch with the router, but the signal is very weak.

    I made a report with ipconfig/all, and here are the results:

    Microsoft Windows XP [Version 5.1.2600]
    Copyright (C) 1985-2001 Microsoft Corp.

    C:\Documents and Settings\Christopher Schmidt > ipconfig/all

    Windows IP configuration

    Name of the host...: CHRISLAPTOP
    Primary Dns suffix...:
    Node... type: hybrid
    Active... IP routing: No.
    Active... proxy WINS: No.

    Adapter Ethernet Wireless Network Connection 4:

    State of the media...: Media disconnected
    ... Description: Dell Wireless 1370 WLAN Minipci car
    d
    Physical address.... : 00-16-CF-CC-13-2E

    The State of the media: media disconnected means that the

    card is not seated correctly?

    In Device Manager, it says that the device is functioning properly.

    Driver version: 4.10.40.0

    Driver date: 02/11/2005


  • HP SimplePass - error "sensor not connected.

    I have used successfully to my software and sensor SimplePass fingerprint for a year, but he has now suddenly stopped working. A friend of my son was using my laptop and may have changed some settings in the error. Now, when I go to the control panel and select biometric devices, he bed 'Windows don't think biometric devices on this computer. You will need to attach your device or install device drivers. I lookd in other forums and that you have downloaded the new drivers Validity Sensor and SimplePass software update, but it disappeared again. Aside from never lend my cell phone once again, any suggestions would be appreciated!

    Hey,ife1973.

    I see that you have a simple problem with pass. Looks like something was wrong with the drivers or the installation itself.

    I suggest you get the simple pass and the fingerprint driver.

    Follow this document which will guide you on how to open the Recovery Manager.

    Like this:

    You want to recovery of the fingerprint driver, which should be called "Validity Sensor" and the program called 'Single Pass'.

    To retrieve the 'single Pass', you can select "reinstalling software." Then to retrieve the fingerprint driver, you need to select 'Hardware driver reinstallation.

    Retrieve the two programs.

    Please let me know the results. If you have any other questions let me know.

    THX

  • Impossible to e mail my creations, I have a strong internet connection signal... problem?

    Impossible to e mail my creations... I get the message: no internet connection

    Hi AntoniaHampton

     

    1. what e-mail program is installed on the computer?

    2 are you able to access another Web page using the internet?


    You can check the links below and check out them if the steps to help you resolve the issue-
    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-Internet-connection-problems

    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-network-connection-problems

     

    I hope this helps.

  • Direct access the 4 G/LTE Verizon's internet connectivity-related issues

    During an attempt to access remotely via a Direct access to a tablet with 4 G/LTE from Verizon, we are unable to access the internet. Before the installation of a Direct access on the Tablet, 4 G high-speed worked fine, but once the Tablet has been recreated for a Direct access, we no longer had access to the internet. A call to Verizon revealed that the Tablet has been connected to the system of Verizon, but is was not connected to IPv4 or IPv6, and whether Verizon could not move forward. Are there Direct access settings that should be addressed in order to allow access to broadband (4 G SIM chip)? Thank you.

    Hello

    I understand that you are unable to access the internet during an attempt to access remotely via direct access on your tablet.

    To better understand the issue, please send us the following information:

    1. What is the brand and model of the Tablet you are facing problems with?
    2. The problem occurs on other laptop or Tablet?
    3. You are connected to the domain network?

    If you are connected to the domain network, you can post your request in the forums TechNet from the link below:

    https://social.technet.Microsoft.com/forums/en-us/home

    It may be useful, get back to us with the required information and we will be happy to help you.

    Thank you.

  • How to create crankshaft sensor signals Hall

    I want to create a waveform with LabVIEW 8.6 and output for oscilloscope via NI PCI-6221, but I don't know how to do.

    So I would ask you advise and technical support, please. The waveform is attached for you reference.


  • I get a lot of 'noise' on my graph labview even when no sensors are connected. Any suggestions as to what this might be?

    I'm trying to set up a test bed to measure the linear moving of a hydraulic cylinder and it trace over time to a graph in labview.  I was getting erroneous readings on the grapn (a point of tension for every ten samples).  I have disconnected the wiring of the Terminal Board of my data acquisition card and the chart fills with 'noise '.  If I remove the plate Terminal and move the wire that goes to the data acquisition card, the graph becomes fixed.

    Any suggestions as to what can be causing this?  All of the components are new, but would it be a bad block, the driver or data acquisition card?

    Thank you


Maybe you are looking for