|
|
@ -228,6 +228,7 @@ export function onGetBLECharacteristicValueChange(options, onChange = function() |
|
|
console.log('deviceId ', options.deviceId); |
|
|
console.log('deviceId ', options.deviceId); |
|
|
console.log('serviceId ', options.serviceId); |
|
|
console.log('serviceId ', options.serviceId); |
|
|
console.log('characteristicId ', options.characteristicId); |
|
|
console.log('characteristicId ', options.characteristicId); |
|
|
|
|
|
console.log('苹果手机看这里'); |
|
|
uniAsyncPromise('notifyBLECharacteristicValueChange', { |
|
|
uniAsyncPromise('notifyBLECharacteristicValueChange', { |
|
|
state: true, |
|
|
state: true, |
|
|
...options, |
|
|
...options, |
|
|
@ -263,6 +264,7 @@ export function sendDataToDevice(options) { |
|
|
value: options.value.slice(0, byteLength > speed ? speed : byteLength), |
|
|
value: options.value.slice(0, byteLength > speed ? speed : byteLength), |
|
|
}) |
|
|
}) |
|
|
.then((res) => { |
|
|
.then((res) => { |
|
|
|
|
|
console.log("发送信息到蓝牙成功") |
|
|
if (byteLength > speed) { |
|
|
if (byteLength > speed) { |
|
|
sendDataToDevice({ |
|
|
sendDataToDevice({ |
|
|
...options, |
|
|
...options, |
|
|
@ -428,7 +430,7 @@ function Hex2Str(num) { |
|
|
* printNum: 打印张数,默认为1 |
|
|
* printNum: 打印张数,默认为1 |
|
|
* rotation:页面整体旋转 1-90度 2-180度 3-270度 其他-不旋转 |
|
|
* rotation:页面整体旋转 1-90度 2-180度 3-270度 其他-不旋转 |
|
|
*/ |
|
|
*/ |
|
|
export function CreatCPCLPage(width, height, printNum, rotation = 0, offset = 0) { |
|
|
export function CreatCPCLPage(width, height, printNum, rotation, offset = 0) { |
|
|
var strCmd = '! ' + offset + ' 200 200 ' + height + ' ' + printNum + '\n'; |
|
|
var strCmd = '! ' + offset + ' 200 200 ' + height + ' ' + printNum + '\n'; |
|
|
strCmd += "PAGE-WIDTH " + width + '\n'; |
|
|
strCmd += "PAGE-WIDTH " + width + '\n'; |
|
|
if (rotation == 1) |
|
|
if (rotation == 1) |
|
|
@ -452,6 +454,7 @@ export function CreatCPCLPage(width, height, printNum, rotation = 0, offset = 0) |
|
|
*/ |
|
|
*/ |
|
|
export function addCPCLText(x, y, fontName, fontSize, rotation, content) { |
|
|
export function addCPCLText(x, y, fontName, fontSize, rotation, content) { |
|
|
//console.log(fontName,fontSize,rotation, content);
|
|
|
//console.log(fontName,fontSize,rotation, content);
|
|
|
|
|
|
// alert(content);
|
|
|
var strCmd = ''; |
|
|
var strCmd = ''; |
|
|
if (rotation == 1) { |
|
|
if (rotation == 1) { |
|
|
strCmd += 'T90 '; |
|
|
strCmd += 'T90 '; |
|
|
|