var JYConnection = function () {
    this.channelId = null;
    this.scId = null;
    this.sn = null;
    this.clientSid = null;
    this.ip = null;
    this.signKey = null;
    this.bsUrl = null;
    this.token = null;
    this.modelName = null;
    this.manufacturer = null;
    this.os = null;
    this.pixel = null;
    this.jy = new JY(2);
    //回调函数
    this.callback = null;
    //排队id
    this.playQueueId = 0;
    //video显示标签id
    this.tagID = 'remoteVideo';
};
JYConnection.prototype.setTagID = function (tagID) {
    this.tagID = tagID;
};
/**
 * sdk初始化
 */
JYConnection.prototype.initSdk = function () {
    //sdk初始化
    console.log(this.channelId, this.bsUrl, this.token, this.sn, this.callback);
    this.jy.sdkLoading(this.channelId, this.bsUrl, this.token, this.sn, this.callback);
};

/**
* 停止游戏
*/
JYConnection.prototype.stop = function () {
    //停止游戏
    this.jy.stop();
};
/**
 * 游戏手柄
 */
JYConnection.prototype.getGamepadList = function () {
    //获取虚拟手柄列表
    return this.jy.getGamepadList();
}
JYConnection.prototype.addVirtualGamepad = function (name) {
    //添加虚拟手柄
    return this.jy.addVirtualGamepad(name);
};
JYConnection.prototype.changeMouseMode = function (modeType) {
    //切换鼠标的工作模式
    return this.jy.changeMouseMode(modeType);
};

JYConnection.prototype.removeVirtualGamepad = function (id) {
    //移除虚拟手柄
    return this.jy.removeVirtualGamepad(id);
}
JYConnection.prototype.setCallback = function (callback) {
    if (callback) {
        this.callback = callback;
    }
}
JYConnection.prototype.sendGamepadStatus = function (id, gamepadStatus) {
    //发送手柄状态
    return this.jy.sendGamepadStatus(id, gamepadStatus);
}
JYConnection.prototype.sendKeyMouseStatus = function (type, event) {
    //发送键盘鼠标事件指令
    return this.jy.sendKeyMouseStatus(type, event);
}
JYConnection.prototype.switchGamepadOn = function (status) {
    //切换手柄状态
    return this.jy.switchGamepadOn(status);
}

/**
 * 创建简单手柄
 * @param {any} data
 */
JYConnection.prototype.simpleHandler = function (data) {
    var _this = this;
    if (data.status == 200) {
        _this.jy.startSimpleHandler(_this.tagID, data.data, _this.callback);
        console.log(data)
    } else {
        console.log(data.msg);
    }
};