Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
DD12
Posts: 170
Registered: ‎01-26-2009
My Device: Not Specified

BatteryInfo - levelChanged Signal - Not working.

Hello Everyone

 

I am using the following code to listen to the signal.

 

BatteryInfo bi;

 

QObject::connect(bi, SIGNAL( levelChanged (int, BatteryChargingState::Type)),

this,

SLOT(BatterylevelChanged (int, BatteryChargingState::Type)));

 

The code gives me following error:

 

  no known conversion for argument 1 from 'bb::device::BatteryInfo' to 'const QObject*'

 

Multiple markers at this line

- candidates are:

- no matching function for call to 'QObject::connect(bb::device::BatteryInfo&, const char*, AppUI* const, const 

char*)'

 

AppUI is the class in which the slot is declared and used.

 

What am I missing?

 

Thanks

 

 

 

Regular Contributor
lunaplena
Posts: 205
Registered: ‎06-11-2013
My Device: Blackbery z10

Re: BatteryInfo - levelChanged Signal - Not working.

are you testing on a device or emulator.

Regular Contributor
lunaplena
Posts: 205
Registered: ‎06-11-2013
My Device: Blackbery z10

Re: BatteryInfo - levelChanged Signal - Not working.

please give us some more detailes.

Developer
DD12
Posts: 170
Registered: ‎01-26-2009
My Device: Not Specified

Re: BatteryInfo - levelChanged Signal - Not working.

The code does not compile. I am trying to run it on Z10.

Regular Contributor
lunaplena
Posts: 205
Registered: ‎06-11-2013
My Device: Blackbery z10

Re: BatteryInfo - levelChanged Signal - Not working.

If it is not compiling, then device does not matter. can you post the error, and the code.

Developer
DD12
Posts: 170
Registered: ‎01-26-2009
My Device: Not Specified

Re: BatteryInfo - levelChanged Signal - Not working.

The code and the error message is in the 1st post.

 

Thanks

Developer
AvneeshKumar
Posts: 20
Registered: ‎04-11-2012
My Device: 8520

Re: BatteryInfo - levelChanged Signal - Not working.

Hello Sir i am having the same Problem . and i am using this code

 

 

bb::device::BatteryInfo batteryInfo;
    bool isConnect = QObject::connect(&batteryInfo,
            SIGNAL(levelChanged(int, bb::device::BatteryChargingState::Type)), this,
            SLOT(onlevelChanged(int, bb::device::BatteryChargingState::Type)));

    if (isConnect) {
        qDebug() << "############################## Connect ";
    } else {
        qDebug() << "############################## No Connect";
    }

 

it show me connect but

 

void Service::smileysurprised:nlevelChanged(int level, bb::device::BatteryChargingState::Type newChargingState)
{

qDebug() << "############################## level changed";

}

 

is Never Call please help me