安卓 连接蓝牙打印 传输数据慢的问题
发布于 6 年前 作者 nbai 19386 次浏览 来自 问答
let arr = [
      fetch.gb2312buffer(title),
 
      fetch.gb2312buffer(barcode),
      // fetch.gb2312buffer(barnum),
      fetch.gb2312buffer(fixword1),
      fetch.gb2312buffer(fixword2),
 
      fetch.gb2312buffer(qrcode),
      fetch.gb2312buffer(receiveMan),
      fetch.gb2312buffer(sep1),
      fetch.gb2312buffer(receiveAddress),
 
      fetch.gb2312buffer(sep2),
      fetch.gb2312buffer(name),
      fetch.gb2312buffer(sep),
      fetch.gb2312buffer(amount),
 
      fetch.gb2312buffer(sep4),
      fetch.gb2312buffer(pType),
      fetch.gb2312buffer(sepl),
      fetch.gb2312buffer(distributionWay),
 
      fetch.gb2312buffer(sep3),
      fetch.gb2312buffer(company)
    ]
    Promise.all(arr).then(res => {
      console.log(res)
      res.map((data, index) => {
        wx.writeBLECharacteristicValue({
          deviceId: that.data.deviceId,
          serviceId: that.data.serviceId,
          characteristicId: that.data.characteristicId,
          value: data.data,
          success: function(re) {
            if (index == res.length - 1) {
              that.myToast.show('打印完成')
            }
 
          },
          fail: function(re) {
            console.log('fail', re)
            that.myToast.show('打印失败,请联系客服人员')
          },
          complete: function() {
            wx.hideLoading()
          }
        })
      })
    }, err => {
      wx.hideLoading()
      that.myToast.show('打印失败,请联系客服人员')
      console.log('re fail', re)
    })

要发送的数据通过后台转码后,promise请求完遍历发送到蓝牙设备,iphone设备发送打印正常,安卓设备就发送很慢,所有的数据都是分开打印的,请问该怎么解决

回到顶部