0

[SOLVED]how to set (c++ side) a specific item of a defined Spinner list

asked 2014-09-11 23:42:10 -0700

alphaemmeo gravatar image

updated 2014-09-16 02:04:23 -0700

Hi folks, my question is simple. Reading the doxygen about ControlPanel API I didn't understand how to set (c++ side) a specific item of a defined Spinner list.

Below you can find the code snippet about the spinner list that I mean.

user_interface_for_AUDUINOserviceHeatProperty = new User_interface_for_AUDUINOserviceHeatProperty("heatProperty", user_interface_for_AUDUINOserviceRootContainer, UINT16_PROPERTY);
[...]
std::vector<uint16_t> user_interface_for_AUDUINOserviceHeatPropertyHintsVec;
user_interface_for_AUDUINOserviceHeatPropertyHintsVec.push_back(SPINNER);
[...]
std::vector<ConstraintList> user_interface_for_AUDUINOserviceHeatPropertyConstraintListVec(4);
std::vector<qcc::String> user_interface_for_AUDUINOserviceHeatPropertyDisplay1Vec;
user_interface_for_AUDUINOserviceHeatPropertyDisplay1Vec.push_back("OFF");
user_interface_for_AUDUINOserviceHeatPropertyDisplay1Vec.push_back("OFF");
user_interface_for_AUDUINOserviceHeatPropertyDisplay1Vec.push_back(UNICODE_REGULAR);
user_interface_for_AUDUINOserviceHeatPropertyConstraintListVec[0].setDisplays(user_interface_for_AUDUINOserviceHeatPropertyDisplay1Vec);
user_interface_for_AUDUINOserviceHeatPropertyConstraintListVec[0].setConstraintValue((uint16_t)37);
std::vector<qcc::String> user_interface_for_AUDUINOserviceHeatPropertyDisplay2Vec;
user_interface_for_AUDUINOserviceHeatPropertyDisplay2Vec.push_back("Regular");
user_interface_for_AUDUINOserviceHeatPropertyDisplay2Vec.push_back("Normal");
user_interface_for_AUDUINOserviceHeatPropertyDisplay2Vec.push_back(UNICODE_REGULAR);
user_interface_for_AUDUINOserviceHeatPropertyConstraintListVec[1].setDisplays(user_interface_for_AUDUINOserviceHeatPropertyDisplay2Vec);
user_interface_for_AUDUINOserviceHeatPropertyConstraintListVec[1].setConstraintValue((uint16_t)175);
std::vector<qcc::String> user_interface_for_AUDUINOserviceHeatPropertyDisplay3Vec;
user_interface_for_AUDUINOserviceHeatPropertyDisplay3Vec.push_back("Hot");
user_interface_for_AUDUINOserviceHeatPropertyDisplay3Vec.push_back("Heiss");
user_interface_for_AUDUINOserviceHeatPropertyDisplay3Vec.push_back(UNICODE_HOT);
[...]

Thanks a lot.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-09-16 02:03:37 -0700

alphaemmeo gravatar image

Hi guys, in mean time I understood how solve my "issue", above-written. In a nutshell I have to set the value that I fixed in the several lines:

user_interface_for_AUDUINOserviceHeatPropertyConstraintListVec[0].setConstraintValue((uint16_t)37);
user_interface_for_AUDUINOserviceHeatPropertyConstraintListVec[1].setConstraintValue((uint16_t)175);
[...]

and so on.

In my case in provided/ControlPanelProvided.cc file I defined the following code snippet:

void setTargetTemperature(uint16_t newTemp)
{
    if (newTemp != 0) {
        changeTargetTemp = true;
        targetTemp = newTemp;
    }
}

so, to select the "Regular" preset I just set targetTemp to the relative value (in this case targetTemp = 175) and then called:

ControlPanelGenerated::user_interface_for_AUDUINOserviceProperty->SendPropertyChangedSignal();
ControlPanelGenerated::user_interface_for_AUDUINOserviceProperty->SendValueChangedSignal();

If the targetTemp value doesn't match anyone prefixed value, therefore the your ControlPanel browser shows the first value of:

user_interface_for_AUDUINOserviceHeatPropertyConstraintListVec

as default value. That in this case is "OFF".

best regards.

edit flag offensive delete publish link more
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2014-09-11 23:42:10 -0700

Seen: 192 times

Last updated: Sep 16 '14