Java SDK
源码位于 java/,固定版本 POM 为 0.1.18-GA、groupId 为 com.printer.psdk。主要模块:frame-father、device-adapter、fruit-cpcl、fruit-tspl、fruit-esc、fruit-pos、fruit-wifi、fruit-emapi。依赖仓库配置以该版本 java/pom.xml 为准,不假定所有产物均在 Maven Central。
设备层包含 Android/Java 的蓝牙、网络、USB、串口等模块;不能把 Java 简化为“只支持经典蓝牙”。选择与运行时匹配的设备及图片适配器。下例是方法体,应放入应用类中,device 由连接层提供。
命令构建示例
Section titled “命令构建示例”import com.printer.psdk.device.adapter.ConnectedDevice;import com.printer.psdk.tspl.TSPL;import com.printer.psdk.tspl.args.TPage;import com.printer.psdk.tspl.args.TText;
byte[] buildLabel(ConnectedDevice device) { return TSPL.generic(device) .page(TPage.builder().width(60).height(40).build()) .cls() .text(TText.builder().x(30).y(40).content("Hello").build()) .print(1) .command().binary();}参数、压缩与响应
Section titled “参数、压缩与响应”下面的完整索引按语言列出参数、默认值和命令构造。先检查生成字节,再按适配器写入;传输结果与打印完成分开确认。