<commit_before>/*
	Usage:
		var wrapper = require("wrapper.js");
		var deeplet = {
			"device_type": "deeplet",
			"address": "192.168.127.12",
			...
		};
		var connector = new wrapper(deeplet);

		connector.method(input);
*/

/* IC method */
if (typeof(LOG) === "undefined") {
	var LOG = {};
	if (typeof(LOG.warn) === "undefined") {
		LOG.warn = function (ret) {
			console.warn(ret);
		}
	}
	if (typeof(LOG.error) === "undefined") {
		LOG.error = function (ret) {
			console.error(ret);
		}
	}
	if (typeof(LOG.stack) == "undefined") {
		LOG.stack = function (ret) {
			console.trace();
		}
	}
}

function wrapper(input) {
	var wrapper_varA = "QAQ";
	var wrapper_varB = "@Q@";

	if (typeof(input) !== "undefined") {
		LOG.warn("input defined");
		this.setup(input);
	}

	return this;
}

wrapper.prototype.setup = function (input) {
	if (typeof(input) !== "undefined") {
		if (typeof(input.type) !== "undefined") {
			input.device_type = input.type;
		}
		switch (input.device_type) {
		case "onvif":
			var onvif = require("./devices/onvifc.js");

			this.prototype = this.__proto__;
			this.__proto__ = new onvif();
			console.log("this.__proto__");
			console.log(this.__proto__);
			onvif.call(this, input);
			this.init(input);
			break;

		case "deeplet":
			LOG.warn("require deeplet wrapper");
			var deeplet = require("./devices/deeplet.js");

			this.prototype = this.__proto__;
			this.__proto__ = new deeplet();
			deeplet.call(this, input);
			this.setupConnector(input);
			break;

		case "dvr":
			LOG.warn("require deeplet wrapper");
			var deeplet = require("./devices/deeplet.js");

			this.prototype = this.__proto__;
			this.__proto__ = new deeplet();
			deeplet.call(this, input);
			this.setupConnector(input);
			break;

		default:
			LOG.warn("not support");
		}
	}
}

wrapper.prototype.scanDevice = function (input) {
	// input.protocal
}

wrapper.prototype.wrapperMethod = function (input) {
	console.log("wrapperMethod");
}

module.exports = wrapper;<commit_msg>change var device_type -> protocol<commit_after>/*
	Usage:
		var wrapper = require("wrapper.js");
		var deeplet = {
			"device_type": "deeplet",
			"address": "192.168.127.12",
			...
		};
		var connector = new wrapper(deeplet);

		connector.method(input);
*/

/* IC method */
if (typeof(LOG) === "undefined") {
	var LOG = {};
	if (typeof(LOG.warn) === "undefined") {
		LOG.warn = function (ret) {
			console.warn(ret);
		}
	}
	if (typeof(LOG.error) === "undefined") {
		LOG.error = function (ret) {
			console.error(ret);
		}
	}
	if (typeof(LOG.stack) == "undefined") {
		LOG.stack = function (ret) {
			console.trace();
		}
	}
}

function wrapper(input) {
	var wrapper_varA = "QAQ";
	var wrapper_varB = "@Q@";

	if (typeof(input) !== "undefined") {
		LOG.warn("input defined");
		this.setup(input);
	}

	return this;
}

wrapper.prototype.setup = function (input) {
	if (typeof(input) !== "undefined") {
/*		if (typeof(input.type) !== "undefined") {
			input.device_type = input.type;
		}
*/
		if (typeof(input.type) !== "undefined") {
			input.protocol = input.type;
		}

		if (typeof(input.device_type) !== "undefined") {
			input.protocol = input.device_type;
		}

//		switch (input.device_type) {
		switch (input.protocol) {
		case "onvif":
			var onvif = require("./devices/onvifc.js");

			this.prototype = this.__proto__;
			this.__proto__ = new onvif();
			console.log("this.__proto__");
			console.log(this.__proto__);
			onvif.call(this, input);
			this.init(input);
			break;

		case "deeplet":
			LOG.warn("require deeplet wrapper");
			var deeplet = require("./devices/deeplet.js");

			this.prototype = this.__proto__;
			this.__proto__ = new deeplet();
			deeplet.call(this, input);
			this.setupConnector(input);
			break;

		case "dvr":
			LOG.warn("require deeplet wrapper");
			var deeplet = require("./devices/deeplet.js");

			this.prototype = this.__proto__;
			this.__proto__ = new deeplet();
			deeplet.call(this, input);
			this.setupConnector(input);
			break;

		default:
			LOG.warn("not support protocol: " + input.protocol);
		}
	}
}

wrapper.prototype.scanDevice = function (input) {
	// input.protocal
}

wrapper.prototype.wrapperMethod = function (input) {
	console.log("wrapperMethod");
}

module.exports = wrapper;
{'fraction_non_alphanumeric': 0.1794811320754717, 'fraction_numerical': 0.005188679245283019, 'mean_word_length': 3.5117021276595746, 'pattern_counts': {'":': 10, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4244896', 'n_tokens_mistral': 1692, 'n_tokens_neox': 1490, 'n_words': 288}