javascript - 如何使用 jicai q2 POS 热敏打印机 (商米 V1) 使用基于 asp.net 的 web 应用程序?
问题描述
我有一个基于 Web 的应用程序,我可以在 Android 浏览器应用程序中运行它,现在我的客户希望它在集菜 Q2 POS 设备上使用它,应用程序运行良好,但我无法从集菜 Q2 POS 热敏打印机打印它(猜猜它类似于宣米V1)。我希望它通过 asp.net 和 Javascript 打印以连接到设备,任何人都可以帮助我吗?我是这个发展的新手
解决方案
我能够在将 Esc/Pos 命令传递给 BluetoothSocket.OutputStream 的 jicai 热敏打印机中进行打印:
using Android.Bluetooth;
// First you get the BluetoothAdapter:
BluetoothAdapter adapter = BluetoothAdapter.DefaultAdapter;
// then, you get the device:
BluetoothDevice device = adapter.BondedDevices.FirstOrDefault(d => d.Address.Equals("00:11:22:33:44:55"));
// now you create the socket
BluetoothSocket socket = device.CreateRfcommSocketToServiceRecord(Java.Util.UUID.FromString("00001101-0000-1000-8000-00805F9B34FB"));
// and now, you're able to get OOS:
Stream outputStream = socket.OutputStream;
// then, you can send esc/pos commands:
var command = new byte[] { 0x0A }; // example line feed command
outputStream.Write(command, 0, command.Length);
此外,您可以选择使用他们提供的库,就像在这个例子中一样。
我希望它有所帮助。
推荐阅读
- java - Java 多线程的非确定性行为
- sql - 想要创建一个触发器来总结谁(user_id)使用 SQL 完整地观看了录制
- audio - 当从 uri 播放视频或音频时,它是流式传输还是完全下载并播放?
- python - 使用 for 循环合并文件
- r - 在 Tidyverse 中使用 TRUE/FALSE 分组
- javascript - Javascript,GetElementById 元素没有定义?
- python - 如何连接具有不同 MultiIndex 值的两个数据帧并重复一个数据帧?
- python - 在 Python 中比较两个 txt 文件
- sql - 复杂 sql 查询/规则中的变量
- r - ggplot2 guide_colorstep 添加自定义标签指南