function Foscam(config) {
    if (!config) {
        throw new Error('no config was supplied');
    }

    this.username = config.username;
    this.password = config.password;
    this.address = config.host;
    this.port = config.port || 88;
    this.protocol = config.protocol || 'http';
    this.rejectUnauthorizedCerts = 'rejectUnauthorizedCerts' in config ? config.rejectUnauthorizedCerts : true;
    this.baseUrl = this.protocol + '://' + this.address + ':' + this.port;
    this.url = this.baseUrl + '/cgi-bin/CGIProxy.fcgi';
    this.streamUrl = this.baseUrl + '/cgi-bin/CGIStream.cgi';
    this.rpClient = rp.defaults({
        rejectUnauthorized: this.rejectUnauthorizedCerts,
        qs: {
            usr: this.username,
            pwd: this.password
        }
    });
}
function Foscam(config) {
    if (!config) {
        throw new Error('no config was supplied');
    }

    this.username = config.username;
    this.password = config.password;
    this.address = config.host;
    this.port = config.port || 88;
    this.protocol = config.protocol || 'http';
    this.rejectUnauthorizedCerts = 'rejectUnauthorizedCerts' in config ? config.rejectUnauthorizedCerts : true;
    this.baseUrl = this.protocol + ':
    this.url = this.baseUrl + '/cgi-bin/CGIProxy.fcgi';
    this.streamUrl = this.baseUrl + '/cgi-bin/CGIStream.cgi';
    this.rpClient = rp.defaults({
        rejectUnauthorized: this.rejectUnauthorizedCerts,
        qs: {
            usr: this.username,
            pwd: this.password
        }
    });
}
function Foscam ( config ) { if ( ! config ) { throw new Error ( 'no config was supplied' ) ; } this . username = config . username ; this . password = config . password ; this . address = config . host ; this . port = config . port || 88 ; this . protocol = config . protocol || 'http' ; this . rejectUnauthorizedCerts = 'rejectUnauthorizedCerts' in config ? config . rejectUnauthorizedCerts : true ; this . baseUrl = this . protocol + '://' + this . address + ':' + this . port ; this . url = this . baseUrl + '/cgi-bin/CGIProxy.fcgi' ; this . streamUrl = this . baseUrl + '/cgi-bin/CGIStream.cgi' ; this . rpClient = rp . defaults ( { rejectUnauthorized : this . rejectUnauthorizedCerts , qs : { usr : this . username , pwd : this . password } } ) ; }
Foscam Client SDK
@class
@param {object} config
@param {string} config.username Username of a valid Foscam user.
@param {string} config.password Password of the Foscam user.
@param {string} config.host Host or IP address of the Foscam
@param {string} [config.port] Optional port to use. Defaults to 88.
@param {string} [config.protocol] Optional protocol to use. Defaults to http.
@constructor
Foscam Client SDK