Exemplo n.º 1
0
json_t* OBSAPIMessageHandler::HandleGetSceneList(OBSAPIMessageHandler* handler, json_t* message)
{
    OBSEnterSceneMutex();
    json_t* ret = GetOkResponse();
    XElement* xscenes = OBSGetSceneListElement();

    XElement* currentScene = OBSGetSceneElement();
    json_object_set_new(ret, "current-scene", json_string_wchar(currentScene->GetName()));

    json_t* scenes = json_array();
    if(scenes != NULL)
    {
        int numScenes = xscenes->NumElements();
        for(int i = 0; i < numScenes; i++)
        {
            XElement* scene = xscenes->GetElementByID(i);
            json_array_append_new(scenes, getSceneJson(scene));
        }
    }
    
    json_object_set_new(ret,"scenes", scenes);
    OBSLeaveSceneMutex();

    return ret;
}
Exemplo n.º 2
0
void wholeConfigFn(WcFnRequestHandler *handler, String requestUri, HTTPMethod method) {
  // Serial.println("Respond with complete json as in https://github.com/probonopd/ESP8266HueEmulator/wiki/Hue-API#get-all-information-about-the-bridge");
  aJsonObject *root;
  root = aJson.createObject();
  // the default group 0 is never listed
  aJson.addItemToObject(root, "groups", getGroupJson());
  aJson.addItemToObject(root, "scenes", getSceneJson());
  aJsonObject *config;
  aJson.addItemToObject(root, "config", config = aJson.createObject());
  addConfigJson(config);
  aJsonObject *lights;
  aJson.addItemToObject(root, "lights", lights = aJson.createObject());
  addLightsJson(lights);
  aJsonObject *schedules;
  aJson.addItemToObject(root, "schedules", schedules = aJson.createObject());
  aJsonObject *sensors;
  aJson.addItemToObject(root, "sensors", sensors = aJson.createObject());
  aJsonObject *rules;
  aJson.addItemToObject(root, "rules", rules = aJson.createObject());
  sendJson(root);
}
Exemplo n.º 3
0
void sceneListingHandler() {
  sendJson(getSceneJson());
}