npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

yimu-urovo-sdk

v1.0.7

Published

YIMU UROVO SDK

Downloads

28

Readme

森冕 web 调用 Flutter 的 API 介绍

通过 npm 安装

npm install yimu-urovo-sdk

扫描二维码

import { scanBarcode } from 'yimu-urovo-sdk'

try {
  const res = await scanBarcode();
  // 返回数据处理
} catch (error) {
  // 异常
}

优博迅打印机相关

连接

import { connectToPrinter } from 'yimu-urovo-sdk'

try {
  // 传入打印机包含id地址(必填)+端口(选填,默认9100)的对象
  const res = await connectToPrinter({ip, port});
  if (res.status == "success") {
    // 成功
  } else {
    // 失败
  }
} catch (error) {
  // 其他异常
}

返回格式

{
  status: 'success',  // success成功,failed失败
};

断开连接

import { disconnect } from 'yimu-urovo-sdk'

try {
  const res = await disconnect();
  if (res.status == "success") {
    // 成功
  } else {
    // 失败
  }
} catch (error) {
  // 其他异常
}

返回格式

{
  status: 'success',  // success成功,failed失败
};

打印

import { urovoPrint } from 'yimu-urovo-sdk'

try {
  // 传入zpl指令
  const res = await urovoPrint(zplStr);
} catch (error) {
  // 异常
}

返回格式

{
  status: 'success',  // 因为优博迅打印机打印完成没有回调,默认为success成功
};

image 转 zpl 指令相关

image 转 zpl

import { convertImage } from 'yimu-urovo-sdk'

try {
  // 传入图片base64地址(必填),options为可配置对象
  const res = await convertImage(base64, options);
  // 返回zpl指令
} catch (error) {
  // 异常
}

options 详解

| 参数 | 默认 | 描述 | 是否选填 | | ------ | ---- | --------------------------------------------------------------------------------------------------------------------------------------- | -------- | | black | 50 | 浓度(1 ~ 99) | 是 | | rot | 'N' | 旋转角度'N':不旋转'L':逆时针旋转 90 度'R':顺时针旋转 90 度'I':旋转 180 度'B':同'L',逆时针旋转 90 度 | 是 | | notrim | true | 不去边缘空白 | 是 |

斑马扫码枪相关

扫码枪初始化(即连接)

import { initToPairing } from 'yimu-urovo-sdk'

try {
  const res = await initToPairing();
  // 返回数据处理
} catch (error) {
  // 异常
}

返回格式

{
  scannerName: '',  // 仅success时有该字段
  status: 'success',  // success成功,failed失败
};

扫码枪扫码

import { callBackScannerData } from 'yimu-urovo-sdk'

callBackScannerData((res) => {
  // 获取扫描内容,推荐在onMounted(以vue3为例)等生命周期里监听,防止重复监听
})

返回格式

{
  text: '123123',  // 内容
  type: 'code128',  // 码类型
};

扫码枪断开连接

import { disconnectScanner } from 'yimu-urovo-sdk'

try {
  const res = await disconnectScanner();
  // 返回数据处理
} catch (error) {
  // 异常
}

返回格式

{
  status: 'success',  // success成功,failed失败
};

扫码枪补充说明

注: 1:因扫码枪断开连接后 sdk 无法获取其返回状态,故扫码枪是否已连接状态要开发本地存储,sdk 无法提供方法查询当前状态。在遇到场景需要重连时由开发自行判断。 2:app 关闭时会自动断开扫码枪连接,且每次连接必须扫码匹配,无法直接无感连接,产品设计时需注意此项。