Object.defineProperty(exports, "__esModule", { value: true });
var Atem = require('atem-connection').Atem;
module.exports = function (Api) {
    //----- ATEM -----
    Api.registerAction('atem_setPreview', 'Set Atem preview', require('./actions/atem/setPreview'));
    Api.registerAction('atem_setProgram', 'Set Atem program', require('./actions/atem/setProgram'));
    Api.registerAction('atem_fadeToBlack', 'Atem fade to black', require('./actions/atem/fadeToBlack'));
    Api.registerConnectionValidator('bm_atem', function (validatorAPI) {
        var ip = validatorAPI.properties.ip;
        var timeout;
        var res = function (valid, message) {
            res = function () { };
            validatorAPI.callback(valid, message);
            clearTimeout(timeout);
        };
        timeout = setTimeout(function () {
            res(false, 'Timeout whilst trying to connect to atem');
        }, 5000);
        var atem = new Atem({ debugBuffers: true });
        atem.on('error', function (error) {
            res(false, error);
        });
        atem.on('connected', function () {
            validatorAPI.setInstance(atem);
            res(true);
        });
        atem.connect(ip);
    });
};
//# sourceMappingURL=main.js.map