Commit 1e390858 authored by martin hou's avatar martin hou

feat: 增加device的获取与更新接口

parent 64c1f248
...@@ -138,6 +138,10 @@ declare class Jensen { ...@@ -138,6 +138,10 @@ declare class Jensen {
ondisconnect?: () => void; ondisconnect?: () => void;
// 连接重置(多连接时适用) // 连接重置(多连接时适用)
reconnect: () => Promise<boolean>; reconnect: () => Promise<boolean>;
// 获取USBDevice实例
getUSBDevice: () => USBDevice;
// 更新USBDevice实例
setUSBDevice: (dev: USBDevice) => void;
// 是否停止连接检查(OTA更新时使用) // 是否停止连接检查(OTA更新时使用)
isStopConnectionCheck: boolean; isStopConnectionCheck: boolean;
// 是否已连接 // 是否已连接
......
...@@ -219,6 +219,14 @@ function Jensen(log, conn) { ...@@ -219,6 +219,14 @@ function Jensen(log, conn) {
return false; return false;
}; };
this.getUSBDevice = function () {
return device;
}
this.setUSBDevice = function (dev) {
device = dev;
}
this.isConnected = function () { this.isConnected = function () {
return device != null; return device != null;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment