Ejemplo n.º 1
0
void createRecursiveActionSet_AllBulbOn()
{
    string actionsetDesc;
    ActionSet *allBulbOn = new ActionSet();
    allBulbOn->type = OIC::ACTIONSET_TYPE::RECURSIVE;

    allBulbOn->actionsetName = "AllBulbOnRecursiveCall";
    allBulbOn->mTime.tm_year = 0;
    allBulbOn->mTime.tm_mon = 0;
    allBulbOn->mTime.tm_mday = 0;
    allBulbOn->mTime.tm_hour = 0;
    allBulbOn->mTime.tm_min = 0;
    allBulbOn->mTime.tm_sec = 5;

    allBulbOn->setDelay(allBulbOn->getSecAbsTime());

    for (auto iter = lights.begin(); iter != lights.end(); ++iter)
    {
        Action *action = new Action();
        action->target = (*iter);

        Capability *capa = new Capability();
        capa->capability = "power";
        capa->status = "on";

        action->listOfCapability.push_back(capa);
        allBulbOn->listOfAction.push_back(action);
    }
    if (g_resource)
    {
        groupMgr->addActionSet(g_resource, allBulbOn, onPut);
    }

    delete allBulbOn;
}