codecamp

openUSB

获取USB设备信息

openUSB(callback(ret, err))

callback(ret)

ret:

  • 类型:JSON对象
  • 内部字段:status 布尔型
  • 内部字段:deviceinfo JSON对象

{
    "deviceInfo": {
        "0": {
            "0": "Bus=0001 Vendor=80ee Product=cafe Version=0500 ",
            "1": "Name=\"VirtualBox mouse integration\" ",
            "2": "Phys= ",
            "3": "Sysfs=/devices/pci0000:00/0000:00:04.0/input/input3 ",
            "4": "Uniq= ",
            "5": "Handlers=event3 ",
            "6": "PROP=0 ",
            "7": "EV=b ",
            "8": "KEY=10000 0 0 0 0 0 0 0 0 ",
            "9": "ABS=3 ",
            "10": " "
        },
        "1": {
            "0": "Bus=0000 Vendor=dbdb Product=0002 Version=0001 ",
            "1": "Name=\"gpio\" ",
            "2": "Phys= ",
            "3": "Sysfs=/devices/virtual/input/input6 ",
            "4": "Uniq= ",
            "5": "Handlers=kbd event6 ",
            "6": "PROP=0 ",
            "7": "EV=23 ",
            "8": "KEY=c0000 0 0 0 ",
            "9": "SW=1 ",
            "10": " "
        }
    }
}

示例代码

var demo = api.require('sunmiT1Printer');
demo.openUSB(function(ret, err) {
    alert(JSON.stringify(ret));
});

可用性

Android系统

可提供的1.0.0及更高版本

openMoneyCount
openBrand
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

端API

设备访问

ipAddress

wifiSSID

smartConfigCheyw

无标题文章

前端框架

云API

开发工具

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }