
/** @type Config */
var CONFIG;

/** @constructor */
function Config(configData) {
    this.deviceId = null;

    this.services = [];

    // Load global configurations
    for (var i =0, nbConfig = configData.length; i < nbConfig; i++)
        if (configData[i]["service"] === null && configData[i]["device"] === null)
            this.mergeConfig(JSON.parse(configData[i]["config"]));
}

Config.prototype.mergeConfig = function(configData) {
    if (configData["services"])
        configData["services"].forEach(function(i) {
            if (this.services.indexOf(i) === -1)
                this.services.push(i);
        }, this);
};

